Skip to content

Commit

Permalink
Set reminders of any type
Browse files Browse the repository at this point in the history
  • Loading branch information
raimund-schluessler committed May 6, 2014
1 parent b4d84ff commit 6cdfb6c
Show file tree
Hide file tree
Showing 14 changed files with 785 additions and 104 deletions.
22 changes: 21 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,7 @@
padding: 9px 20px 9px 55px;
position: relative;
text-shadow: 0 1px 0 white;
border-top: none;
}
#task-details .body .section input {
-moz-box-sizing: border-box;
Expand All @@ -842,7 +843,8 @@
border-radius: 0px;
border: 1px solid #CCC;
padding: 0;
width: 100px;
width: 98px;
margin: 0;
font-weight: normal;
}
#task-details .body .section .icon {
Expand All @@ -867,6 +869,14 @@
#task-details .body .section .icon.detail-start {
background-position: -220px -80px;
}
#task-details .body .section .icon.detail-remindertype {
display: none;
left: 38px;
opacity: 0.4;
}
#task-details .body .section .icon.detail-remindertype:hover {
opacity: 0.8;
}
#task-details .body .section .section-title {
color: #9FA2A6;
font-weight: bold;
Expand Down Expand Up @@ -904,6 +914,12 @@
#task-details .body .section.date .section-title.repeat {
margin-top: -2px;
}
#task-details .body .section.editing .icon.detail-remindertype {
display: block;
}
#task-details .body .section .icon.detail-remindertype {
background-position: -260px -40px;
}
#task-details .body .section.detail-reminder .section-description {
display: none;
font-size: 11px;
Expand Down Expand Up @@ -943,6 +959,10 @@ input.datepicker-input {
input.timepicker-input {
width: 80px;
}
input.duration-input {
margin: 2px 0 0 0.3em;
width: 35px;
}
.ui-widget-content {
background: none repeat scroll 0 0 #F9F9F9;
border-radius: 4px 4px 4px 4px;
Expand Down
24 changes: 23 additions & 1 deletion css/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@
padding: 9px 20px 9px 55px;
position: relative;
text-shadow: 0 1px 0 white;
border-top:none;
input{
-moz-box-sizing: border-box;
background: none repeat scroll 0 0 white;
Expand All @@ -876,7 +877,8 @@
border-radius: 0px;
border: 1px solid #CCC;
padding:0;
width: 100px;
width: 98px;
margin:0;
font-weight: normal;
}
.icon{
Expand All @@ -899,6 +901,14 @@
&.detail-date, &.detail-start {
background-position: -220px -80px;
}
&.detail-remindertype{
display: none;
left: 38px;
opacity: 0.4;
&:hover{
opacity: 0.8;
}
}
}
.section-title{
color: #9FA2A6;
Expand Down Expand Up @@ -941,6 +951,14 @@
}
}
}
&.editing{
.icon.detail-remindertype{
display: block;
}
}
.icon.detail-remindertype{
background-position: -260px -40px;
}
&.detail-reminder{
.section-description{
display: none;
Expand Down Expand Up @@ -992,6 +1010,10 @@ input.datepicker-input{
input.timepicker-input{
width: 80px;
}
input.duration-input{
margin: 2px 0 0 0.3em;
width: 35px;
}
.ui-widget-content{
color: #423E3E;
background: none repeat scroll 0 0 #F9F9F9;
Expand Down
74 changes: 56 additions & 18 deletions img/sprites.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 74 additions & 11 deletions js/app/controllers/detailscontroller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,64 @@ $timeout, $routeParams) ->
)

@_$scope.durations = [
{name: t('tasks_enhanced','years'), abbr: 'y'},
{name: t('tasks_enhanced','months'), abbr: 'm'},
{name: t('tasks_enhanced','days'), abbr: 'd'},
{name: t('tasks_enhanced','hours'), abbr: 'h'},
{name: t('tasks_enhanced','minutes'), abbr: 'i'},
{name: t('tasks_enhanced','seconds'), abbr: 's'}
{
name: t('tasks_enhanced','week'),
names: t('tasks_enhanced','weeks'),
id: 'week'},
{
name: t('tasks_enhanced','day'),
names: t('tasks_enhanced','days'),
id: 'day'},
{
name: t('tasks_enhanced','hour'),
names: t('tasks_enhanced','hours'),
id: 'hour'},
{
name: t('tasks_enhanced','minute'),
names: t('tasks_enhanced','minutes'),
id: 'minute'},
{
name: t('tasks_enhanced','second'),
names: t('tasks_enhanced','seconds'),
id: 'second'}
]

@_$scope.duration = _$scope.durations[1]
@_$scope.params = (task) ->
params = [
{
name: t('tasks_enhanced','before beginning'),
invert: true
related:'START',
id: "10"},
{
name: t('tasks_enhanced','after beginning'),
invert: false
related:'START',
id: "00"},
{
name: t('tasks_enhanced','before end'),
invert: true
related:'END',
id: "11"},
{
name: t('tasks_enhanced','after end'),
invert: false
related:'END',
id: "01"}
]
if task.due && task.start
return params
else if task.start
return params.slice(0,2)
else
return params.slice(2)

@_$scope.closeDetails = () ->
if _$scope.status.searchActive
_$location.path('/search/'+_$scope.route.searchString)
else
_$location.path('/lists/'+_$scope.route.listID)


@_$scope.deleteTask = (taskID) ->
_$scope.closeDetails()
_$timeout(() ->
Expand All @@ -76,6 +117,7 @@ $timeout, $routeParams) ->
else
_$location.path('/lists/'+_$scope.route.listID +
'/tasks/' + _$scope.route.taskID + '/edit/duedate')
_tasksbusinesslayer.initDueDate(_$scope.route.taskID)

@_$scope.editStart = () ->
if _$scope.status.searchActive
Expand All @@ -84,6 +126,7 @@ $timeout, $routeParams) ->
else
_$location.path('/lists/'+_$scope.route.listID +
'/tasks/' + _$scope.route.taskID + '/edit/startdate')
_tasksbusinesslayer.initStartDate(_$scope.route.taskID)

@_$scope.editReminder = () ->
if _$scope.status.searchActive
Expand All @@ -92,6 +135,7 @@ $timeout, $routeParams) ->
else
_$location.path('/lists/'+_$scope.route.listID +
'/tasks/' + _$scope.route.taskID + '/edit/reminder')
_tasksbusinesslayer.initReminder(_$scope.route.taskID)

@_$scope.editNote = () ->
if _$scope.status.searchActive
Expand Down Expand Up @@ -182,23 +226,42 @@ $timeout, $routeParams) ->
moment(date,'HH:mm'),'time')

@_$scope.setreminderday = (date) ->
_tasksbusinesslayer.setReminder(_$scope.route.taskID,
_tasksbusinesslayer.setReminderDate(_$scope.route.taskID,
moment(date,'MM/DD/YYYY'),'day')

@_$scope.setremindertime = (date) ->
_tasksbusinesslayer.setReminder(_$scope.route.taskID,
_tasksbusinesslayer.setReminderDate(_$scope.route.taskID,
moment(date,'HH:mm'),'time')

@_$scope.reminderType = (task) ->
if !angular.isUndefined(task)
if task.reminder == null
if moment(task.start, "YYYYMMDDTHHmmss").isValid()
if moment(task.start, "YYYYMMDDTHHmmss").isValid() ||
moment(task.due, "YYYYMMDDTHHmmss").isValid()
return 'DURATION'
else
return 'DATE-TIME'
else
return task.reminder.type

@_$scope.changeReminderType = (task) ->
_tasksbusinesslayer.checkReminderDate(task.id)
if @reminderType(task) == 'DURATION'
if task.reminder
task.reminder.type = 'DATE-TIME'
else
task.reminder = {type:'DATE-TIME'}
else
if task.reminder
task.reminder.type = 'DURATION'
else
task.reminder = {type:'DURATION'}
_tasksbusinesslayer.setReminder(task.id)


@_$scope.setReminderDuration = (taskID) ->
_tasksbusinesslayer.setReminder(_$scope.route.taskID)

return new DetailsController($scope, $window, TasksModel,
TasksBusinessLayer, $route, $location, $timeout, $routeParams)
]
31 changes: 25 additions & 6 deletions js/app/filters/reminderDetails.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,34 @@ angular.module('Tasks').filter 'reminderDetails', () ->
if reminder.type == 'DATE-TIME' &&
moment(reminder.date, "YYYYMMDDTHHmmss").isValid()
return moment(reminder.date, "YYYYMMDDTHHmmss").lang('reminder').calendar()
else if reminder.type == 'DURATION'
else if reminder.type == 'DURATION' && reminder.duration
ds = t('tasks_enhanced', 'Remind me')
for token in scope.durations
if reminder.duration[token.abbr]
ds+=' '+reminder.duration[token.abbr]+' '+t('tasks_enhanced',token.name)
if reminder.duration.invert
ds+= ' '+t('tasks_enhanced','before')
if +reminder.duration[token.id]
time = 1
ds+=' '+reminder.duration[token.id]+' '
if +reminder.duration[token.id] == 1
ds+=token.name
else
ds+=token.names
if !time
if reminder.duration.params.related == 'END'
ds+= ' '+t('tasks_enhanced','at the end')
else
ds+= ' '+t('tasks_enhanced','at the beginning')
else
ds+= ' '+t('tasks_enhanced','after')
if reminder.duration.params.invert
if reminder.duration.params.related == 'END'
ds+= ' '+t('tasks_enhanced','before end')
else
ds+= ' '+t('tasks_enhanced','before beginning')
else
if reminder.duration.params.related == 'END'
ds+= ' '+t('tasks_enhanced','after end')
else
ds+= ' '+t('tasks_enhanced','after beginning')
return ds
else
return t('tasks_enhanced', 'Remind me')
else
return t('tasks_enhanced', 'Remind me')
Loading

0 comments on commit 6cdfb6c

Please sign in to comment.