summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorThibault Delavallée <tde@openerp.com>2012-08-06 14:44:54 +0200
committerThibault Delavallée <tde@openerp.com>2012-08-06 14:44:54 +0200
commit5bfe0953b46ea29f90db57ca9a394717ddc35a8e (patch)
tree07a365ee685887bd016d11123561e3432b5ead0c /addons/web/static/src
parent38552a9c49eec29136c620ae99ebbc363fd45031 (diff)
parent8cecaa14f3f9b3ed48adccf4ebf933e67cd8b714 (diff)
[MERGE] Merged with web/trunk.
bzr revid: tde@openerp.com-20120806124454-hgdw4vjzjuhfsg2n
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/css/base.css54
-rw-r--r--addons/web/static/src/css/base.sass63
-rw-r--r--addons/web/static/src/img/graph_background.pngbin0 -> 3920 bytes
-rw-r--r--addons/web/static/src/img/view_empty_arrow.pngbin2308 -> 4157 bytes
-rw-r--r--addons/web/static/src/js/chrome.js49
-rw-r--r--addons/web/static/src/js/coresetup.js26
-rw-r--r--addons/web/static/src/js/view_form.js12
-rw-r--r--addons/web/static/src/js/view_list.js22
-rw-r--r--addons/web/static/src/js/views.js52
-rw-r--r--addons/web/static/src/xml/base.xml2
10 files changed, 199 insertions, 81 deletions
diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css
index 02c9db98eb5..22e3fa28357 100644
--- a/addons/web/static/src/css/base.css
+++ b/addons/web/static/src/css/base.css
@@ -80,6 +80,14 @@
* http://stackoverflow.com/questions/2855589/replace-input-type-file-by-an-image
*/
}
+.openerp :-moz-placeholder {
+ color: #afafb6 !important;
+ font-style: italic !important;
+}
+.openerp ::-webkit-input-placeholder {
+ color: #afafb6 !important;
+ font-style: italic !important;
+}
.openerp a {
text-decoration: none;
}
@@ -1808,15 +1816,29 @@
margin: 0 0 0 4px;
padding: 0;
}
-.openerp .oe_view_nocontent > img {
- float: left;
- margin: 1.5em;
-}
-.openerp .oe_view_nocontent > div {
- overflow: hidden;
- padding: 35px 0px 0px 0px;
- max-width: 700px;
+.openerp .oe_view_nocontent {
+ padding: 15px;
+ margin-top: 0;
+ color: #777777;
font-size: 125%;
+ max-width: 700px;
+}
+.openerp .oe_view_nocontent .oe_view_nocontent_create {
+ background: transparent url(/web/static/src/img/view_empty_arrow.png) no-repeat 7px 0;
+ margin-top: 0;
+ padding-top: 35px;
+ min-height: 28px;
+ color: #4c4c4c;
+}
+.openerp .oe_view_nocontent > p {
+ padding-left: 95px;
+}
+.openerp .oe_view_nocontent .oe_empty_custom_dashboard {
+ background: transparent url(/web/static/src/img/graph_background.png) no-repeat 0 0;
+ margin-top: -15px;
+ padding: 100px 0 0 137px;
+ min-height: 327px;
+ margin-left: -15px;
}
.openerp .oe_formview {
background: white;
@@ -1908,6 +1930,16 @@
max-width: 860px;
margin: 0 auto;
}
+.openerp .oe_form div.oe_form_configuration div.oe_horizontal_separator {
+ margin: 25px 0 10px 0;
+}
+.openerp .oe_form div.oe_form_configuration p {
+ color: #aaaaaa;
+ max-width: 650px;
+}
+.openerp .oe_form div.oe_form_configuration label {
+ min-width: 150px;
+}
.openerp ul.oe_form_steps {
height: 30px;
padding: 0;
@@ -2001,7 +2033,7 @@
}
.openerp .oe_form td.oe_form_group_cell_label {
border-right: 1px solid #dddddd;
- padding: 2px 0px 2px 0px;
+ padding: 4px 0px 4px 0px;
}
.openerp .oe_form td.oe_form_group_cell_label label {
line-height: 18px;
@@ -2013,7 +2045,7 @@
}
.openerp .oe_form .oe_form_group {
width: 100%;
- margin: 6px 0 6px 0;
+ margin: 9px 0 9px 0;
}
.openerp .oe_form .oe_form_group .oe_form_group_cell.oe_group_right {
padding-left: 20px;
@@ -2038,7 +2070,7 @@
font-weight: bold;
font-size: 20px;
margin: 8px 0px 8px 0px;
- color: #aaaabb;
+ color: #53637e;
}
.openerp .oe_horizontal_separator:empty {
height: 5px;
diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass
index 58d24152b0e..482dd490988 100644
--- a/addons/web/static/src/css/base.sass
+++ b/addons/web/static/src/css/base.sass
@@ -140,6 +140,14 @@ $sheet-max-width: 860px
font-size: 13px
background: white
// }}}
+ //Placeholder style{{{
+ \:-moz-placeholder
+ color: $facets-border !important
+ font-style: italic !important
+ \::-webkit-input-placeholder
+ color: $facets-border !important
+ font-style: italic !important
+ //}}}
// Tag reset {{{
a
text-decoration: none
@@ -150,7 +158,7 @@ $sheet-max-width: 860px
font-weight: bold
background-color: #f0f0f0
th
- border-right: 1px dotted #afafb6
+ border-right: 1px dotted $facets-border
&:last-child
border-right: none
th, td
@@ -524,7 +532,7 @@ $sheet-max-width: 860px
top: 26px
left: 0
z-index: 1
- border: 1px solid #afafb6
+ border: 1px solid $facets-border
background: white
padding: 4px 0
min-width: 140px
@@ -804,7 +812,7 @@ $sheet-max-width: 860px
display: none
width: 220px
background: #f0eeee
- border-right: 1px solid #afafb6
+ border-right: 1px solid $facets-border
text-shadow: 0 1px 1px white
padding-bottom: 16px
a.oe_logo
@@ -1245,7 +1253,7 @@ $sheet-max-width: 860px
background-color: white
min-width: 100%
display: none
- border: 1px solid #afafb6
+ border: 1px solid $facets-border
text-align: left
@include radius(4px)
@include box-shadow(0 1px 4px rgba(0,0,0,0.3))
@@ -1400,15 +1408,26 @@ $sheet-max-width: 860px
// }}}
// Views Common {{{
.oe_view_nocontent
- > img
- float: left
- margin: 1.5em
- > div
- // don't encroach on my arrow
- overflow: hidden
- padding: 35px 0px 0px 0px
- max-width: 700px
- font-size: 125%
+ padding: 15px
+ margin-top: 0
+ color: #777777
+ font-size: 125%
+ max-width: 700px
+ .oe_view_nocontent_create
+ background: transparent url(/web/static/src/img/view_empty_arrow.png) no-repeat 7px 0
+ margin-top: 0
+ padding-top: 35px
+ min-height: 28px
+ color: #4c4c4c
+ > p
+ padding-left: 95px
+ .oe_empty_custom_dashboard
+ background: transparent url(/web/static/src/img/graph_background.png) no-repeat 0 0
+ margin-top: -15px
+ padding: 100px 0 0 137px
+ min-height: 327px
+ margin-left: -15px
+
// }}}
// FormView.base and dynamic tags {{{
.oe_formview
@@ -1462,6 +1481,14 @@ $sheet-max-width: 860px
min-width: 650px
max-width: $sheet-max-width
margin: 0 auto
+ div.oe_form_configuration
+ div.oe_horizontal_separator
+ margin: 25px 0 10px 0
+ p
+ color: #aaa
+ max-width: 650px
+ label
+ min-width: 150px
ul.oe_form_steps
height: 30px
padding: 0
@@ -1524,7 +1551,7 @@ $sheet-max-width: 860px
background: white
min-height: 330px
padding: 16px
- border: 1px solid #afafb6
+ border: 1px solid $facets-border
@include box-shadow(0 0 10px rgba(0,0,0,0.3))
.ui-tabs
margin: 0 -16px
@@ -1537,7 +1564,7 @@ $sheet-max-width: 860px
margin: 2px
td.oe_form_group_cell_label
border-right: 1px solid #ddd
- padding: 2px 0px 2px 0px
+ padding: 4px 0px 4px 0px
label
line-height: 18px
display: block
@@ -1546,7 +1573,7 @@ $sheet-max-width: 860px
padding-left: 6px
.oe_form_group
width: 100%
- margin: 6px 0 6px 0
+ margin: 9px 0 9px 0
.oe_form_group_cell.oe_group_right
padding-left: 20px
// }}}
@@ -1571,7 +1598,7 @@ $sheet-max-width: 860px
font-weight: bold
font-size: 20px
margin: 8px 0px 8px 0px
- color: #aab
+ color: #53637e
.oe_horizontal_separator:empty
height: 5px
.oe_vertical_separator
@@ -1913,7 +1940,7 @@ $sheet-max-width: 860px
border-bottom: 2px solid #cacaca
.treeview-tr, .treeview-td
cursor: pointer
- border-right: 1px dotted #afafb6
+ border-right: 1px dotted $facets-border
vertical-align: top
text-align: left
border-bottom: 1px solid #cfcccc
diff --git a/addons/web/static/src/img/graph_background.png b/addons/web/static/src/img/graph_background.png
new file mode 100644
index 00000000000..530312b20bb
--- /dev/null
+++ b/addons/web/static/src/img/graph_background.png
Binary files differ
diff --git a/addons/web/static/src/img/view_empty_arrow.png b/addons/web/static/src/img/view_empty_arrow.png
index b0b1372adfd..ef8f3c820d7 100644
--- a/addons/web/static/src/img/view_empty_arrow.png
+++ b/addons/web/static/src/img/view_empty_arrow.png
Binary files differ
diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js
index 7486d746496..0557fe56d5e 100644
--- a/addons/web/static/src/js/chrome.js
+++ b/addons/web/static/src/js/chrome.js
@@ -609,6 +609,55 @@ instance.web.Login = instance.web.Widget.extend({
});
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 = instance.web.Widget.extend({
+ init: function(parent, params) {
+ this._super(parent);
+ this.menu_id = (params && params.menu_id) || false;
+ },
+ start: function() {
+ var l = window.location;
+ var timestamp = new Date().getTime();
+ var search = "?ts=" + timestamp;
+ if (l.search) {
+ search = l.search + "&ts=" + timestamp;
+ }
+ var hash = l.hash;
+ if (this.menu_id) {
+ hash = "#menu_id=" + this.menu_id;
+ }
+ var url = l.protocol + "//" + l.host + l.pathname + search + hash;
+ window.location = url;
+ }
+});
+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 = instance.web.Widget.extend({
+ init: function(parent, params) {
+ if (!parent.history_back()) {
+ window.location = '/' + (window.location.search || '');
+ }
+ }
+});
+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) {
+ window.location = '/' + (window.location.search || '');
+ }
+});
+instance.web.client_actions.add("home", "instance.web.Home");
+
instance.web.Menu = instance.web.Widget.extend({
template: 'Menu',
init: function() {
diff --git a/addons/web/static/src/js/coresetup.js b/addons/web/static/src/js/coresetup.js
index 2f2fb4f7832..6ba62162e93 100644
--- a/addons/web/static/src/js/coresetup.js
+++ b/addons/web/static/src/js/coresetup.js
@@ -672,32 +672,6 @@ instance.connection.on('module_loaded', this, function () {
*/
instance.web.client_actions = new instance.web.Registry();
-/**
- * Client action to reload the whole interface.
- * If params has an entry 'menu_id', it opens the given menu entry.
- */
-instance.web.Reload = instance.web.Widget.extend({
- init: function(parent, params) {
- this._super(parent);
- this.menu_id = (params && params.menu_id) || false;
- },
- start: function() {
- var l = window.location;
- var timestamp = new Date().getTime();
- var search = "?ts=" + timestamp;
- if (l.search) {
- search = l.search + "&ts=" + timestamp;
- }
- var hash = l.hash;
- if (this.menu_id) {
- hash = "#menu_id=" + this.menu_id;
- }
- var url = l.protocol + "//" + l.host + l.pathname + search + hash;
- window.location = url;
- }
-});
-instance.web.client_actions.add("reload", "instance.web.Reload");
-
};
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 77a9c64822e..c4e13dabae2 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -151,7 +151,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
this.sidebar.add_items('other', [
{ label: _t('Delete'), callback: self.on_button_delete },
{ label: _t('Duplicate'), callback: self.on_button_duplicate },
- { label: _t('Set Default'), callback: function (item) { self.open_defaults_dialog(); } },
+ { label: _t('Set Default'), callback: function (item) { self.open_defaults_dialog(); } }
]);
}
@@ -684,8 +684,12 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM
},
on_button_cancel: function(event) {
if (this.can_be_discarded()) {
- this.to_view_mode();
- this.on_record_loaded(this.datarecord);
+ if (this.get('actual_mode') === 'create') {
+ this.trigger('history_back');
+ } else {
+ this.to_view_mode();
+ this.on_record_loaded(this.datarecord);
+ }
}
return false;
},
@@ -3625,7 +3629,7 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
$("textarea", this.$element).focusout(function() {
self.$text.trigger("setInputData", "");
}).keydown(function(e) {
- if (event.keyCode === 9 && self._drop_shown) {
+ if (e.which === $.ui.keyCode.TAB && self._drop_shown) {
self.$text.textext()[0].autocomplete().selectFromDropdown();
}
});
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 9c7bf88db1a..57be3ca6db1 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -354,7 +354,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
this.sidebar.add_items('other', [
{ label: _t("Import"), callback: this.on_sidebar_import },
{ label: _t("Export"), callback: this.on_sidebar_export },
- { label: _t('Delete'), callback: this.do_delete_selected },
+ { label: _t('Delete'), callback: this.do_delete_selected }
]);
this.sidebar.add_toolbar(this.fields_view.toolbar);
this.sidebar.$element.hide();
@@ -444,10 +444,6 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
id: '_group', tag: '', string: _t("Group"), meta: true,
modifiers_for: function () { return {}; },
modifiers: {}
- }, {
- id: '_count', tag: '', string: '#', meta: true,
- modifiers_for: function () { return {}; },
- modifiers: {}
});
}
@@ -880,9 +876,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi
}
this.$element.find('table:first').hide();
this.$element.prepend(
- $('<div class="oe_view_nocontent">')
- .append($('<img>', { src: '/web/static/src/img/view_empty_arrow.png' }))
- .append($('<div>').html(this.options.action.help))
+ $('<div class="oe_view_nocontent">').html(this.options.action.help)
);
}
});
@@ -1344,15 +1338,19 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
_t("Grouping on field '%s' is not possible because that field does not appear in the list view."),
group.grouped_on));
}
+ var group_label;
try {
- $group_column.html(instance.web.format_cell(
+ group_label = instance.web.format_cell(
row_data, group_column, {
value_if_empty: _t("Undefined"),
process_modifiers: false
- }));
+ });
} catch (e) {
- $group_column.html(row_data[group_column.id].value);
+ group_label = row_data[group_column.id].value;
}
+ $group_column.text(_.str.sprintf("%s (%d)",
+ group_label, group.length));
+
if (group.length && group.openable) {
// Make openable if not terminal group & group_by_no_leaf
$group_column.prepend('<span class="ui-icon ui-icon-triangle-1-e" style="float: left;">');
@@ -1364,8 +1362,6 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
}
}
self.indent($group_column, group.level);
- // count column
- $('<td>').text(group.length).appendTo($row);
if (self.options.selectable) {
$row.append('<td>');
diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js
index af4ae68737a..ae46d3d9ff1 100644
--- a/addons/web/static/src/js/views.js
+++ b/addons/web/static/src/js/views.js
@@ -14,6 +14,9 @@ instance.web.ActionManager = instance.web.Widget.extend({
this.dialog = null;
this.dialog_widget = null;
this.breadcrumbs = [];
+ this.on('history_back', this, function() {
+ return this.history_back();
+ });
},
start: function() {
this._super.apply(this, arguments);
@@ -65,21 +68,46 @@ instance.web.ActionManager = instance.web.Widget.extend({
item.id = _.uniqueId('breadcrumb_');
this.breadcrumbs.push(item);
},
+ history_back: function() {
+ var last = this.breadcrumbs.slice(-1)[0];
+ if (!last) {
+ return false;
+ }
+ var title = last.get_title();
+ if (_.isArray(title) && title.length > 1) {
+ return this.select_breadcrumb(this.breadcrumbs.length - 1, title.length - 2);
+ } else if (this.breadcrumbs.length === 1) {
+ // Only one single titled item in breadcrumb, most of the time you want to trigger back to home
+ return false;
+ } else {
+ var prev = this.breadcrumbs[this.breadcrumbs.length - 2];
+ title = prev.get_title();
+ return this.select_breadcrumb(this.breadcrumbs.length - 2, _.isArray(title) ? title.length - 1 : undefined);
+ }
+ },
on_breadcrumb_clicked: function(ev) {
var $e = $(ev.target);
var id = $e.data('id');
- var item;
+ var index;
for (var i = this.breadcrumbs.length - 1; i >= 0; i--) {
- var it = this.breadcrumbs[i];
- if (it.id == id) {
- item = it;
+ if (this.breadcrumbs[i].id == id) {
+ index = i;
break;
}
- this.remove_breadcrumb(i);
}
- var index = $e.parent().find('.oe_breadcrumb_item[data-id=' + $e.data('id') + ']').index($e);
- item.show(index, $e);
+ var subindex = $e.parent().find('.oe_breadcrumb_item[data-id=' + $e.data('id') + ']').index($e);
+ this.select_breadcrumb(index, subindex);
+ },
+ select_breadcrumb: function(index, subindex) {
+ for (var i = this.breadcrumbs.length - 1; i >= 0; i--) {
+ if (i > index) {
+ this.remove_breadcrumb(i);
+ }
+ }
+ var item = this.breadcrumbs[index];
+ item.show(subindex);
this.inner_widget = item.widget;
+ return true;
},
clear_breadcrumbs: function() {
while (this.breadcrumbs.length) {
@@ -166,6 +194,7 @@ instance.web.ActionManager = instance.web.Widget.extend({
var action = state.client_action;
if(_.isString(action)) {
action = {
+ type: 'ir.actions.client',
tag: action,
params: state,
};
@@ -462,6 +491,13 @@ instance.web.ViewManager = instance.web.Widget.extend({
}
var controller = new controllerclass(this, this.dataset, view.view_id, options);
+ controller.on('history_back', this, function() {
+ var am = self.getParent();
+ if (am && am.trigger) {
+ return am.trigger('history_back');
+ }
+ });
+
controller.on("change:title", this, function() {
if (self.active_view === view_type) {
self.set_title(controller.get('title'));
@@ -505,7 +541,7 @@ instance.web.ViewManager = instance.web.Widget.extend({
this.getParent().push_breadcrumb({
widget: this,
action: this.action,
- show: function(index, $e) {
+ show: function(index) {
var view_to_select = views[index];
self.$element.show();
if (self.active_view !== view_to_select) {
diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml
index 49897cc0e52..c45b2d7f226 100644
--- a/addons/web/static/src/xml/base.xml
+++ b/addons/web/static/src/xml/base.xml
@@ -1444,7 +1444,7 @@
</div>
</div>
<div t-name="SearchView.addtoreporting" class="oe_searchview_dashboard">
- <h4>Add to Reporting</h4>
+ <h4>Add to Dashboard</h4>
<form>
<p><input placeholder="Title of new dashboard item"/></p>
<button class="oe_apply" type="submit">Add</button>