| author | rougeronj |
| Tue, 31 Mar 2015 12:25:19 +0200 | |
| changeset 48 | c17f2b37b032 |
| parent 40 | 4b3bebe4355d |
| child 54 | ccb586464a6f |
| permissions | -rw-r--r-- |
| 0 | 1 |
(function(){ |
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
2 |
'use strict'; |
| 0 | 3 |
|
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
4 |
angular.module('ammicoSlides',['ngResource', 'ngRoute']) |
|
40
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
5 |
.controller('slidesCtrl', function($scope, $routeParams, searchApi){ |
|
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
6 |
console.log($scope.currentBook); |
|
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
7 |
|
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
8 |
$scope.slide = searchApi.slide.get({idSlide:$routeParams.idSlide, format:'json'}, function(data){ |
|
40
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
9 |
data = searchApi.sanitizeUrls(data); |
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
10 |
}); |
| 37 | 11 |
|
12 |
$scope.save = function(){ |
|
13 |
$scope.slide.$save({idSlide:$routeParams.idSlide, format:'json'}); |
|
14 |
}; |
|
15 |
||
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
16 |
}) |
| 37 | 17 |
.directive('slideEditor', function() { |
18 |
return { |
|
19 |
restrict: 'AE', |
|
20 |
replace: true, |
|
21 |
scope: false, |
|
22 |
templateUrl: 'slides/dataEditor.html', |
|
23 |
controller: function($scope){ |
|
24 |
$scope.slidesave = function(){ |
|
25 |
if(typeof $scope.slide.tags === 'string'){ |
|
26 |
$scope.slide.tags = $scope.slide.tags.split(','); |
|
|
40
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
27 |
for (var i = $scope.slide.tags.length - 1; i >= 0; i--) { |
|
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
28 |
$scope.slide.tags[i] = $scope.slide.tags[i].trim(); |
|
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
29 |
} |
| 37 | 30 |
} |
31 |
$scope.slide.editMode = false; |
|
32 |
$scope.save(); |
|
33 |
}; |
|
|
40
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
34 |
$scope.doubleClick = function(){ |
|
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
35 |
$scope.slide.editMode = true; |
|
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
36 |
}; |
| 37 | 37 |
} |
38 |
}; |
|
|
31
8d016c195d79
get info of a slide and show it. Sanitize html from description field and add it to the scope
rougeronj
parents:
26
diff
changeset
|
39 |
}); |
| 0 | 40 |
|
41 |
})(); |