Make it possible to choose between MM/dd and dd/MM date format

This commit is contained in:
Verabird 2014-12-24 22:18:50 -05:00
parent e391fc04f0
commit 7297429888
6 changed files with 20 additions and 5 deletions

View file

@ -65,6 +65,13 @@ habitrpg.controller('SettingsCtrl',
User.set({'preferences.language': $scope.language.code}); User.set({'preferences.language': $scope.language.code});
} }
$scope.availableFormats = ['MM/dd/yyyy','dd/MM/yyyy','yyyy/MM/dd'];
$scope.changeDateFormat = function(){
var dateFormat= User.user.preferences.dateFormat;
User.set({'preferences.dateFormat': dateFormat});
}
$scope.reroll = function(){ $scope.reroll = function(){
User.user.ops.reroll({}); User.user.ops.reroll({});
$rootScope.$state.go('tasks'); $rootScope.$state.go('tasks');

View file

@ -278,6 +278,7 @@ var UserSchema = new Schema({
automaticAllocation: Boolean, automaticAllocation: Boolean,
allocationMode: {type:String, enum: ['flat','classbased','taskbased'], 'default': 'flat'}, allocationMode: {type:String, enum: ['flat','classbased','taskbased'], 'default': 'flat'},
costume: Boolean, costume: Boolean,
dateFormat: {type: String, enum:['MM/dd/yyyy', 'dd/MM/yyyy', 'yyyy/MM/dd'], 'default': 'MM/dd/yyyy'},
sleep: {type: Boolean, 'default': false}, sleep: {type: Boolean, 'default': false},
stickyHeader: {type: Boolean, 'default': true}, stickyHeader: {type: Boolean, 'default': true},
disableClasses: {type: Boolean, 'default': false}, disableClasses: {type: Boolean, 'default': false},

View file

@ -36,6 +36,12 @@ script(type='text/ng-template', id='partials/options.settings.settings.html')
br br
strong strong
!=env.t('helpWithTranslation') !=env.t('helpWithTranslation')
.form-horizontal
h5=env.t('dateFormat')
select.form-control(ng-model='user.preferences.dateFormat', ng-options='DF for DF in availableFormats', ng-change='changeDateFormat()')
.checkbox .checkbox
label label
input(type='checkbox', ng-click='hideHeader() ', ng-checked='user.preferences.hideHeader!==true') input(type='checkbox', ng-click='hideHeader() ', ng-checked='user.preferences.hideHeader!==true')

View file

@ -14,7 +14,7 @@ mixin chatMessages(inbox)
// this invisible username label is here to push the message text far enough right that the visible label can be floated to this point without covering up any of the text // this invisible username label is here to push the message text far enough right that the visible label can be floated to this point without covering up any of the text
markdown(ng-model='::message.text') markdown(ng-model='::message.text')
| - | -
span.muted.time(from-now='::message.timestamp' tooltip="{{::message.timestamp | date:'short'}}") span.muted.time(from-now='::message.timestamp' tooltip="{{::message.timestamp | date:user.preferences.dateFormat.concat(' HH:mm:ss')}}")
unless inbox unless inbox
span span
a.label.label-default(ng-show='countExists(message.likes)', ng-class='{"label-success":message.likes[user._id]}', ng-click='likeChatMessage(group,message)') +{{countExists(message.likes)}} a.label.label-default(ng-show='countExists(message.likes)', ng-class='{"label-success":message.likes[user._id]}', ng-click='likeChatMessage(group,message)') +{{countExists(message.likes)}}

View file

@ -15,12 +15,12 @@ script(type='text/ng-template', id='modals/member.html')
|  | 
=env.t('memberSince') =env.t('memberSince')
|  | 
| {{::profile.auth.timestamps.created | date:env.t('mediumdate')}} - | {{::profile.auth.timestamps.created | date:user.preferences.dateFormat}} -
li(ng-show='::profile.auth.timestamps.loggedin') li(ng-show='::profile.auth.timestamps.loggedin')
|  | 
=env.t('lastLoggedIn') =env.t('lastLoggedIn')
|  | 
| {{::profile.auth.timestamps.loggedin | date:env.t('mediumdate')}} - | {{::profile.auth.timestamps.loggedin | date:user.preferences.dateFormat}} -
h3=env.t('stats') h3=env.t('stats')
.label.label-info {{:: {warrior:env.t("warrior"), wizard:env.t("mage"), rogue:env.t("rogue"), healer:env.t("healer")}[profile.stats.class] }} .label.label-info {{:: {warrior:env.t("warrior"), wizard:env.t("mage"), rogue:env.t("rogue"), healer:env.t("healer")}[profile.stats.class] }}
include ../profiles/stats include ../profiles/stats

View file

@ -4,7 +4,8 @@ li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s
// Due Date // Due Date
span(ng-if='task.type=="todo" && task.date') span(ng-if='task.type=="todo" && task.date')
span(ng-class='{"label label-danger":(moment(task.date).isBefore(_today, "days") && !task.completed)}') {{moment(task.date).format(env.t('shortdate'))}} span(ng-class='{"label label-danger":(moment(task.date).isBefore(_today, "days") && !task.completed)}') {{task.date | date:user.preferences.dateFormat.substr(0,5)}}
//{{::profile.auth.timestamps.created | date:user.preferences.dateFormat}}
// Streak // Streak
|   |  
span(ng-show='task.streak') {{task.streak}}  span(ng-show='task.streak') {{task.streak}} 
@ -190,7 +191,7 @@ li(bindonce='list', id='task-{{::task.id}}', ng-repeat='task in obj[list.type+"s
// if Todos, the due date // if Todos, the due date
fieldset.option-group(ng-if='task.type=="todo" && !task.challenge.id') fieldset.option-group(ng-if='task.type=="todo" && !task.challenge.id')
legend.option-title=env.t('dueDate') legend.option-title=env.t('dueDate')
input.option-content.datepicker(type='text', datepicker-popup=env.t('mediumdate'), ng-model='task.date', is-open='datepickerOpened', ng-click='datepickerOpened = true') input.option-content.datepicker(type='text', datepicker-popup='{{user.preferences.dateFormat}}', ng-model='task.date', is-open='datepickerOpened', ng-click='datepickerOpened = true')
// Tags // Tags
fieldset.option-group(ng-if='!$state.includes("options.social.challenges")') fieldset.option-group(ng-if='!$state.includes("options.social.challenges")')