Merge lp:~openerp-dev/openerp-web/7.0-manageview-fix-position into lp:openerp-web/7.0

Proposed by Vidhin Mehta (OpenERP)
Status: Merged
Merged at revision: 3903
Proposed branch: lp:~openerp-dev/openerp-web/7.0-manageview-fix-position
Merge into: lp:openerp-web/7.0
Diff against target: 73 lines (+15/-7)
1 file modified
addons/web_view_editor/static/src/js/view_editor.js (+15/-7)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-manageview-fix-position
Reviewer Review Type Date Requested Status
Nicolas Vanhoren (OpenERP) Pending
Review via email: mp+157308@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web_view_editor/static/src/js/view_editor.js'
--- addons/web_view_editor/static/src/js/view_editor.js 2013-03-21 15:28:31 +0000
+++ addons/web_view_editor/static/src/js/view_editor.js 2013-04-05 09:26:24 +0000
@@ -15,7 +15,7 @@
15 }15 }
16 evt.currentTarget.selectedIndex = 0;16 evt.currentTarget.selectedIndex = 0;
17 }else{17 }else{
18 return this._super.apply(this,arguments); 18 return this._super.apply(this,arguments);
19 }19 }
20 }20 }
21});21});
@@ -232,10 +232,11 @@
232 return main_object;232 return main_object;
233 },233 },
234 parse_xml: function(arch, view_id) {234 parse_xml: function(arch, view_id) {
235 //First element of att_list must be element tagname.
235 main_object = {236 main_object = {
236 'level': 0,237 'level': 0,
237 'id': this.xml_element_id +=1,238 'id': this.xml_element_id +=1,
238 'att_list': [],239 'att_list': ["view"],
239 'name': _.str.sprintf("<view view_id = %s>", view_id),240 'name': _.str.sprintf("<view view_id = %s>", view_id),
240 'child_id': []241 'child_id': []
241 };242 };
@@ -535,15 +536,22 @@
535 var field_dataset = new instance.web.DataSetSearch(this, this.model, null, null);536 var field_dataset = new instance.web.DataSetSearch(this, this.model, null, null);
536 parent_tr = self.get_object_by_id(parseInt($(parent_tr).attr('id').replace(/[^0-9]+/g, '')), this.one_object['main_object'], [])[0].att_list[0];537 parent_tr = self.get_object_by_id(parseInt($(parent_tr).attr('id').replace(/[^0-9]+/g, '')), this.one_object['main_object'], [])[0].att_list[0];
537 _.each([tr, parent_tr],function(element) {538 _.each([tr, parent_tr],function(element) {
538 var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false; 539 var value = _.has(_CHILDREN, element) ? element : _.str.include(html_tag, element)?"html_tag":false;
539 property_to_check.push(value);540 property_to_check.push(value);
540 });541 });
541 field_dataset.call( 'fields_get', []).done(function(result) {542 field_dataset.call( 'fields_get', []).done(function(result) {
542 var fields = _.keys(result);543 var fields = _.keys(result);
543 fields.push(" "),fields.sort();544 fields.push(" "),fields.sort();
544 self.on_add_node(property_to_check, fields);545 self.on_add_node(property_to_check, fields, self.inject_position(parent_tr,tr));
545 });546 });
546 },547 },
548 inject_position : function(parent_tag,current_tag){
549 if(parent_tag == "view")
550 return ['Inside'];
551 if(current_tag == "field")
552 return ['After','Before'];
553 return ['After','Before','Inside'];
554 },
547 do_node_edit: function(side) {555 do_node_edit: function(side) {
548 var self = this;556 var self = this;
549 var result = self.get_object_by_id(this.one_object.clicked_tr_id, this.one_object['main_object'], []);557 var result = self.get_object_by_id(this.one_object.clicked_tr_id, this.one_object['main_object'], []);
@@ -941,11 +949,11 @@
941 });949 });
942 return def.promise();950 return def.promise();
943 },951 },
944 on_add_node: function(properties, fields){952 on_add_node: function(properties, fields, position){
945 var self = this;953 var self = this;
946 var render_list = [{'name': 'node_type','selection': _.keys(_CHILDREN).sort(), 'value': 'field', 'string': 'Node Type','type': 'selection'},954 var render_list = [{'name': 'node_type','selection': _.keys(_CHILDREN).sort(), 'value': 'field', 'string': 'Node Type','type': 'selection'},
947 {'name': 'field_value','selection': fields, 'value': false, 'string': '','type': 'selection'},955 {'name': 'field_value','selection': fields, 'value': false, 'string': '','type': 'selection'},
948 {'name': 'position','selection': ['After','Before','Inside'], 'value': false, 'string': 'Position','type': 'selection'}];956 {'name': 'position','selection': position, 'value': false, 'string': 'Position','type': 'selection'}];
949 this.add_widget = [];957 this.add_widget = [];
950 this.add_node_dialog = new instance.web.Dialog(this,{958 this.add_node_dialog = new instance.web.Dialog(this,{
951 title: _t("Properties"),959 title: _t("Properties"),
@@ -1186,7 +1194,7 @@
1186//e.g.:xyz 'td' : ['field']1194//e.g.:xyz 'td' : ['field']
1187};1195};
1188// Generic html_tag list and can be added html tag in future. It's support above _CHILDREN dict's *html_tag* by default.1196// Generic html_tag list and can be added html tag in future. It's support above _CHILDREN dict's *html_tag* by default.
1189// For specific child node one has to define tag above and specify children tag in list. Like above xyz example. 1197// For specific child node one has to define tag above and specify children tag in list. Like above xyz example.
1190var html_tag = ['div','h1','h2','h3','h4','h5','h6','td','tr'];1198var html_tag = ['div','h1','h2','h3','h4','h5','h6','td','tr'];
11911199
1192var _ICONS = ['','STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD',1200var _ICONS = ['','STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD',