feat(sharing): More opt outs

Also fixes a bug where "Display Now" didn't work for pets with a space in their name.
This commit is contained in:
Sabe Jones
2015-10-28 17:48:16 -04:00
parent aad3e5ade6
commit 22caaa7eda
7 changed files with 36 additions and 12 deletions

View File

@@ -116,7 +116,7 @@ habitrpg.controller("InventoryCtrl",
if (!$window.confirm(window.env.t('hatchAPot', {potion: potName, egg: eggName}))) return;
user.ops.hatch({params:{egg:egg.key, hatchingPotion:potion.key}});
if (!user.preferences.suppressModals.hatchPet) {
$rootScope.hatchedPet = {egg: eggName, potion: potName, pet: 'Pet-' + egg.key + '-' + potion.key};
$rootScope.hatchedPet = {egg: eggName, potion: potName, eggKey: egg.key, pet: 'Pet-' + egg.key + '-' + potion.key};
$rootScope.openModal('hatchPet', {controller: 'InventoryCtrl', size: 'sm'});
}
$scope.selectedEgg = null;
@@ -160,7 +160,7 @@ habitrpg.controller("InventoryCtrl",
$scope.selectedFood = null;
_updateDropAnimalCount(user.items);
if ($scope.mountCount > startingMounts) {
if ($scope.mountCount > startingMounts && !user.preferences.suppressModals.raisePet) {
$rootScope.raisedPet = {displayName: petDisplayName, spriteName: pet, egg: egg, potion: potion}
$rootScope.openModal('raisePet', {controller:'InventoryCtrl',size:'sm'});
}

View File

@@ -65,7 +65,7 @@ habitrpg.controller('NotificationCtrl',
if (after > before) {
Notification.lvl();
$rootScope.playSound('Level_Up');
$rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'});
if (!User.user.preferences.suppressModals.levelUp) $rootScope.openModal('levelUp', {controller:'UserCtrl', size:'sm'});
}
});

View File

@@ -33,7 +33,7 @@ _.each(pages, function(name){
// -------- Social Media Sharing --------
var shareables = ['level-up','hatch-pet'];
var shareables = ['level-up','hatch-pet','raise-pet'];
_.each(shareables, function(name){
router.get('/social/' + name, i18n.getUserLanguage, locals, function(req, res) {

View File

@@ -1,7 +1,6 @@
include ../avatar/generated_avatar
script(type='text/ng-template', id='modals/hatchPet.html')
div(id='fb-root')
.modal-content(style='min-width:28em')
.modal-body.text-center(style='padding-bottom:0')
h3(style='margin-bottom: 0')=env.t('hatchedPet',{egg:'{{::hatchedPet.egg}}', potion:'{{::hatchedPet.potion}}'})
@@ -17,7 +16,7 @@ script(type='text/ng-template', id='modals/hatchPet.html')
+generatedAvatar
p=env.t('earnedCompanion')
br
button.btn.btn-primary(ng-click='choosePet(hatchedPet.egg, hatchedPet.potion); $close()')=env.t('displayNow')
button.btn.btn-primary(ng-click='choosePet(hatchedPet.eggKey, hatchedPet.potion); $close()')=env.t('displayNow')
button.btn.btn-default(ng-click='$close()')=env.t('displayLater')
.checkbox
label(style='display:inline-block')=env.t('dontShowAgain')
@@ -26,7 +25,7 @@ script(type='text/ng-template', id='modals/hatchPet.html')
.container-fluid
.row
.col-xs-3
a.twitter-share-button(href='https://twitter.com/intent/tweet?text=I+just+hatched+a+{{::hatchedPet.potion}}+{{::hatchedPet.egg}}+by+completing+my+real-life+tasks!&via=habitica&url=https://habitrpg-gamma.herokuapp.com/social/hatch-pet&count=none')=env.t('tweet')
a.twitter-share-button(href='https://twitter.com/intent/tweet?text=I just hatched a {{::hatchedPet.potion}} {{::hatchedPet.egg}} by completing my real-life tasks!&via=habitica&url=https://habitrpg-gamma.herokuapp.com/social/hatch-pet&count=none')=env.t('tweet')
.col-xs-4(style='margin-left:.8em')
.fb-share-button(data-href='https://habitrpg-gamma.herokuapp.com/social/hatch-pet', data-layout='button')
.col-xs-4(style='margin-left:.8em')

View File

@@ -1,7 +1,6 @@
include ../avatar/generated_avatar
script(type='text/ng-template', id='modals/levelUp.html')
div(id='fb-root')
.modal-content(style='min-width:28em')
.modal-body.text-center(style='padding-bottom:0')
h3(style='margin-bottom: 0')=env.t('gainedLevel')
@@ -24,7 +23,7 @@ script(type='text/ng-template', id='modals/levelUp.html')
.container-fluid
.row
.col-xs-3
a.twitter-share-button(href='https://twitter.com/intent/tweet?text=I+got+to+Level+{{::user.stats.lvl}}+in+Habitica+by+improving+my+real-life+habits!&via=habitica&url=https://habitrpg-gamma.herokuapp.com/social/level-up&count=none')=env.t('tweet')
a.twitter-share-button(href='https://twitter.com/intent/tweet?text=I got to Level {{::user.stats.lvl}} in Habitica by improving my real-life habits!&via=habitica&url=https://habitrpg-gamma.herokuapp.com/social/level-up&count=none')=env.t('tweet')
.col-xs-4(style='margin-left:.8em')
.fb-share-button(data-href='https://habitrpg-gamma.herokuapp.com/social/level-up', data-layout='button')
.col-xs-4(style='margin-left:.8em')

View File

@@ -2,7 +2,7 @@ include ../avatar/generated_avatar
script(type='text/ng-template', id='modals/raisePet.html')
.modal-content(style='min-width:28em')
.modal-body.text-center
.modal-body.text-center(style='padding-bottom:0')
h3(style='margin-bottom: 0')=env.t('raisedPet',{pet:'{{::raisedPet.displayName}}'})
.container-fluid
.row(style='margin-bottom:1em', ng-controller='UserCtrl')
@@ -15,7 +15,18 @@ script(type='text/ng-template', id='modals/raisePet.html')
+generatedAvatar
span(class='Mount_Head_{{::raisedPet.spriteName}}')
p=env.t('earnedSteed')
.modal-footer(style='margin-top:0')
br
button.btn.btn-primary(ng-click='chooseMount(raisedPet.egg, raisedPet.potion); $close()')=env.t('rideNow')
button.btn.btn-default(ng-click='$close()')=env.t('rideLater')
.checkbox
label(style='display:inline-block')=env.t('dontShowAgain')
input(type='checkbox', ng-model='user.preferences.suppressModals.raisePet', ng-change='set({"preferences.suppressModals.raisePet": user.preferences.suppressModals.raisePet?true: false})')
.modal-footer(style='margin-top:0', ng-init='loadWidgets()')
.container-fluid
.row
.col-xs-3
a.twitter-share-button(href='https://twitter.com/intent/tweet?text=I just raised a {{::raisedPet.displayName}} mount by completing my real-life tasks!&via=habitica&url=https://habitrpg-gamma.herokuapp.com/social/raise-pet&count=none')=env.t('tweet')
.col-xs-4(style='margin-left:.8em')
.fb-share-button(data-href='https://habitrpg-gamma.herokuapp.com/social/raise-pet', data-layout='button')
.col-xs-4(style='margin-left:.8em')
a.tumblr-share-button(data-href='https://habitrpg-gamma.herokuapp.com/social/raise-pet', data-notes='none')

View File

@@ -0,0 +1,15 @@
doctype html
html
head
meta(name='twitter:card' content='summary')
meta(name='twitter:site' content='@habitica')
meta(name='twitter:title' content='Raised a Pet into a Mount!')
meta(name='twitter:description' content='In Habitica, collectible pets grow along with you as you advance you real-life goals. My progress has turned a pet into a trusty mount!')
meta(name='twitter:image' content='https://s3.amazonaws.com/habitica-assets/assets/gryphon_logo.png')
meta(property='og:url', content='https://habitica.com/social/raise-pet')
meta(property='og:type', content='website')
meta(property='og:title', content='Level Up!')
meta(property='og:description', content='In Habitica, collectible pets grow along with you as you advance you real-life goals. My progress has turned a pet into a trusty mount!')
meta(property='og:site_name', content='Habitica')
meta(property='og:image', content='https://s3.amazonaws.com/habitica-assets/assets/gryphon_logo_300x300.png')
meta(property='fb:app_id', content='128307497299777')