Merge pull request #172 from odoo-dev/saas-4-widget-image-rim

Some fixes in the image qweb widget + CMS fixes
This commit is contained in:
Richard Mathot 2014-05-23 12:35:02 +02:00
commit 1b0bfd2187
2 changed files with 10 additions and 4 deletions

View File

@ -265,10 +265,16 @@ class Image(orm.AbstractModel):
if options is None: options = {}
classes = ['img', 'img-responsive'] + options.get('class', '').split()
return ir_qweb.HTMLSafe('<img class="%s" src="/website/image?model=%s&field=%s&id=%s"/>' % (
size_params = []
if options.has_key('max_width'):
size_params.append("max_width=%i" % options['max_width'])
if options.has_key('max_height'):
size_params.append("max_height=%i" % options['max_height'])
return ir_qweb.HTMLSafe('<img class="%s" src="/website/image?model=%s&field=%s&id=%s&%s"/>' % (
' '.join(itertools.imap(werkzeug.utils.escape, classes)),
record._model._name,
field_name, record.id))
field_name, record.id, '&'.join(size_params)))
local_url_re = re.compile(r'^/(?P<module>[^]]+)/static/(?P<rest>.+)$')
def from_html(self, cr, uid, model, column, element, context=None):

View File

@ -86,8 +86,8 @@
</t>
<div class="media">
<a class="pull-left" t-attf-href="/partners/#{slug(partner)}?#{current_grade and 'grade_id=%s&amp;' % current_grade.id}#{current_country and 'country_id=%s' % current_country.id}"
t-field="partner.image_small"
t-field-options='{"widget": "image", "class": "media-object"}'
t-field="partner.image"
t-field-options='{"widget": "image", "class": "media-object", "max_width": 128}'
></a>
<div class="media-body o_partner_body" style="min-height: 64px;">
<a class="media-heading" t-attf-href="/partners/#{slug(partner)}?#{current_grade and 'grade_id=%s&amp;' % current_grade.id}#{current_country and 'country_id=%s' % current_country.id}">