diff --git a/addons/calendar/static/src/css/calendar.css b/addons/calendar/static/src/css/calendar.css deleted file mode 100644 index 6d7dbe9f9b7..00000000000 --- a/addons/calendar/static/src/css/calendar.css +++ /dev/null @@ -1,89 +0,0 @@ -.openerp .oe_invitation , .text-core .text-tag .oe_invitation{ - width : 13px; - height : 13px; - margin-bottom : -4px; - display : inline-block; -} -.openerp .needsAction , .tentative,.text-core .text-tag .custom-edit, .text-core .text-tag .tentative { - background : url(/web/static/src/img/icons/gtk-normal.png) no-repeat; - background-size : 11px 11px; -} -.openerp .accepted , .text-core .text-tag .accepted { - background : url(/web/static/src/img/icons/gtk-yes.png) no-repeat; - background-size : 11px 11px; -} -.openerp .declined , .text-core .text-tag .declined { - background : url(/web/static/src/img/icons/gtk-no.png) no-repeat; - background-size : 11px 11px; -} -.openerp a.oe_invitation { - cursor:default !important; -} -.cal_meeting { - font-size : 24px; - font-style: bold; - text-align : justify; - color : #8A89BA; -} -.cal_lable { - width: 50px; - color : #808080; -} -.invitation_block { - padding : 50px 0 0 30px; - font-size : 14px; - background : #f9f9f9; -} -.attendee_accepted { - background : url(/web/static/src/img/icons/gtk-apply.png) no-repeat; - background-size : 15px 15px; - padding-left: 20px; -} -.attendee_declined { - background : url(/web/static/src/img/icons/gtk-cancel.png) no-repeat; - background-size : 15px 15px; - padding-left: 20px; -} -.event_status { - border : 1px solid; - height : 20px; - width : auto; - background: #808080; - color : #FFFFFF; - padding: 5px 10px; - width: 400px; -} -.cal_inline { - display: inline; -} -.cal_tag { - padding-right : 10px; - font-style : italic; - font-size : 17px; - vertical-align:bottom; -} -.cal_image { - height: 30px; - width : 100px; -} -span.no-wrap { - white-space:nowrap -} -.cal_tab { - margin: 20 0 20 0; -} -.openerp .oe_remove_follower { - cursor: pointer; - position: absolute; - right: 0px; - line-height: 20px; - color: #D3D3D3; -} -.openerp .oe_add_input_box > div > input{ - width: 200px; -} -.openerp .oe_add_input_box > div > .oe_m2o_drop_down_button { - position: relative; - top: 0px; - right: 20px; -} diff --git a/addons/calendar/static/src/js/base_calendar.js b/addons/calendar/static/src/js/base_calendar.js index 2120b14d0da..8021d0e5914 100644 --- a/addons/calendar/static/src/js/base_calendar.js +++ b/addons/calendar/static/src/js/base_calendar.js @@ -4,6 +4,7 @@ odoo.define('base_calendar.base_calendar', function (require) { var core = require('web.core'); var CalendarView = require('web_calendar.CalendarView'); var data = require('web.data'); +var Dialog = require('web.Dialog'); var form_common = require('web.form_common'); var Model = require('web.DataModel'); var Notification = require('web.notification').Notification; @@ -23,7 +24,7 @@ function reload_favorite_list(result) { } new Model("res.users") .query(["partner_id"]) - .filter([["id", "=",self.dataset.context.uid]]) + .filter([["id", "=", self.dataset.context.uid]]) .first() .done(function(result) { var sidebar_items = {}; @@ -36,8 +37,8 @@ function reload_favorite_list(result) { is_checked: true, is_remove: false, }; - - sidebar_items[0] = filter_item ; + sidebar_items[filter_value] = filter_item ; + filter_item = { value: -1, label: _lt("Everybody's calendars"), @@ -64,8 +65,7 @@ function reload_favorite_list(result) { self.sidebar.filter.events_loaded(self.all_filters); self.sidebar.filter.set_filters(); - self.sidebar.filter.set_distroy_filters(); - self.sidebar.filter.addInputBox(); + self.sidebar.filter.add_favorite_calendar(); self.sidebar.filter.destroy_filter(); }).done(function () { self.$calendar.fullCalendar('refetchEvents'); @@ -77,25 +77,16 @@ function reload_favorite_list(result) { } CalendarView.include({ - extraSideBar: function(){ + extraSideBar: function() { this._super(); - if (this.useContacts){ - new reload_favorite_list(this); + if (this.useContacts) { + reload_favorite_list(this); } } }); widgets.SidebarFilter.include({ - set_distroy_filters: function() { - var self = this; - // When mouse-enter the favorite list it will show the 'X' for removing partner from the favorite list. - if (self.view.useContacts){ - self.$('.oe_calendar_all_responsibles').on('mouseenter mouseleave', function(e) { - self.$('.oe_remove_follower').toggleClass('hidden', e.type == 'mouseleave'); - }); - } - }, - addInputBox: function() { + add_favorite_calendar: function() { var self = this; if (this.dfm) return; @@ -108,14 +99,14 @@ widgets.SidebarFilter.include({ var FieldMany2One = core.form_widget_registry.get('many2one'); this.ir_model_m2o = new FieldMany2One(self.dfm, { attrs: { - class: 'oe_add_input_box', + class: 'o_add_favorite_calendar', name: "partner_id", type: "many2one", options: '{"no_open": True}', placeholder: _t("Add Favorite Calendar"), }, }); - this.ir_model_m2o.insertAfter($('div.oe_calendar_filter')); + this.ir_model_m2o.appendTo(this.$el); this.ir_model_m2o.on('change:value', self, function() { self.add_filter(); }); @@ -134,18 +125,22 @@ widgets.SidebarFilter.include({ } }); }); - new reload_favorite_list(this); + reload_favorite_list(this); }, destroy_filter: function(e) { - var self= this; + var self = this; this.$(".oe_remove_follower").on('click', function(e) { self.ds_message = new data.DataSetSearch(self, 'calendar.contacts'); - if (! confirm(_t("Do you really want to delete this filter from favorite?"))) { return false; } var id = $(e.currentTarget)[0].dataset.id; - self.ds_message.call('search', [[['partner_id', '=', parseInt(id)]]]).then(function(record){ - return self.ds_message.unlink(record); - }).done(function() { - new reload_favorite_list(self); + + Dialog.confirm(self, _t("Do you really want to delete this filter from favorite?"), { + confirm_callback: function() { + self.ds_message.call('search', [[['partner_id', '=', parseInt(id)]]]).then(function(record) { + return self.ds_message.unlink(record); + }).done(function() { + reload_favorite_list(self); + }); + }, }); }); }, diff --git a/addons/calendar/static/src/less/calendar.less b/addons/calendar/static/src/less/calendar.less new file mode 100644 index 00000000000..b531a583145 --- /dev/null +++ b/addons/calendar/static/src/less/calendar.less @@ -0,0 +1,62 @@ +.openerp { + .oe_invitation { + width : 13px; + height : 13px; + margin-bottom : -4px; + display : inline-block; + } + a.oe_invitation { + cursor: default!important; + } + .needsAction { + background : url(/web/static/src/img/icons/gtk-normal.png) no-repeat; + background-size : 11px 11px; + } + .accepted { + background : url(/web/static/src/img/icons/gtk-yes.png) no-repeat; + background-size : 11px 11px; + } + .declined { + background : url(/web/static/src/img/icons/gtk-no.png) no-repeat; + background-size : 11px 11px; + } +} + +.o_calendar_invitation { + display: inline-block; + width: 10px; + height: 10px; + border-radius: 5px; + + &.accepted { + background-color: @brand-success; + } + + &.needsAction { + background-color: @odoo-brand-secondary; + } +} + +.o_calendar_all_responsibles { + .o_calendar_responsible { + margin-top: 10px; + } + + .oe_remove_follower { + display: none; + cursor: pointer; + } + &:hover .oe_remove_follower { + display: inline-block; + } +} + +.o_cal_avatar { + height: 24px; + width: 24px; +} + +.o_add_favorite_calendar { + margin-top: 10px; + position: relative; +} diff --git a/addons/calendar/static/src/xml/base_calendar.xml b/addons/calendar/static/src/xml/base_calendar.xml index 14652960b40..08bc9481290 100644 --- a/addons/calendar/static/src/xml/base_calendar.xml +++ b/addons/calendar/static/src/xml/base_calendar.xml @@ -20,55 +20,11 @@ - -
-
()
-
- -
-
-
-

Calendar Invitation

- - - Yes I'm going. - No I'm not going. - - -

-
-
- - - - - - - - - - - - - -
When
Where
Who - -
- -
-
-
-
-
-
-
- -