Merge branch 'dateformat' of git://github.com/Verabird/habitrpg into Verabird-dateformat

This commit is contained in:
Matteo Pagliazzi 2014-12-29 21:09:04 +01:00
commit 752161b284
6 changed files with 21 additions and 6 deletions

View file

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

View file

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

View file

@ -36,6 +36,12 @@ script(type='text/ng-template', id='partials/options.settings.settings.html')
br
strong
!=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
label
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
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
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)}}

View file

@ -15,12 +15,12 @@ script(type='text/ng-template', id='modals/member.html')
| 
=env.t('memberSince')
| 
| {{::timestamp(profile.auth.timestamps.created)}} -
| {{::profile.auth.timestamps.created | date:user.preferences.dateFormat}} -
li(ng-show='::profile.auth.timestamps.loggedin')
| 
=env.t('lastLoggedIn')
| 
| {{::timestamp(profile.auth.timestamps.loggedin)}} -
| {{::profile.auth.timestamps.loggedin | date:user.preferences.dateFormat}} -
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] }}
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
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('MM/DD')}}
span(ng-class='{"label label-danger":(moment(task.date).isBefore(_today, "days") && !task.completed)}') {{task.date | date:user.preferences.dateFormat.substr(0,5)}}
// 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
fieldset.option-group(ng-if='task.type=="todo" && !task.challenge.id')
legend.option-title=env.t('dueDate')
input.option-content.datepicker(type='text', datepicker-popup='MM/dd/yyyy', 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
fieldset.option-group(ng-if='!$state.includes("options.social.challenges")')