diff options
| author | Antony Lesuisse <al@openerp.com> | 2011-12-15 19:43:05 +0100 |
|---|---|---|
| committer | Antony Lesuisse <al@openerp.com> | 2011-12-15 19:43:05 +0100 |
| commit | 2fd2f299b40a03044e5700509f18ae2ac2c0afce (patch) | |
| tree | 67d8b4faa981df4b308bcf6261095c0f898fc77a /addons/web/static/src | |
| parent | 4206e4d2627be8ca252fdfce2f90654ff9db0055 (diff) | |
| parent | 72e820765fccc9227c8b684e3d42f6344756cffc (diff) | |
[MERGE] trunk
bzr revid: al@openerp.com-20111215184305-3yxw54l91psrz5d6
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 149 | ||||
| -rw-r--r-- | addons/web/static/src/img/pencil.gif | bin | 0 -> 129 bytes | |||
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 15 | ||||
| -rw-r--r-- | addons/web/static/src/js/data.js | 7 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 9 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list.js | 25 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_list_editable.js | 7 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_page.js | 24 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 12 |
9 files changed, 204 insertions, 44 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 04fff6c9375..25e593170c6 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2,7 +2,6 @@ body.openerp { padding: 0; margin: 0; height: 100%; - min-width: 1000px; overflow-y: scroll; font-size: 80%; font-family: Ubuntu, Helvetica, sans-serif; @@ -359,7 +358,7 @@ label.error { position: absolute; z-index: 100; border: 4px solid #585858; - border: 4px solid rgba(88, 88, 88, .5); + border-color: rgba(88, 88, 88, .5); border-radius: 4px; min-width: 200px; } @@ -600,6 +599,10 @@ label.error { } .openerp .filter_label.enabled, .openerp .filter_icon.enabled { background: #aaa; + -moz-box-shadow: none; + -webkit-box-shadow: none; + -o-box-shadow: none; + box-shadow: none; } .openerp .filter_icon { height: 22px; @@ -622,6 +625,13 @@ label.error { padding-right: 0.4em; white-space: nowrap; } + +.openerp .filter_label_group button { + -webkit-border-radius: 0; + -moz-border-radius: 0; + border-radius: 0; + border-right: none; +} .openerp .filter_label_group button:first-child { -webkit-border-top-left-radius: 7px; -webkit-border-bottom-left-radius: 7px; @@ -631,9 +641,6 @@ label.error { border-bottom-left-radius: 7px; border-right: none; } -.openerp .filter_label_group button { - border-right: none; -} .openerp .filter_label_group button:last-child { -webkit-border-top-right-radius: 7px; -webkit-border-bottom-right-radius: 7px; @@ -649,12 +656,12 @@ label.error { .openerp .filter_label_group button.filter_icon:first-child { border-left: solid 1px #999; margin-left: -7px; - -webkit-border-top-left-radius: 0px; - -webkit-border-bottom-left-radius: 0px; - -moz-border-radius-topleft: 0px; - -moz-border-radius-bottomleft: 0px; - border-top-left-radius: 0px; - border-bottom-left-radius: 0px; + -webkit-border-top-left-radius: 0; + -webkit-border-bottom-left-radius: 0; + -moz-border-radius-topleft: 0; + -moz-border-radius-bottomleft: 0; + border-top-left-radius: 0; + border-bottom-left-radius: 0; } .openerp .searchview_group_string { @@ -822,9 +829,12 @@ label.error { border-bottom: 1px solid #E3E3E3; } -.openerp .oe-listview .oe-record-selector { +.openerp .oe-listview .oe-record-selector, .openerp .oe-listview .oe-record-edit-link { border-bottom: 1px solid #E3E3E3; } +.openerp .oe-listview .oe-record-edit-link { + cursor: pointer; +} .openerp .oe-listview .oe-field-cell { cursor: pointer; @@ -966,15 +976,13 @@ label.error { .openerp .field_date, .openerp .field_float, .openerp .field_selection, -.openerp .oe_form_field_many2one a, -.openerp .oe_form_field_reference a{ +.openerp a.oe_form_uri { vertical-align: middle; padding-top: 3px; font-size: 90%; color: #222; } -.openerp .oe_form_field_many2one a, -.openerp .oe_form_field_reference a { +.openerp a.oe_form_uri { color: #9A0404; line-height: 12px; } @@ -985,7 +993,7 @@ label.error { .openerp .oe_form_frame_cell input[type="checkbox"] { margin-top: 3px; - vertical-align: center; + vertical-align: middle; } .openerp .oe_form_frame_cell .input[type="text"] { padding-bottom: 1px; @@ -1194,7 +1202,7 @@ label.error { .openerp .oe_datepicker_root { display: inline-block; } -.openerp .oe_forms.oe_frame .oe_datepicker_root { +.openerp .oe_form_frame_cell .oe_datepicker_root { width: 100%; } .openerp .oe_input_icon_disabled { @@ -1507,6 +1515,10 @@ label.error { .openerp.kitten-mode-activated .main_table { background: url(http://placekitten.com/g/1500/800) repeat; } +.openerp.kitten-mode-activated.clark-gable .main_table { + background: url(http://amigrave.com/ClarkGable.jpg); + background-size: 100%; +} .openerp.kitten-mode-activated .header { background: url(http://placekitten.com/g/211/65) repeat; @@ -1683,9 +1695,7 @@ ul.oe-arrow-list li { ul.oe-arrow-list li span { vertical-align: top; display: inline-block; - border-width:1em; - border-style:solid; - border-color: #DEDEDE; + border: 1em solid #DEDEDE; line-height:0em; } ul.oe-arrow-list .oe-arrow-list-before { @@ -1734,3 +1744,100 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after { .openerp .oe_view_editor_tree_grid a { display: block; } + +/* Buttons */ +.openerp a.button:link, +.openerp a.button:visited, +.openerp button { + display: inline-block; + border: 1px solid #ababab; + color: #404040; + font-size: 12px; + padding: 3px 10px; + text-align: center; + -o-background-size: 100% 100%; + -moz-background-size: 100% 100%; + -webkit-background-size: auto auto !important; + background-size: 100% 100%; + background: #d8d8d8 none; + background: none, -webkit-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8)); + background: none, -webkit-linear-gradient(#efefef, #d8d8d8); + background: none, -moz-linear-gradient(#efefef, #d8d8d8); + background: none, -o-linear-gradient(top, #efefef, #d8d8d8); + background: none, -khtml-gradient(linear, left top, left bottom, from(#efefef), to(#d8d8d8)); + -moz-border-radius: 3px; + -webkit-border-radius: 3px; + -o-border-radius: 3px; + -ms-border-radius: 3px; + border-radius: 3px; + -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset; + text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); + -webkit-font-smoothing: antialiased; + outline: none; +} + +.openerp a.button:hover, +.openerp button:hover { + -o-background-size: 100% 100%; + -moz-background-size: 100% 100%; + -webkit-background-size: auto auto !important; + background-size: 100% 100%; + background: #e3e3e3 none; + background: none, -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3)); + background: none, -webkit-linear-gradient(#f6f6f6, #e3e3e3); + background: none, -moz-linear-gradient(#f6f6f6, #e3e3e3); + background: none, -o-linear-gradient(top, #f6f6f6, #e3e3e3); + background: none, -khtml-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3)); + cursor: pointer; +} + +.openerp a.button:focus, +.openerp button:focus { + border: 1px solid #80bfff; + -o-background-size: 100% 100%; + -moz-background-size: 100% 100%; + -webkit-background-size: auto auto !important; + background-size: 100% 100%; + background: #e3e3e3, none; + background: none, -webkit-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3)); + background: none, -webkit-linear-gradient(#f6f6f6, #e3e3e3); + background: none, -moz-linear-gradient(#f6f6f6, #e3e3e3); + background: none, -o-linear-gradient(top, #f6f6f6, #e3e3e3); + background: none, -khtml-gradient(linear, left top, left bottom, from(#f6f6f6), to(#e3e3e3)); + -moz-box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -webkit-box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset; + -o-box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset; + box-shadow: 0 0 3px #80bfff, 0 1px 1px rgba(255, 255, 255, 0.8) inset; +} + +.openerp a.button:active, +.openerp a.button.active, +.openerp button:active, +.openerp button.active { + background: #e3e3e3; + background: -moz-linear-gradient(top, #e3e3e3, #f6f6f6) #1b468f; + background: -webkit-gradient(linear, left top, left bottom, from(#e3e3e3), to(#f6f6f6)) #1b468f; + background: linear-gradient(top, #e3e3e3, #f6f6f6) #1b468f; + -moz-box-shadow: none, 0 0 0 transparent; + -webkit-box-shadow: none, 0 0 0 transparent; + -o-box-shadow: none, 0 0 0 transparent; + box-shadow: none, 0 0 0 transparent; +} + +.openerp a.button.disabled, +.openerp button:disabled { + background: #efefef !important; + border: 1px solid #d1d1d1 !important; + font-size: 12px; + padding: 3px 10px; + -moz-box-shadow: none !important, 0 0 0 transparent; + -webkit-box-shadow: none !important, 0 0 0 transparent; + -o-box-shadow: none !important, 0 0 0 transparent; + box-shadow: none !important, 0 0 0 transparent; + color: #aaaaaa !important; + cursor: default; + text-shadow: 0 1px 1px white !important; +} diff --git a/addons/web/static/src/img/pencil.gif b/addons/web/static/src/img/pencil.gif Binary files differnew file mode 100644 index 00000000000..6e9aa5ef659 --- /dev/null +++ b/addons/web/static/src/img/pencil.gif diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index eb9328a6bd1..70beb7ecc34 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -956,13 +956,16 @@ openerp.web.Menu = openerp.web.Widget.extend(/** @lends openerp.web.Menu# */{ $sub_menu.css(css); $sub_menu.mouseenter(function() { clearTimeout($sub_menu.data('timeoutId')); + $sub_menu.data('timeoutId', null); + return false; }).mouseleave(function(evt) { var timeoutId = setTimeout(function() { - if (self.folded) { - $sub_menu.hide(); + if (self.folded && $sub_menu.data('timeoutId')) { + $sub_menu.hide().unbind('mouseenter').unbind('mouseleave'); } }, self.float_timeout); $sub_menu.data('timeoutId', timeoutId); + return false; }); } $sub_menu.show(); @@ -988,6 +991,7 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie * @param element_id */ init: function(element_id) { + var self = this; this._super(null, element_id); openerp.webclient = this; @@ -1015,8 +1019,11 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie var self = this; openerp.connection.bind("",function() { var params = {}; - if(jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()).kitten != undefined) { - self.$element.addClass("kitten-mode-activated"); + if (jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()).kitten != undefined) { + this.$element.addClass("kitten-mode-activated"); + this.$element.delegate('img.oe-record-edit-link-img', 'hover', function(e) { + self.$element.toggleClass('clark-gable'); + }); } self.$element.html(QWeb.render("Interface", params)); openerp.connection.session_restore(); diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index aec701e6e67..46393aaf205 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -510,9 +510,10 @@ openerp.web.DataSetStatic = openerp.web.DataSet.extend({ }, set_ids: function (ids) { this.ids = ids; - if (this.index !== null) { - this.index = this.index <= this.ids.length - 1 ? - this.index : (this.ids.length > 0 ? this.length - 1 : 0); + if (ids.length === 0) { + this.index = null; + } else if (this.index >= ids.length - 1) { + this.index = ids.length - 1; } }, unlink: function(ids) { diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 0e7eca43eda..607bf7b8a00 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2909,13 +2909,18 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({ }, set_value: function(value) { this._super.apply(this, arguments); - var show_value = (value != null && value !== false) ? value : ''; + var show_value; + if (this.node.attrs.filename) { + show_value = this.view.datarecord[this.node.attrs.filename] || ''; + } else { + show_value = (value != null && value !== false) ? value : ''; + } this.$element.find('input').eq(0).val(show_value); }, on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { this.value = file_base64; this.binary_value = true; - var show_value = this.human_filesize(size); + var show_value = name + " (" + this.human_filesize(size) + ")"; this.$element.find('input').eq(0).val(show_value); this.set_filename(name); }, diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 36dc71cc485..f3aa9a61703 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -17,7 +17,9 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# // sorted it can not be reordered anymore 'sortable': true, // whether the view rows can be reordered (via vertical drag & drop) - 'reorderable': true + 'reorderable': true, + // display an edit icon linking to form view + 'isClarkGable': true }, /** * Core class for list-type displays. @@ -120,8 +122,8 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# 'action': function (e, action_name, id, callback) { self.do_button_action(action_name, id, callback); }, - 'row_link': function (e, id, dataset) { - self.do_activate_record(dataset.index, id, dataset); + 'row_link': function (e, id, dataset, view) { + self.do_activate_record(dataset.index, id, dataset, view); } }); }, @@ -556,9 +558,9 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# * @param {Object} id identifier of the activated record * @param {openerp.web.DataSet} dataset dataset in which the record is available (may not be the listview's dataset in case of nested groups) */ - do_activate_record: function (index, id, dataset) { + do_activate_record: function (index, id, dataset, view) { this.dataset.ids = dataset.ids; - this.select_record(index); + this.select_record(index, view); }, /** * Handles signal for the addition of a new record (can be a creation, @@ -818,15 +820,19 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis if (!self.dataset.select_id(row_id)) { throw "Could not find id in dataset" } - self.row_clicked(e); + var view; + if ($(e.target).is('.oe-record-edit-link-img')) { + view = 'form'; + } + self.row_clicked(e, view); } }); }, - row_clicked: function () { + row_clicked: function (e, view) { $(this).trigger( 'row_link', [this.dataset.ids[this.dataset.index], - this.dataset]); + this.dataset, view]); }, render_cell: function (record, column) { var value; @@ -887,6 +893,9 @@ openerp.web.ListView.List = openerp.web.Class.extend( /** @lends openerp.web.Lis if (this.options.selectable) { cells.push('<th class="oe-record-selector"></td>'); } + if (this.options.isClarkGable) { + cells.push('<th class="oe-record-edit-link"></td>'); + } _(this.columns).each(function(column) { if (column.invisible === '1') { return; diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index b2edf55b314..453536f7ec6 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -116,7 +116,7 @@ openerp.web.list_editable = function (openerp) { openerp.web.ListView.List.include(/** @lends openerp.web.ListView.List# */{ row_clicked: function (event) { if (!this.options.editable) { - return this._super(event); + return this._super.apply(this, arguments); } this.edit_record($(event.currentTarget).data('id')); }, @@ -248,7 +248,10 @@ openerp.web.list_editable = function (openerp) { .end() .find('td:last').removeClass('oe-field-cell').end(); if (self.options.selectable) { - $new_row.prepend('<td>'); + $new_row.prepend('<th>'); + } + if (self.options.isClarkGable) { + $new_row.prepend('<th>'); } // pad in case of groupby _(self.columns).each(function (column) { diff --git a/addons/web/static/src/js/view_page.js b/addons/web/static/src/js/view_page.js index 40ca1176c79..060c95e86e3 100644 --- a/addons/web/static/src/js/view_page.js +++ b/addons/web/static/src/js/view_page.js @@ -200,6 +200,27 @@ openerp.web.page = function (openerp) { openerp.web.page.FieldOne2ManyReadonly = openerp.web.form.FieldOne2Many.extend({ force_readonly: true }); + openerp.web.page.FieldBinaryFileReadonly = openerp.web.form.FieldBinary.extend({ + template: 'FieldURI.readonly', + start: function() { + this._super.apply(this, arguments); + var self = this; + this.$element.find('a').click(function() { + if (self.value) { + self.on_save_as(); + } + return false; + }); + }, + set_value: function(value) { + this._super.apply(this, arguments); + this.$element.find('a').show(!!value); + if (value) { + var show_value = _t("Download") + " " + (this.view.datarecord[this.node.attrs.filename] || ''); + this.$element.find('a').text(show_value); + } + } + }); openerp.web.page.readonly = openerp.web.form.widgets.clone({ 'frame': 'openerp.web.page.WidgetFrameReadonly', 'char': 'openerp.web.page.FieldCharReadonly', @@ -218,6 +239,7 @@ openerp.web.page = function (openerp) { 'boolean': 'openerp.web.page.FieldBooleanReadonly', 'float': 'openerp.web.page.FieldCharReadonly', 'integer': 'openerp.web.page.FieldCharReadonly', - 'float_time': 'openerp.web.page.FieldCharReadonly' + 'float_time': 'openerp.web.page.FieldCharReadonly', + 'binary': 'openerp.web.page.FieldBinaryFileReadonly', }); }; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index a880293403d..ff21856aeff 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -567,7 +567,7 @@ </tr> <table t-name="ListView" class="oe-listview-content"> - <t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0)"/> + <t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0) + (options.isClarkGable ? 1 : 0)"/> <thead class="ui-widget-header"> <tr t-if="options.action_buttons !== false or options.pager !== false"> <th t-att-colspan="columns_count"> @@ -596,6 +596,7 @@ </t> <th t-if="options.selectable" width="1" > <input type="checkbox" class="all-record-selector"/> </th> + <th t-if="options.isClarkGable" width="1"> </th> <t t-foreach="columns" t-as="column"> <th t-if="!column.meta and column.invisible !== '1'" t-att-data-id="column.id" t-att-class="((options.sortable and column.tag !== 'button') ? 'oe-sortable' : null)"> @@ -609,6 +610,7 @@ <tfoot class="ui-widget-header"> <tr> <td t-if="options.selectable"/> + <td t-if="options.isClarkGable"/> <td t-foreach="aggregate_columns" t-as="column" class="oe-list-footer oe-number" t-att-data-field="column.id" t-att-title="column.label"> </td> @@ -666,6 +668,9 @@ <th t-if="options.selectable" class="oe-record-selector" width="1"> <input t-att-type="options.radio? 'radio': 'checkbox'" name ="radiogroup" t-att-checked="options.select_view_id == record.get('id')? true: null"/> </th> + <th t-if="options.isClarkGable" class="oe-record-edit-link" width="1"> + <img src="/web/static/src/img/pencil.gif" width="12" height="12" class="oe-record-edit-link-img"/> + </th> <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" @@ -899,7 +904,7 @@ </div> </t> <t t-name="FieldURI.readonly"> - <a href="#">#</a> + <a href="#" class="oe_form_uri">#</a> </t> <t t-name="FieldEmail"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> @@ -1065,7 +1070,7 @@ <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr> <td width="100%"> - <input type="text" size="1" + <input type="text" size="1" readonly="readonly" t-att-name="widget.name" t-att-id="widget.element_id + '_field'" t-attf-class="field_#{widget.type}" style="width: 100%" @@ -1419,6 +1424,7 @@ --> <t t-jquery="> :first" t-operation="before"> <td t-if="edited and !options.selectable" class="oe-listview-padding"/> + <td t-if="edited and !options.isClarkGable" class="oe-listview-padding"/> </t> <t t-jquery="> :last" t-operation="after"> <td t-if="edited and !options.deletable" class="oe-listview-padding"/> |
