feat(sharing): Pretty Tweet button for level up

This commit is contained in:
Sabe Jones 2015-10-21 15:23:31 -04:00
parent 1ad6ffd35d
commit 44818882f6
5 changed files with 41 additions and 8 deletions

View file

@ -3,9 +3,10 @@
habitrpg.controller("UserCtrl", ['$rootScope', '$scope', '$location', 'User', '$http', '$state', 'Guide', 'Shared', 'Content', 'Stats',
function($rootScope, $scope, $location, User, $http, $state, Guide, Shared, Content, Stats) {
$scope.profile = User.user;
$scope.statCalc = Stats;
$.getScript('https://platform.twitter.com/widgets.js');
$scope.hideUserAvatar = function() {
$(".userAvatar").hide();
};

View file

@ -18,7 +18,7 @@ router.get('/', i18n.getUserLanguage, locals, function(req, res) {
});
});
// -------- Marketing --------
// -------- Static Pages --------
var pages = ['front', 'privacy', 'terms', 'api', 'features', 'videos', 'contact', 'plans', 'new-stuff', 'community-guidelines', 'old-news', 'press-kit', 'faq'];
@ -31,6 +31,19 @@ _.each(pages, function(name){
});
});
// -------- Social Media Sharing --------
var shareables = ['level-up'];
_.each(shareables, function(name){
router.get('/social/' + name, i18n.getUserLanguage, locals, function(req, res) {
res.render( 'social/' + name, {
env: res.locals.habitrpg,
marked: require('marked')
});
});
});
// --------- Redirects --------
router.get('/static/extensions', function(req, res) {

View file

@ -6,13 +6,15 @@ script(type='text/ng-template', id='modals/levelUp.html')
h3(style='margin-bottom: 0')=env.t('gainedLevel')
.container-fluid
.row
.herobox(style='margin:auto 8.5em; width: 6em; height: 9em; padding-top: 0')
.herobox(style='margin:auto 8.2em; width: 6em; height: 9em; padding-top: 0')
.character-sprites(style='margin: 0; width: 0')
+generatedAvatar
.row
.herobox(style='margin:auto 9em; width: 6em; height: 0; padding-top: 0')
.herobox(style='margin:auto 8.6em; width: 6em; height: 0; padding-top: 0')
.avatar-level(ng-class='userLevelStyle(user)')=env.t('level')+' {{user.stats.lvl}}'
h4(style='margin-top: 1em')!=env.t('leveledUp', {level:'{{user.stats.lvl}}'})
p=env.t('fullyHealed')
.modal-footer(style='margin-top:0')
br
button.btn.btn-primary(ng-click='$close()')=env.t('huzzah')
.modal-footer(style='margin-top:0')
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')

View file

@ -102,10 +102,12 @@ script(type='text/ng-template', id='modals/questDrop.html')
.col-xs-4(style='margin-top:1.5em')
.quest-icon(class='inventory_quest_scroll_{{::selectedQuest.key}}')
h4!=env.t('leveledUpReceivedQuest', {level:'{{user.stats.lvl}}'})
.row(style='margin-top:2em')
button.btn.btn-primary(ng-click='inviteOrStartParty(group); $close()', ng-if='!party.members')=env.t('startAParty')
button.btn.btn-primary(ng-click='questInit(); $close()', ng-if='party.members')=env.t('inviteParty')
button.btn.btn-default(ng-click='closeQuest(); $close()')=env.t('questLater')
.modal-footer(style='margin-top:0')
button.btn.btn-primary(ng-click='inviteOrStartParty(group); $close()', ng-if='!party.members')=env.t('startAParty')
button.btn.btn-primary(ng-click='questInit(); $close()', ng-if='party.members')=env.t('inviteParty')
button.btn.btn-default(ng-click='closeQuest(); $close()')=env.t('questLater')
a.twitter-share-button(href='https://twitter.com/intent/tweet?text=I+leveled+up+to+{{::user.stats.lvl}}+in+Habitica!&via=habitica&url=https://habitica.com/social/level-up&count=none')=env.t('tweet')
script(type='text/ng-template', id='modals/ownedQuests.html')
.modal-header

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='Level Up!')
meta(name='twitter:description' content='In Habitica, your avatar grows in strength as you improve your real-life habits. I\'ve attained a new level with what I\'ve accomplished!')
meta(name='twitter:image' content='')
meta(property='og:url', content='https://habitica.com/social/level-up')
meta(property='og:type', content='website')
meta(property='og:title', content='Level Up!')
meta(property='og:description', content='In Habitica, your avatar grows in strength as you improve your real-life habits. I\'ve attained a new level with what I\'ve accomplished!')
meta(property='og:site_name', content='Habitica')
meta(property='og:image', content='')
meta(property='fb:app_id', content='128307497299777')