Bhumi Thakkar (Open ERP) has proposed merging 
lp:~openerp-dev/openerp-web/mobile-client-bth-notebook into 
lp:~openerp-dev/openerp-web/mobile-client.

Requested reviews:
  OpenERP R&D Team (openerp-dev)

For more details, see:
https://code.launchpad.net/~openerp-dev/openerp-web/mobile-client-bth-notebook/+merge/67687
-- 
https://code.launchpad.net/~openerp-dev/openerp-web/mobile-client-bth-notebook/+merge/67687
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openerp-web/mobile-client-bth-notebook into 
lp:~openerp-dev/openerp-web/mobile-client.
=== modified file 'addons/base/static/src/js/base.js'
--- addons/base/static/src/js/base.js	2011-07-11 06:04:30 +0000
+++ addons/base/static/src/js/base.js	2011-07-12 12:21:23 +0000
@@ -20,7 +20,7 @@
     // Copy the properties over onto the new prototype
     for (var name in prop) {
       // Check if we're overwriting an existing function
-      prototype[name] = typeof prop[name] == "function" && 
+      prototype[name] = typeof prop[name] == "function" &&
         typeof _super[name] == "function" && fnTest.test(prop[name]) ?
         (function(name, fn){
           return function() {

=== modified file 'addons/web_mobile/static/src/css/web_mobile.css'
--- addons/web_mobile/static/src/css/web_mobile.css	2011-06-13 05:19:16 +0000
+++ addons/web_mobile/static/src/css/web_mobile.css	2011-07-12 12:21:23 +0000
@@ -0,0 +1,1 @@
+.ui-collapsible-content-expanded { display: block; }
\ No newline at end of file

=== modified file 'addons/web_mobile/static/src/js/form_mobile.js'
--- addons/web_mobile/static/src/js/form_mobile.js	2011-07-08 13:08:29 +0000
+++ addons/web_mobile/static/src/js/form_mobile.js	2011-07-12 12:21:23 +0000
@@ -10,24 +10,77 @@
         id = this.list_id;
         model = this.action.res_model;
         view_id = this.action.views[1][0];
+
         this.dataset = new openerp.base.DataSetSearch(this.session, this.action.res_model, null, null);
-        this.dataset.read_slice(false, false, false, function(result){
+        this.dataset.read_slice(false, false, false, function (result) {
+
             for (var i = 0; i < result.length; i++) {
                 if (result[i].id == id) {
                     var data = result[i];
                 }
             }
-            self.rpc("/base/formview/load", {"model": model, "view_id": view_id },
-                function(result){
-                    var view_fields = result.fields_view.arch.children;
-                    get_fields = self.get_fields(view_fields);
-                    for (var j = 0; j < view_fields.length; j++) {
-                        if (view_fields[j].tag == 'notebook') {
-                            var notebooks = view_fields[j];
+            self.rpc("/base/formview/load", {"model": model, "view_id": view_id }, function (result) {
+                var view_fields = result.fields_view.arch.children;
+                var get_fields = self.get_fields(view_fields);
+
+                for (var j = 0; j < view_fields.length; j++) {
+                    if (view_fields[j].tag == 'notebook') {
+                        var notebooks = view_fields[j];
+                    }
+                }
+                $("#oe_header").find("h1").html(result.fields_view.arch.attrs.string);
+                self.$element.html(QWeb.render("FormView", {'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : result.fields_view.fields, 'values' : data }));
+
+                    self.$element.find('a').click(function(){
+
+                        for (var k = 0; k < notebooks.children.length; k++) {
+
+                            var text = $(this).find('.ui-btn-text').text();
+                            var next = $(this).next();
+                            var span = $(this).find('span .ui-icon');
+                            var content_expanded_class = "ui-collapsible-content ui-collapsible-content-expanded";
+                            var content_collapsed_class = "ui-collapsible-content ui-collapsible-content-collapsed";
+                            var expanded_class = "ui-collapsible-content-expanded";
+                            var collapsed_class = "ui-collapsible-content-collapsed";
+                            var plus_class = "ui-icon-plus";
+                            var minus_class = "ui-icon-minus";
+
+                            if (notebooks.children[k].attrs.string == $.trim(text)) {
+                                get_fields = self.get_fields(notebooks.children[k].children);
+
+                                $(this).parents().find('form').find('div').each( function() {
+                                    var prev = $(this).prev();
+                                    var trim_class = $.trim($(this).attr('class'));
+                                    if (trim_class == content_expanded_class || trim_class == content_collapsed_class) {
+                                        prev.removeClass('ui-btn-active');
+
+                                        if ($.trim(prev.find('.ui-btn-text').text()) != notebooks.children[k].attrs.string) {
+                                            prev.find('span .ui-icon').removeClass(minus_class);
+                                            prev.find('span .ui-icon').addClass(plus_class);
+                                            $(this).removeClass(expanded_class);
+                                            $(this).addClass(collapsed_class);
+                                        }
+                                    }
+                                });
+
+                                if (next.hasClass(content_collapsed_class)) {
+                                    span.removeClass(plus_class);
+                                    span.addClass(minus_class);
+                                    next.removeClass(collapsed_class);
+                                    next.addClass(expanded_class);
+                                }
+                                else if (next.hasClass(content_expanded_class)) {
+                                    span.removeClass(minus_class);
+                                    span.addClass(plus_class);
+                                    next.removeClass(expanded_class);
+                                    next.addClass(collapsed_class);
+                                }
+                                if (!next.find('.detail').html().length) {
+                                    next.find('.detail').append(QWeb.render("FormView", {'get_fields': get_fields,'fields' : result.fields_view.fields, 'values' : data }));
+                                }
+                            }
                         }
-                    }
-                    jQuery("#oe_header").find("h1").html(result.fields_view.arch.attrs.string);
-                    self.$element.html(QWeb.render("FormView", {'get_fields': get_fields, 'notebooks': notebooks || false, 'fields' : result.fields_view.fields, 'values' : data}));
+                    });
                 });
         });
     },
@@ -40,9 +93,12 @@
             if (view_fields[i].tag == 'group') {
                 this.get_fields(view_fields[i].children, this.fields);
             }
+            if (view_fields[i].tag == 'separator') {
+                this.get_fields(view_fields[i].children, this.fields);
+            }
         }
         return this.fields;
-    }
+    },
 });
 
 }
\ No newline at end of file

=== modified file 'addons/web_mobile/static/src/web_mobile.html'
--- addons/web_mobile/static/src/web_mobile.html	2011-07-08 13:08:29 +0000
+++ addons/web_mobile/static/src/web_mobile.html	2011-07-12 12:21:23 +0000
@@ -25,7 +25,8 @@
     <script type="text/javascript" src="/web_mobile/static/src/js/chrome_mobile.js"></script>
     <script type="text/javascript" src="/web_mobile/static/src/js/list_mobile.js"></script>
     <script type="text/javascript" src="/web_mobile/static/src/js/form_mobile.js"></script>
-
+
+    <script type="text/javascript" src="/web_mobile/static/src/css/web_mobile.css"></script>
     <script type="text/javascript">
         $(function() {
             QWeb = window.QWeb || new QWeb2.Engine();

=== modified file 'addons/web_mobile/static/src/xml/web_mobile.xml'
--- addons/web_mobile/static/src/xml/web_mobile.xml	2011-07-07 11:45:17 +0000
+++ addons/web_mobile/static/src/xml/web_mobile.xml	2011-07-12 12:21:23 +0000
@@ -195,16 +195,15 @@
                 </t>
             </div>
             </t>
-
             <t t-if="notebooks">
                 <t t-foreach="notebooks.children" t-as="page">
                     <div class="info ui-collapsible-contain" data-collapsed="true" data-role="collapsible">
-                        <h1 class="ui-collapsible-heading ui-collapsible-heading-collapsed">
-                            <a class="ui-collapsible-heading-toggle ui-btn ui-btn-icon-left ui-shadow ui-corner-all ui-btn-up-c" href="#" data-theme="c">
+                        <h1 class="ui-collapsible-heading">
+                            <a class="ui-collapsible-heading-toggle ui-btn ui-btn-icon-left ui-shadow ui-corner-all ui-btn-up-c" href="#" data-theme="c" t-id="page.attrs.string">
                                 <span class="ui-btn-inner ui-corner-all">
                                     <span class="ui-btn-text">
                                         <t t-esc="page.attrs.string"></t>
-                                        <span class="ui-collapsible-heading-status"></span>
+                                        <!-- <span class="ui-collapsible-heading-status"></span> -->
                                     </span>
                                     <span data-theme="d" class="ui-btn ui-btn-icon-left ui-btn-corner-all ui-shadow ui-btn-up-d">
                                         <span class="ui-btn-inner ui-btn-corner-all ui-corner-all">
@@ -214,12 +213,10 @@
                                     </span>
                                 </span>
                             </a>
+                            <div class="ui-collapsible-content ui-collapsible-content-collapsed" aria-hidden="true">
+                                <div class="detail"></div>
+                            </div>
                         </h1>
-                        <div class="ui-collapsible-content ui-collapsible-content-collapsed" aria-hidden="true">
-                            <div class="detail">
-                                
-                            </div>
-                        </div>
                     </div>
                 </t>
             </t>

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to