Merge branch 'develop' into api-v3

This commit is contained in:
Matteo Pagliazzi
2015-11-27 17:05:29 +01:00
56 changed files with 3747 additions and 3338 deletions
+1 -1
View File
@@ -148,6 +148,7 @@ window.habitrpg = angular.module('habitrpg',
// Options > Social > Challenges
.state('options.social.challenges', {
url: "/challenges",
params: { groupIdFilter: null },
controller: 'ChallengesCtrl',
templateUrl: "partials/options.social.challenges.html"
})
@@ -156,7 +157,6 @@ window.habitrpg = angular.module('habitrpg',
templateUrl: 'partials/options.social.challenges.detail.html',
controller: ['$scope', 'Challenges', '$stateParams',
function($scope, Challenges, $stateParams){
$scope.obj = $scope.challenge = Challenges.Challenge.get({cid:$stateParams.cid}, function(){
$scope.challenge._locked = true;
});
@@ -5,6 +5,8 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
// challenge
$scope.cid = $state.params.cid;
$scope.groupIdFilter = $stateParams.groupIdFilter;
_getChallenges();
// FIXME $scope.challenges needs to be resolved first (see app.js)
@@ -325,6 +327,21 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
});
};
$scope.filterInitialChallenges = function() {
$scope.groupsFilter = _.uniq(_.pluck($scope.challenges, 'group'), function(g){return g._id});
$scope.search = {
group: _.transform($scope.groups, function(m,g){m[g._id]=true;}),
_isMember: "either",
_isOwner: "either"
};
//If we game from a group, then override the filter to that group
if ($scope.groupIdFilter) {
$scope.search.group = {};
$scope.search.group[$scope.groupIdFilter] = true ;
}
}
function _calculateMaxPrize(gid) {
var userBalance = User.getBalanceInGems() || 0;
@@ -375,12 +392,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
} else {
Challenges.Challenge.query(function(challenges){
$scope.challenges = challenges;
$scope.groupsFilter = _.uniq(_.pluck(challenges, 'group'), function(g){return g._id});
$scope.search = {
group: _.transform($scope.groups, function(m,g){m[g._id]=true;}),
_isMember: "either",
_isOwner: "either"
};
$scope.filterInitialChallenges();
});
}
};
@@ -114,8 +114,12 @@ habitrpg.controller("InventoryCtrl",
var eggName = Content.eggs[egg.key].text();
var potName = Content.hatchingPotions[potion.key].text();
if (!$window.confirm(window.env.t('hatchAPot', {potion: potName, egg: eggName}))) return;
var userHasPet = user.items.pets[egg.key + '-' + potion.key];
user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}});
if (!user.preferences.suppressModals.hatchPet) {
if (!user.preferences.suppressModals.hatchPet && !userHasPet) {
$scope.hatchedPet = {
egg: eggName,
potion: potName,
@@ -159,7 +163,7 @@ habitrpg.controller("InventoryCtrl",
// Feeding Pet
if ($scope.selectedFood) {
var food = $scope.selectedFood;
var startingMounts = Stats.totalCount(user.items.mounts);
var startingMounts = $rootScope.countExists(user.items.mounts);
if (food.key === 'Saddle') {
if (!$window.confirm(window.env.t('useSaddle', {pet: petDisplayName}))) return;
} else if (!$window.confirm(window.env.t('feedPet', {name: petDisplayName, article: food.article, text: food.text()}))) {
@@ -169,7 +173,7 @@ habitrpg.controller("InventoryCtrl",
$scope.selectedFood = null;
_updateDropAnimalCount(user.items);
if (Stats.totalCount(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
if ($rootScope.countExists(user.items.mounts) > startingMounts && !user.preferences.suppressModals.raisePet) {
$scope.raisedPet = {
displayName: petDisplayName,
spriteName: pet,
@@ -0,0 +1,15 @@
angular.module('habitrpg')
.filter('timezoneOffsetToUtc', function () {
return function (offset) {
var sign = offset > 0 ? '-' : '+';
offset = Math.abs(offset) / 60;
var hour = Math.floor(offset);
var minutes_int = (offset - hour) * 60;
var minutes = minutes_int < 10 ? '0'+minutes_int : minutes_int;
return 'UTC' + sign + hour + ':' + minutes;
}
});
+1
View File
@@ -58,6 +58,7 @@
"js/filters/money.js",
"js/filters/roundLargeNumbers.js",
"js/filters/taskOrdering.js",
"js/filters/timezoneOffsetToUtc.js",
"js/directives/close-menu.directive.js",
"js/directives/expand-menu.directive.js",
+1 -1
View File
@@ -524,7 +524,7 @@ api.leave = function(req, res, next) {
}
if (group.quest && group.quest.active && group.quest.members && group.quest.members[user._id]) {
return res.json(403, 'You cannot leave party during an active quest. Please leave the quest first');
return res.json(403, 'You cannot leave party during an active quest. Please leave the quest first.');
}
}
+10
View File
@@ -164,12 +164,22 @@ export let schema = new Schema({
inviteParty: {type: Boolean, default: false},
},
ios: {
<<<<<<< HEAD
addTask: {type: Boolean, default: false},
editTask: {type: Boolean, default: false},
deleteTask: {type: Boolean, default: false},
filterTask: {type: Boolean, default: false},
groupPets: {type: Boolean, default: false},
},
=======
addTask: {type: Boolean, 'default': false},
editTask: {type: Boolean, 'default': false},
deleteTask: {type: Boolean, 'default': false},
filterTask: {type: Boolean, 'default': false},
groupPets: {type: Boolean, 'default': false},
inviteParty: {type: Boolean, 'default': false},
}
>>>>>>> develop
},
dropsEnabled: {type: Boolean, default: false},
itemsEnabled: {type: Boolean, default: false},
+10
View File
@@ -116,6 +116,16 @@ script(type='text/ng-template', id='partials/options.settings.settings.html')
ng-disabled='dayStart == user.preferences.dayStart')
=env.t('saveCustomDayStart')
hr
h5=env.t('timezone')
.form-horizontal
.form-group
.col-sm-12
p!=env.t('timezoneUTC', {utc: "{{ user.preferences.timezoneOffset | timezoneOffsetToUtc }}"})
br
p!=env.t('timezoneInfo')
.personal-options.col-md-6
.panel.panel-default
.panel-heading
@@ -10,7 +10,8 @@
table.table.table-striped
tr(ng-repeat='challenge in group.challenges')
td
a(ui-sref='options.social.challenges.detail({cid:challenge._id})') {{challenge.name}}
a(ui-sref='options.social.challenges.detail({cid:challenge._id, groupIdFilter: group._id})')
markdown(text='challenge.name')
div(ng-if='group.challenges.length == 0')
p
|&nbsp;
+26 -23
View File
@@ -139,32 +139,34 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
placeholder=env.t('challengeTitle'), required='required',
ng-disabled='insufficientGemsForTavernChallenge()')
.form-group
input.form-control(type='text', minlength="3", maxlength="16",
ng-model='newChallenge.shortName', placeholder=env.t('challengeTag'), required
ng-disabled='insufficientGemsForTavernChallenge()')
|&nbsp;
a.hint.vertical-20(target='_blank', href='http://habitica.wikia.com/wiki/Tags',
popover=env.t('challengeTagPop'), popover-trigger='mouseenter', popover-placement='right')
=env.t('moreInfo')
.form-group
textarea.form-control(cols='3', placeholder=env.t('challengeDescr'), ng-model='newChallenge.description'
ng-disabled='insufficientGemsForTavernChallenge()')
.form-group
.input-group
span.input-group-addon
.Pet_Currency_Gem1x
input.form-control(type='number', placeholder=env.t('prize'),
ng-disabled='insufficientGemsForTavernChallenge()'
min="{{newChallenge.group=='habitrpg' ? 1 : 0}}",
max="{{maxPrize}}", ng-model='newChallenge.prize')
a.hint(popover="{{newChallenge.group=='habitrpg' ? env.t('prizePopTavern') : env.t('prizePop')}}",
popover-trigger='mouseenter', popover-placement='right')
=env.t('moreInfo')
.pull-right(ng-show='newChallenge.group=="habitrpg"')
!=env.t('publicChallenges')
.row
.form-group.col-md-6.col-sm-12
input.form-control(type='text', minlength="3",
ng-model='newChallenge.shortName', placeholder=env.t('challengeTag'), required
ng-disabled='insufficientGemsForTavernChallenge()')
|&nbsp;
a.hint.vertical-20(target='_blank', href='http://habitica.wikia.com/wiki/Tags',
popover=env.t('challengeTagPop'), popover-trigger='mouseenter', popover-placement='right')
=env.t('moreInfo')
.row
.form-group.col-md-6.col-sm-12
.input-group
span.input-group-addon
.Pet_Currency_Gem1x
input.form-control(type='number', placeholder=env.t('prize'),
ng-disabled='insufficientGemsForTavernChallenge()'
min="{{newChallenge.group=='habitrpg' ? 1 : 0}}",
max="{{maxPrize}}", ng-model='newChallenge.prize')
a.hint(popover="{{newChallenge.group=='habitrpg' ? env.t('prizePopTavern') : env.t('prizePop')}}",
popover-trigger='mouseenter', popover-placement='right')
=env.t('moreInfo')
div(ng-show='newChallenge.group=="habitrpg"')
!=env.t('publicChallenges')
.form-group(ng-if='user.contributor.admin')
.checkbox
@@ -203,7 +205,8 @@ script(type='text/ng-template', id='partials/options.social.challenges.html')
a.btn.btn-sm.btn-success(ng-hide='challenge._isMember', ng-click='join(challenge)')
span.glyphicon.glyphicon-ok
=env.t('join')
a.accordion-toggle(id="{{challenge._id}}" ng-click='toggle(challenge._id)') {{challenge.name}}
a.accordion-toggle(id="{{challenge._id}}" ng-click='toggle(challenge._id)')
markdown(text='challenge.name')
.panel-body(ng-class='{collapse: !$stateParams.cid == challenge._id}')
.accordion-inner(ng-if='$stateParams.cid == challenge._id')
div(ui-view)
+30 -11
View File
@@ -1,26 +1,45 @@
h2 11/19/2015 - SMALL iOS UPDATE AND HABITICA HIRING NEWS!
h2 11/25/2015 - HABITICA THANKSGIVING! NOVEMBER SUBSCRIBER ITEM AND TURKEY PETS AND MOUNTS
hr
tr
td
h3 Habitica Hiring News
p Exciting news! Right now, Habitica is looking to add a senior full stack developer to our team, and what better place to look than our awesome community?
br
p If youd like to apply, you should have experience as a lead developer, and be a JavaScript whiz who is familiar with MongoDB and Angular. Bonus points for familiarity with <a href='http://habitica.wikia.com/wiki/Guidance_for_Blacksmiths#Technology_Stack' target='_blank'>our tech stack</a>! Passion for open source is, naturally, a must ;)
br
p Send your resume to <a href='mailto:jobs@habitica.com'>jobs@habitica.com</a> with your GitHub handle, Habitica username, and list of favorite online hangouts! Please also let us know whether or not you would be able to move to Los Angeles. Were looking forward to hearing from you!
.npc_daniel.pull-right
h3 Happy Thanksgiving!
p It's Thanksgiving in Habitica! On this day Habiticans celebrate by spending time with loved ones, giving thanks, and riding their glorious turkeys into the magnificent sunset. Some of the NPCs are celebrating the occasion!
tr
td
h3 Small iOS App Update
p We've released a small <a href='https://itunes.apple.com/us/app/habitica/id994882113?ls=1&mt=8' target='_blank'>iOS update</a>, just to fix some bothersome bugs (including crashes), add a nice intro slide for new users, and make it more obvious how to invite your friends to your party.
.Pet-Turkey-Gilded.pull-right
h3 Turkey Pet and Mount!
p Those of you who weren't around last Thanksgiving have received an adorable Turkey Pet, and those of you who got a Turkey Pet last year have received a handsome Turkey Mount! Already got a Turkey Mount? You, my friend, have been gifted the rare and glittering Gilded Turkey Pet!
br
p If you already reviewed the last version of the app, Apple has hidden it for this version, but you can automatically post the same review again by tapping “Write a review” and then just hitting "Send." Thank you very much for taking the time to share your thoughts with us! Posting and reposting reviews really helps us out.
p.small.muted by Viirus and Lemoness
p Thank you for using Habitica - we really love you guys <3
tr
td
.promo_mystery_201511.pull-right
h3 November Subscriber Items Revealed
p The November Subscriber Item Set has been revealed: the Wood Warrior Set! All November subscribers will receive the Log Crown and the Wooden Armor. You still have five days to <a href='/#/options/settings/subscription'>subscribe</a> and receive the item set! Thank you so much for your support - we really do rely on you to keep Habitica free to use and running smoothly.
p.small.muted by Lemoness
if menuItem !== 'oldNews'
hr
a(href='/static/old-news', target='_blank') Read older news
mixin oldNews
h2 11/19/2015 - SMALL iOS UPDATE AND HABITICA HIRING NEWS!
tr
td
h3 Habitica Hiring News
p Exciting news! Right now, Habitica is looking to add a senior full stack developer to our team, and what better place to look than our awesome community?
br
p If youd like to apply, you should have experience as a lead developer, and be a JavaScript whiz who is familiar with MongoDB and Angular. Bonus points for familiarity with <a href='http://habitica.wikia.com/wiki/Guidance_for_Blacksmiths#Technology_Stack' target='_blank'>our tech stack</a>! Passion for open source is, naturally, a must ;)
br
p Send your resume to <a href='mailto:jobs@habitica.com'>jobs@habitica.com</a> with your GitHub handle, Habitica username, and list of favorite online hangouts! Please also let us know whether or not you would be able to move to Los Angeles. Were looking forward to hearing from you!
tr
td
h3 Small iOS App Update
p We've released a small <a href='https://itunes.apple.com/us/app/habitica/id994882113?ls=1&mt=8' target='_blank'>iOS update</a>, just to fix some bothersome bugs (including crashes), add a nice intro slide for new users, and make it more obvious how to invite your friends to your party.
br
p If you already reviewed the last version of the app, Apple has hidden it for this version, but you can automatically post the same review again by tapping “Write a review” and then just hitting "Send." Thank you very much for taking the time to share your thoughts with us! Posting and reposting reviews really helps us out.
p.small.muted by Viirus and Lemoness
h2 11/16/2015 - HABITICA STICKERS AND COSTUME CONTEST BADGES!
tr
td
+1 -2
View File
@@ -589,8 +589,7 @@ html(ng-app='habitrpg', ng-controller='RootCtrl')
#footercall
.container-fluid
.row
.col-md-10
h3= env.t('joinOthers')
h3= env.t('joinOthers', {userCount:'900,000'})
.row
.col-md-4.col-md-offset-4
button.btn.btn-primary.btn-lg.btn-block(ng-click='playButtonClick()')= env.t('free')