[FIX] drop when no dropzone, [IMP] Jobs layout
authorFabien Pinckaers <fp@openerp.com>
Sat, 16 Nov 2013 08:53:50 +0000 (09:53 +0100)
committerFabien Pinckaers <fp@openerp.com>
Sat, 16 Nov 2013 08:53:50 +0000 (09:53 +0100)
bzr revid: fp@openerp.com-20131116085350-gfrm0jn7bv3ubfz7

addons/website/models/ir_ui_view.py
addons/website/static/src/js/website.snippets.editor.js
addons/website_hr_recruitment/views/website_hr_recruitment.xml

index d502ef7..ad95a6b 100644 (file)
@@ -47,16 +47,16 @@ class view(osv.osv):
         if options:
             todo += filter(lambda x: not x.inherit_id, view.inherited_option_ids)
         for child_view in todo:
-            result += self._views_get(cr, uid, child_view, options=options, context=context, root=False, stack_result=result)
+            for r in self._views_get(cr, uid, child_view, options=options, context=context, root=False, stack_result=result):
+                if r not in result:
+                    result.append(r)
         node = etree.fromstring(view.arch)
         for child in node.xpath("//t[@t-call]"):
             call_view = view_obj(child.get('t-call'))
-            if call_view not in stack_result:
+            if call_view not in result:
                 result += self._views_get(cr, uid, call_view, options=options, context=context, stack_result=result)
         return result
 
-
-
     def extract_embedded_fields(self, cr, uid, arch, context=None):
         return arch.xpath('//*[@data-oe-model != "ir.ui.view"]')
 
index a63a8da..07979bf 100644 (file)
                     });
                 },
                 stop: function(ev, ui){
-                    if (action === 'insert' && ! dropped) {
-                        var $el = $('.oe_drop_zone').nearest({x: ui.position.left, y: ui.position.top}).first();
-                        if ($el) {
-                            $el.after($toInsert);
+                    if (action === 'insert' && ! dropped && $('.oe_drop_zone')) {
+                        var el = $('.oe_drop_zone').nearest({x: ui.position.left, y: ui.position.top}).first();
+                        if (el.length) {
+                            el.after($toInsert);
                             dropped = true;
                         }
                     }
index 4e17aa8..2db41c5 100644 (file)
                         <i class="icon-map-marker"/> <span t-field="job.address_id.city"/> <span t-if="job.address_id.state_id" t-field="job.address_id.state_id.name"/>, <span t-field="job.address_id.country_id.name"/>
                     </h5>
                     <h5 class="text-center text-muted">
-                                    <i class="icon-time"/> <span><t t-esc="vals_date"/></span>
+                        <i class="icon-time"/> <span><t t-esc="vals_date"/></span>
                     </h5>
                 </div>
-                <div class="container oe_structure">
-                    <div class="row">
-                        <div t-if="job.website_description">
-                            <div t-field="job.website_description"/>
-                            <section data-snippet-id="cta" class="mt16 mb16">
-                                <div class="container">
-                                    <div class="row">
-                                    <div class="col-md-12 text-center mt16 mb16">
-                                        <a t-href="/job/apply/#{ job.id }/" class="btn btn-primary btn-lg">Apply</a>
-                                    </div>
-                                      </div>
+                <div t-field="job.website_description"/>
+
+                <div class="oe_structure">
+                    <section data-snippet-id="cta" class="mt16 mb16">
+                        <div class="container">
+                            <div class="row">
+                                <div class="col-md-12 text-center mt16 mb16">
+                                    <a t-href="/job/apply/#{ job.id }/" class="btn btn-primary btn-lg">Apply</a>
                                 </div>
-                            </section>
+                            </div>
                         </div>
-                    </div>
+                    </section>
                 </div>
             </div>
             </t>