From c68a061c0dbc933d078c0a5e0cdd09caea0ee159 Mon Sep 17 00:00:00 2001 From: Alice Harris Date: Sun, 7 Sep 2014 15:14:58 +1000 Subject: [PATCH] experimental changes for indicating acceptance of guidelines --- public/css/game-pane.styl | 3 +++ public/js/controllers/rootCtrl.js | 4 ++++ src/models/user.js | 3 ++- views/options/social/chat-box.jade | 16 ++++++++++++++-- ...nes.jade => community-guidelines-accept.jade} | 4 ++-- views/shared/modals/index.jade | 2 +- 6 files changed, 26 insertions(+), 6 deletions(-) rename views/shared/modals/{community-guidelines.jade => community-guidelines-accept.jade} (60%) diff --git a/public/css/game-pane.styl b/public/css/game-pane.styl index d5c927e2ac..9bf398514d 100644 --- a/public/css/game-pane.styl +++ b/public/css/game-pane.styl @@ -13,6 +13,9 @@ margin-bottom: 0.618em line-height: 1.618em +.guidelines-not-accepted + border: 1px solid black + .chat-controls > div display: inline-block diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index 96f8b210e0..c5b7729169 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -122,6 +122,10 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $rootScope.set({'flags.newStuff':false}); } + $rootScope.acceptCommunityGuidelines = function() { + $rootScope.set({'flags.communityGuidelinesAccepted':true}); + } + $rootScope.notPorted = function(){ alert(window.env.t('notPorted')); } diff --git a/src/models/user.js b/src/models/user.js index 5c707a5df8..72807d67af 100644 --- a/src/models/user.js +++ b/src/models/user.js @@ -112,7 +112,8 @@ var UserSchema = new Schema({ rebirthEnabled: {type: Boolean, 'default': false}, freeRebirth: {type: Boolean, 'default': false}, levelDrops: {type:Schema.Types.Mixed, 'default':{}}, - chatRevoked: Boolean + chatRevoked: Boolean, + communityGuidelinesAccepted: {type: Boolean, 'default': false} }, history: { exp: Array, // [{date: Date, value: Number}], // big peformance issues if these are defined diff --git a/views/options/social/chat-box.jade b/views/options/social/chat-box.jade index 50bcae08a3..b729dbcad5 100644 --- a/views/options/social/chat-box.jade +++ b/views/options/social/chat-box.jade @@ -1,4 +1,16 @@ -form.chat-form(ng-submit='postChat(group,message.content)') +div.chat-form.guidelines-not-accepted(ng-if='!user.flags.communityGuidelinesAccepted') + p If you would like to post messages in the Tavern or any party or guild chat, please read our + |  + a(target='_blank', href='/static/community-guidelines')=env.t('communityGuidelines') + | and then click the button below to indicate that you accept them. + .chat-controls + div + button.btn.btn-warning(ng-click='acceptCommunityGuidelines()')=env.t('iAcceptCommunityGuidelines') + .chat-buttons + button(type="button", ng-click='sync(group)', tooltip=env.t('toolTipMsg')) + span.glyphicon.glyphicon-refresh + +form.chat-form(ng-if='user.flags.communityGuidelinesAccepted' ng-submit='postChat(group,message.content)') div(ng-controller='AutocompleteCtrl') textarea.form-control(rows=4, ui-keypress='{13:"postChat(group,message.content)"}', ng-model='message.content', updateinterval='250', flag='@', at-user, auto-complete) span.user-list(ng-show='!isAtListHidden') @@ -11,4 +23,4 @@ form.chat-form(ng-submit='postChat(group,message.content)') .chat-buttons input(type='submit', value=env.t('sendChat'), ng-class='{disabled: _sending == true}') button(type="button", ng-click='sync(group)', tooltip=env.t('toolTipMsg')) - span.glyphicon.glyphicon-refresh \ No newline at end of file + span.glyphicon.glyphicon-refresh diff --git a/views/shared/modals/community-guidelines.jade b/views/shared/modals/community-guidelines-accept.jade similarity index 60% rename from views/shared/modals/community-guidelines.jade rename to views/shared/modals/community-guidelines-accept.jade index c830ce25bb..6537b4897a 100644 --- a/views/shared/modals/community-guidelines.jade +++ b/views/shared/modals/community-guidelines-accept.jade @@ -1,7 +1,7 @@ -script(type='text/ng-template', id='modals/communityGuidelines.html') +script(type='text/ng-template', id='modals/communityGuidelinesAccept.html') .modal-header h4=env.t('communityGuidelines') .modal-body.community-guidelines-modal.modal-fixed-height - include ../../static/community-guidelines + // include ../../static/community-guidelines .modal-footer button.btn.btn-default(ng-click='$close()')=env.t('close') diff --git a/views/shared/modals/index.jade b/views/shared/modals/index.jade index 96cd3d2c29..329a78c3bf 100644 --- a/views/shared/modals/index.jade +++ b/views/shared/modals/index.jade @@ -10,4 +10,4 @@ include ./classes include ./quests include ./rebirth include ./limited -// include ./community-guidelines +// include ./community-guidelines-accept