[IMP] website: media editor: insert add button for image loader and fix try_remove...
authorchm@openerp.com <>
Mon, 7 Apr 2014 07:49:22 +0000 (09:49 +0200)
committerchm@openerp.com <>
Mon, 7 Apr 2014 07:49:22 +0000 (09:49 +0200)
bzr revid: chm@openerp.com-20140407074922-zri6j4u9sw52nkkw

addons/website/models/website.py
addons/website/static/src/js/website.editor.js
addons/website/static/src/xml/website.editor.xml

index a516f5c..a0a6d1f 100644 (file)
@@ -638,7 +638,7 @@ class ir_attachment(osv.osv):
             # in-document URLs are html-escaped, a straight search will not
             # find them
             url = werkzeug.utils.escape(attachment.website_url)
-            ids = Views.search(cr, uid, [('arch', 'like', url)], context=context)
+            ids = Views.search(cr, uid, ["|", ('arch', 'like', '"%s"' % url), ('arch', 'like', "'%s'" % url)], context=context)
 
             if ids:
                 removal_blocked_by[attachment.id] = Views.read(
index bd17584..bb24ad0 100644 (file)
                 this.$('input[type=file]').click();
             },
             'change input[type=file]': 'file_selection',
-            'change input[type=text]': function () {
-                this.$('form').submit();
-            },
             'submit form': 'form_submit',
             //'change input.url': 'preview_image',
             //'change select.image-style': 'preview_image',
index ca8a264..0f57dea 100644 (file)
                         <button type="button" class="btn hidden wait" disabled="disabled">Uploading...</button>
                     </div>
                     <span class="text-muted">— or —</span>
-                    <div class="form-group">
-                        <label for="iamgeurl">Image URL</label>
-                        <input type="text" name="url" class="form-control url" style="width: 300px;" id="iamgeurl" placeholder="http://openerp.com"/>
+                    <label for="iamgeurl">Image URL</label>
+                    <div class="form-group btn-group">
+                        <input type="text" name="url" class="form-control url" style="width: 320px; float: left;" id="iamgeurl" placeholder="http://openerp.com"/>
+                        <button class="btn btn-primary" type="submit">Add</button>
                     </div>
                 </div>
                 <input type="hidden" name="func"/>
-                <div class="existing-attachments"/>
                 <div class="help-block"/>
+                <div class="existing-attachments"/>
             </form>
         </div>
         <iframe src="about:blank" name="fileframe" class="hidden"/>