[FIX] various small UI tweaks
authorGéry Debongnie <ged@odoo.com>
Tue, 14 Oct 2014 09:02:11 +0000 (11:02 +0200)
committerGéry Debongnie <ged@odoo.com>
Tue, 21 Oct 2014 07:33:52 +0000 (09:33 +0200)
addons/web/static/src/css/base.css
addons/web/static/src/css/base.sass
addons/web/static/src/js/search.js
addons/web/static/src/js/views.js
addons/web/static/src/xml/base.xml
addons/web_graph/static/src/js/graph_view.js
addons/web_graph/static/src/js/graph_widget.js

index 61938b8..11dd624 100644 (file)
   background-color: #f0eeee;
   border-bottom: 1px solid #afafb6;
 }
+.openerp .oe-view-manager-header .selected {
+  display: block;
+}
+.openerp .oe-view-manager-header .selected a {
+  font-weight: bold;
+}
+.openerp .oe-view-manager-header .selected a:before {
+  font-family: FontAwesome;
+  position: absolute;
+  left: 6px;
+  top: 3px;
+  content: "";
+}
+.openerp .oe-view-manager-header .dropdown-menu li {
+  position: relative;
+}
+.openerp .oe-view-manager-header .dropdown-menu li a {
+  padding: 3px 25px;
+}
 .openerp .oe-view-manager-header .oe-right-toolbar {
   float: right;
 }
   display: inline-block;
   float: right;
 }
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form {
+  cursor: pointer;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form span {
+  padding: 3px 20px;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form input.oe_form_binary_file {
+  width: 100%;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_form_binary_form:hover {
+  background-color: #f5f5f5;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_file_attachment {
+  display: inline;
+  padding: 3px 20px;
+}
+.openerp .oe-view-manager-header .oe-view-manager-sidebar .oe_sidebar_delete_item {
+  display: inline;
+  padding: 0;
+}
 .openerp .oe-view-manager-header .oe_form_buttons {
   padding: 0;
 }
   border-radius: 0px;
 }
 .openerp .oe_searchview .oe_searchview_facets .oe_searchview_input {
-  padding: 0 0 0 6px;
+  padding: 2px 0 0 6px;
   font-size: 12px;
   height: 16px;
 }
   padding-left: 0;
   padding-right: 10px;
 }
-.openerp .oe-search-options .selected {
-  display: block;
-}
-.openerp .oe-search-options .selected a {
-  font-weight: bold;
-}
-.openerp .oe-search-options .selected a:before {
-  font-family: FontAwesome;
-  position: absolute;
-  left: 6px;
-  top: 3px;
-  content: "";
-}
 .openerp .oe-search-options .oe-group-selector {
   margin: 3px 25px;
   min-width: calc(100% - 40px);
index 845c005..da23bf3 100644 (file)
@@ -900,6 +900,21 @@ $sheet-padding: 16px
         display: table-row
         background-color: rgb(240, 238, 238)
         border-bottom: 1px solid #afafb6
+        .selected
+            display: block
+            a
+                font-weight: bold
+            a:before
+                font-family: FontAwesome
+                position: absolute
+                left: 6px
+                top: 3px
+                content: "\f00c"
+        .dropdown-menu
+            li
+                position: relative
+                a
+                    padding: 3px 25px
         .oe-right-toolbar
             float: right
             > div
@@ -942,6 +957,22 @@ $sheet-padding: 16px
         .oe-view-manager-sidebar
             display: inline-block
             float: right
+            .oe_form_binary_form
+                cursor: pointer
+                span
+                    padding: 3px 20px
+                input.oe_form_binary_file
+                    width: 100%
+
+            .oe_form_binary_form:hover
+                background-color: #f5f5f5
+            .oe_file_attachment
+                display: inline
+                padding: 3px 20px
+            .oe_sidebar_delete_item
+                display: inline
+                padding: 0
+
         .oe_form_buttons
             padding: 0
         .oe-pager-buttons
@@ -1010,7 +1041,7 @@ $sheet-padding: 16px
                 .label
                     @include radius(0px)
             .oe_searchview_input
-                padding: 0 0 0 6px
+                padding: 2px 0 0 6px
                 font-size: 12px
                 height: 16px
                 &:focus
@@ -1109,16 +1140,6 @@ $sheet-padding: 16px
             margin-left: 10px
             padding-left: 0
             padding-right: 10px
-        .selected
-            display: block
-            a
-                font-weight: bold
-            a:before
-                font-family: FontAwesome
-                position: absolute
-                left: 6px
-                top: 3px
-                content: "\f00c"
         .oe-group-selector
             margin: 3px 25px
             min-width: calc(100% - 40px)
index 1feef6e..f55f9b4 100644 (file)
@@ -333,8 +333,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
         },
         'click .oe_searchview_unfold_drawer': function (e) {
             e.stopImmediatePropagation();
-            $(e.target).toggleClass('fa-chevron-right')
-                       .toggleClass('fa-chevron-down');
+            $(e.target).toggleClass('fa-caret-down')
+                       .toggleClass('fa-caret-up');
             localStorage.visible_search_menu = !(localStorage.visible_search_menu === 'true');
             this.toggle_buttons();
         },
@@ -408,8 +408,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea
             context: this.dataset.get_context(),
         });
         this.$('.oe_searchview_unfold_drawer')
-            .toggleClass('fa-chevron-right', !this.visible_filters)
-            .toggleClass('fa-chevron-down', this.visible_filters);
+            .toggleClass('fa-caret-down', !this.visible_filters)
+            .toggleClass('fa-caret-up', this.visible_filters);
         return $.when(this._super(), this.alive($.when(load_view))
             .then(this.view_loaded.bind(this)));
     },
index 2659d46..ef71f19 100644 (file)
@@ -1152,7 +1152,7 @@ instance.web.Sidebar = instance.web.Widget.extend({
             this.$el.find('form.oe_form_binary_form').submit();
             $e.parent().find('input[type=file]').prop('disabled', true);
             $e.parent().find('button').prop('disabled', true).find('img, span').toggle();
-            this.$('.oe_sidebar_add_attachment span').text(_t('Uploading...'));
+            this.$('.oe_sidebar_add_attachment a').text(_t('Uploading...'));
             instance.web.blockUI();
         }
     },
index c452781..4ae1e09 100644 (file)
                             <t t-raw="item.write_uid[1] + ' ' + item.write_date"/>
                         </t>
                     </t>
-                    <a t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url">
+                    <a class="oe_file_attachment" t-att-title="item.title or ''" t-att-data-section="section.name" t-att-data-index="item_index" t-att-href="item.url">
                         <t t-raw="item.label"/>
                     </a>
                      <a t-if="section.name == 'files' and !item.callback" class="oe_sidebar_delete_item" t-att-data-id="item.id" title="Delete this attachment">x</a>
         <li class="oe-save-search closed-menu"><a>Save current search</a></li>
         <li class="oe-save-name"><input type="text" class="form-control"></input></li>
         <li class="oe-save-name">
-            <span><input type="checkbox"/>Share with all users</span>
+            <span><input type="checkbox"/>Use by default</span>
         </li>
         <li class="oe-save-name">
-            <span><input type="checkbox"/>Use by default</span>
+            <span><input type="checkbox"/>Share with all users</span>
         </li>
         <li class="oe-save-name"><button class="btn btn-default">Save</button></li>
     </ul>
index 9242962..acd075d 100644 (file)
@@ -231,7 +231,7 @@ instance.web_graph.GraphView = instance.web.View.extend({
         return {
             category:'ColGroupBy',
             values: this.make_groupby_values(groupbys, 'col_group_by'),
-            icon:'fa fa-bars fa-rotate-90',
+            icon:'fa fa-level-down',
             field: this.col_search_field
         };
     },
index ffdcd4c..3731d30 100644 (file)
@@ -20,7 +20,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
         this.model = model;
         this.domain = domain;
         this.mode = options.mode || 'pivot';  // pivot, bar, pie, line
-        this.heatmap_mode = options.heatmap_mode || 'none';
         this.visible_ui = options.visible_ui || true;
         this.bar_ui = options.bar_ui || 'group';
         this.graph_view = options.graph_view || null;
@@ -34,27 +33,28 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
         this.table = $('<table>');
         this.$('.graph_main_content').append(this.table);
 
-        var $pivot_button = this.$buttons.find('.oe-pivot-mode');
-        $pivot_button.click(function () {
+        this.$buttons.find('.oe-pivot-mode').click(function () {
             self.set_mode.bind(self)('pivot');
         });
         this.$measure_list = this.$buttons.find('.oe-measure-list');
 
-        var $barchart_button = this.$buttons.find('.oe-bar-mode');
-        $barchart_button.click(function () {
+        this.$buttons.find('.oe-bar-mode').click(function () {
             self.set_mode.bind(self)('bar');
         });
-        var $line_chart_button = this.$buttons.find('.oe-line-mode');
-        $line_chart_button.click(function () {
+        this.$buttons.find('.oe-line-mode').click(function () {
             self.set_mode.bind(self)('line');
         });
-        var $pie_chart_button = this.$buttons.find('.oe-pie-mode');
-        $pie_chart_button.click(function () {
+        this.$buttons.find('.oe-pie-mode').click(function () {
             self.set_mode.bind(self)('pie');
         });
+        this.$buttons.find('.fa-expand').click(this.swap_axis.bind(this));
+        this.$buttons.find('.fa-arrows-alt').click(function () {
+            self.pivot.expand_all().then(self.proxy('display_data'));
+        });
+        this.$buttons.find('.fa-download').click(this.export_xls.bind(this));
 
         var indexes = {'pivot': 0, 'bar': 1, 'line': 2, 'chart': 3};
-        this.$('.graph_mode_selection label').eq(indexes[this.mode]).addClass('active');
+        this.$('.graph_mode_selection label').eq(indexes[this.mode]).addClass('selected');
 
         if (this.mode !== 'pivot') {
             this.$('.graph_heatmap label').addClass('disabled');
@@ -233,15 +233,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
         this.display_data();
     },
 
-    set_heatmap_mode: function (mode) { // none, row, col, all
-        this.heatmap_mode = mode;
-        if (mode === 'none') {
-            this.$('.graph_heatmap label').removeClass('disabled');
-            this.$('.graph_heatmap label').removeClass('active');
-        }
-        this.display_data();
-    },
-
     create_field_value: function (f) {
         var field = (_.contains(f, ':')) ? f.split(':')[0] : f,
             groupby_field = _.findWhere(this.groupby_fields, {field:field}),
@@ -303,10 +294,10 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
     put_measure_checkmarks: function () {
         var self = this,
             measures_li = this.$measure_list.find('li');
-        measures_li.removeClass('active');
+        measures_li.removeClass('selected');
         _.each(this.measure_list, function (measure, index) {
             if (_.findWhere(self.pivot.measures, measure)) {
-                measures_li.eq(index).addClass('active');
+                measures_li.eq(index).addClass('selected');
             }
         });
 
@@ -330,17 +321,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
         }
     },
 
-    heatmap_mode_selection: function (event) {
-        event.preventDefault();
-        var mode = event.currentTarget.getAttribute('data-mode');
-        if (this.heatmap_mode === mode) {
-            event.stopPropagation();
-            this.set_heatmap_mode('none');
-        } else {
-            this.set_heatmap_mode(mode);
-        }
-    },
-
     header_cell_clicked: function (event) {
         event.preventDefault();
         event.stopPropagation();
@@ -518,14 +498,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
         var formatted_value = raw && !_.isUndefined(value) ? value : openerp.web.format_value(value, {type:this.pivot.measures[index].type}),
             cell = {value:formatted_value};
 
-        if (this.heatmap_mode === 'none') { return cell; }
-        var total = (this.heatmap_mode === 'both') ? this.pivot.get_total()[index]
-                  : (this.heatmap_mode === 'row')  ? this.pivot.get_total(row)[index]
-                  : this.pivot.get_total(col)[index];
-        var color = Math.floor(90 + 165*(total - Math.abs(value))/total);
-        if (color < 255) {
-            cell.color = color;
-        }
         return cell;
     },
 
@@ -591,7 +563,6 @@ openerp.web_graph.Graph = openerp.web.Widget.extend({
         this.$('.graph_main_content svg').remove();
         this.$('.graph_main_content div').remove();
         this.table.empty();
-        this.table.toggleClass('heatmap', this.heatmap_mode !== 'none');
         this.$('.graph_options_selection label').last().toggleClass('disabled', this.pivot.no_data);
         this.width = this.$el.width();
         this.height = Math.min(Math.max(document.documentElement.clientHeight - 116 - 60, 250), Math.round(0.8*this.$el.width()));