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') %> -
-
+
diff --git a/app/assets/javascripts/app/views/generic/business_hours.jst.eco b/app/assets/javascripts/app/views/generic/business_hours.jst.eco new file mode 100644 index 000000000..157a472f8 --- /dev/null +++ b/app/assets/javascripts/app/views/generic/business_hours.jst.eco @@ -0,0 +1,75 @@ + + + <% for id, day of @days: %> + + + <% end %> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <%- @Icon('plus-small') %> + + <%- @Icon('plus-small') %> + + <%- @Icon('plus-small') %> + + <%- @Icon('plus-small') %> + + <%- @Icon('plus-small') %> + + <%- @Icon('plus-small') %> + + <%- @Icon('plus-small') %> + + \ No newline at end of file diff --git a/app/assets/stylesheets/zammad.css.scss b/app/assets/stylesheets/zammad.css.scss index 4d89ad742..dc3921817 100644 --- a/app/assets/stylesheets/zammad.css.scss +++ b/app/assets/stylesheets/zammad.css.scss @@ -630,6 +630,11 @@ table { justify-content: center; } +.checkbox-replacement.checkbox-replacement--inline, +.radio-replacement.radio-replacement--inline { + display: inline-flex; +} + .checkbox-replacement input, .checkbox-replacement input:not(:checked) ~ .icon-checked, .checkbox-replacement input:checked ~ .icon-unchecked, @@ -810,8 +815,10 @@ label, display: inline; white-space: nowrap; /* for labels in tables that might get crushed view: calendar_subscriptions */ } -.inline-label .label-text { +.label-text { margin-left: 3px; + user-select: none; + cursor: pointer; } fieldset { @@ -5799,7 +5806,8 @@ output { } .form-group.day-time { - padding: 5px 5px 4px; + padding: 10px 5px 6px; + margin: 0; label { text-align: center; @@ -5808,7 +5816,7 @@ output { .form-control { margin-left: auto; margin-right: auto; - margin-bottom: 5px; + margin-bottom: 8px; } } @@ -5908,9 +5916,8 @@ output { .settings-list-action-cell { @extend .u-clickable; text-align: center; - padding-top: 7px; - padding-bottom: 7px; background: hsl(197,22%,96%); + line-height: 1; &:hover { .icon {