[IMP]removed view editor from web to web addons.

bzr revid: vme@tinyerp.com-20120730091815-scj8dt3j1tr1jpvx
This commit is contained in:
Vidhin Mehta (OpenERP) 2012-07-30 14:48:15 +05:30
parent 45951a0a49
commit 8e5a0fa9b0
11 changed files with 139 additions and 122 deletions

View File

@ -2474,27 +2474,6 @@
.openerp .oe_trad_field.touched {
border: 1px solid green !important;
}
.openerp .oe_view_editor {
width: 100%;
border-collapse: collapse;
margin-left: -12px;
width: 100%;
background-color: white;
border-spacing: 0;
}
.openerp .oe_view_editor td {
text-align: center;
white-space: nowrap;
border: 1px solid #d8d8d8;
cursor: pointer;
font-size: 90%;
}
.openerp .oe_view_editor_field td {
border: 0px !important;
}
.openerp .oe_view_editor tr:hover {
background-color: #ecebf2;
}
.openerp .oe_layout_debugging .oe_form_group {
outline: 2px dashed green;
}

View File

@ -1929,25 +1929,6 @@ $sheet-max-width: 860px
.oe_trad_field.touched
border: 1px solid green !important
// }}}
// View Editor {{{
.oe_view_editor
width: 100%
border-collapse: collapse
margin-left: -12px
width: 100%
background-color: white
border-spacing: 0
td
text-align: center
white-space: nowrap
border: 1px solid #D8D8D8
cursor: pointer
font-size: 90%
.oe_view_editor_field td
border: 0px !important
.oe_view_editor tr:hover
background-color: #ecebf2
// }}}
// Debugging stuff {{{
.oe_layout_debugging
.oe_form_group

View File

@ -48,7 +48,7 @@
* OpenERP Web web module split
*---------------------------------------------------------*/
openerp.web = function(session) {
var files = ["corelib","coresetup","dates","formats","chrome","data","views","search","list","form","list_editable","web_mobile","view_tree","data_export","data_import","view_editor"];
var files = ["corelib","coresetup","dates","formats","chrome","data","views","search","list","form","list_editable","web_mobile","view_tree","data_export","data_import"];
for(var i=0; i<files.length; i++) {
if(openerp.web[files[i]]) {
openerp.web[files[i]](session);

View File

@ -739,7 +739,7 @@ instance.web.ViewManagerAction = instance.web.ViewManager.extend({
break;
case 'manage_views':
if (current_view.fields_view && current_view.fields_view.arch) {
var view_editor = new instance.web.ViewEditor(current_view, current_view.$element, this.dataset, current_view.fields_view.arch);
var view_editor = new instance.web_view_editor.ViewEditor(current_view, current_view.$element, this.dataset, current_view.fields_view.arch);
view_editor.start();
} else {
this.do_warn(_t("Manage Views"),

View File

@ -1502,70 +1502,6 @@
</select>
</t>
<t t-name="view_editor">
<table class="oe_view_editor">
<t t-call="view_editor.row"/>
</table>
</t>
<t t-name="view_editor.row">
<tr t-att-id="'viewedit-' + rec.id" t-att-level="rec.level" t-foreach="data" t-as="rec">
<td width="90%">
<table class="oe_view_editor_field">
<tr>
<td width="16px" t-att-style="'background-position: ' + 20*rec.level + 'px; padding-left: ' + 20*rec.level + 'px'">
<img t-if="rec.child_id.length" t-att-id="'parentimg-' + rec.id"
t-att-src='_s + "/web/static/src/img/collapse.gif"' width="16" height="16" border="0"/>
</td>
<td style="cursor: pointer;">
<a style="text-decoration:none" href="javascript:void(0);">
<t t-esc="rec.name"/>
</a>
</td>
</tr>
</table>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-add" t-att-src='_s + "/web/static/src/img/icons/gtk-add.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img id="side-remove" t-att-src='_s + "/web/static/src/img/icons/gtk-remove.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length and !_.include(no_properties, rec.att_list[0])"
id="side-edit" t-att-src='_s + "/web/static/src/img/icons/gtk-edit.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-up" t-att-src='_s + "/web/static/src/img/icons/gtk-go-up.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-down" t-att-src='_s + "/web/static/src/img/icons/gtk-go-down.png"' style="cursor: pointer;"/>
</td>
<t t-if="rec.child_id.length">
<t t-set="data" t-value="rec.child_id"/>
<t t-call="view_editor.row"/>
</t>
</tr>
</t>
<t t-name="vieweditor_char">
<input type="text" t-att-id="widget.name" class="field_char" size="50"/>
</t>
<t t-name="vieweditor_selection">
<select t-att-id="widget.name" >
<t t-if="widget.selection" t-foreach="widget.selection" t-as="option">
<option
t-att-value="typeof option === 'object' ? option[0] : option">
<t t-esc="typeof option === 'object' ? option[1] : option"/>
</option>
</t>
</select>
</t>
<t t-name="vieweditor_boolean">
<input type="checkbox" t-att-id="widget.name"/>
</t>
<t t-name="ExportView">
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
</t>

View File

@ -0,0 +1 @@
# -*- coding: utf-8 -*-

View File

@ -0,0 +1,14 @@
{
"name": "View Editor",
"category": "Hidden",
"description":
"""
OpenERP Web to edit views.
""",
"version": "2.0",
"depends":['web'],
"js": ["static/src/js/view_editor.js"],
"css": ['static/src/css/view_editor.css'],
"qweb": ['static/src/xml/view_editor.xml'],
'auto_install': True,
}

View File

@ -0,0 +1,19 @@
# Translations template for PROJECT.
# Copyright (C) 2012 ORGANIZATION
# This file is distributed under the same license as the PROJECT project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2012.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2012-07-30 14:37+0530\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"

View File

@ -0,0 +1,21 @@
.openerp .oe_view_editor {
width: 100%;
border-collapse: collapse;
margin-left: -12px;
width: 100%;
background-color: white;
border-spacing: 0;
}
.openerp .oe_view_editor td {
text-align: center;
white-space: nowrap;
border: 1px solid #d8d8d8;
cursor: pointer;
font-size: 90%;
}
.openerp .oe_view_editor_field td {
border: 0px !important;
}
.openerp .oe_view_editor tr:hover {
background-color: #ecebf2;
}

View File

@ -1,7 +1,7 @@
openerp.web.view_editor = function(instance) {
openerp.web_view_editor = function(instance) {
var _t = instance.web._t;
var QWeb = instance.web.qweb;
instance.web.ViewEditor = instance.web.OldWidget.extend({
instance.web_view_editor.ViewEditor = instance.web.OldWidget.extend({
init: function(parent, element_id, dataset, view, options) {
this._super(parent);
this.element_id = element_id;
@ -9,7 +9,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
this.dataset = new instance.web.DataSetSearch(this, 'ir.ui.view', null, null),
this.model = dataset.model;
this.xml_element_id = 0;
this.property = instance.web.ViewEditor.property_widget;
this.property = instance.web_view_editor.ViewEditor.property_widget;
this.one_object = false;
},
start: function() {
@ -434,7 +434,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
break;
}
if (view_find.attr('level') < min_level) {
min_level = parseInt(view_find.attr('level'));
min_level = parseInt(view_find.attr('level'));
}
}
var val = _.detect(obj.att_list, function(val) {return val[0] == "name";});
@ -1013,7 +1013,7 @@ instance.web.ViewEditor = instance.web.OldWidget.extend({
});
}
});
instance.web.ViewEditor.Field = instance.web.Class.extend({
instance.web_view_editor.ViewEditor.Field = instance.web.Class.extend({
init: function(view, widget) {
this.$element = view.$element;
this.dirty = false;
@ -1049,7 +1049,7 @@ instance.web.ViewEditor.Field = instance.web.Class.extend({
return _.str.sprintf("<td id = %s>%s</td>", this.name, QWeb.render(this.template, {widget: this}))
}
});
instance.web.ViewEditor.FieldBoolean = instance.web.ViewEditor.Field.extend({
instance.web_view_editor.ViewEditor.FieldBoolean = instance.web_view_editor.ViewEditor.Field.extend({
template : "vieweditor_boolean",
start: function() {
var self = this;
@ -1067,7 +1067,7 @@ instance.web.ViewEditor.FieldBoolean = instance.web.ViewEditor.Field.extend({
return this.$element.find("input[id=" + this.name + "]").is(':checked')? "1" : null;
}
});
instance.web.ViewEditor.FieldChar = instance.web.ViewEditor.Field.extend({
instance.web_view_editor.ViewEditor.FieldChar = instance.web_view_editor.ViewEditor.Field.extend({
template : "vieweditor_char",
start: function () {
var self = this;
@ -1083,7 +1083,7 @@ instance.web.ViewEditor.FieldChar = instance.web.ViewEditor.Field.extend({
return this.$element.find("input[id=" + this.name + "]").val();
}
});
instance.web.ViewEditor.FieldSelect = instance.web.ViewEditor.Field.extend({
instance.web_view_editor.ViewEditor.FieldSelect = instance.web_view_editor.ViewEditor.Field.extend({
template : "vieweditor_selection",
start: function () {
var self = this;
@ -1113,7 +1113,7 @@ instance.web.ViewEditor.FieldSelect = instance.web.ViewEditor.Field.extend({
return this.$element.find("select[id=" + this.name + "]").val();
}
});
instance.web.ViewEditor.FieldSelectMulti = instance.web.ViewEditor.FieldSelect.extend({
instance.web_view_editor.ViewEditor.FieldSelectMulti = instance.web_view_editor.ViewEditor.FieldSelect.extend({
start: function () {
this._super();
this.$element.find("select[id=" + this.name + "]").css('height', '100px').attr("multiple", true);
@ -1129,7 +1129,7 @@ instance.web.ViewEditor.FieldSelectMulti = instance.web.ViewEditor.FieldSelect.e
});
}
});
instance.web.ViewEditor.FieldFloat = instance.web.ViewEditor.FieldChar.extend({
instance.web_view_editor.ViewEditor.FieldFloat = instance.web_view_editor.ViewEditor.FieldChar.extend({
});
var _PROPERTIES = {
@ -1202,11 +1202,11 @@ var _ICONS = ['','STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD',
'terp-sale', 'terp-tools', 'terp-administration', 'terp-hr', 'terp-partner',
'terp-project', 'terp-report', 'terp-stock', 'terp-calendar', 'terp-graph'
];
instance.web.ViewEditor.property_widget = new instance.web.Registry({
'boolean' : 'instance.web.ViewEditor.FieldBoolean',
'selection_multi' : 'instance.web.ViewEditor.FieldSelectMulti',
'selection' : 'instance.web.ViewEditor.FieldSelect',
'char' : 'instance.web.ViewEditor.FieldChar',
'float' : 'instance.web.ViewEditor.FieldFloat'
instance.web_view_editor.ViewEditor.property_widget = new instance.web.Registry({
'boolean' : 'instance.web_view_editor.ViewEditor.FieldBoolean',
'selection_multi' : 'instance.web_view_editor.ViewEditor.FieldSelectMulti',
'selection' : 'instance.web_view_editor.ViewEditor.FieldSelect',
'char' : 'instance.web_view_editor.ViewEditor.FieldChar',
'float' : 'instance.web_view_editor.ViewEditor.FieldFloat'
});
};

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8" ?>
<template>
<t t-name="view_editor">
<table class="oe_view_editor">
<t t-call="view_editor.row"/>
</table>
</t>
<t t-name="view_editor.row">
<tr t-att-id="'viewedit-' + rec.id" t-att-level="rec.level" t-foreach="data" t-as="rec">
<td width="90%">
<table class="oe_view_editor_field">
<tr>
<td width="16px" t-att-style="'background-position: ' + 20*rec.level + 'px; padding-left: ' + 20*rec.level + 'px'">
<img t-if="rec.child_id.length" t-att-id="'parentimg-' + rec.id"
t-att-src='_s + "/web/static/src/img/collapse.gif"' width="16" height="16" border="0"/>
</td>
<td style="cursor: pointer;">
<a style="text-decoration:none" href="javascript:void(0);">
<t t-esc="rec.name"/>
</a>
</td>
</tr>
</table>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-add" t-att-src='_s + "/web/static/src/img/icons/gtk-add.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img id="side-remove" t-att-src='_s + "/web/static/src/img/icons/gtk-remove.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length and !_.include(no_properties, rec.att_list[0])"
id="side-edit" t-att-src='_s + "/web/static/src/img/icons/gtk-edit.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-up" t-att-src='_s + "/web/static/src/img/icons/gtk-go-up.png"' style="cursor: pointer;"/>
</td>
<td width="2%">
<img t-if="rec.att_list.length"
id="side-down" t-att-src='_s + "/web/static/src/img/icons/gtk-go-down.png"' style="cursor: pointer;"/>
</td>
<t t-if="rec.child_id.length">
<t t-set="data" t-value="rec.child_id"/>
<t t-call="view_editor.row"/>
</t>
</tr>
</t>
<t t-name="vieweditor_char">
<input type="text" t-att-id="widget.name" class="field_char" size="50"/>
</t>
<t t-name="vieweditor_selection">
<select t-att-id="widget.name" >
<t t-if="widget.selection" t-foreach="widget.selection" t-as="option">
<option
t-att-value="typeof option === 'object' ? option[0] : option">
<t t-esc="typeof option === 'object' ? option[1] : option"/>
</option>
</t>
</select>
</t>
<t t-name="vieweditor_boolean">
<input type="checkbox" t-att-id="widget.name"/>
</t>
</template>