@@ -44,6 +44,7 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
4444 $scope . formData = {
4545 feeds : [ ] ,
4646 scripts : [ ] ,
47+ styles : [ ] ,
4748 code : ''
4849 } ;
4950
@@ -2209,9 +2210,9 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
22092210 $scope . fileChanged ( ) ;
22102211 } ;
22112212
2212- $scope . addScript = ( ) => {
2213+ $scope . addUrl = ( script = true ) => {
22132214 dialogHub . showFormDialog ( {
2214- title : ' Add script' ,
2215+ title : ` Add ${ script ? 'script' : 'style' } ` ,
22152216 form : {
22162217 'asName' : {
22172218 label : 'Name' ,
@@ -2236,7 +2237,7 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
22362237 } ) . then ( ( form ) => {
22372238 if ( form ) {
22382239 $scope . $evalAsync ( ( ) => {
2239- $scope . formData . scripts . push ( {
2240+ $scope . formData [ script ? ' scripts' : 'styles' ] . push ( {
22402241 name : form [ 'asName' ] ,
22412242 url : form [ 'asUrl' ]
22422243 } ) ;
@@ -2246,25 +2247,25 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
22462247 } , ( error ) => {
22472248 console . error ( error ) ;
22482249 dialogHub . showAlert ( {
2249- title : ' New script error' ,
2250- message : ' There was an error while adding the new script.' ,
2250+ title : ` New ${ script ? 'script' : 'style' } error` ,
2251+ message : ` There was an error while adding the new ${ script ? 'script' : 'style' } .` ,
22512252 type : AlertTypes . Error ,
22522253 preformatted : false ,
22532254 } ) ;
22542255 } ) ;
22552256 } ;
22562257
2257- $scope . editScript = ( script ) => {
2258+ $scope . editUrl = ( item , script = true ) => {
22582259 dialogHub . showFormDialog ( {
2259- title : ' Edit script' ,
2260+ title : ` Edit ${ script ? 'script' : 'style' } ` ,
22602261 form : {
22612262 'asName' : {
22622263 label : 'Name' ,
22632264 controlType : 'input' ,
22642265 placeholder : '' ,
22652266 type : 'text' ,
22662267 minlength : 1 ,
2267- value : script . name ,
2268+ value : item . name ,
22682269 focus : true ,
22692270 required : true
22702271 } ,
@@ -2274,7 +2275,7 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
22742275 placeholder : '' ,
22752276 type : 'text' ,
22762277 minlength : 1 ,
2277- value : script . url ,
2278+ value : item . url ,
22782279 required : true
22792280 } ,
22802281 } ,
@@ -2283,24 +2284,24 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
22832284 } ) . then ( ( form ) => {
22842285 if ( form ) {
22852286 $scope . $evalAsync ( ( ) => {
2286- script . name = form [ 'asName' ] ;
2287- script . url = form [ 'asUrl' ] ;
2287+ item . name = form [ 'asName' ] ;
2288+ item . url = form [ 'asUrl' ] ;
22882289 $scope . fileChanged ( ) ;
22892290 } ) ;
22902291 }
22912292 } , ( error ) => {
22922293 console . error ( error ) ;
22932294 dialogHub . showAlert ( {
2294- title : ' New script error' ,
2295- message : ' There was an error while adding the new script.' ,
2295+ title : ` New ${ script ? 'script' : 'style' } error` ,
2296+ message : ` There was an error while adding the new ${ script ? 'script' : 'style' } .` ,
22962297 type : AlertTypes . Error ,
22972298 preformatted : false ,
22982299 } ) ;
22992300 } ) ;
23002301 } ;
23012302
2302- $scope . deleteScript = ( index ) => {
2303- $scope . formData . scripts . splice ( index , 1 ) ;
2303+ $scope . deleteUrl = ( index , script = true ) => {
2304+ $scope . formData [ script ? ' scripts' : 'styles' ] . splice ( index , 1 ) ;
23042305 $scope . fileChanged ( ) ;
23052306 } ;
23062307
@@ -2480,6 +2481,9 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
24802481 if ( response . data . hasOwnProperty ( 'scripts' ) ) {
24812482 $scope . formData . scripts = response . data . scripts ;
24822483 }
2484+ if ( response . data . hasOwnProperty ( 'styles' ) ) {
2485+ $scope . formData . styles = response . data . styles ;
2486+ }
24832487 if ( response . data . hasOwnProperty ( 'form' ) ) {
24842488 createDomFromJson ( migrateForm ( response . data . form ) ) ;
24852489 }
@@ -2542,6 +2546,7 @@ editorView.controller('DesignerController', ($scope, $window, $document, $timeou
25422546 metadata : getMetadataFromForm ( ) ,
25432547 feeds : $scope . formData . feeds ,
25442548 scripts : $scope . formData . scripts ,
2549+ styles : $scope . formData . styles ,
25452550 code : $scope . formData . code ,
25462551 form : createFormJson ( $scope . formModel )
25472552 } ;
0 commit comments