height: 500,
buttons: {
"Create": function(){
-
+
},
"Edit": function(){
self.xml_id = 0 ;
self.get_data();
-
+
},
"Close": function(){
$(this).dialog('destroy');
},
});
- this.dialog.start();
+ this.dialog.start();
this.dialog.open();
action_manager.appendTo(this.dialog);
action_manager.do_action(action);
att_list = _.select(att_list, function(attrs){
if (tag != 'button'){
if(attrs.nodeName == "string" || attrs.nodeName == "name" || attrs.nodeName == "index"){
- name1 += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
+ name1 += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
}else{
if(attrs.nodeName == "name"){
- name1 += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
+ name1 += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
}
- });
+ });
name1+= ">";
- });
+ });
obj.name = name1;
return obj;
},
child_obj_list.push(string);
});
if(children_list.length != 0){
- parent_child_id.push({key: parent_id, value: child_obj_list});
-
+ var child_ids = _.map(child_obj_list ,function(num){return num.id;});
+ parent_child_id.push({'key': parent_id, 'value': child_ids});
var parents = $(children_list[0]).parents().get();
if(parents.length <= parent_list.length){
parent_list.splice(parents.length-1);}
parent_list.push(parent_id);
$.each(main_object, function(key,val) {
- self.save_object(val,parent_list.slice(1),child_obj_list);
+ self.save_object(val,parent_list.slice(1),child_obj_list);
});
}
for(var i=0;i<children_list.length;i++){
return {"main_object":main_object,"parent_child_id":parent_child_id};
},
get_data : function(){
-
var self = this;
var view_id =(($("input[name='radiogroup']:checked").parent()).parent()).attr('data-id');
var ve_dataset = new openerp.web.DataSet(this,'ir.ui.view');
},
edit_view : function(one_object){
var self = this;
- this.dialog = new openerp.web.Dialog(this,{
- modal: true,
- title: 'Edit Xml',
- width: 750,
- height: 500,
- buttons: {
- "Inherited View": function(){
-
- },
- "Preview": function(){
-
- },
- "Close": function(){
- $(this).dialog('destroy');
- }
- }
- });
- this.dialog.start().open();
- this.dialog.$element.html(QWeb.render('view_editor', {
- 'data': one_object['main_object'],
- }));
+ this.dialog = new openerp.web.Dialog(this,{
+ modal: true,
+ title: 'Edit Xml',
+ width: 750,
+ height: 500,
+ buttons: {
+ "Inherited View": function(){
- $("tr[id^='viewedit-']").click(function() {
- $("tr[id^='viewedit-']").removeClass('ui-selected');
- $(this).addClass('ui-selected');
- });
+ },
+ "Preview": function(){
- $("img[id^='parentimg-']").click(function() {
- if ($(this).attr('src') == '/web/static/src/img/collapse.gif'){
- $(this).attr('src', '/web/static/src/img/expand.gif');
- }else{
- $(this).attr('src', '/web/static/src/img/collapse.gif');
+ },
+ "Close": function(){
+ $(this).dialog('destroy');
+ }
}
- });
- }
+ });
+ this.dialog.start().open();
+ this.dialog.$element.html(QWeb.render('view_editor', {
+ 'data': one_object['main_object'],
+ }));
-
+ $("tr[id^='viewedit-']").click(function() {
+ $("tr[id^='viewedit-']").removeClass('ui-selected');
+ $(this).addClass('ui-selected');
+ });
+
+ $("img[id^='parentimg-']").click(function() {
+ if ($(this).attr('src') == '/web/static/src/img/collapse.gif'){
+ $(this).attr('src', '/web/static/src/img/expand.gif');
+ self.on_expand(this);
+ }else{
+ $(this).attr('src', '/web/static/src/img/collapse.gif');
+ self.on_collapse(this,one_object['parent_child_id']);
+ }
+ });
+ },
+ on_expand: function(self){
+ var level = $(self).closest("tr[id^='viewedit-']").attr('level');
+ var cur_tr = $(self).closest("tr[id^='viewedit-']");
+ while (1){
+ var nxt_tr = cur_tr.next();
+ if (nxt_tr.attr('level') > level){
+ cur_tr = nxt_tr;
+ nxt_tr.hide();
+ }else break;
+ }
+ },
+ on_collapse: function(self,parent_child_id){
+ var id = self.id.split('-')[1];
+ var datas = _.detect(parent_child_id,function(res){
+ return res.key == id;
+ });
+ _.each(datas.value,function(rec){
+ var tr = $("tr[id='viewedit-"+rec+"']");
+ tr.find("img[id='parentimg-"+rec+"']").attr('src','/web/static/src/img/expand.gif');
+ tr.show();
+ });
+ }
});
};
<input type="checkbox"/>
</th>
</t>
-
-
+
+
<t t-foreach="columns" t-as="column">
<t t-set="align" t-value="column.type === 'integer' or column.type == 'float'"/>
<td t-if="!column.meta and column.invisible !== '1'" t-att-title="column.help"
<t t-call="view_editor.row"/>
</table>
</t>
-<tr t-name="view_editor.row" t-att-id="'viewedit-' + rec.id" t-foreach="data" t-as="rec">
- <td t-att-id = "rec.id" class="view_editor">
+<tr t-name="view_editor.row" t-att-id="'viewedit-' + rec.id " t-att-level="rec.level" t-foreach="data" t-as="rec">
+ <td class="view_editor">
<table>
<tr>
<td width="16px" t-att-style="'background-position: ' + 20*rec.level + 'px; padding-left: ' + 20*rec.level + 'px'">
</tr>
</table>
</td>
- <td align="left" class="view_editor" style="cursor: pointer;">
+ <td align="left" width="15%" class="view_editor" style="cursor: pointer;" >
<table cellspacing="0" cellpadding ="0" width="100%">
<tr>
<td> <img src="/web/static/src/img/icons/gtk-add.png" border="0"/> </td>
<t t-call="view_editor.row"/>
</t>
</tr>
+
<t t-name="ExportView">
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
</t>