From 659993a14ccb4701781ab3a1ff48685db2377480 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 9 Sep 2015 11:58:38 +0200 Subject: [PATCH] Added calendar new demo screen. --- .../app/controllers/calendar.js.coffee | 18 +- app/assets/javascripts/app/index.js.coffee | 8 + .../javascripts/app/views/calendar.jst.eco | 12 +- .../app/views/calendar/new.jst.eco | 715 ++++++++++++++++++ 4 files changed, 747 insertions(+), 6 deletions(-) create mode 100644 app/assets/javascripts/app/views/calendar/new.jst.eco diff --git a/app/assets/javascripts/app/controllers/calendar.js.coffee b/app/assets/javascripts/app/controllers/calendar.js.coffee index bac061ffa..19fcc39b2 100644 --- a/app/assets/javascripts/app/controllers/calendar.js.coffee +++ b/app/assets/javascripts/app/controllers/calendar.js.coffee @@ -1,4 +1,6 @@ class Index extends App.ControllerContent + events: + 'click .js-new': 'newDialog' constructor: -> super @@ -16,7 +18,7 @@ class Index extends App.ControllerContent public_holidays_preview = {} if calendar.public_holidays from = new Date().setTime(new Date().getTime() - (5*24*60*60*1000)) - till = new Date().setTime(new Date().getTime() + (90*24*60*60*1000)) + till = new Date().setTime(new Date().getTime() + (70*24*60*60*1000)) keys = Object.keys(calendar.public_holidays).reverse() #for day, comment of calendar.public_holidays for day in keys @@ -33,5 +35,19 @@ class Index extends App.ControllerContent if @subscribeId App.Calendar.unsubscribe(@subscribeId) + newDialog: => + console.log('NEW') + @newItemModal = new App.ControllerModal + head: 'New Calendar' + content: App.view('calendar/new')() + button: 'Create' + shown: true + cancel: true + container: @el.closest('.content') + onComplete: => + @$('.js-responseTime').timepicker + maxHours: 99 + @$('.js-time').timepicker + showMeridian: true # show am/pm App.Config.set( 'Calendars', { prio: 2400, name: 'Calendars', parent: '#manage', target: '#manage/calendars', controller: Index, role: ['Admin'] }, 'NavBarAdmin' ) \ No newline at end of file diff --git a/app/assets/javascripts/app/index.js.coffee b/app/assets/javascripts/app/index.js.coffee index 9594524ad..4a32b39c7 100644 --- a/app/assets/javascripts/app/index.js.coffee +++ b/app/assets/javascripts/app/index.js.coffee @@ -182,6 +182,14 @@ class App extends Spine.Controller params.Ti = ( item, args... ) -> App.i18n.translateInline( item, args... ) + # define translation for date helper + params.Tdate = ( item, args... ) -> + App.i18n.translateDate( item, args... ) + + # define translation for timestamp helper + params.Ttimestamp = ( item, args... ) -> + App.i18n.translateTimestamp( item, args... ) + # define linkify helper params.L = ( item ) -> if item && typeof item is 'string' diff --git a/app/assets/javascripts/app/views/calendar.jst.eco b/app/assets/javascripts/app/views/calendar.jst.eco index b461fa03a..b56e57595 100644 --- a/app/assets/javascripts/app/views/calendar.jst.eco +++ b/app/assets/javascripts/app/views/calendar.jst.eco @@ -4,7 +4,7 @@
- <%- @T('New Calendar') %> + <%- @T('New Calendar') %>
@@ -12,12 +12,12 @@
-

<%= calendar.name %>

+

<%- @Icon('status', 'ok inline') %> <%= calendar.name %>

<%- @T('Timezone') %>: <%= calendar.timezone %>
<%- @T('Business Hours') %>:
- +
@@ -42,10 +42,12 @@
<%- @T('Monday') %><% if _.isEmpty(calendar.business_hours['mon']): %>-<% else: %><% for from, till of calendar.business_hours['mon']: %><%= from %>:<%= till %> <% end %><% end %>
- <%- @T('Public Holidays') %>:
+ <%- @T('Public Holidays') %>: + <% for holiday, meta of calendar.public_holidays_preview: %> - <%= holiday %>: <%= meta.summary %>
+ class="is-inactive"<% end %>> <% end %> +
<%- @Tdate(holiday) %><%= meta.summary %>
diff --git a/app/assets/javascripts/app/views/calendar/new.jst.eco b/app/assets/javascripts/app/views/calendar/new.jst.eco new file mode 100644 index 000000000..81a6e37a0 --- /dev/null +++ b/app/assets/javascripts/app/views/calendar/new.jst.eco @@ -0,0 +1,715 @@ + +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + +
+
+ +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ <%- @T('Day') %> + + <%- @T('From/Till') %> + + <%- @T('From/Till') %> +
<%- @T('Monday') %> + + + + + +
<%- @T('Tuesday') %> + + + + + +
<%- @T('Wednesday') %> + + + + + +
<%- @T('Thursday') %> + + + + + +
<%- @T('Friday') %> + + + + + +
<%- @T('Saturday') %> + + + + + +
<%- @T('Sunday') %> + + + + + +
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ + + + + + + + + + + + +
<%- @T('Date') %> + <%- @T('Description') %> + <%- @T('Action') %> +
<%- @Tdate('2015-12-24') %> + Some Description + <%- @Icon('diagonal-cross') %> +
<%- @Tdate('2015-12-25') %> + Some Description + <%- @Icon('diagonal-cross') %> +
<%- @Tdate('2015-12-26') %> + Some Description + ICON FOR ENABLE? +
<%- @T('Add manual hollidays') %>: +
+ + <%- @Icon('plus') %> + +
+
+
+ +
+
+ +
+
+ +
+