mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
Merge branch 'develop' into blade-Finish_weeklies_pr
This commit is contained in:
@@ -116,5 +116,8 @@
|
|||||||
"sendGiftFromBalance": "From Balance",
|
"sendGiftFromBalance": "From Balance",
|
||||||
"sendGiftPurchase": "Purchase",
|
"sendGiftPurchase": "Purchase",
|
||||||
"sendGiftMessagePlaceholder": "Personal message (optional)",
|
"sendGiftMessagePlaceholder": "Personal message (optional)",
|
||||||
"sendGiftSubscription": "<%= months %> Month(s): $<%= price %>"
|
"sendGiftSubscription": "<%= months %> Month(s): $<%= price %>",
|
||||||
|
"inviteFriends": "Invite Friends",
|
||||||
|
"startAParty": "Start a Party",
|
||||||
|
"addToParty": "Add someone to your party"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,5 +118,7 @@
|
|||||||
"resubscribe": "Resubscribe",
|
"resubscribe": "Resubscribe",
|
||||||
"promoCode": "Promo Code",
|
"promoCode": "Promo Code",
|
||||||
"promoCodeApplied": "Promo Code Applied! Check your inventory",
|
"promoCodeApplied": "Promo Code Applied! Check your inventory",
|
||||||
"promoPlaceholder": "Enter Promotion Code"
|
"promoPlaceholder": "Enter Promotion Code",
|
||||||
|
"couponText": "We sometimes have events and give out coupon codes for special gear. (eg, those who stop by our Wondercon booth)",
|
||||||
|
"displayInviteToPartyWhenPartyIs1": "Display Invite To Party button when party has 1 member."
|
||||||
}
|
}
|
||||||
|
|||||||
56
test/spec/headerCtrlSpec.js
Normal file
56
test/spec/headerCtrlSpec.js
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe('Header Controller', function() {
|
||||||
|
var scope, ctrl, user, $location, $rootScope;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
module(function($provide) {
|
||||||
|
$provide.value('User', {});
|
||||||
|
});
|
||||||
|
|
||||||
|
inject(function(_$rootScope_, _$controller_, _$location_){
|
||||||
|
user = specHelper.newUser();
|
||||||
|
user._id = "unique-user-id"
|
||||||
|
|
||||||
|
scope = _$rootScope_.$new();
|
||||||
|
$rootScope = _$rootScope_;
|
||||||
|
|
||||||
|
$location = _$location_;
|
||||||
|
|
||||||
|
// Load RootCtrl to ensure shared behaviors are loaded
|
||||||
|
_$controller_('RootCtrl', {$scope: scope, User: {user: user}});
|
||||||
|
|
||||||
|
ctrl = _$controller_('HeaderCtrl', {$scope: scope, User: {user: user}});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
context('inviteOrStartParty', function(){
|
||||||
|
beforeEach(function(){
|
||||||
|
sinon.stub($location, 'path');
|
||||||
|
sinon.stub($rootScope, 'openModal');
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function(){
|
||||||
|
$location.path.restore();
|
||||||
|
$rootScope.openModal.restore();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('redirects to party page if user does not have a party', function(){
|
||||||
|
var group = {};
|
||||||
|
scope.inviteOrStartParty(group);
|
||||||
|
|
||||||
|
expect($location.path).to.be.calledWith("/options/groups/party");
|
||||||
|
expect($rootScope.openModal).to.not.be.called;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Opens invite-friends modal if user has a party', function(){
|
||||||
|
var group = {
|
||||||
|
type: 'party'
|
||||||
|
};
|
||||||
|
scope.inviteOrStartParty(group);
|
||||||
|
|
||||||
|
expect($rootScope.openModal).to.be.calledOnce;
|
||||||
|
expect($location.path).to.not.be.called;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -98,7 +98,7 @@
|
|||||||
@media (min-width: 70em)
|
@media (min-width: 70em)
|
||||||
.site-header
|
.site-header
|
||||||
width: 70%
|
width: 70%
|
||||||
|
|
||||||
|
|
||||||
// this is a wrapper for avatars in the header
|
// this is a wrapper for avatars in the header
|
||||||
// inside this is the actual `herobox` module
|
// inside this is the actual `herobox` module
|
||||||
@@ -125,7 +125,7 @@
|
|||||||
hrpg-label-color-mixin(darken($color-herobox, 16.18%))
|
hrpg-label-color-mixin(darken($color-herobox, 16.18%))
|
||||||
width: 2.618em
|
width: 2.618em
|
||||||
text-align:center
|
text-align:center
|
||||||
margin-right: 0.618em
|
margin-right: 0.618em
|
||||||
.meter
|
.meter
|
||||||
position: relative
|
position: relative
|
||||||
overflow: hidden
|
overflow: hidden
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
white-space: nowrap
|
white-space: nowrap
|
||||||
&.value
|
&.value
|
||||||
right: 0.382em
|
right: 0.382em
|
||||||
|
|
||||||
// boss.jade only
|
// boss.jade only
|
||||||
[class^="quest_"] + &
|
[class^="quest_"] + &
|
||||||
min-width: 220px
|
min-width: 220px
|
||||||
@@ -172,4 +172,8 @@
|
|||||||
header .hero-stats
|
header .hero-stats
|
||||||
background-color: darken($color-herobox, 4%)
|
background-color: darken($color-herobox, 4%)
|
||||||
border-right: 1px solid darken($color-herobox, 12%)
|
border-right: 1px solid darken($color-herobox, 12%)
|
||||||
|
|
||||||
|
button.party-invite
|
||||||
|
right: 10px;
|
||||||
|
position: absolute;
|
||||||
|
top: 55px;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
|
habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User', '$location', '$rootScope',
|
||||||
function($scope, Groups, User) {
|
function($scope, Groups, User, $location, $rootScope) {
|
||||||
|
|
||||||
$scope.Math = window.Math;
|
$scope.Math = window.Math;
|
||||||
$scope.user = User.user;
|
$scope.user = User.user;
|
||||||
@@ -16,6 +16,19 @@ habitrpg.controller("HeaderCtrl", ['$scope', 'Groups', 'User',
|
|||||||
$scope.$watch('user.party.orderAscending', triggerResort);
|
$scope.$watch('user.party.orderAscending', triggerResort);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.inviteOrStartParty = function(group) {
|
||||||
|
if (group.type === "party") {
|
||||||
|
$rootScope.openModal('invite-friends', {
|
||||||
|
controller:'InviteToGroupCtrl',
|
||||||
|
resolve: {
|
||||||
|
injectedGroup: function(){ return group; }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$location.path("/options/groups/party");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function resortParty() {
|
function resortParty() {
|
||||||
var result = _.sortBy(
|
var result = _.sortBy(
|
||||||
_.filter($scope.party.members, function(member){
|
_.filter($scope.party.members, function(member){
|
||||||
|
|||||||
@@ -321,6 +321,7 @@ var UserSchema = new Schema({
|
|||||||
advancedCollapsed: {type: Boolean, 'default': false},
|
advancedCollapsed: {type: Boolean, 'default': false},
|
||||||
toolbarCollapsed: {type:Boolean, 'default':false},
|
toolbarCollapsed: {type:Boolean, 'default':false},
|
||||||
background: String,
|
background: String,
|
||||||
|
displayInviteToPartyWhenPartyIs1: { type:Boolean, 'default':true},
|
||||||
webhooks: {type: Schema.Types.Mixed, 'default': {}},
|
webhooks: {type: Schema.Types.Mixed, 'default': {}},
|
||||||
// For this fields make sure to use strict comparison when searching for falsey values (=== false)
|
// For this fields make sure to use strict comparison when searching for falsey values (=== false)
|
||||||
// As users who didn't login after these were introduced may have them undefined/null
|
// As users who didn't login after these were introduced may have them undefined/null
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ script(type='text/ng-template', id='partials/options.settings.settings.html')
|
|||||||
label
|
label
|
||||||
input(type='checkbox', ng-model='user.preferences.dailyDueDefaultView', ng-change='set({"preferences.dailyDueDefaultView": user.preferences.dailyDueDefaultView?true: false})')
|
input(type='checkbox', ng-model='user.preferences.dailyDueDefaultView', ng-change='set({"preferences.dailyDueDefaultView": user.preferences.dailyDueDefaultView?true: false})')
|
||||||
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('dailyDueDefaultViewPop'))=env.t('dailyDueDefaultView')
|
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('dailyDueDefaultViewPop'))=env.t('dailyDueDefaultView')
|
||||||
|
.checkbox(ng-if='party.memberCount === 1')
|
||||||
|
label
|
||||||
|
input(type='checkbox', ng-model='user.preferences.displayInviteToPartyWhenPartyIs1', ng-change='set({"preferences.displayInviteToPartyWhenPartyIs1": user.preferences.displayInviteToPartyWhenPartyIs1 ? true : false})')
|
||||||
|
span.hint(popover-trigger='mouseenter', popover-placement='right', popover=env.t('displayInviteToPartyWhenPartyIs1'))=env.t('displayInviteToPartyWhenPartyIs1')
|
||||||
// button.btn.btn-default(ng-click='showTour()', popover-placement='right', popover-trigger='mouseenter', popover=env.t('restartTour'))= env.t('showTour')
|
// button.btn.btn-default(ng-click='showTour()', popover-placement='right', popover-trigger='mouseenter', popover=env.t('restartTour'))= env.t('showTour')
|
||||||
button.btn.btn-default(ng-click='showBailey()', popover-trigger='mouseenter', popover-placement='right', popover=env.t('showBaileyPop'))= env.t('showBailey')
|
button.btn.btn-default(ng-click='showBailey()', popover-trigger='mouseenter', popover-placement='right', popover=env.t('showBaileyPop'))= env.t('showBailey')
|
||||||
button.btn.btn-default(ng-click='openRestoreModal()', popover-trigger='mouseenter', popover-placement='right', popover=env.t('fixValPop'))= env.t('fixVal')
|
button.btn.btn-default(ng-click='openRestoreModal()', popover-trigger='mouseenter', popover-placement='right', popover=env.t('fixValPop'))= env.t('fixVal')
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ a.pull-right.gem-wallet(ng-if='group.type!="party"', popover-trigger='mouseenter
|
|||||||
.panel-heading
|
.panel-heading
|
||||||
h3.panel-title
|
h3.panel-title
|
||||||
=env.t('members')
|
=env.t('members')
|
||||||
button.pull-right.btn.btn-primary(ng-click="openInviteModal(group)")=env.t('inviteFriends')
|
button.pull-right.btn.btn-primary(ng-click="openInviteModal(group)")=env.t("inviteFriends")
|
||||||
.panel-body.modal-fixed-height
|
.panel-body.modal-fixed-height
|
||||||
div.form-group(ng-if='::group.type=="party"')
|
div.form-group(ng-if='::group.type=="party"')
|
||||||
p=env.t('partyList')
|
p=env.t('partyList')
|
||||||
|
|||||||
@@ -32,5 +32,8 @@
|
|||||||
|
|
||||||
// party
|
// party
|
||||||
span(ng-controller='PartyCtrl')
|
span(ng-controller='PartyCtrl')
|
||||||
|
button.party-invite.pull-right.btn.btn-primary(ng-click="inviteOrStartParty(group)",
|
||||||
|
ng-if="(!party.members || party.memberCount === 1) && user.preferences.displayInviteToPartyWhenPartyIs1",
|
||||||
|
popover="{{!party.members ? env.t('startAParty') : env.t('addToParty')}}", popover-placement="left", popover-trigger="mouseenter")=env.t("inviteFriends")
|
||||||
.herobox-wrap(ng-repeat='profile in partyMinusSelf')
|
.herobox-wrap(ng-repeat='profile in partyMinusSelf')
|
||||||
+herobox()
|
+herobox()
|
||||||
|
|||||||
Reference in New Issue
Block a user