#267: added sound notifications

This commit is contained in:
Vokhmin Alexey V 2013-08-20 23:10:24 +04:00
parent afb9ad581d
commit 36259776a1
7 changed files with 33 additions and 5 deletions

View File

@ -65,6 +65,7 @@ gem 'ng-rails-csrf'
gem 'momentjs-rails'
gem 'angular-i18n', '0.1.2'
gem 'js-routes'
gem 'soundmanager-rails'
gem 'time_diff'

View File

@ -372,6 +372,7 @@ GEM
skinny (0.2.3)
eventmachine (~> 1.0.0)
thin (~> 1.5.0)
soundmanager-rails (0.1.5)
sprockets (2.2.2)
hike (~> 1.2)
multi_json (~> 1.0)
@ -492,6 +493,7 @@ DEPENDENCIES
sass-rails (~> 3.2.5)
shotgun
shoulda
soundmanager-rails
state_machine
therubyracer (~> 0.10.2)
therubyrhino (~> 1.73.1)

View File

@ -24,3 +24,20 @@ var LocalesHelper = function($locale) {
}
}
RosaABF.factory("LocalesHelper", ['$locale', LocalesHelper]);
var SoundNotificationsHelper = function() {
var statusChangedSound = null;
soundManager.setup({
url: '/assets/swf/',
onready: function() {
statusChangedSound = soundManager.createSound({url: '/assets/garbage_shattering.wav'});
}
});
return {
buildStatusChanged: function() {
if (statusChangedSound)
statusChangedSound.play();
}
}
}
RosaABF.factory('SoundNotificationsHelper', SoundNotificationsHelper);

View File

@ -1,4 +1,4 @@
RosaABF.controller('BuildListController', ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
RosaABF.controller('BuildListController', ['$scope', '$http', '$timeout', 'SoundNotificationsHelper', function($scope, $http, $timeout, SoundNotificationsHelper) {
$scope.advisoriable_types = <%=BuildList::RELEASE_UPDATE_TYPES%>;
@ -13,7 +13,10 @@ RosaABF.controller('BuildListController', ['$scope', '$http', '$timeout', functi
$scope.getBuildList = function() {
$http.get(Routes.build_list_path($scope.id, {format: 'json'})).success(function(results) {
$scope.build_list = $scope.subject = new BuildList(results.build_list);
var build_list = new BuildList(results.build_list);
if ($scope.build_list && $scope.build_list.status != build_list.status)
SoundNotificationsHelper.buildStatusChanged();
$scope.build_list = $scope.subject = build_list;
});
}

View File

@ -1,4 +1,4 @@
RosaABF.controller('ProductBuildListController', ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
RosaABF.controller('ProductBuildListController', ['$scope', '$http', '$timeout', 'SoundNotificationsHelper', function($scope, $http, $timeout, SoundNotificationsHelper) {
$scope.id = $('#product_build_list_id').val();
$scope.pbl = null;
@ -6,7 +6,10 @@ RosaABF.controller('ProductBuildListController', ['$scope', '$http', '$timeout',
$scope.getProductBuildList = function() {
$http.get(Routes.product_build_list_path($scope.id, {format: 'json'})).success(function(results) {
$scope.pbl = $scope.subject = results.product_build_list;
var product_build_list = results.product_build_list;
if ($scope.pbl && $scope.pbl.status != product_build_list.status)
SoundNotificationsHelper.buildStatusChanged();
$scope.pbl = $scope.subject = product_build_list;
});
}

View File

@ -19,6 +19,8 @@
//= require angular-i18n
//= require_tree ./angularjs
//= require moment
//= require soundmanager2
// require soundmanager2-nodebug-jsmin
//= require_self

Binary file not shown.