From 646a5c942ba8d9d4002362ea25f2e78e3cf54d78 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Sat, 2 Nov 2013 16:07:12 -0700 Subject: [PATCH] [#1716 #1705] working modal for challenge.participants.stats! also don't scroll to top of page. We'll want to test that this doesn't break anything else in the app, @paglias looks like the guys on that thread felt pretty dirty about this workaround for some reason --- public/css/challenges.styl | 10 +++++++++- public/js/app.js | 5 ++++- views/options/social/challenges.jade | 26 +++++++++++++++----------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/public/css/challenges.styl b/public/css/challenges.styl index d3a39eaca1..98d12edb17 100644 --- a/public/css/challenges.styl +++ b/public/css/challenges.styl @@ -10,4 +10,12 @@ ul.challenge-accordion-header-specs margin-bottom: 10px #challenges-filters h3 - margin-top: 0px; \ No newline at end of file + margin-top: 0px; + +// for things like challenges, member profiles, etc +@media (min-width: 767px) + .wide-modal + /* new custom width */ + width: 1020px; + /* must be half of the width, minus scrollbar on the left (30px) */ + margin-left: -480px; \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js index a559a3aba0..1c40ac0d2a 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -5,6 +5,10 @@ window.habitrpg = angular.module('habitrpg', 'sharedServices', 'authServices', 'notificationServices', 'guideServices', 'ui.bootstrap', 'ui.keypress', 'ui.router', 'chieffancypants.loadingBar']) + // @see https://github.com/angular-ui/ui-router/issues/110 and https://github.com/HabitRPG/habitrpg/issues/1705 + // temporary hack until they have a better solution + .value('$anchorScroll', angular.noop) + .constant("API_URL", "") .constant("STORAGE_USER_ID", 'habitrpg-user') .constant("STORAGE_SETTINGS_ID", 'habit-mobile-settings') @@ -115,7 +119,6 @@ window.habitrpg = angular.module('habitrpg', templateUrl: 'partials/options.social.challenges.detail.member.html', controller: ['$scope', 'Challenges', '$stateParams', function($scope, Challenges, $stateParams){ - alert("Why is this controller not being instantiated?"); $scope.obj = Challenges.Challenge.getMember({cid:$stateParams.cid, uid:$stateParams.uid}, function(){ $scope.obj._locked = true; }); diff --git a/views/options/social/challenges.jade b/views/options/social/challenges.jade index 8ac6158328..a24c7f1791 100644 --- a/views/options/social/challenges.jade +++ b/views/options/social/challenges.jade @@ -7,8 +7,14 @@ script(type='text/ng-template', id='partials/options.social.challenges.detail.cl a(ng-click='cancelClosing(closingChal)') cancel script(type='text/ng-template', id='partials/options.social.challenges.detail.member.html') - h4 {{member.profile.name}} - habitrpg-tasks(main=false) + .modal.wide-modal + .modal-header + button.close(type='button', ng-click='$state.go("^")', aria-hidden='true') × + h3 {{obj.profile.name}} + .modal-body + habitrpg-tasks(main=false) + .modal-footer + a.btn(ng-click='$state.go("^")') Close script(type='text/ng-template', id='partials/options.social.challenges.detail.html') // Edit button @@ -35,22 +41,20 @@ script(type='text/ng-template', id='partials/options.social.challenges.detail.ht // Member List div(ng-if='challenge.members.length > 0') - h3 Participants - small. - (stats coming soon, see this issue.) - table.table - tr(ng-repeat='member in challenge.members') - td {{member.profile.name}} + h3 How's Everyone Doing? + menu + button.customize-option(ng-repeat='member in challenge.members', ng-click='toggleMember(challenge._id, member._id)') {{member.profile.name}} + div(ui-view) - // FIXME, get this working - see https://github.com/HabitRPG/habitrpg/issues/1716 - //-div(ng-if='challenge.members') + // Accordion version if we choose that instead + //- div(ng-if='challenge.members') h4 How's Everyone Doing? .accordion-group(ng-repeat='member in challenge.members') .accordion-heading a.accordion-toggle(ng-click='toggleMember(challenge._id, member._id)') {{member.profile.name}} .accordion-body(ng-class='{collapse: $stateParams.uid != member._id}') .accordion-inner(ng-if='$stateParams.uid == member._id') - div(ng-view) + div(ui-view) script(type='text/ng-template', id='partials/options.social.challenges.html') .row-fluid