diff --git a/addons/web/i18n/zh_CN.po b/addons/web/i18n/zh_CN.po index 69cd72339ae..09a7d041b88 100644 --- a/addons/web/i18n/zh_CN.po +++ b/addons/web/i18n/zh_CN.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openerp-web\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2012-07-02 09:06+0200\n" -"PO-Revision-Date: 2012-02-17 07:29+0000\n" -"Last-Translator: Jeff Wang \n" +"PO-Revision-Date: 2012-11-06 04:40+0000\n" +"Last-Translator: Wei \"oldrev\" Li \n" "Language-Team: Chinese (Simplified) \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-21 05:03+0000\n" -"X-Generator: Launchpad (build 16165)\n" +"X-Launchpad-Export-Date: 2012-11-07 04:55+0000\n" +"X-Generator: Launchpad (build 16232)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 @@ -129,56 +129,56 @@ msgstr "OpenERP社区支持版" #. openerp-web #: addons/web/static/src/js/coresetup.js:619 msgid "less than a minute ago" -msgstr "" +msgstr "一分钟内" #. openerp-web #: addons/web/static/src/js/coresetup.js:620 msgid "about a minute ago" -msgstr "" +msgstr "大约一分钟" #. openerp-web #: addons/web/static/src/js/coresetup.js:621 #, python-format msgid "%d minutes ago" -msgstr "" +msgstr "%d 分钟之前" #. openerp-web #: addons/web/static/src/js/coresetup.js:622 msgid "about an hour ago" -msgstr "" +msgstr "大约一小时前" #. openerp-web #: addons/web/static/src/js/coresetup.js:623 #, python-format msgid "%d hours ago" -msgstr "" +msgstr "%d 小时前" #. openerp-web #: addons/web/static/src/js/coresetup.js:624 msgid "a day ago" -msgstr "" +msgstr "一天前" #. openerp-web #: addons/web/static/src/js/coresetup.js:625 #, python-format msgid "%d days ago" -msgstr "" +msgstr "%d 天前" #. openerp-web #: addons/web/static/src/js/coresetup.js:626 msgid "about a month ago" -msgstr "" +msgstr "大约一月前" #. openerp-web #: addons/web/static/src/js/coresetup.js:627 #, python-format msgid "%d months ago" -msgstr "" +msgstr "%d 月前" #. openerp-web #: addons/web/static/src/js/coresetup.js:628 msgid "about a year ago" -msgstr "" +msgstr "大约一年前" #. openerp-web #: addons/web/static/src/js/coresetup.js:629 @@ -247,13 +247,13 @@ msgstr "" #. openerp-web #: addons/web/static/src/js/data_import.js:386 msgid "*Required Fields are not selected :" -msgstr "" +msgstr "*没有选择必须的字段:" #. openerp-web #: addons/web/static/src/js/formats.js:139 #, python-format msgid "(%d records)" -msgstr "" +msgstr "(%d 条记录)" #. openerp-web #: addons/web/static/src/js/formats.js:325 diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index b030d0712f0..94d02758ad0 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -659,7 +659,7 @@ cursor: pointer; } .openerp .oe_dropdown_toggle { - color: rgba(0, 0, 0, 0.5); + color: rgba(0, 0, 0, 0.3); font-weight: normal; } .openerp .oe_dropdown_hover:hover .oe_dropdown_menu, .openerp .oe_dropdown_menu.oe_opened { @@ -2565,7 +2565,7 @@ background-color: #eeeeee; } .openerp .oe_list_editable .oe_list_content td.oe_list_field_cell { - padding: 4px 6px 3px 6px; + padding: 4px 6px 3px; } .openerp .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) { color: transparent; @@ -2646,6 +2646,9 @@ margin: 0 !important; padding: 0; } +.openerp .oe_list .oe_form .oe_form_field_boolean { + padding: 1px 6px 3px; +} .openerp .oe_list .oe_list_content .oe_group_header { background-color: #fcfcfc; background-image: -webkit-gradient(linear, left top, left bottom, from(#fcfcfc), to(#dedede)); @@ -2777,6 +2780,9 @@ content: "}"; color: #e0e0e0; } +.openerp .oe_list_content .oe_list_field_progressbar progress { + width: 100%; +} .openerp .tree_header { background-color: #f0f0f0; border-bottom: 1px solid #cacaca; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 79a688cf823..f911929e159 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -569,7 +569,7 @@ $sheet-padding: 16px position: relative cursor: pointer .oe_dropdown_toggle - color: rgba(0,0,0,0.5) + color: rgba(0,0,0,0.3) font-weight: normal .oe_dropdown_hover:hover .oe_dropdown_menu, .oe_dropdown_menu.oe_opened display: block @@ -2030,10 +2030,8 @@ $sheet-padding: 16px background-color: #eee $row-height: 27px - .oe_list_editable - .oe_list_content - td.oe_list_field_cell - padding: 4px 6px 3px 6px + .oe_list_editable .oe_list_content td.oe_list_field_cell + padding: 4px 6px 3px .oe_list.oe_list_editable.oe_editing .oe_edition .oe_list_field_cell:not(.oe_readonly) * @@ -2106,6 +2104,10 @@ $sheet-padding: 16px position: absolute margin: 0 !important // dammit padding: 0 + .oe_form_field_boolean + // use padding similar to actual cell to correctly position the + // checkbox + padding: 1px 6px 3px .oe_list_content .oe_group_header @include vertical-gradient(#fcfcfc, #dedede) @@ -2193,6 +2195,8 @@ $sheet-padding: 16px .oe_list_handle @include text-to-entypo-icon("}",#E0E0E0,18px) margin-right: 7px + .oe_list_field_progressbar progress + width: 100% // }}} // Tree view {{{ .tree_header diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index 6cf35a14e92..08ef8c4f9bf 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -504,13 +504,13 @@ instance.web.Login = instance.web.Widget.extend({ template: "Login", remember_credentials: true, - init: function(parent, params) { + init: function(parent, action) { this._super(parent); this.has_local_storage = typeof(localStorage) != 'undefined'; this.db_list = null; this.selected_db = null; this.selected_login = null; - this.params = params || {}; + this.params = action.params || {}; if (this.params.login_successful) { this.on('login_successful', this, this.params.login_successful); @@ -616,8 +616,9 @@ instance.web.client_actions.add("login", "instance.web.Login"); * Client action to reload the whole interface. * If params has an entry 'menu_id', it opens the given menu entry. */ -instance.web.Reload = function(parent, params) { - var menu_id = (params && params.menu_id) || false; +instance.web.Reload = function(parent, action) { + var params = action.params || {}; + var menu_id = params.menu_id || false; var l = window.location; var sobj = $.deparam(l.search.substr(1)); @@ -638,7 +639,7 @@ instance.web.client_actions.add("reload", "instance.web.Reload"); * Client action to go back in breadcrumb history. * If can't go back in history stack, will go back to home. */ -instance.web.HistoryBack = function(parent, params) { +instance.web.HistoryBack = function(parent) { if (!parent.history_back()) { window.location = '/' + (window.location.search || ''); } @@ -649,7 +650,7 @@ instance.web.client_actions.add("history_back", "instance.web.HistoryBack"); * Client action to go back home. */ instance.web.Home = instance.web.Widget.extend({ - init: function(parent, params) { + init: function(parent) { window.location = '/' + (window.location.search || ''); } }); diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 520dcd9169f..d005c79e9b2 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -124,19 +124,10 @@ function assert(condition, message) { } my.InputView = instance.web.Widget.extend({ template: 'SearchView.InputView', - start: function () { - var p = this._super.apply(this, arguments); - this.$el.on('focus', this.proxy('onFocus')); - this.$el.on('blur', this.proxy('onBlur')); - this.$el.on('keydown', this.proxy('onKeydown')); - return p; - }, - onFocus: function () { - this.trigger('focused', this); - }, - onBlur: function () { - this.$el.text(''); - this.trigger('blurred', this); + events: { + focus: function () { this.trigger('focused', this); }, + blur: function () { this.$el.text(''); this.trigger('blurred', this); }, + keydown: 'onKeydown' }, getSelection: function () { // get Text node @@ -212,6 +203,27 @@ my.InputView = instance.web.Widget.extend({ }); my.FacetView = instance.web.Widget.extend({ template: 'SearchView.FacetView', + events: { + 'focus': function () { this.trigger('focused', this); }, + 'blur': function () { this.trigger('blurred', this); }, + 'click': function (e) { + if ($(e.target).is('.oe_facet_remove')) { + this.model.destroy(); + return false; + } + this.$el.focus(); + e.stopPropagation(); + }, + 'keydown': function (e) { + var keys = $.ui.keyCode; + switch (e.which) { + case keys.BACKSPACE: + case keys.DELETE: + this.model.destroy(); + return false; + } + } + }, init: function (parent, model) { this._super(parent); this.model = model; @@ -223,33 +235,11 @@ my.FacetView = instance.web.Widget.extend({ }, start: function () { var self = this; - this.$el.on('focus', function () { self.trigger('focused', self); }); - this.$el.on('blur', function () { self.trigger('blurred', self); }); - this.$el.on('click', function (e) { - if ($(e.target).is('.oe_facet_remove')) { - self.model.destroy(); - return false; - } - self.$el.focus(); - e.stopPropagation(); - }); - this.$el.on('keydown', function (e) { - var keys = $.ui.keyCode; - switch (e.which) { - case keys.BACKSPACE: - case keys.DELETE: - self.model.destroy(); - return false; - } - }); - var $e = self.$el.find('> span:last-child'); - var q = $.when(this._super()); - return q.pipe(function () { - var values = self.model.values.map(function (value) { + var $e = this.$('> span:last-child'); + return $.when(this._super()).pipe(function () { + return $.when.apply(null, self.model.values.map(function (value) { return new my.FacetValueView(self, value).appendTo($e); - }); - - return $.when.apply(null, values); + })); }); }, model_changed: function () { @@ -274,6 +264,48 @@ my.FacetValueView = instance.web.Widget.extend({ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.SearchView# */{ template: "SearchView", + events: { + // focus last input if view itself is clicked + 'click': function (e) { + if (e.target === this.$('.oe_searchview_facets')[0]) { + this.$('.oe_searchview_input:last').focus(); + } + }, + // when the completion list opens/refreshes, automatically select the + // first completion item so if the user just hits [RETURN] or [TAB] it + // automatically selects it + 'autocompleteopen': function () { + var menu = this.$el.data('autocomplete').menu; + menu.activate( + $.Event({ type: "mouseenter" }), + menu.element.children().first()); + }, + // search button + 'click button.oe_searchview_search': function (e) { + e.stopImmediatePropagation(); + this.do_search(); + }, + 'click .oe_searchview_clear': function (e) { + e.stopImmediatePropagation(); + this.query.reset(); + }, + 'click .oe_searchview_unfold_drawer': function (e) { + e.stopImmediatePropagation(); + this.$el.toggleClass('oe_searchview_open_drawer'); + }, + 'keydown .oe_searchview_input, .oe_searchview_facet': function (e) { + switch(e.which) { + case $.ui.keyCode.LEFT: + this.focusPreceding(this); + e.preventDefault(); + break; + case $.ui.keyCode.RIGHT: + this.focusFollowing(this); + e.preventDefault(); + break; + } + } + }, /** * @constructs instance.web.SearchView * @extends instance.web.Widget @@ -331,55 +363,11 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea }); } - // Launch a search on clicking the oe_searchview_search button - this.$el.on('click', 'button.oe_searchview_search', function (e) { - e.stopImmediatePropagation(); - self.do_search(); - }); - - this.$el.on('keydown', - '.oe_searchview_input, .oe_searchview_facet', function (e) { - switch(e.which) { - case $.ui.keyCode.LEFT: - self.focusPreceding(this); - e.preventDefault(); - break; - case $.ui.keyCode.RIGHT: - self.focusFollowing(this); - e.preventDefault(); - break; - } - }); - - this.$el.on('click', '.oe_searchview_clear', function (e) { - e.stopImmediatePropagation(); - self.query.reset(); - }); - this.$el.on('click', '.oe_searchview_unfold_drawer', function (e) { - e.stopImmediatePropagation(); - self.$el.toggleClass('oe_searchview_open_drawer'); - }); instance.web.bus.on('click', this, function(ev) { if ($(ev.target).parents('.oe_searchview').length === 0) { self.$el.removeClass('oe_searchview_open_drawer'); } }); - // Focus last input if the view itself is clicked (empty section of - // facets element) - this.$el.on('click', function (e) { - if (e.target === self.$el.find('.oe_searchview_facets')[0]) { - self.$el.find('.oe_searchview_input:last').focus(); - } - }); - // when the completion list opens/refreshes, automatically select the - // first completion item so if the user just hits [RETURN] or [TAB] it - // automatically selects it - this.$el.on('autocompleteopen', function () { - var menu = self.$el.data('autocomplete').menu; - menu.activate( - $.Event({ type: "mouseenter" }), - menu.element.children().first()); - }); return $.when(p, this.ready); }, @@ -480,7 +468,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * div[contenteditable].oe_searchview_input) */ currentInputValue: function () { - return this.$el.find('div.oe_searchview_input:focus').text(); + return this.$('div.oe_searchview_input:focus').text(); }, /** * Provide auto-completion result for req.term (an array to `resp`) @@ -510,7 +498,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea var input_index = _(this.input_subviews).indexOf( this.subviewForRoot( - this.$el.find('div.oe_searchview_input:focus')[0])); + this.$('div.oe_searchview_input:focus')[0])); this.query.add(ui.item.facet, {at: input_index / 2}); }, childFocused: function () { @@ -539,7 +527,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea // _2: undefined if event=change, otherwise model var self = this; var started = []; - var $e = this.$el.find('div.oe_searchview_facets'); + var $e = this.$('div.oe_searchview_facets'); _.invoke(this.input_subviews, 'destroy'); this.input_subviews = []; @@ -664,7 +652,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea // build drawer var drawer_started = $.when.apply( null, _(this.select_for_drawer()).invoke( - 'appendTo', this.$el.find('.oe_searchview_drawer'))); + 'appendTo', this.$('.oe_searchview_drawer'))); // load defaults var defaults_fetched = $.when.apply(null, _(this.inputs).invoke( @@ -736,6 +724,9 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * * If at least one field failed its validation, triggers * :js:func:`instance.web.SearchView.on_invalid` instead. + * + * @param [_query] + * @param {Object} [options] */ do_search: function (_query, options) { if (options && options.preventSearch) { @@ -961,7 +952,7 @@ instance.web.search.FilterGroup = instance.web.search.Input.extend(/** @lends in */ search_change: function () { var self = this; - var $filters = this.$el.find('> li').removeClass('oe_selected'); + var $filters = this.$('> li').removeClass('oe_selected'); var facet = this.view.query.find(_.bind(this.match_facet, this)); if (!facet) { return; } facet.values.each(function (v) { @@ -1512,7 +1503,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ }).pipe(this.proxy('set_filters')); }, clear_selection: function () { - this.$el.find('li.oe_selected').removeClass('oe_selected'); + this.$('li.oe_selected').removeClass('oe_selected'); }, append_filter: function (filter) { var self = this; @@ -1524,7 +1515,7 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ } else { var id = filter.id; $filter = this.filters[key] = $('
  • ') - .appendTo(this.$el.find('.oe_searchview_custom_list')) + .appendTo(this.$('.oe_searchview_custom_list')) .addClass(filter.user_id ? 'oe_searchview_custom_private' : 'oe_searchview_custom_public') .text(filter.name); @@ -1559,8 +1550,8 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ }, save_current: function () { var self = this; - var $name = this.$el.find('input:first'); - var private_filter = !this.$el.find('input:last').prop('checked'); + var $name = this.$('input:first'); + var private_filter = !this.$('input:last').prop('checked'); var search = this.view.build_search_data(); this.rpc('/web/session/eval_domain_and_context', { @@ -1665,11 +1656,20 @@ instance.web.search.Advanced = instance.web.search.Input.extend({ }); }, append_proposition: function () { + var self = this; return (new instance.web.search.ExtendedSearchProposition(this, this.fields)) - .appendTo(this.$el.find('ul')); + .appendTo(this.$('ul')).then(function () { + self.$('button.oe_apply').prop('disabled', false); + }); + }, + remove_proposition: function (prop) { + // removing last proposition, disable apply button + if (this.getChildren().length <= 1) { + this.$('button.oe_apply').prop('disabled', true); + } + prop.destroy(); }, commit_search: function () { - var self = this; // Get domain sections from all propositions var children = this.getChildren(); var propositions = _.invoke(children, 'get_proposition'); @@ -1699,6 +1699,13 @@ instance.web.search.Advanced = instance.web.search.Input.extend({ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @lends instance.web.search.ExtendedSearchProposition# */{ template: 'SearchView.extended_search.proposition', + events: { + 'change .searchview_extended_prop_field': 'changed', + 'click .searchview_extended_delete_prop': function (e) { + e.stopPropagation(); + this.getParent().remove_proposition(this); + } + }, /** * @constructs instance.web.search.ExtendedSearchProposition * @extends instance.web.Widget @@ -1716,17 +1723,10 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ this.value = null; }, start: function () { - var _this = this; - this.$el.find(".searchview_extended_prop_field").change(function() { - _this.changed(); - }); - this.$el.find('.searchview_extended_delete_prop').click(function () { - _this.destroy(); - }); - this.changed(); + return this._super().then(this.proxy('changed')); }, changed: function() { - var nval = this.$el.find(".searchview_extended_prop_field").val(); + var nval = this.$(".searchview_extended_prop_field").val(); if(this.attrs.selected == null || nval != this.attrs.selected.name) { this.select_field(_.detect(this.fields, function(x) {return x.name == nval;})); } @@ -1741,7 +1741,7 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ if(this.attrs.selected != null) { this.value.destroy(); this.value = null; - this.$el.find('.searchview_extended_prop_op').html(''); + this.$('.searchview_extended_prop_op').html(''); } this.attrs.selected = field; if(field == null) { @@ -1757,9 +1757,9 @@ instance.web.search.ExtendedSearchProposition = instance.web.Widget.extend(/** @ _.each(this.value.operators, function(operator) { $('