diff --git a/Gemfile.lock b/Gemfile.lock index c12e50bed..15fff0c49 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -315,6 +315,3 @@ DEPENDENCIES twitter (~> 5.13.0) uglifier writeexcel - -BUNDLED WITH - 1.10.5 diff --git a/app/assets/javascripts/app/controllers/calendar.js.coffee b/app/assets/javascripts/app/controllers/calendar.js.coffee index d794b2d0e..0ef6e17e0 100644 --- a/app/assets/javascripts/app/controllers/calendar.js.coffee +++ b/app/assets/javascripts/app/controllers/calendar.js.coffee @@ -3,6 +3,37 @@ class Index extends App.ControllerContent 'click .js-new': 'newDialog' 'click .js-description': 'description' + hours: { + mon: { + active: true + timeframes: ['09:00-17:00'] + } + tue: { + active: true + timeframes: ['00:00-24:00'] + } + wed: { + active: true + timeframes: ['09:00-17:00'] + } + thu: { + active: true + timeframes: ['09:00-12:00', '13:00-17:00'] + } + fri: { + active: true + timeframes: ['09:00-17:00'] + } + sat: { + active: false + timeframes: ['10:00-14:00'] + } + sun: { + active: false + timeframes: ['10:00-14:00'] + } + } + constructor: -> super @@ -50,7 +81,6 @@ class Index extends App.ControllerContent App.Calendar.unsubscribe(@subscribeId) newDialog: => - console.log('NEW') @newItemModal = new App.ControllerModal large: true head: 'New Calendar' @@ -60,10 +90,12 @@ class Index extends App.ControllerContent cancel: true container: @el.closest('.content') onComplete: => - @$('.js-responseTime').timepicker - maxHours: 99 - @$('.js-time').timepicker - showMeridian: true # show am/pm + businessHours = new App.BusinessHours + hours: @hours + + businessHours.render() + + @el.closest('.content').find('.js-business-hours').html(businessHours.el) description: (e) => new App.ControllerGenericDescription( diff --git a/app/assets/javascripts/app/controllers/layout_ref.js.coffee b/app/assets/javascripts/app/controllers/layout_ref.js.coffee index 83e07e538..597771192 100644 --- a/app/assets/javascripts/app/controllers/layout_ref.js.coffee +++ b/app/assets/javascripts/app/controllers/layout_ref.js.coffee @@ -1333,7 +1333,7 @@ class slaRef extends App.ControllerContent @$('.js-responseTime').timepicker maxHours: 99 @$('.js-time').timepicker - showMeridian: true # show am/pm + showMeridian: true # meridian = am/pm App.Config.set( 'layout_ref/sla', slaRef, 'Routes' ) diff --git a/app/assets/javascripts/app/lib/app_post/business_hours.js.coffee b/app/assets/javascripts/app/lib/app_post/business_hours.js.coffee new file mode 100644 index 000000000..47f5290cf --- /dev/null +++ b/app/assets/javascripts/app/lib/app_post/business_hours.js.coffee @@ -0,0 +1,36 @@ +class App.BusinessHours extends Spine.Controller + + className: 'settings-list settings-list--stretch settings-list--toggleColumn' + tag: 'table' + + events: + 'click .js-activateColumn': 'activateColumn' + + constructor: -> + super + + render: => + days = + mon: App.i18n.translateInline('Monday') + tue: App.i18n.translateInline('Tuesday') + wed: App.i18n.translateInline('Wednesday') + thu: App.i18n.translateInline('Thursday') + fri: App.i18n.translateInline('Friday') + sat: App.i18n.translateInline('Saturday') + sun: App.i18n.translateInline('Sunday') + + html = App.view('generic/business_hours') + days: days + hours: @options.hours + + console.log "BusinessHours:", "days", days, "hours", @options.hours, "html", html + + @html html + + @$('.js-time').timepicker + showMeridian: false # meridian = am/pm + + activateColumn: (event) => + checkbox = @$(event.currentTarget) + columnName = checkbox.attr('data-target') + @$("[data-column=#{columnName}]").toggleClass('is-active', checkbox.prop('checked')) diff --git a/app/assets/javascripts/app/views/calendar/new.jst.eco b/app/assets/javascripts/app/views/calendar/new.jst.eco index 92e5a05c9..41fbe2e3c 100644 --- a/app/assets/javascripts/app/views/calendar/new.jst.eco +++ b/app/assets/javascripts/app/views/calendar/new.jst.eco @@ -562,89 +562,7 @@
- - | - - | - - | - - | - - | - - | - - |
---|---|---|---|---|---|---|
- - - - - - | - - - - - - | - - - - - - | - - - - - - | - - - - - - | - - - - - - | - - - - - |
- <%- @Icon('plus') %> - | - <%- @Icon('plus') %> - | - <%- @Icon('plus') %> - | - <%- @Icon('plus') %> - | - <%- @Icon('plus') %> - | - <%- @Icon('plus') %> - | - <%- @Icon('plus') %> - |