mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 14:47:53 +01:00
Cleaned up task.jade file:
- moved ugly html newlines into the stylesheet - renamed temporary var for datePicker’s ngmodel from _dateString to _tempDateForPicker - renamed open -> openDatePicker, and have the function track datePicker’s open/closed state on a per task instead of global basis
This commit is contained in:
@@ -60,6 +60,7 @@
|
|||||||
"clearTags": "Clear",
|
"clearTags": "Clear",
|
||||||
"hideTags": "Hide",
|
"hideTags": "Hide",
|
||||||
"showTags": "Show",
|
"showTags": "Show",
|
||||||
|
"startDate": "Start Date",
|
||||||
"streakName": "Streak Achievements",
|
"streakName": "Streak Achievements",
|
||||||
"streakText": "Has performed <%= streaks %> 21-day streaks on Dailies",
|
"streakText": "Has performed <%= streaks %> 21-day streaks on Dailies",
|
||||||
"streakSingular": "Streaker",
|
"streakSingular": "Streaker",
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ for $stage in $stages
|
|||||||
.color-{$stage[0]}:not(.completed)
|
.color-{$stage[0]}:not(.completed)
|
||||||
background-color: $stage[1]
|
background-color: $stage[1]
|
||||||
border: 1px solid shade($stage[1],10%)
|
border: 1px solid shade($stage[1],10%)
|
||||||
.priority-multiplier, .task-attributes, .repeat-days
|
.priority-multiplier, .task-attributes, .repeat-days, .repeat-frequency
|
||||||
li
|
li
|
||||||
hrpg-button-color-mixin($stage[1])
|
hrpg-button-color-mixin($stage[1])
|
||||||
button
|
button
|
||||||
@@ -63,7 +63,7 @@ for $stage in $stages
|
|||||||
color: darken($completed,30%)
|
color: darken($completed,30%)
|
||||||
background-color: $completed
|
background-color: $completed
|
||||||
border: 1px solid shade($completed,10%)
|
border: 1px solid shade($completed,10%)
|
||||||
.priority-multiplier, .task-attributes, .repeat-days
|
.priority-multiplier, .task-attributes, .repeat-days, .repeat-frequency
|
||||||
li
|
li
|
||||||
hrpg-button-color-mixin($completed)
|
hrpg-button-color-mixin($completed)
|
||||||
button
|
button
|
||||||
@@ -507,7 +507,7 @@ form
|
|||||||
|
|
||||||
form
|
form
|
||||||
padding-bottom: 1em
|
padding-bottom: 1em
|
||||||
.priority-multiplier, .task-attributes, .repeat-days
|
.priority-multiplier, .task-attributes, .repeat-days, .repeat-frequency
|
||||||
text-align: center
|
text-align: center
|
||||||
li
|
li
|
||||||
@extend $hrpg-button
|
@extend $hrpg-button
|
||||||
@@ -517,6 +517,7 @@ form
|
|||||||
&:last-of-type
|
&:last-of-type
|
||||||
margin-right: 0
|
margin-right: 0
|
||||||
.repeat-days
|
.repeat-days
|
||||||
|
padding-bottom: 1em
|
||||||
li
|
li
|
||||||
button
|
button
|
||||||
min-width: 2.5em
|
min-width: 2.5em
|
||||||
@@ -524,6 +525,11 @@ form
|
|||||||
text-align: center
|
text-align: center
|
||||||
@extend $hrpg-button
|
@extend $hrpg-button
|
||||||
|
|
||||||
|
// Dailies
|
||||||
|
.dailies
|
||||||
|
.repeat-weekly
|
||||||
|
padding-bottom: 1em
|
||||||
|
|
||||||
// Habits – task button styles (+ -)
|
// Habits – task button styles (+ -)
|
||||||
.habits
|
.habits
|
||||||
.task-actions
|
.task-actions
|
||||||
|
|||||||
@@ -4,10 +4,6 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||||||
function($scope, $rootScope, $location, User, Notification, $http, ApiUrl, $timeout, Shared, Guide) {
|
function($scope, $rootScope, $location, User, Notification, $http, ApiUrl, $timeout, Shared, Guide) {
|
||||||
$scope.obj = User.user; // used for task-lists
|
$scope.obj = User.user; // used for task-lists
|
||||||
$scope.user = User.user;
|
$scope.user = User.user;
|
||||||
// HACK: flagDict is for storing whether the datePicker popup is open or not. This should just be a boolean flag,
|
|
||||||
// but apparently due to angular bug need to put the bool in intermediate dict...
|
|
||||||
$scope.flagDict = {};
|
|
||||||
|
|
||||||
$scope.score = function(task, direction) {
|
$scope.score = function(task, direction) {
|
||||||
switch (task.type) {
|
switch (task.type) {
|
||||||
case 'reward':
|
case 'reward':
|
||||||
@@ -136,15 +132,18 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N
|
|||||||
------------------------
|
------------------------
|
||||||
*/
|
*/
|
||||||
$scope.updateTaskStartDate = function(task) {
|
$scope.updateTaskStartDate = function(task) {
|
||||||
// TODO: Weirdness here...startDate should be a Date and _dateString
|
/*
|
||||||
// should be a string, but the datePicker input fields sets _dateString
|
Keep startDate and _tempDateForPicker in sync. The reason for having both instead
|
||||||
// to a Date even though input type="text"...
|
of having startDate be the ngmodel for datePicker is that datePicker initializes with
|
||||||
task.startDate = task._dateString;
|
an incorrect format when given a Date for an ngmodel; instead we initialize _tempDate
|
||||||
|
to be a string that datePicker then converts to a Date, which lets us control the format.
|
||||||
|
*/
|
||||||
|
task.startDate = task._tempDateForPicker;
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.open = function($event) {
|
$scope.openDatePicker = function($event, task) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
$scope.flagDict['opened'] = !$scope.flagDict['opened'];
|
task._isDatePickerOpen = !task._isDatePickerOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ habitrpg
|
|||||||
task._editing = !task._editing;
|
task._editing = !task._editing;
|
||||||
task._tags = User.user.preferences.tagsCollapsed;
|
task._tags = User.user.preferences.tagsCollapsed;
|
||||||
task._advanced = User.user.preferences.advancedCollapsed;
|
task._advanced = User.user.preferences.advancedCollapsed;
|
||||||
task._dateString = moment(task.startDate).format('YYYY-MM-DD');
|
task._tempDateForPicker = moment(task.startDate).format('YYYY-MM-DD');
|
||||||
if($rootScope.charts[task.id]) $rootScope.charts[task.id] = false;
|
if($rootScope.charts[task.id]) $rootScope.charts[task.id] = false;
|
||||||
};
|
};
|
||||||
}],
|
}],
|
||||||
|
|||||||
@@ -164,34 +164,33 @@ li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s
|
|||||||
label(for='{{obj._id}}_{{task.id}}-option-minus')
|
label(for='{{obj._id}}_{{task.id}}-option-minus')
|
||||||
|
|
||||||
// if Daily, calendar
|
// if Daily, calendar
|
||||||
fieldset(ng-if='::task.type=="daily"', class="option-group")
|
fieldset.option-group.calendar(ng-if='::task.type=="daily"', class="option-group")
|
||||||
|
.dailies
|
||||||
legend.option-title=env.t('repeat')
|
legend.option-title=env.t('repeat')
|
||||||
|
|
||||||
// Choose the frequency
|
// Choose the frequency
|
||||||
ul.priority-multiplier
|
ul.repeat-frequency
|
||||||
li
|
li
|
||||||
button(ng-class='{active: task.frequency=="daily"}', type='button', ng-click='task.frequency="daily"')='Daily'
|
button(ng-class='{active: task.frequency=="daily"}', type='button', ng-click='task.frequency="daily"')='Daily'
|
||||||
li
|
li
|
||||||
button(ng-class='{active: task.frequency=="weekly"}', type='button', ng-click='task.frequency="weekly"')='Weekly'
|
button(ng-class='{active: task.frequency=="weekly"}', type='button', ng-click='task.frequency="weekly"')='Weekly'
|
||||||
|
|
||||||
// If frequency is daily
|
// If frequency is daily
|
||||||
fieldset(ng-show='task.frequency=="daily"')
|
div.repeat-frequency(ng-show='task.frequency=="daily"')
|
||||||
|
div.repeat-daily
|
||||||
| Once every
|
| Once every
|
||||||
select(ng-model='task.everyX')
|
select(ng-model='task.everyX')
|
||||||
option(ng-repeat='x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]') {{x}}
|
option(ng-repeat='x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]') {{x}}
|
||||||
| days<br><br>
|
| days
|
||||||
| Start date:
|
|
||||||
p(class='input-group')
|
|
||||||
input(type='text' class='form-control' datepicker-popup ng-model='task._dateString' ng-change='updateTaskStartDate(task)' is-open='flagDict.opened')
|
|
||||||
span(class='input-group-btn')
|
|
||||||
button(type="button" ng-click="open($event)")
|
|
||||||
span.input-group-addon.glyphicon.glyphicon-calendar
|
|
||||||
// If frequency is weekly
|
// If frequency is weekly
|
||||||
fieldset(ng-show='task.frequency=="weekly"')
|
div.repeat-frequency(ng-show='task.frequency=="weekly"')
|
||||||
|
div.repeat-weekly
|
||||||
| Once every
|
| Once every
|
||||||
select(ng-model='task.everyX')
|
select(ng-model='task.everyX')
|
||||||
option(ng-repeat='x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]') {{x}}
|
option(ng-repeat='x in [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]') {{x}}
|
||||||
| weeks on these days: <br><br>
|
| weeks on these days:
|
||||||
|
|
||||||
ul.repeat-days(bindonce)
|
ul.repeat-days(bindonce)
|
||||||
// note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding
|
// note, does not use data-toggle="buttons-checkbox" - it would interfere with our own click binding
|
||||||
li
|
li
|
||||||
@@ -208,12 +207,12 @@ li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s
|
|||||||
button(ng-class='{active: task.repeat.f}', type='button', ng-click='task.challenge.id || (task.repeat.f= !task.repeat.f)') {{::moment.weekdaysMin(5)}}
|
button(ng-class='{active: task.repeat.f}', type='button', ng-click='task.challenge.id || (task.repeat.f= !task.repeat.f)') {{::moment.weekdaysMin(5)}}
|
||||||
li
|
li
|
||||||
button(ng-class='{active: task.repeat.s}', type='button', ng-click='task.challenge.id || (task.repeat.s = !task.repeat.s)') {{::moment.weekdaysMin(6)}}
|
button(ng-class='{active: task.repeat.s}', type='button', ng-click='task.challenge.id || (task.repeat.s = !task.repeat.s)') {{::moment.weekdaysMin(6)}}
|
||||||
| <br><br>
|
|
||||||
| Start date:
|
label.option-title=env.t('startDate')
|
||||||
p(class='input-group')
|
p(class='input-group')
|
||||||
input(type='text' class='form-control' datepicker-popup ng-model='task._dateString' ng-change='updateTaskStartDate(task)' is-open='flagDict.opened')
|
input(type='text' class='form-control' datepicker-popup ng-model='task._tempDateForPicker' ng-change='updateTaskStartDate(task)' is-open='task._isDatePickerOpen')
|
||||||
span(class='input-group-btn')
|
span(class='input-group-btn')
|
||||||
button(type="button" ng-click="open($event)")
|
button(type="button" ng-click="openDatePicker($event, task)")
|
||||||
span.input-group-addon.glyphicon.glyphicon-calendar
|
span.input-group-addon.glyphicon.glyphicon-calendar
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user