summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorAntoine Huvelle <ahu@openerp.com>2011-12-14 16:25:44 +0100
committerAntoine Huvelle <ahu@openerp.com>2011-12-14 16:25:44 +0100
commit9b1f2d686ecf9b707254dbe9d0feefc1baa24bab (patch)
treed118ef8ec5b37e414a2b40716d13b76295d9c63a /addons/web/static/src
parent20d5fc5b8adf27bbed3470c02a11fa268e9f57bc (diff)
parente557a4b4c0d720c778828b73eae19920e9cf8f66 (diff)
[Merge]
bzr revid: ahu@openerp.com-20111214152544-qmfkzaqubwsafwzy
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css12
-rw-r--r--addons/web/static/src/js/chrome.js9
-rw-r--r--addons/web/static/src/js/search.js5
-rw-r--r--addons/web/static/src/js/view_form.js28
-rw-r--r--addons/web/static/src/js/view_list.js2
-rw-r--r--addons/web/static/src/js/view_page.js7
-rw-r--r--addons/web/static/src/xml/base.xml13
7 files changed, 48 insertions, 28 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index ca863513961..54f02d6bf0a 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -727,11 +727,9 @@ label.error {
padding: 10px 0 10px 0;
vertical-align:middle;
}
-.openerp .oe_search-view-custom-filter-btn span {
- background: url(/web/static/src/img/icons/gtk-add.png) repeat-y;
- padding-left: 18px;
+.openerp .oe_search-view-filters-management {
+ float: right;
}
-
.openerp .oe_search-view-filters-management, .openerp .oe_search-view-custom-filter-btn {
float:right;
}
@@ -1192,7 +1190,11 @@ label.error {
.openerp .oe_forms select{
padding-top: 2px;
}
-
+.openerp .oe_forms input[disabled],
+.openerp .oe_forms select[disabled],
+.openerp .oe_forms textarea[disabled]{
+ background: #E0E0E0;
+}
.openerp .oe_forms textarea {
resize:vertical;
}
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index f737d8eb92a..83f7f971434 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -916,6 +916,8 @@ openerp.web.Menu = openerp.web.Widget.extend(/** @lends openerp.web.Menu# */{
if (!(this.folded && manual)) {
this.do_show_secondary($sub_menu, $main_menu);
+ } else {
+ this.do_show_secondary();
}
if ($main_menu != $clicked_menu) {
@@ -941,8 +943,15 @@ openerp.web.Menu = openerp.web.Widget.extend(/** @lends openerp.web.Menu# */{
}
return false;
},
+ do_hide_secondary: function() {
+ this.$secondary_menu.hide();
+ },
do_show_secondary: function($sub_menu, $main_menu) {
var self = this;
+ this.$secondary_menu.show();
+ if (!arguments.length) {
+ return;
+ }
if (this.folded) {
var css = $main_menu.position(),
fold_width = this.$secondary_menu.width() + 2,
diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js
index d1e4b161b39..9b485b457cd 100644
--- a/addons/web/static/src/js/search.js
+++ b/addons/web/static/src/js/search.js
@@ -155,6 +155,7 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
var ext = new openerp.web.search.ExtendedSearch(this, this.model);
lines.push([ext]);
this.inputs.push(ext);
+ this.extended_search = ext;
var render = QWeb.render("SearchView", {
'view': data.fields_view['arch'],
@@ -163,7 +164,6 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
});
this.$element.html(render);
- this.$element.find(".oe_search-view-custom-filter-btn").click(ext.on_activate);
var f = this.$element.find('form');
this.$element.find('form')
@@ -199,6 +199,9 @@ openerp.web.SearchView = openerp.web.Widget.extend(/** @lends openerp.web.Search
var select = this.$element.find(".oe_search-view-filters-management");
var val = select.val();
switch(val) {
+ case 'advanced_filter':
+ this.extended_search.on_activate();
+ break;
case 'add_to_dashboard':
this.on_add_to_dashboard();
break;
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index fef32df4a90..5908dc67dc6 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -619,8 +619,8 @@ openerp.web.form.SidebarAttachments = openerp.web.Widget.extend({
var $e = $(e.target);
if ($e.val() != '') {
this.$element.find('form.oe-binary-form').submit();
- $e.parent().find('input[type=file]').attr('disabled', 'true');
- $e.parent().find('button').attr('disabled', 'true').find('img, span').toggle();
+ $e.parent().find('input[type=file]').prop('disabled', true);
+ $e.parent().find('button').prop('disabled', true).find('img, span').toggle();
}
},
on_attachment_delete: function(e) {
@@ -1094,13 +1094,9 @@ openerp.web.form.WidgetButton = openerp.web.form.Widget.extend({
this.check_disable();
},
check_disable: function() {
- if (this.readonly || this.force_disabled || !this.view.is_interactible_record()) {
- this.$element.find("button").attr("disabled", "disabled");
- this.$element.find("button").css("color", "grey");
- } else {
- this.$element.find("button").removeAttr("disabled");
- this.$element.find("button").css("color", "");
- }
+ var disabled = (this.readonly || this.force_disabled || !this.view.is_interactible_record());
+ this.$element.find('button').prop('disabled', disabled);
+ this.$element.find("button").css('color', disabled ? 'grey' : '');
}
});
@@ -1268,7 +1264,7 @@ openerp.web.form.FieldChar = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
- this.$element.find('input').attr('disabled', this.readonly);
+ this.$element.find('input').prop('disabled', this.readonly);
},
set_value_from_ui: function() {
this.value = openerp.web.parse_value(this.$element.find('input').val(), this);
@@ -1392,7 +1388,7 @@ openerp.web.DateTimeWidget = openerp.web.Widget.extend({
},
set_readonly: function(readonly) {
this.readonly = readonly;
- this.$input.attr('disabled', this.readonly);
+ this.$input.prop('disabled', this.readonly);
this.$element.find('img.oe_datepicker_trigger').toggleClass('oe_input_icon_disabled', readonly);
},
is_valid: function(required) {
@@ -1479,7 +1475,7 @@ openerp.web.form.FieldText = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
- this.$element.find('textarea').attr('disabled', this.readonly);
+ this.$element.find('textarea').prop('disabled', this.readonly);
},
set_value_from_ui: function() {
this.value = openerp.web.parse_value(this.$element.find('textarea').val(), this);
@@ -1516,7 +1512,7 @@ openerp.web.form.FieldBoolean = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
- this.$element.find('input').attr('disabled', this.readonly);
+ this.$element.find('input').prop('disabled', this.readonly);
},
focus: function() {
this.$element.find('input').focus();
@@ -1599,7 +1595,7 @@ openerp.web.form.FieldSelection = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
- this.$element.find('select').attr('disabled', this.readonly);
+ this.$element.find('select').prop('disabled', this.readonly);
},
validate: function() {
var value = this.values[this.$element.find('select')[0].selectedIndex];
@@ -1948,7 +1944,7 @@ openerp.web.form.FieldMany2One = openerp.web.form.Field.extend({
},
update_dom: function() {
this._super.apply(this, arguments);
- this.$input.attr('disabled', this.readonly);
+ this.$input.prop('disabled', this.readonly);
}
});
@@ -2905,7 +2901,7 @@ openerp.web.form.FieldBinaryFile = openerp.web.form.FieldBinary.extend({
update_dom: function() {
this._super.apply(this, arguments);
this.$element.find('.oe-binary-file-set, .oe-binary-file-clear').toggle(!this.readonly);
- this.$element.find('input[type=text]').attr('disabled', this.readonly);
+ this.$element.find('input[type=text]').prop('disabled', this.readonly);
},
set_value: function(value) {
this._super.apply(this, arguments);
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 059bc020682..bf423434ecc 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -79,6 +79,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
self.compute_aggregates();
});
+ this.no_leaf = false;
},
/**
* Retrieves the view's number of records per page (|| section)
@@ -473,6 +474,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
if (_.isEmpty(group_by) && !context['group_by_no_leaf']) {
group_by = null;
}
+ this.no_leaf = !!context['group_by_no_leaf'];
this.reload_view(!!group_by, context).then(
$.proxy(this, 'reload_content'));
diff --git a/addons/web/static/src/js/view_page.js b/addons/web/static/src/js/view_page.js
index abcfb5131dd..40ca1176c79 100644
--- a/addons/web/static/src/js/view_page.js
+++ b/addons/web/static/src/js/view_page.js
@@ -102,9 +102,10 @@ openerp.web.page = function (openerp) {
this._super(s[2]);
}
});
- openerp.web.page.FieldBooleanReadonly = openerp.web.page.FieldCharReadonly.extend({
- set_value: function (value) {
- this._super(value ? '\u2611' : '\u2610');
+ openerp.web.page.FieldBooleanReadonly = openerp.web.form.FieldBoolean.extend({
+ update_dom: function() {
+ this._super.apply(this, arguments);
+ this.$element.find('input').prop('disabled', true);
}
});
openerp.web.page.FieldSelectionReadonly = openerp.web.page.FieldReadonly.extend({
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 73b0b59125e..8f5fb686e50 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -481,6 +481,10 @@
</t>
<t t-extend="ViewManager" t-name="One2Many.viewmanager">
<t t-jquery="span.oe_view_title_text" t-operation="replace"/>
+
+ <t t-jquery=".oe-view-manager-header">
+ this.attr('t-if', 'views.length != 1');
+ </t>
</t>
<t t-name="Sidebar">
@@ -567,7 +571,7 @@
<th t-att-colspan="columns_count">
<table>
<tr>
- <td t-if="options.action_buttons !== false" class="oe-actions">
+ <td t-if="!no_leaf and options.action_buttons !== false" class="oe-actions">
<button type="button" class="oe-list-add"
t-if="options.addable">
<t t-esc="options.addable"/>
@@ -617,6 +621,9 @@
<t t-jquery="thead.ui-widget-header > tr:first">
this.removeAttr('t-if');
</t>
+
+ <t t-jquery="tfoot &gt; tr:last-child" t-operation="replace"/>
+
<t t-jquery="td.oe-actions">
this.removeAttr('t-if');
var $title = $(document.createElement('h3')).addClass('oe_view_title');
@@ -625,7 +632,7 @@
this.prepend($title);
</t>
</t>
-<th t-name="Listview.navigation.button" t-if="options.pager !== false"
+<th t-name="Listview.navigation.button" t-if="!no_leaf and options.pager !== false"
class="oe-list-pager" t-att-colspan="columns_count">
<button type="button" disabled="disabled"
data-pager-action="first"></button>
@@ -1146,7 +1153,6 @@
<div class="oe_search-view-buttons">
<button>Search</button>
<button type="reset">Clear</button>
- <button type="button" class="oe_search-view-custom-filter-btn"><span>Advanced Filter</span></button>
<select class="oe_search-view-filters-management">
</select>
</div>
@@ -1160,6 +1166,7 @@
</t>
</optgroup>
<optgroup label="-- Actions --">
+ <option value="advanced_filter">Advanced Filter</option>
<option value="save_filter">Save Filter</option>
<option value="add_to_dashboard">Add to Dashboard</option>
<option value="manage_filters">Manage Filters</option>