rosa-build/app/assets/javascripts/angularjs/controllers/datepicker_controller.js.co...

63 lines
1.4 KiB
Plaintext
Raw Normal View History

2015-03-17 17:43:03 +00:00
DatePickerController = ($scope, datepickerPopupConfig) ->
vm = this
vm.minDate = new Date(2010, 1, 1)
vm.maxDate = moment().add(1, 'months').calendar()
vm.today = ->
vm.dt = new Date()
vm.today()
vm.clear = ->
dt = null
# Disable weekend selection
vm.disabled = (date, mode)->
mode is 'day' and ( date.getDay() is 0 or date.getDay() is 6 )
vm.toggleMin = ->
vm.minDate = vm.minDate ? null : new Date()
vm.toggleMin()
vm.open_updated_at_start = ($event)->
$event.preventDefault()
$event.stopPropagation()
vm.updated_at_start_opened = true
vm.open_updated_at_end = ($event)->
$event.preventDefault()
$event.stopPropagation()
vm.updated_at_end_opened = true
vm.dateOptions =
formatYear: 'yy'
startingDay: <%= I18n.locale == :ru ? 1 : 0 %>
'show-weeks': false
vm.initDate = vm.today()
2015-03-18 10:34:16 +00:00
vm.format = 'dd/MM/yyyy'
2015-03-17 17:43:03 +00:00
<% if I18n.locale == :ru %>
# TRANSLATION
datepickerPopupConfig.currentText = 'Сегодня'
datepickerPopupConfig.clearText = 'Очистить'
datepickerPopupConfig.weeksText = 'Недели'
datepickerPopupConfig.closeText = 'Закрыть'
<% end %>
#datepickerPopupConfig.appendToBody = 'true'
2016-04-29 15:10:30 +01:00
return vm
2015-03-17 17:43:03 +00:00
angular
.module("RosaABF")
.controller "DatePickerController", DatePickerController
DatePickerController.$inject = [
'$scope'
]