Skip to content

Commit

Permalink
questions spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbrooks committed Mar 15, 2015
1 parent 8777a15 commit 0151e0a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 16 deletions.
9 changes: 1 addition & 8 deletions msgvis/static/SparQs/SparQs.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,9 @@
'SparQs.charts',
'ngCookies',
'ngDragDrop',
'ngAnimate',
'angularSpinner'
'ngAnimate'
]);

app.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
usSpinnerConfigProvider.setDefaults({
color: '#eee'
});
}]);

//Fix CSRF
//http://django-angular.readthedocs.org/en/latest/csrf-protection.html
app.run(['$http', '$cookies', function ($http, $cookies) {
Expand Down
37 changes: 30 additions & 7 deletions msgvis/static/SparQs/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@


var module = angular.module('SparQs.controllers', [
'SparQs.services'
'SparQs.services',
'angularSpinner'
]);

module.config(function ($interpolateProvider) {
module.config(['$interpolateProvider', function ($interpolateProvider) {
$interpolateProvider.startSymbol('{$');
$interpolateProvider.endSymbol('$}');
});
}]);


module.config(['usSpinnerConfigProvider', function (usSpinnerConfigProvider) {
usSpinnerConfigProvider.setDefaults({
color: '#eee'
});
}]);

var DimensionController = function ($scope, Dimensions, Filtering, Selection) {

Expand Down Expand Up @@ -147,13 +155,27 @@
];
module.controller('SparQs.controllers.ExampleMessageController', ExampleMessageController);

var SampleQuestionController = function ($scope, $timeout, Selection, SampleQuestions) {
var SampleQuestionController = function ($scope, $timeout, Selection, SampleQuestions, usSpinnerService) {

$scope.questions = SampleQuestions;
$scope.selection = Selection;

$scope.spinnerOptions = {
radius: 15,
width: 4,
length: 8
};

$scope.get_sample_questions = function () {
SampleQuestions.load(Selection.dimensions());
var request = SampleQuestions.load(Selection.dimensions());

if (request) {
usSpinnerService.spin('questions-spinner');
request.then(function() {
usSpinnerService.stop('questions-spinner');
})

}
};

$scope.get_authors = function(authors){
Expand All @@ -174,7 +196,7 @@
if ( source.venue )
template += "<span class='source venue'>Published in <em>" + source.venue + "</em></span>";
return template;
}
};

$scope.$watch('questions.list', function(){
//When the question list changes, we are going to manually (jQuery)
Expand Down Expand Up @@ -203,7 +225,8 @@
'$scope',
'$timeout',
'SparQs.services.Selection',
'SparQs.services.SampleQuestions'
'SparQs.services.SampleQuestions',
'usSpinnerService'
];
module.controller('SparQs.controllers.SampleQuestionController', SampleQuestionController);

Expand Down
2 changes: 1 addition & 1 deletion msgvis/static/SparQs/services/questions_service.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
};

var self = this;
$http.post(apiUrl, request)
return $http.post(apiUrl, request)
.success(function (data) {
self.list = data.questions.map(function (qdata) {
$timeout(function() {
Expand Down
2 changes: 2 additions & 0 deletions msgvis/templates/explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
</span>-->
</li>
</ul>

<span us-spinner="spinnerOptions" spinner-key="questions-spinner"></span>
</div>
<div id="viz" class="row app-panel" ng-controller="SparQs.controllers.VisualizationController">
<div class="heading">Visualization</div>
Expand Down

0 comments on commit 0151e0a

Please sign in to comment.