| author | rougeronj |
| Wed, 27 May 2015 19:02:43 +0200 | |
| changeset 99 | c7c424e9eed5 |
| parent 76 | aa0a2d37faca |
| permissions | -rw-r--r-- |
| 0 | 1 |
(function(){ |
|
99
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
2 |
'use strict'; |
| 0 | 3 |
|
|
99
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
4 |
angular.module('ammicoSlides',['ngResource', 'ngRoute']) |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
5 |
.controller('slidesCtrl', function($scope, $routeParams, Slide, Utils){ |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
6 |
|
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
7 |
$scope.slide = Slide.get({idSlide:$routeParams.idSlide, format:'json'}, function(data){ |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
8 |
data = Utils.sanitizeUrls(data); |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
9 |
}); |
| 37 | 10 |
|
|
99
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
11 |
}) |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
12 |
.directive('slideEditor', function() { |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
13 |
return { |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
14 |
restrict: 'AE', |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
15 |
replace: true, |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
16 |
scope: false, |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
17 |
templateUrl: 'slides/data_editor.html', |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
18 |
controller: function($scope){ |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
19 |
$scope.slidesave = function(){ |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
20 |
if(typeof $scope.slide.tags === 'string'){ |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
21 |
$scope.slide.tags = $scope.slide.tags.split(','); |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
22 |
for (var i = $scope.slide.tags.length - 1; i >= 0; i--) { |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
23 |
$scope.slide.tags[i] = $scope.slide.tags[i].trim(); |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
24 |
} |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
25 |
} |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
26 |
$scope.slide.editMode = false; |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
27 |
$scope.slide.$update({format:'json'}); |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
28 |
}; |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
29 |
$scope.doubleClick = function(){ |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
30 |
$scope.slide.editMode = true; |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
31 |
}; |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
32 |
} |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
33 |
}; |
|
c7c424e9eed5
refactor the ammicoApi service and put it into a specific module (ammicoCommon). Use factory to serve the resources
rougeronj
parents:
76
diff
changeset
|
34 |
}); |
| 0 | 35 |
|
36 |
})(); |