| author | rougeronj |
| Wed, 08 Apr 2015 00:31:45 +0200 | |
| changeset 76 | aa0a2d37faca |
| parent 70 | e7e9f2ff6f10 |
| child 99 | c7c424e9eed5 |
| 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']) |
| 55 | 5 |
.controller('slidesCtrl', function($scope, $routeParams, ammicoApi){ |
|
40
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
6 |
|
| 55 | 7 |
$scope.slide = ammicoApi.slide.get({idSlide:$routeParams.idSlide, format:'json'}, function(data){ |
8 |
data = ammicoApi.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
|
9 |
}); |
| 37 | 10 |
|
|
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
|
11 |
}) |
| 37 | 12 |
.directive('slideEditor', function() { |
13 |
return { |
|
14 |
restrict: 'AE', |
|
15 |
replace: true, |
|
16 |
scope: false, |
|
| 70 | 17 |
templateUrl: 'slides/data_editor.html', |
| 37 | 18 |
controller: function($scope){ |
19 |
$scope.slidesave = function(){ |
|
20 |
if(typeof $scope.slide.tags === 'string'){ |
|
21 |
$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
|
22 |
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
|
23 |
$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
|
24 |
} |
| 37 | 25 |
} |
26 |
$scope.slide.editMode = false; |
|
|
76
aa0a2d37faca
show the data of the json received from the server (normalize the exchanged data)
rougeronj
parents:
70
diff
changeset
|
27 |
$scope.slide.$save({idSlide:$scope.slide.id, format:'json'}); |
| 37 | 28 |
}; |
|
40
4b3bebe4355d
add sanitize function to accept url from the request response - enable edit on dbclick - improve html
rougeronj
parents:
37
diff
changeset
|
29 |
$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
|
30 |
$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
|
31 |
}; |
| 37 | 32 |
} |
33 |
}; |
|
|
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
|
34 |
}); |
| 0 | 35 |
|
36 |
})(); |