From 9fa452173989889c48ed696a45cf4a1dc16294a4 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Wed, 22 Jan 2014 23:20:59 -0800 Subject: [PATCH] feat(challenges): add angular-ui-select2 for simpler find/select challenge winner. --- bower.json | 3 ++- public/css/index.styl | 1 + public/js/app.js | 2 +- public/manifest.json | 2 ++ views/options/social/challenges.jade | 6 ++++-- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index 0e17a75c86..de58e3a827 100644 --- a/bower.json +++ b/bower.json @@ -40,7 +40,8 @@ "bootstrap-tour": "~0.8.0", "angular-ui-utils": "~0.1.0", "swagger-ui": "https://github.com/wordnik/swagger-ui.git#105c516f5f055b140e935e9cfe0c36f841921dff", - "ngInfiniteScroll": "~1.0.0" + "ngInfiniteScroll": "~1.0.0", + "angular-ui-select2": "~0.0.5" }, "devDependencies": { "angular-mocks": "~1.2.1" diff --git a/public/css/index.styl b/public/css/index.styl index 7fbb6f7615..825885a03c 100644 --- a/public/css/index.styl +++ b/public/css/index.styl @@ -9,6 +9,7 @@ @import "../bower_components/bootstrap-tour/build/css/bootstrap-tour.min.css" @import "../bower_components/angular-loading-bar/build/loading-bar.css" @import "../bower_components/js-emoji/emoji.css" +@import "../bower_components/select2/select2.css" // Custom includes @import "./tasks.styl" diff --git a/public/js/app.js b/public/js/app.js index ed3d79b8e8..6ffb1bf987 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -18,7 +18,7 @@ window.env.t = function(string){ window.habitrpg = angular.module('habitrpg', ['ngResource', 'ngSanitize', 'userServices', 'groupServices', 'memberServices', 'challengeServices', 'authServices', 'notificationServices', 'guideServices', 'authCtrl', - 'ui.bootstrap', 'ui.keypress', 'ui.router', 'chieffancypants.loadingBar', 'At', 'pasvaz.bindonce', 'infinite-scroll']) + 'ui.bootstrap', 'ui.keypress', 'ui.router', 'chieffancypants.loadingBar', 'At', 'pasvaz.bindonce', 'infinite-scroll', 'ui.select2']) // @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 diff --git a/public/manifest.json b/public/manifest.json index 3a4025e4d0..9c0dec275b 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -19,6 +19,8 @@ "bower_components/js-emoji/emoji.js", "bower_components/sticky/jquery.sticky.js", "bower_components/ngInfiniteScroll/ng-infinite-scroll.js", + "bower_components/select2/select2.js", + "bower_components/angular-ui-select2/src/select2.js", "bower_components/bootstrap/docs/assets/js/bootstrap.js", "bower_components/angular-bootstrap/ui-bootstrap.js", diff --git a/views/options/social/challenges.jade b/views/options/social/challenges.jade index 619d63c56e..ceb3b2ec18 100644 --- a/views/options/social/challenges.jade +++ b/views/options/social/challenges.jade @@ -1,8 +1,10 @@ script(type='text/ng-template', id='partials/options.social.challenges.detail.close.html') a.btn.btn-small.btn-danger(ng-click="delete(closingChal)") Delete h5 - Or - - small Select a winner and close the challenge: - select(ng-model='closingChal.winner', name='Winner', ng-options='u._id as u.profile.name for u in closingChal.members', ng-change='selectWinner(closingChal)') + select(ui-select2, ng-required=true, ng-model='closingChal.winner', data-placeholder='Select winner, close challenge', ng-change='selectWinner(closingChal)', ) + option(value='') + option(ng-repeat='u in closingChal.members', value='{{u._id}}') {{u.profile.name}} + small.pull-right a(ng-click='cancelClosing(closingChal)') cancel