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 @@
@@ -12,12 +12,12 @@
-
<%= calendar.name %>
+ <%- @Icon('status', 'ok inline') %> <%= calendar.name %>
<%- @T('Timezone') %>: <%= calendar.timezone %>
<%- @T('Business Hours') %>:
-
+
<%- @T('Monday') %> | <% if _.isEmpty(calendar.business_hours['mon']): %>-<% else: %><% for from, till of calendar.business_hours['mon']: %><%= from %>:<%= till %> | <% end %><% end %> |
@@ -42,10 +42,12 @@
- <%- @T('Public Holidays') %>:
+ <%- @T('Public Holidays') %>:
+
<% for holiday, meta of calendar.public_holidays_preview: %>
- <%= holiday %>: <%= meta.summary %>
+ class="is-inactive"<% end %>><%- @Tdate(holiday) %> | <%= meta.summary %> |
<% end %>
+
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 @@
+
+
+
+
+
+
+
+
+
+
+
+