Skip to content

Commit

Permalink
Update custom scores UI (#392)
Browse files Browse the repository at this point in the history
* Update CHANGELOG.md

* nicer labels

* bit o doc

* Lets do the right thing and clean up our javascript file names and routing!

Co-authored-by: epugh@opensourceconnections.com <>
  • Loading branch information
epugh committed Aug 6, 2021
1 parent 72c2087 commit 41c425e
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 32 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

### Improvements

* Quepid is running on Rails 6! Rails 6 was released ~26 months, and represents the future of Rails. I'm excited that this push initiated by @DmitryKey is going to bring us some great new features like: better developer experience with Webpack for JavaScript, ActionText to handle better text formatting of notes and messages about Cases and Queries, ActionCable which will let us notify users who are rating the same case. https://github.com/o19s/quepid/pull/381 by @DmitryKey with assist from @epugh.
* Quepid is running on Rails 6! Rails 6 was released ~26 months ago, and represents the future of Rails. I'm excited that this push initiated by @DmitryKey is going to bring us some great new features like: better developer experience with Webpack for JavaScript, ActionText to handle better text formatting of notes and messages about Cases and Queries, ActionCable which will let us notify all the users of the same case that data has changed when it changes. https://github.com/o19s/quepid/pull/381 by @DmitryKey with assist from @epugh.

* Make our ActiveRecord modeling for ownership the same. Teams have an _owner_, Scorers have an _owner_, but Cases have a _user_. Now we have _case.owner_ relationship. https://github.com/o19s/quepid/pull/359 by @epugh.

Expand All @@ -28,7 +28,7 @@

* Admin user can now reset a users password with a new password. https://github.com/o19s/quepid/pull/385 by @epugh to fix issue identified by @michaelcizmar. Thanks Michael!

* Trying to communciate about HTTPS better when you set up a case. https://github.com/o19s/quepid/pull/384 by @epugh inspired by https://github.com/o19s/quepid/issues/279 by @arafalov.
* Trying to communicate about HTTPS better when you set up a case. https://github.com/o19s/quepid/pull/384 by @epugh inspired by https://github.com/o19s/quepid/issues/279 by @arafalov.



Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/controllers/scorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ angular.module('QuepidApp')

$scope.activeScorer = parent.currentScorer || {};
$scope.cancel = cancel;
$scope.gotoAdvanced = gotoAdvanced;
$scope.gotoScorers = gotoScorers;
$scope.ok = ok;
$scope.scorers = [];
$scope.communalScorers = [];
Expand All @@ -38,9 +38,9 @@ angular.module('QuepidApp')
$uibModalInstance.dismiss('cancel');
}

function gotoAdvanced() {
function gotoScorers() {
$uibModalInstance.dismiss('cancel');
$location.path('/advanced');
$location.path('/scorers');
}

function ok() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
/*jshint camelcase: false */
/*jslint latedef:false*/

// This controller manages the Scorers screen

angular.module('QuepidApp')
.controller('AdvancedCtrl', [
.controller('ScorersCtrl', [
'$rootScope', '$scope',
'flash',
'broadcastSvc',
Expand All @@ -16,11 +18,11 @@ angular.module('QuepidApp')
customScorerSvc, configurationSvc
) {
// Attributes
$scope.advanced = {};
$scope.advanced.communalScorers = [];
$scope.advanced.combinedScorers = [];
$scope.advanced.userScorers = [];
$scope.advanced.user = $rootScope.currentUser;
$scope.scorers = {};
$scope.scorers.communalScorers = [];
$scope.scorers.combinedScorers = [];
$scope.scorers.userScorers = [];
$scope.scorers.user = $rootScope.currentUser;

$scope.pagination = {
scorers: {
Expand All @@ -34,10 +36,10 @@ angular.module('QuepidApp')
$scope.communalScorersOnly = configurationSvc.isCommunalScorersOnly();

// Functions
$scope.advanced.updateUserScorer = updateUserScorer;
$scope.scorers.updateUserScorer = updateUserScorer;

$rootScope.$watch('currentUser', function() {
$scope.advanced.user = $rootScope.currentUser;
$scope.scorers.user = $rootScope.currentUser;
});

$scope.loading = true;
Expand All @@ -57,9 +59,9 @@ angular.module('QuepidApp')
});

function getLists() {
$scope.advanced.communalScorers = customScorerSvc.communalScorers;
$scope.advanced.userScorers = customScorerSvc.scorers;
$scope.advanced.combinedScorers = $scope.advanced.communalScorers.concat($scope.advanced.userScorers);
$scope.scorers.communalScorers = customScorerSvc.communalScorers;
$scope.scorers.userScorers = customScorerSvc.scorers;
$scope.scorers.combinedScorers = $scope.scorers.communalScorers.concat($scope.scorers.userScorers);
}

function updateUserScorer(scorerId) {
Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ angular.module('QuepidApp')
templateUrl: 'views/teams/show.html',
controller: 'TeamCtrl'
})
.when('/advanced', {
templateUrl: 'views/advanced/index.html',
controller: 'AdvancedCtrl'
.when('/scorers', {
templateUrl: 'views/scorers/index.html',
controller: 'ScorersCtrl'
})
.otherwise({
templateUrl: 'views/404.html',
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/services/userSvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ angular.module('UtilitiesModule')
var self = this;

// Make sure the user's scorerId is an int instead of a string.
// In the advanced screen, the dropdown lists the scorers' id as a number
// In the Scorers screen, the dropdown lists the scorers' id as a number
// so the comparison fails if the user's scorerId is a string, and
// even if the user has a default scorer it would look like as
// if he does not.
Expand Down
2 changes: 1 addition & 1 deletion app/assets/templates/views/pick_scorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h4>Select from defaults:</h4>
</div>

<div class="modal-footer">
<button class="btn btn-primary pull-left" ng-click="gotoAdvanced()" ng-show="!communalScorersOnly">
<button class="btn btn-primary pull-left" ng-click="gotoScorers()" ng-show="!communalScorersOnly">
<i class="glyphicon glyphicon-plus" style="color: #FFF"></i>
Create New Scorer
</button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
<div id="advanced" class="container">
<h2>Advanced Options</h2>
<div id="scorers" class="container">
<h2>Scorer Options</h2>

<div id='default-scorers' class="row">
<div class='col-sm-6'>
<div class='advanced-header'>
<div class='scorers-header'>
<h3>Your Default Scorer</h3>
<p>Change the default scorer you use when creating new cases!</p>

<div class="form-group">
<select
ng-model="advanced.user.defaultScorerId"
ng-options="scorer.scorerId as scorer.displayName for scorer in advanced.combinedScorers"
ng-change="advanced.updateUserScorer(advanced.user.defaultScorerId)"
ng-model="scorers.user.defaultScorerId"
ng-options="scorer.scorerId as scorer.displayName for scorer in scorers.combinedScorers"
ng-change="scorers.updateUserScorer(scorers.user.defaultScorerId)"
class="form-control"
>
</select>
Expand All @@ -25,6 +25,7 @@ <h3>Your Default Scorer</h3>

<div id='custom-scorers'>
<h3>Scorers</h3>
<p>We have two types of scorers, <i>Communal</i> that ship with Quepid and <i>Custom</i> which are scorers that you create and share with your teammates.</p>

<div class="row">
<div class='col-md-4'>
Expand Down Expand Up @@ -71,8 +72,8 @@ <h3>Scorers</h3>
</div>
</div>

<ul ng-model="advanced.combinedScorers" class="scorers-list row">
<li dir-paginate="scorer in advanced.combinedScorers | scorerType:scorerFilters.typeFilter | filter:q | itemsPerPage: pagination.scorers.pageSize : 'scorers' track by scorer.scorerId" current-page="pagination.scorers.currentPage" pagination-id="scorers" class="scorers-list-item col-xs-12">
<ul ng-model="scorers.combinedScorers" class="scorers-list row">
<li dir-paginate="scorer in scorers.combinedScorers | scorerType:scorerFilters.typeFilter | filter:q | itemsPerPage: pagination.scorers.pageSize : 'scorers' track by scorer.scorerId" current-page="pagination.scorers.currentPage" pagination-id="scorers" class="scorers-list-item col-xs-12">
<scorer-listing scorer="scorer"></scorer-listing>
</li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions app/views/layouts/_main_navigation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Begin case selector -->
<li class="dropdown" uib-dropdown>
<a href class="dropdown-toggle" uib-dropdown-toggle>
<span class="nav-label">Relevancy cases</span>
<span class="nav-label">Relevancy Cases</span>
<i class="fa fa-chevron-down"></i>
</a>

Expand Down Expand Up @@ -32,5 +32,5 @@
<!-- End case selector -->

<li><a ng-attr-target="{{ isRailsGoingToAngular() ? '_self' : undefined }}" href="/teams">Teams</a></li>
<li><a ng-attr-target="{{ isRailsGoingToAngular() ? '_self' : undefined }}" href="/advanced">Custom scorers</a></li>
<li><a ng-attr-target="{{ isRailsGoingToAngular() ? '_self' : undefined }}" href="/scorers">Scorers</a></li>
</ul>
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
get '/case' => 'home#index'
get '/cases/import' => 'home#index'
get '/teams(/:id)' => 'home#index', as: :teams_path
get '/advanced' => 'home#index'
get '/scorers' => 'home#index'

# Static pages
get '*page' => 'pages#show'
Expand Down

0 comments on commit 41c425e

Please sign in to comment.