[REF] web(_*): views: view_switcher icon

Add a key icon in the view's prototype corresponding to the font-awesome icon
to display in the view switcher.
This commit is contained in:
Aaron Bohy
2015-08-07 14:05:07 +02:00
parent b1f28100f9
commit 10f2df8e59
15 changed files with 15 additions and 45 deletions
-24
View File
@@ -1040,30 +1040,6 @@
.openerp .oe-control-panel .oe-cp-switch-buttons button {
width: 34px;
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-kanban:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-list:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-form:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-graph:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-calendar:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-gantt:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-pivot:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-switch-buttons .oe-cp-switch-tree:before {
content: "";
}
.openerp .oe-control-panel .oe-cp-buttons {
display: inline-block;
}
-16
View File
@@ -905,22 +905,6 @@ $sheet-padding: 16px
.oe-cp-switch-buttons
button
width: 34px
.oe-cp-switch-kanban:before
content: "\f009"
.oe-cp-switch-list:before
content: ""
.oe-cp-switch-form:before
content: "\f044"
.oe-cp-switch-graph:before
content: "\f080"
.oe-cp-switch-calendar:before
content: "\f073"
.oe-cp-switch-gantt:before
content: "\f0ae"
.oe-cp-switch-pivot:before
content: "\f0ce"
.oe-cp-switch-tree:before
content: "\f036"
.oe-cp-buttons
display: inline-block
.oe-cp-sidebar
@@ -23,6 +23,8 @@ var View = Widget.extend({
// multi_record is used to distinguish views displaying a single record
// (e.g. FormView) from those that display several records (e.g. ListView)
multi_record: true,
// icon is the font-awesome icon to display in the view switcher
icon: 'fa-question',
init: function(parent, dataset, view_id, options) {
this._super(parent);
this.ViewManager = parent;
+1
View File
@@ -62,6 +62,7 @@ var ViewManager = Widget.extend(ControlPanelMixin, {
button_label: View ? _.str.sprintf(_t('%(view_type)s view'), {'view_type': (view_label || view_type)}) : (void 'nope'),
multi_record: View ? View.prototype.multi_record : undefined,
accesskey: View ? View.prototype.accesskey : undefined,
icon: View ? View.prototype.icon : undefined,
};
self.view_order.push(view_descr);
self.views[view_type] = view_descr;
@@ -35,6 +35,7 @@ var FormView = View.extend(common.FieldManagerMixin, {
view_type: "form",
multi_record: false,
accesskey: "F",
icon: 'fa-edit',
/**
* @constructs instance.web.FormView
* @extends instance.web.View
@@ -16,6 +16,7 @@ var QWeb = core.qweb;
var GraphView = View.extend({
className: 'oe_graph',
display_name: _lt('Graph'),
icon: 'fa-bar-chart',
view_type: 'graph',
init: function(parent, dataset, view_id, options) {
@@ -35,6 +35,7 @@ var row_decoration = [
var ListView = View.extend( /** @lends instance.web.ListView# */ {
_template: 'ListView',
accesskey: 'L',
icon: 'fa-list-ul',
display_name: _lt('List'),
defaults: {
// records can be selected one by one
@@ -21,6 +21,7 @@ var total = _t("Total");
var PivotView = View.extend({
template: 'PivotView',
icon: 'fa-table',
display_name: _lt('Pivot'),
view_type: 'pivot',
events: {
@@ -16,6 +16,7 @@ var QWeb = core.qweb;
var TreeView = View.extend(/** @lends instance.web.TreeView# */{
display_name: _lt('Tree'),
icon: 'fa-align-left',
view_type: 'tree',
/**
* Indicates that this view is not searchable, and thus that no search
+3 -1
View File
@@ -171,7 +171,9 @@
</div>
<t t-name="ViewManager.switch-buttons">
<t t-foreach="views" t-as="view">
<button type="button" t-attf-class="btn btn-default fa oe-cp-switch-#{view.type}" t-att-data-view-type="view.type" t-att-title="view.label" t-att-accesskey="view.accesskey"/>
<button type="button" t-att-accesskey="view.accesskey"
t-attf-class="btn btn-default fa #{view.icon} oe-cp-switch-#{view.type}"
t-att-data-view-type="view.type" t-att-title="view.label"/>
</t>
</t>
@@ -63,6 +63,7 @@ function isNullOrUndef(value) {
var CalendarView = View.extend({
template: "CalendarView",
display_name: _lt('Calendar'),
icon: 'fa-calendar',
quick_create_instance: widgets.QuickCreate,
init: function (parent, dataset, view_id, options) {
@@ -44,7 +44,3 @@
-o-user-select: none;
user-select: none;
}
.oe-cp-switch-buttons .oe-cp-switch-diagram:before {
content: "";
}
@@ -15,6 +15,7 @@ var QWeb = core.qweb;
var DiagramView = View.extend({
display_name: _lt('Diagram'),
icon: 'fa-code-fork',
view_type: 'diagram',
searchable: false,
multi_record: false,
+1
View File
@@ -17,6 +17,7 @@ var QWeb = core.qweb;
var GanttView = View.extend({
display_name: _lt('Gantt'),
icon: 'fa-tasks',
view_type: "gantt",
init: function() {
this._super.apply(this, arguments);
@@ -27,6 +27,7 @@ var KanbanView = View.extend({
accesskey: "K",
className: "o_kanban_view",
display_name: _lt("Kanban"),
icon: 'fa-th-large',
mobile_friendly: true,
view_type: "kanban",