diff options
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/css/base.css | 84 | ||||
| -rw-r--r-- | addons/web/static/src/css/base.sass | 90 | ||||
| -rw-r--r-- | addons/web/static/src/js/chrome.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/core.js | 29 | ||||
| -rw-r--r-- | addons/web/static/src/js/data_export.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/search.js | 32 | ||||
| -rw-r--r-- | addons/web/static/src/js/testing.js | 23 | ||||
| -rw-r--r-- | addons/web/static/src/js/view_form.js | 11 | ||||
| -rw-r--r-- | addons/web/static/src/xml/base.xml | 21 |
9 files changed, 149 insertions, 145 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 916e4ffe9ba..8534927def1 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1,4 +1,4 @@ -@charset "utf-8"; +@charset "UTF-8"; @font-face { font-family: "mnmliconsRegular"; src: url("/web/static/src/font/mnmliconsv21-webfont.eot") format("eot"); @@ -79,7 +79,7 @@ vertical-align: top; } .openerp .oe_title { - width: 50%; + width: 38%; float: left; } .openerp .oe_title:after { @@ -314,56 +314,58 @@ .openerp .oe_form_dirty button.oe_highlight_on_dirty:hover { background: #ed6f6a; } -.openerp .oe_button_box { - width: 400px; - text-align: left; -} -.openerp .oe_button_box .oe_stat_button:hover { - background: #7c7bad; - color: white; -} -.openerp .oe_button_box .oe_stat_button:hover .fa { - color: white; -} -.openerp .oe_button_box .oe_stat_button { +.openerp .oe_stat_button { font-weight: normal; - display: inline-table; - width: 33% !important; - height: 42px; + width: 132px !important; + height: 40px; + color: #666666; margin: 0px -1px -1px 0px; padding: 0; - color: #666666; border: 1px solid #dddddd; border-radius: 0; box-shadow: none; background: white; } -.openerp .oe_button_box .oe_stat_button > div { +.openerp .oe_stat_button > div { display: table-cell; vertical-align: middle; text-align: left; padding: 0; line-height: 120%; } -.openerp .oe_button_box .oe_stat_button .stat_button_icon { +.openerp .oe_stat_button .stat_button_icon { color: #7c7bad; font-size: 24px; padding: 0px 3px; width: 37px; text-align: center; } -.openerp .oe_button_box .oe_stat_button .oe_form_field_percent_pie { +.openerp .oe_stat_button .oe_form_field_percent_pie { width: 42px; } -.openerp .oe_button_box .oe_stat_button .oe_form_field_bar_chart { +.openerp .oe_stat_button .oe_form_field_bar_chart { width: 42px; } -.openerp .oe_button_box .oe_stat_button svg { +.openerp .oe_stat_button svg { width: 38px; height: 38px; display: inline; vertical-align: middle; } +.openerp .oe_stat_button:hover { + background: #7c7bad; + color: white; +} +.openerp .oe_stat_button:hover .fa { + color: white; +} +.openerp .oe_button_box { + width: 400px; + text-align: right; +} +.openerp .oe_button_box .oe_stat_button { + display: inline-table; +} .openerp .oe_avatar > img { max-height: 90px; max-width: 90px; @@ -720,7 +722,7 @@ border-bottom-left-radius: 8px; } .openerp .oe_notification { - z-index: 1050; + z-index: 1500; } .openerp .oe_webclient_timezone_notification a { color: white; @@ -2742,13 +2744,15 @@ padding: 3px 6px; white-space: pre-line; } -.openerp .oe_list_content > tbody > tr > td > button.btn_img, .openerp .oe_list_content > tbody > tr > th > button.btn_img { +.openerp .oe_list_content > tbody > tr > td > button, .openerp .oe_list_content > tbody > tr > th > button { border: none; background: transparent; padding: 0; - -moz-box-shadow: none; - -webkit-box-shadow: none; - box-shadow: none; +} +.openerp .oe_list_content > tbody > tr > td > button.btn_txt, .openerp .oe_list_content > tbody > tr > th > button.btn_txt { + border: 1px solid rgba(0, 0, 0, 0.4); + background: #e3e3e3; + padding: 3px 12px; } .openerp .oe_list_content > tbody > tr > td.oe_list_checkbox:first-child, .openerp .oe_list_content > tbody > tr th.oe_list_checkbox:first-child { width: 17px; @@ -3293,11 +3297,6 @@ body.oe_single_form .oe_single_form_container { overflow: hidden !important; } } -.ui-icon { - width: 18px; - height: 18px; -} - .tooltip { padding: 0; margin: 0; @@ -3307,8 +3306,6 @@ body.oe_single_form .oe_single_form_container { background: white; text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); background-color: transparent; - /*We need a greater z-index in order for tooltip to go over bootstrap modal z-index*/ - z-index: 1500; } .tooltip .tooltip-inner { text-align: left !important; @@ -3345,6 +3342,12 @@ body.oe_single_form .oe_single_form_container { .tooltip .tooltip-inner .oe_tooltip_message { max-width: 310px; } + +.ui-icon { + width: 18px; + height: 18px; +} + .modal .modal-header button.close { border: none; background: none; @@ -3355,12 +3358,17 @@ body.oe_single_form .oe_single_form_container { .modal .modal-footer { text-align: left; } -.modal .oe_act_window.modal-body{ +.modal .oe_button { + margin: 0 4px 0 0; +} +.modal .oe_act_window.modal-body { padding: 0; } -.modal .oe_button{ - margin: 0 4px 0 0; + +.ui-datepicker { + z-index: 1500 !important; } + input[type="radio"], input[type="checkbox"] { margin-right: 4px; margin-left: 4px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index d83b09bc897..f1a92f44288 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -190,7 +190,7 @@ $sheet-padding: 16px td vertical-align: top .oe_title - width: 50% + width: 38% float: left .oe_title:after content: "." @@ -330,47 +330,48 @@ $sheet-padding: 16px @include box-shadow(none) &:hover background: #ED6F6A + .oe_stat_button + font-weight: normal + width: 132px !important + height: 40px + color: #666 + margin: 0px -1px -1px 0px + padding: 0 + border: 1px solid #dddddd + border-radius: 0 + box-shadow: none + background: white + > div + display: table-cell + vertical-align: middle + text-align: left + padding: 0 + line-height: 120% + .stat_button_icon + color: #7C7BAD + font-size: 24px + padding: 0px 3px + width: 37px + text-align: center + .oe_form_field_percent_pie + width: 42px + .oe_form_field_bar_chart + width: 42px + svg + width: 38px + height: 38px + display: inline + vertical-align: middle + .oe_stat_button:hover + background: #7c7bad + color: white + .fa + color: white .oe_button_box width: 400px - text-align: left - .oe_stat_button:hover - background: #7c7bad - color: white - .fa - color: white + text-align: right .oe_stat_button - font-weight: normal display: inline-table - width: 33% !important - height: 42px - margin: 0px -1px -1px 0px - padding: 0 - color: #666 - border: 1px solid #dddddd - border-radius: 0 - box-shadow: none - background: white - > div - display: table-cell - vertical-align: middle - text-align: left - padding: 0 - line-height: 120% - .stat_button_icon - color: #7C7BAD - font-size: 24px - padding: 0px 3px - width: 37px - text-align: center - .oe_form_field_percent_pie - width: 42px - .oe_form_field_bar_chart - width: 42px - svg - width: 38px - height: 38px - display: inline - vertical-align: middle .oe_avatar > img max-height: 90px @@ -639,7 +640,8 @@ $sheet-padding: 16px // }}} // Notifications {{{ .oe_notification - z-index: 1050 + z-index: 1500 + .oe_webclient_timezone_notification a color: white @@ -2220,11 +2222,14 @@ $sheet-padding: 16px padding: 3px 6px white-space: pre-line > td, > th - > button.btn_img + > button border: none background: transparent padding: 0 - @include box-shadow(none) + > button.btn_txt + border: 1px solid rgba(0,0,0,0.4) + background: #e3e3e3 + padding: 3px 12px > td.oe_list_checkbox:first-child, th.oe_list_checkbox:first-child width: 17px &:after @@ -2736,6 +2741,9 @@ body.oe_single_form .oe_act_window.modal-body padding: 0 +.ui-datepicker + z-index: 1500 !important + input[type="radio"], input[type="checkbox"] margin-right: 4px margin-left: 4px diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index e1b654aa3f7..0aa46ebb104 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1460,7 +1460,7 @@ instance.web.embed = function (origin, dbname, login, key, action, options) { $('head').append($('<link>', { 'rel': 'stylesheet', 'type': 'text/css', - 'href': origin +'/web/webclient/css' + 'href': origin +'/web/css/web.assets_webclient' })); var currentScript = document.currentScript; if (!currentScript) { diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js index a4bcd1922de..c64da7e5810 100644 --- a/addons/web/static/src/js/core.js +++ b/addons/web/static/src/js/core.js @@ -232,7 +232,7 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ var self = this; return this.session_reload().then(function(result) { var modules = instance._modules.join(','); - var deferred = self.rpc('/web/webclient/qweblist', {mods: modules}).then(self.load_qweb.bind(self)); + var deferred = self.load_qweb(modules); if(self.session_is_valid()) { return deferred.then(function() { return self.load_modules(); }); } @@ -318,7 +318,7 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ loaded = $.when( loaded, self.rpc('/web/webclient/csslist', {mods: to_load}).done(self.load_css.bind(self)), - self.rpc('/web/webclient/qweblist', {mods: to_load}).then(self.load_qweb.bind(self)), + self.load_qweb(to_load), self.rpc('/web/webclient/jslist', {mods: to_load}).done(function(files) { file_list = file_list.concat(files); }) @@ -375,14 +375,12 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ } return d; }, - load_qweb: function(files) { + load_qweb: function(mods) { var self = this; - _.each(files, function(file) { - self.qweb_mutex.exec(function() { - return self.rpc('/web/proxy/load', {path: file}).then(function(xml) { - if (!xml) { return; } - instance.web.qweb.add_template(_.str.trim(xml)); - }); + self.qweb_mutex.exec(function() { + return self.rpc('/web/proxy/load', {path: '/web/webclient/qweb?mods=' + mods}).then(function(xml) { + if (!xml) { return; } + instance.web.qweb.add_template(_.str.trim(xml)); }); }); return self.qweb_mutex.def; @@ -460,14 +458,11 @@ instance.web.Session.include( /** @lends instance.web.Session# */{ .appendTo(document.body) .load(function () { try { - if (options.error) { - if (!this.contentDocument.body.childNodes[1]) { - options.error(this.contentDocument.body.childNodes); - } - else { - options.error(JSON.parse(this.contentDocument.body.childNodes[1].textContent)); - } - } + if (options.error) { + var body = this.contentDocument.body; + var node = body.childNodes[1] || body.childNodes[0]; + options.error(JSON.parse(node.textContent)); + } } finally { complete(); } diff --git a/addons/web/static/src/js/data_export.js b/addons/web/static/src/js/data_export.js index 2de933f45e8..2f7ff81d089 100644 --- a/addons/web/static/src/js/data_export.js +++ b/addons/web/static/src/js/data_export.js @@ -32,7 +32,7 @@ instance.web.DataExport = instance.web.Dialog.extend({ var self = this; var options = { buttons: [ - {text: _t("Close"), click: function () { self.close(); }}, + {text: _t("Close"), click: function () { self.$el.parents('.modal').modal('hide'); }}, {text: _t("Export To File"), click: function () { self.on_click_export_data(); }} ], close: function () { self.close();} diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 04bb1a61d99..832faa4ca62 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -29,8 +29,8 @@ my.Facet = B.Model.extend({ B.Model.prototype.initialize.apply(this, arguments); this.values = new my.FacetValues(values || []); - this.values.on('add remove change reset', function () { - this.trigger('change', this); + this.values.on('add remove change reset', function (_, options) { + this.trigger('change', this, options); }, this); }, get: function (key) { @@ -399,7 +399,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.setup_global_completion(); this.query = new my.SearchQuery() .on('add change reset remove', this.proxy('do_search')) - .on('add change reset remove', this.proxy('renderFacets')); + .on('change', this.proxy('renderChangedFacets')) + .on('add reset remove', this.proxy('renderFacets')); if (this.options.hidden) { this.$el.hide(); @@ -578,14 +579,20 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea .trigger('blur'); }, /** - * - * @param {openerp.web.search.SearchQuery | openerp.web.search.Facet} _1 - * @param {openerp.web.search.Facet} [_2] + * Call the renderFacets method with the correct arguments. + * This is due to the fact that change events are called with two arguments + * (model, options) while add, reset and remove events are called with + * (collection, model, options) as arguments + */ + renderChangedFacets: function (model, options) { + this.renderFacets(undefined, model, options); + }, + /** + * @param {openerp.web.search.SearchQuery | undefined} Undefined if event is change + * @param {openerp.web.search.Facet} * @param {Object} [options] */ - renderFacets: function (_1, _2, options) { - // _1: model if event=change, otherwise collection - // _2: undefined if event=change, otherwise model + renderFacets: function (collection, model, options) { var self = this; var started = []; var $e = this.$('div.oe_searchview_facets'); @@ -610,6 +617,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea }); $.when.apply(null, started).then(function () { + if (options && options.focus_input === false) return; var input_to_focus; // options.at: facet inserted at given index, focus next input // otherwise just focus last input @@ -618,7 +626,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea } else { input_to_focus = self.input_subviews[(options.at + 1) * 2]; } - input_to_focus.$el.focus(); }); }, @@ -1602,8 +1609,11 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({ return facetValue.get('label'); }, make_domain: function (name, operator, facetValue) { - if (operator === this.default_operator) { + switch(operator){ + case this.default_operator: return [[name, '=', facetValue.get('value')]]; + case 'child_of': + return [[name, 'child_of', facetValue.get('value')]]; } return this._super(name, operator, facetValue); }, diff --git a/addons/web/static/src/js/testing.js b/addons/web/static/src/js/testing.js index 1f1c718ad5f..5e9483addc1 100644 --- a/addons/web/static/src/js/testing.js +++ b/addons/web/static/src/js/testing.js @@ -48,15 +48,6 @@ openerp.testing = {}; testing.dependencies = window['oe_all_dependencies'] || []; testing.current_module = null; - testing.templates = { }; - testing.add_template = function (name) { - var xhr = QWeb2.Engine.prototype.get_xhr(); - xhr.open('GET', name, false); - xhr.send(null); - (testing.templates[testing.current_module] = - testing.templates[testing.current_module] || []) - .push(xhr.responseXML); - }; /** * Function which does not do anything */ @@ -206,7 +197,7 @@ openerp.testing = {}; teardown: testing.noop }); - QUnit.module(testing.current_module + '.' + name, {_oe: options}); + QUnit.module(name, {_oe: options}); body(testing['case']); }; testing['case'] = function (name, options, callback) { @@ -244,18 +235,6 @@ openerp.testing = {}; expect(opts.asserts); } - if (opts.templates) { - for(var i=0; i<module_deps.length; ++i) { - var dep = module_deps[i]; - var templates = testing.templates[dep]; - if (_.isEmpty(templates)) { continue; } - - for (var j=0; j < templates.length; ++j) { - instance.web.qweb.add_template(templates[j]); - } - } - } - var $fixture = $('#qunit-fixture'); var mock, async = false; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 247fd2d2a1a..2c68a23dbf9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1940,7 +1940,7 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ init: function(field_manager, node) { node.attrs.type = node.attrs['data-button-type']; this.is_stat_button = /\boe_stat_button\b/.test(node.attrs['class']); - this.icon = node.attrs.icon && "<span class=\"fa " + node.attrs.icon + " fa-fw\"></span>"; + this.icon_class = node.attrs.icon && "stat_button_icon fa " + node.attrs.icon + " fa-fw"; this._super(field_manager, node); this.force_disabled = false; this.string = (this.node.attrs.string || '').replace(/_/g, ''); @@ -3356,13 +3356,16 @@ instance.web.form.CompletionFieldMixin = { instance.web.form.M2ODialog = instance.web.Dialog.extend({ template: "M2ODialog", init: function(parent) { + this.name = parent.string; this._super(parent, { - title: _.str.sprintf(_t("Add %s"), parent.string), + title: _.str.sprintf(_t("Create a %s"), parent.string), size: 'medium', }); }, start: function() { var self = this; + var text = _.str.sprintf(_t("You are creating a new %s, are you sure it does not exist yet?"), self.name); + this.$("p").text( text ); this.$buttons.html(QWeb.render("M2ODialog.buttons")); this.$("input").val(this.getParent().last_query); this.$buttons.find(".oe_form_m2o_qc_button").click(function(){ @@ -3486,7 +3489,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc self.display_value_backup = {}; self.render_value(); self.focus(); - self.view.do_onchange(self); + self.trigger('changed_value'); }); }); }); @@ -3621,6 +3624,8 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc minLength: 0, delay: 250 }); + // set position for list of suggestions box + this.$input.autocomplete( "option", "position", { my : "left top", at: "left bottom" } ); this.$input.autocomplete("widget").openerpClass(); // used to correct a bug when selecting an element by pushing 'enter' in an editable list this.$input.keyup(function(e) { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 24c5ba625b0..18a55656df2 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -40,7 +40,7 @@ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h3 class="modal-title"><t t-raw="title"/></h3> </div> - <div class="modal-body"> + <div class="modal-body" style="overflow-y: auto;"> </div> </div> </div> @@ -800,12 +800,11 @@ </t> <button t-name="ListView.row.text_button" type="button" t-att-title="widget.string" t-att-disabled="disabled || undefined" - t-att-class="disabled ? 'oe_list_button_disabled btn' : 'btn'"> - <t t-esc="widget.string"/> -</button> + t-att-class="disabled ? 'oe_list_button_disabled btn_txt oe_link' : 'btn_txt oe_link'" + ><t t-esc="widget.string"/></button> <button t-name="ListView.row.button" type="button" t-att-title="widget.string" t-att-disabled="disabled || undefined" - t-att-class="disabled ? 'oe_list_button_disabled btn_img' : 'btn_img'" + t-att-class="disabled ? 'oe_list_button_disabled' : ''" ><img t-attf-src="#{prefix}/web/static/src/img/icons/#{widget.icon}.png" t-att-alt="widget.string"/></button> <t t-extend="ListView.row"> @@ -1409,7 +1408,7 @@ t-att-autofocus="widget.node.attrs.autofocus" t-att-accesskey="widget.node.attrs.accesskey"> <img t-if="!widget.is_stat_button and widget.node.attrs.icon " t-att-src="_s + widget.node.attrs.icon" width="16" height="16"/> - <div t-if="widget.is_stat_button and widget.icon" class="stat_button_icon"><t t-raw="widget.icon"/></div> + <div t-if="widget.is_stat_button and widget.icon_class" t-att-class="widget.icon_class"></div> <span t-if="widget.string and !widget.is_stat_button"><t t-esc="widget.string"/></span> <div t-if="widget.string and widget.is_stat_button"><t t-esc="widget.string"/></div> </button> @@ -1948,13 +1947,14 @@ </t> <t t-name="M2ODialog"> <div> + <p class="oe_grey"/> Name: <input class="oe_form_m2o_input_name" type="text"/> </div> </t> <t t-name="M2ODialog.buttons"> - <button class="oe_form_m2o_qc_button oe_button oe_highlight">Quick Add</button> - <button class="oe_form_m2o_sc_button oe_button">Add All Info...</button> - <button class="oe_form_m2o_cancel_button oe_button">Cancel</button> + <button class="oe_form_m2o_qc_button oe_button oe_highlight">Create</button> + <button class="oe_form_m2o_sc_button oe_button">Create and edit</button> or + <button class="oe_form_m2o_cancel_button oe_button oe_link"><span>Cancel</span></button> </t> <t t-name="FieldMonetary" t-extend="FieldChar"> <t t-jquery="t:first" t-operation="before"> @@ -1985,6 +1985,5 @@ <a href="javascript:void(0)"><t t-esc="text"/></a> </t> <t t-name="StatInfo"> - <strong><t t-esc="value"/></strong> - <t t-esc="text"/></t> + <strong><t t-esc="value"/></strong><br/><t t-esc="text"/></t> </templates> |
