Fix bug #930: on front

stable
Jesús Espino 2014-09-10 18:06:38 +02:00
parent 7ea37decfb
commit 8f2cb309b3
2 changed files with 18 additions and 6 deletions

View File

@ -81,20 +81,30 @@ module.directive("tgSprintProgressbar", SprintProgressBarDirective)
DateSelectorDirective =->
link = ($scope, $el, $attrs, $model) ->
$.selectedDate = null
selectedDate = null
$el.picker = new Pikaday({
field: $el[0]
format: "DD MMM YYYY"
onSelect: (date) =>
$.selectedDate = date
selectedDate = date
onOpen: =>
$el.picker.setDate($.selectedDate) if $.selectedDate?
$el.picker.setDate(selectedDate) if selectedDate?
})
if $attrs.greaterThan
$scope.$watch $attrs.greaterThan, (val) ->
console.log "HOLA"
console.log val
$el.picker.setMinDate(moment(val))
if $attrs.lessThan
$scope.$watch $attrs.lessThan, (val) ->
$el.picker.setMaxDate(moment(val))
$scope.$on "sprints:loaded", (ctx, sprints) =>
if sprints.length > 0
estimatedStart = sprints[0].estimated_finish
$.selectedDate = estimatedStart
selectedDate = estimatedStart
$el.val(moment(estimatedStart).format("DD MMM YYYY"))
$el.picker.setDate(estimatedStart)

View File

@ -10,10 +10,12 @@ form
fieldset.dates
div
input.date-start(type="text", name="estimated_start", placeholder="Estimated Start",
ng-model="sprint.estimated_start", data-required="true", tg-date-selector)
ng-model="sprint.estimated_start", data-required="true", tg-date-selector,
less-than="sprint.estimated_finish")
div
input.date-end(type="text", name="estimated_finish", placeholder="Estimated End",
ng-model="sprint.estimated_finish", data-required="true", tg-date-selector)
ng-model="sprint.estimated_finish", data-required="true", tg-date-selector
greater-than="sprint.estimated_start")
a.button.button-green(href="", title="Save")
span Create