Vidhin Mehta  (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons-issues4-dashboard-title-jra-header_input-vme
 into 
lp:~openerp-dev/openobject-addons/trunk-addons-issues4-dashboard-title-jra.

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

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons-issues4-dashboard-title-jra-header_input-vme/+merge/120791

Make dasboard's header editable.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons-issues4-dashboard-title-jra-header_input-vme/+merge/120791
Your team OpenERP R&D Team is requested to review the proposed merge of 
lp:~openerp-dev/openobject-addons/trunk-addons-issues4-dashboard-title-jra-header_input-vme
 into 
lp:~openerp-dev/openobject-addons/trunk-addons-issues4-dashboard-title-jra.
=== modified file 'board/static/src/css/dashboard.css'
--- board/static/src/css/dashboard.css	2012-08-09 15:36:05 +0000
+++ board/static/src/css/dashboard.css	2012-08-22 14:22:16 +0000
@@ -50,6 +50,13 @@
   content: "+";
   margin-left: 4px;
 }
+.openerp .oe_dashboard .oe_action .oe_header .oe_header_text {
+  visibility: hidden;
+  cursor: text;
+}
+.openerp .oe_dashboard .oe_action .oe_header span {
+  cursor: pointer;
+}
 .openerp .oe_dashboard .oe_action .oe_header_empty {
   padding-top: 0;
   padding-bottom: 2px;

=== modified file 'board/static/src/css/dashboard.sass'
--- board/static/src/css/dashboard.sass	2012-08-09 16:12:40 +0000
+++ board/static/src/css/dashboard.sass	2012-08-22 14:22:16 +0000
@@ -49,6 +49,11 @@
         .oe_maximize:after
           content: "+"
           margin-left: 4px
+        .oe_header_text
+          visibility: hidden
+          cursor: text
+        span
+          cursor: pointer
       .oe_header_empty
         padding-top: 0
         padding-bottom: 2px

=== modified file 'board/static/src/js/dashboard.js'
--- board/static/src/js/dashboard.js	2012-08-09 15:36:05 +0000
+++ board/static/src/js/dashboard.js	2012-08-22 14:22:16 +0000
@@ -22,12 +22,15 @@
             connectWith: '.oe_dashboard_column',
             handle: '.oe_header',
             scroll: false
-        }).disableSelection().bind('sortstop', self.do_save_dashboard);
+        }).bind('sortstop', self.do_save_dashboard);
 
         // Events
         this.$element.find('.oe_dashboard_link_reset').click(this.on_reset);
         this.$element.find('.oe_dashboard_link_change_layout').click(this.on_change_layout);
-
+        this.$element.find('h2.oe_header span.oe_header_txt').click(function(ev){
+            if(ev.target === ev.currentTarget)
+                self.on_header_string($(ev.target).parent());
+        });
         this.$element.delegate('.oe_dashboard_column .oe_fold', 'click', this.on_fold_action);
         this.$element.delegate('.oe_dashboard_column .oe_close', 'click', this.on_close_action);
 
@@ -46,6 +49,30 @@
             });
         });
     },
+    on_header_string:function(h2){
+        var self = this;
+        var span = h2.find('span:first').hide();
+        var input = h2.find('.oe_header_text').css('visibility','visible');
+        var attr = h2.closest(".oe_action").data('action_attrs');
+        var change_string = function(new_name){
+                attr['string'] = new_name;
+                span.text(new_name).show();
+                input.css('visibility','hidden');
+                self.do_save_dashboard();
+        }
+        input.unbind()
+        .val(span.text())
+        .change(function(event){
+            change_string($(this).val());
+        })
+        .keyup(function(event){
+            if(event.keyCode == 27){
+                //esc key to cancel changes
+                input.css('visibility','hidden');
+                span.show();
+            }
+        });
+    },
     on_reset: function() {
         this.rpc('/web/view/undo_custom', {
             view_id: this.view.fields_view.view_id,

=== modified file 'board/static/src/xml/board.xml'
--- board/static/src/xml/board.xml	2012-08-09 15:36:05 +0000
+++ board/static/src/xml/board.xml	2012-08-22 14:22:16 +0000
@@ -23,13 +23,15 @@
 <t t-name="DashBoard.action">
     <div t-att-data-id="action.attrs.name" class="oe_action">
         <h2 t-attf-class="oe_header #{action.attrs.string ? '' : 'oe_header_empty'}">
-            <t t-esc="action.attrs.string"/>
+            <span class="oe_header_txt"> <t t-esc="action.attrs.string"/> </span>
+            <input class = "oe_header_text" type="text"/>
             <t t-if="!action.attrs.string">&amp;nbsp;</t>
             <button t-if="action.attrs.creatable and action.attrs.creatable !== 'false'" class="oe_button oe_button_create">Create</button>
             <span class='oe_icon oe_close'></span>
             <span class='oe_icon oe_minimize oe_fold' t-if="!action.attrs.fold"></span>
             <span class='oe_icon oe_maximize oe_fold' t-if="action.attrs.fold"></span>
         </h2>
+        
         <div t-attf-id="#{view.element_id}_action_#{column_index}_#{action_index}" class="oe_content" t-att-style="action.attrs.fold ? 'display: none' : null"></div>
     </div>
 </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