1(function() { 2 'use strict'; 3 4 angular.module('cmsEngine').config(['$provide', function( $provide ) { 5 /** 6 * Avaa moduulin muokkausmodalin 7 * @param {Module} module Muokattava moduuli 8 */ 9 $provide.decorator( 'editor', ['$delegate','artestFileGallery','premadeAssetData','$assets','$http','$constructors','$server','Notification','$uibModal','$rootScope','$clientData','engineUtils','$ApiHandler', 10 function( $delegate, artestFileGallery, premadeAssetData, $assets, $http, $constructors, $server, Notification, $uibModal, $rootScope, $clientData, engineUtils, $ApiHandler ) { 11 12 var moduleEditModalInstance; 13 $delegate.openModuleSettings = function(module,operationmode) { 14 15 16 if (moduleEditModalInstance) { 17 if (!document.querySelector("body > .modal.editor-modal")) { 18 moduleEditModalInstance.close(); 19 moduleEditModalInstance = null; 20 } 21 22 if (moduleEditModalInstance) { 23 return Notification.error( "Module edit modal is already open" ); 24 } 25 } 26 27 var modalInstance = moduleEditModalInstance = $uibModal.open({ 28 animation: true, 29 templateUrl: '/cmsengine/partials/moduleEditModal.html', 30 controller: "moduleEditModal", 31 controllerAs: 'moduleEditor', 32 backdrop: 'static', 33 size: 'full-width', // custom-luokka 34 windowClass: 'editor-modal', 35 resolve: { 36 "$controller": window.controllerResolverRaw( location.origin + "/cmsengine/js/controllers/", "moduleEditModal" ), 37 artestFileGallery: function(){ return artestFileGallery; }, 38 39 tinyMCREPreload: function() { 40 if (typeof $delegate.doPreloadTinyMCE == "function") { 41 let ret = $delegate.doPreloadTinyMCE(); 42 if (ret) ret.catch(e => console.log(e)); 43 } 44 }, 45 46 operationmode: function(){ 47 return operationmode; 48 }, 49 module_categories: function(){ 50 return $ApiHandler.get( '/cms/modules_categories', { "filters":"onlydata,onlyattrs" }, undefined ) 51 .then(function(cats){ 52 return cats.data; 53 }) 54 }, 55 similar_modules: function(){ 56 57 var retmods = []; 58 for(var p in $assets.pages){ 59 for(var m in $assets.pages[p].content.placeholders){ 60 if($assets.pages[p].content.placeholders[m].uid == module.uid){ 61 retmods.push({ 62 'module_data' :$assets.pages[p].content.moduleData[$assets.pages[p].content.placeholders[m].uid][$assets.pages[p].content.placeholders[m].id] , 63 'placeholder':$assets.pages[p].content.placeholders[m], 64 'display_name': $assets.pages[p].content.moduleData[$assets.pages[p].content.placeholders[m].uid][$assets.pages[p].content.placeholders[m].id].data.display_name || '', 65 'from_page': $assets.pages[p].title, 66 'from_template':null, 67 'from_element':null 68 }); 69 } 70 } 71 72 } 73 for(var t in $assets.templates){ 74 for(var m in $assets.templates[t].header.placeholders){ 75 if($assets.templates[t].header.placeholders[m].uid == module.uid){ 76 retmods.push({ 77 'module_data' :$assets.templates[t].header.moduleData[$assets.templates[t].header.placeholders[m].uid][$assets.templates[t].header.placeholders[m].id] , 78 'placeholder':$assets.templates[t].header.placeholders[m], 79 'display_name': $assets.templates[t].header.moduleData[$assets.templates[t].header.placeholders[m].uid][$assets.templates[t].header.placeholders[m].id].data.display_name || '', 80 'from_page': null, 81 'from_template':$assets.templates[t].name, 82 'from_element':'header' 83 }); 84 } 85 } 86 for(var m in $assets.templates[t].footer.placeholders){ 87 if( $assets.templates[t].footer.placeholders[m].uid == module.uid){ 88 retmods.push({ 89 'module_data' :$assets.templates[t].footer.moduleData[$assets.templates[t].footer.placeholders[m].uid][$assets.templates[t].footer.placeholders[m].id] , 90 'placeholder':$assets.templates[t].footer.placeholders[m], 91 'display_name': $assets.templates[t].footer.moduleData[$assets.templates[t].footer.placeholders[m].uid][$assets.templates[t].footer.placeholders[m].id].data.display_name || '', 92 'from_page':null , 93 'from_template':$assets.templates[t].name, 94 'from_element':'footer' 95 }); 96 } 97 } 98 for(var m in $assets.templates[t].sidebarLeft.placeholders){ 99 if( $assets.templates[t].sidebarLeft.placeholders[m].uid == module.uid){ 100 retmods.push({ 101 'module_data' :$assets.templates[t].sidebarLeft.moduleData[$assets.templates[t].sidebarLeft.placeholders[m].uid][$assets.templates[t].sidebarLeft.placeholders[m].id] , 102 'placeholder':$assets.templates[t].sidebarLeft.placeholders[m], 103 'display_name': $assets.templates[t].sidebarLeft.moduleData[$assets.templates[t].sidebarLeft.placeholders[m].uid][$assets.templates[t].sidebarLeft.placeholders[m].id].data.display_name || '', 104 'from_page':null , 105 'from_template':$assets.templates[t].name, 106 'from_element':'sidebarLeft' 107 }); 108 } 109 110 } 111 for(var m in $assets.templates[t].sidebarRight.placeholders){ 112 if($assets.templates[t].sidebarRight.placeholders[m].uid == module.uid){ 113 retmods.push({ 114 'module_data' :$assets.templates[t].sidebarRight.moduleData[$assets.templates[t].sidebarRight.placeholders[m].uid][$assets.templates[t].sidebarRight.placeholders[m].id] , 115 'placeholder':$assets.templates[t].sidebarRight.placeholders[m], 116 'display_name': $assets.templates[t].sidebarRight.moduleData[$assets.templates[t].sidebarRight.placeholders[m].uid][$assets.templates[t].sidebarRight.placeholders[m].id].data.display_name || '', 117 'from_page':null , 118 'from_template':$assets.templates[t].name, 119 'from_element':'sidebarRight' 120 }); 121 } 122 } 123 for(var m in $assets.templates[t].sidebarLeftDynamic.placeholders){ 124 if( $assets.templates[t].sidebarLeftDynamic.placeholders[m].uid == module.uid){ 125 retmods.push({ 126 'module_data' :$assets.templates[t].sidebarLeftDynamic.moduleData[$assets.templates[t].sidebarLeftDynamic.placeholders[m].uid][$assets.templates[t].sidebarLeftDynamic.placeholders[m].id] , 127 'placeholder':$assets.templates[t].sidebarLeftDynamic.placeholders[m], 128 'display_name': $assets.templates[t].sidebarLeftDynamic.moduleData[$assets.templates[t].sidebarLeftDynamic.placeholders[m].uid][$assets.templates[t].sidebarLeftDynamic.placeholders[m].id].data.display_name || '', 129 'from_page':null , 130 'from_template':$assets.templates[t].name, 131 'from_element':'sidebarLeftDynamic' 132 }); 133 } 134 } 135 for(var m in $assets.templates[t].sidebarRightDynamic.placeholders){ 136 if($assets.templates[t].sidebarRightDynamic.placeholders[m].uid == module.uid){ 137 retmods.push({ 138 'module_data' :$assets.templates[t].sidebarRightDynamic.moduleData[$assets.templates[t].sidebarRightDynamic.placeholders[m].uid][$assets.templates[t].sidebarRightDynamic.placeholders[m].id] , 139 'placeholder':$assets.templates[t].sidebarRightDynamic.placeholders[m], 140 'display_name': $assets.templates[t].sidebarRightDynamic.moduleData[$assets.templates[t].sidebarRightDynamic.placeholders[m].uid][$assets.templates[t].sidebarRightDynamic.placeholders[m].id].data.display_name || '', 141 'from_page':null , 142 'from_template':$assets.templates[t].name, 143 'from_element':'sidebarRightDynamic' 144 }); 145 } 146 } 147 } 148 return retmods; 149 }, 150 module: function() { 151 var modulemodel = angular.copy(module.data.model); 152 var modulesettings = angular.copy(module.data.settings); 153 var previewModule = new $constructors.Module(module.getServerObject()); 154 155 previewModule.data.model = modulemodel; 156 previewModule.data.settings = modulesettings; 157 previewModule.parentContainer = 'preview'; 158 previewModule.id = module.id; 159 160 previewModule['formMetaString'] = JSON.stringify(previewModule.data.form_meta,null,"\t"); 161 previewModule['json_valid'] = true; 162 previewModule['json_touched'] = false;
163 previewModule['css_touched'] = false; 164 previewModule['html_touched'] = false; 165 previewModule['js_valid'] = true; 166 previewModule['js_touched'] = false; 167 168 return previewModule; 169 }, 170 css_schemas : function(){ 171 var schemakeys = [ 172 "font-family", 173 "font-size", 174 "font-style", 175 "text-align", 176 "color", 177 "background-color", 178 "border-color", 179 "border-style", 180 "border-width", 181 "border-top-color", 182 "border-top-style", 183 "border-top-width", 184 "border-right-color", 185 "border-right-style", 186 "border-right-width", 187 "border-bottom-color", 188 "border-bottom-style", 189 "border-bottom-width", 190 "border-left-color", 191 "border-left-style", 192 "border-left-width", 193 "margin-left", 194 "margin-right", 195 "margin-top", 196 "margin-bottom", 197 "padding-left", 198 "padding-right", 199 "padding-top", 200 "padding-bottom", 201 "text-decoration", 202 "text-shadow", 203 "font-weight", 204 "list-style-type", 205 "list-style-position", 206 "box-shadow", 207 "border-radius", 208 ]; 209 var schemavalidators = { 210 "font-size" : { 211 "pattern" : "^[0-9]+(\.[0-9]+)?(px|pt|em|rem|vh|vw|%){1}$" 212 } 213 }; 214 215 var schemas = {}; 216 for(var sid in module.data.form_meta.style_elements){ 217 var schemaobject = { 218 "type": "object", 219 "properties": {} 220 }; 221 222 for(var sk in schemakeys){ 223 schemaobject.properties[schemakeys[sk]] = {}; 224 schemaobject.properties["cssdonotuse-"+schemakeys[sk]] = {"type":"boolean","default" :false,"title":" ","label":false}; 225 // schemaobject.properties["separateBorders"] = { "type": "boolean", "default": false, "title": "Assign borders individually" }; 226 if(schemavalidators[schemakeys[sk]] != null){ 227 schemaobject.properties[schemakeys[sk]]['type'] = "string"; 228 schemaobject.properties[schemakeys[sk]]['pattern'] = schemavalidators[schemakeys[sk]].pattern; 229 230 231 } 232 233 } 234 schemas[module.data.form_meta.style_elements[sid].key] = schemaobject; 235 } 236 //console.log(schemas); 237 return schemas; 238 }, 239 css_forms: function(){ 240 var css_standard_keys = [ 241 "font-size", 242 "font-family", 243 "font-style", 244 "text-align", 245 "color", 246 "background-color", 247 "font-weight", 248 "text-decoration", 249 ]; 250 var css_ext_keys = { 251 "borders": [ 252 "border-style", 253 "border-width", 254 "border-color", 255 256 "border-top-style", 257 "border-top-width", 258 "border-top-color", 259 260 "border-right-style", 261 "border-right-width", 262 "border-right-color", 263 264 "border-bottom-style", 265 "border-bottom-width", 266 "border-bottom-color", 267 268 "border-left-style", 269 "border-left-width", 270 "border-left-color" 271 ], 272 "margins": [ 273 "margin-left", 274 "margin-right", 275 "margin-top", 276 "margin-bottom" 277 ], 278 "paddings": [ 279 "padding-left", 280 "padding-right", 281 "padding-top", 282 "padding-bottom" 283 ], 284 "lists": [ 285 "list-style-type", 286 "list-style-position" 287 ], 288 "box-shadow": [ 289 "box-shadow" 290 ], 291 "text-shadow": [ 292 "text-shadow" 293 ], 294 "border-radius": [ 295 "border-radius" 296 ] 297 } 298 299 var generateCSSEditorRow = function(elementkey,title, key, options){ 300 if(calculated_css_keys[elementkey].indexOf(key) < 0){ 301 return {}; 302 } 303 var returnobject = { 304 305 "type":"section", 306 "htmlClass" :"row", 307 "items": [ 308 { 309 "type": "section", 310 "htmlClass":"col-xs-1", 311 "items":[ 312 { 313 314 "key": [ 315 "cssdonotuse-"+key 316 ], 317 } 318 ] 319 }, 320 { 321 "type":"section", 322 "htmlClass":"col-xs-11", 323 "items":[ 324 angular.extend({"key": [key],"title":title},options) 325 ] 326 } 327 328 ] 329 330 331 }; 332 return returnobject; 333 } 334 var calculated_css_keys = {}; 335 336 for(var sid in module.data.form_meta.style_elements){ 337 calculated_css_keys[module.data.form_meta.style_elements[sid].key] = css_standard_keys.slice(); 338 } 339 340 for(var sid in module.data.form_meta.style_elements){ 341 if(module.data.form_meta.style_elements[sid].includes != null){ 342 for(var eid in module.data.form_meta.style_elements[sid].includes){ 343 if(css_ext_keys[module.data.form_meta.style_elements[sid].includes[eid]] == null){ 344 continue; 345 } 346 //console.log(module.data.form_meta.style_elements[sid].includes[eid]); 347 //console.log(css_ext_keys); 348 for(var incl in css_ext_keys[module.data.form_meta.style_elements[sid].includes[eid]]){ 349 if(calculated_css_keys[module.data.form_meta.style_elements[sid].key].indexOf(css_ext_keys[module.data.form_meta.style_elements[sid].includes[eid]][incl]) >= 0) { 350 continue; 351 } 352 else { 353 calculated_css_keys[module.data.form_meta.style_elements[sid].key].push(css_ext_keys[module.data.form_meta.style_elements[sid].includes[eid]][incl]); 354 } 355 } 356 } 357 } 358 } 359 for(var sid in module.data.form_meta.style_elements){ 360 if(module.data.form_meta.style_elements[sid].excludes != null){ 361 for(var eid in module.data.form_meta.style_elements[sid].excludes){ 362 var remindex = calculated_css_keys[module.data.form_meta.style_elements[sid].key].indexOf( module.data.form_meta.style_elements[sid].excludes[eid]); 363 if(remindex >= 0){ 364 calculated_css_keys[module.data.form_meta.style_elements[sid].key].splice(remindex,1); 365 } 366 367 } 368 } 369 } 370 371 372 var forms = {}; 373 374 //======== 375 /* 376 Errormessage cheat sheet (must be used numerically) 377 INVALID_TYPE: 0, 378 ENUM_MISMATCH: 1, 379 ANY_OF_MISSING: 10, 380 ONE_OF_MISSING: 11, 381 ONE_OF_MULTIPLE: 12, 382 NOT_PASSED: 13, 383 // Numeric errors 384 NUMBER_MULTIPLE_OF: 100, 385 NUMBER_MINIMUM: 101, 386 NUMBER_MINIMUM_EXCLUSIVE: 102,
387 NUMBER_MAXIMUM: 103, 388 NUMBER_MAXIMUM_EXCLUSIVE: 104, 389 NUMBER_NOT_A_NUMBER: 105, 390 // String errors 391 STRING_LENGTH_SHORT: 200, 392 STRING_LENGTH_LONG: 201, 393 STRING_PATTERN: 202, 394 // Object errors 395 OBJECT_PROPERTIES_MINIMUM: 300, 396 OBJECT_PROPERTIES_MAXIMUM: 301, 397 OBJECT_REQUIRED: 302, 398 OBJECT_ADDITIONAL_PROPERTIES: 303, 399 OBJECT_DEPENDENCY_KEY: 304, 400 // Array errors 401 ARRAY_LENGTH_SHORT: 400, 402 ARRAY_LENGTH_LONG: 401, 403 ARRAY_UNIQUE: 402, 404 ARRAY_ADDITIONAL_ITEMS: 403, 405 // Custom/user-defined errors 406 FORMAT_CUSTOM: 500, 407 KEYWORD_CUSTOM: 501, 408 // Schema structure 409 CIRCULAR_REFERENCE: 600, 410 // Non-standard validation options 411 UNKNOWN_PROPERTY: 1000 412 413 Add this string to add glyphicon indicator for failed / succeeded validation 414 415 "feedback": "{'glyphicon': true, 'glyphicon-ok': hasSuccess(), 'glyphicon-star': !hasSuccess() }" 416 417 */ 418 //======== 419 for(var sid in module.data.form_meta.style_elements){ 420 //console.log(sid, module.data.form_meta.style_elements[sid].key); 421 var formobject = 422 [ 423 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 424 "Font Family", 425 "font-family", 426 { 427 "type": "select", 428 "titleMap": [ 429 { 430 "value": "initial", 431 "name" : "Initial" 432 }, 433 { 434 "value": 'inherit', 435 "name" : 'Inherit' 436 }, 437 { 438 "value": "Arial, Helvetica, sans-serif", 439 "name": "Arial, Helvetica, sans-serif" 440 }, 441 { 442 "value": "'Arial Black', Gadget, sans-serif", 443 "name" : "'Arial Black', Gadget, sans-serif" 444 }, 445 { 446 "value": "'Comic Sans MS', cursive, sans-serif", 447 "name" : "'Comic Sans MS', cursive, sans-serif" 448 }, 449 { 450 "value": 'Impact, Charcoal, sans-serif', 451 "name" : 'Impact, Charcoal, sans-serif' 452 }, 453 { 454 "value": "'Lucida Sans Unicode', 'Lucida Grande', sans-serif", 455 "name" : "'Lucida Sans Unicode', 'Lucida Grande', sans-serif" 456 }, 457 { 458 "value": 'Tahoma, Geneva, sans-serif', 459 "name" : 'Tahoma, Geneva, sans-serif' 460 }, 461 { 462 "value": "'Trebuchet MS', Helvetica, sans-serif", 463 "name" : "'Trebuchet MS', Helvetica, sans-serif" 464 }, 465 { 466 "value": 'Verdana, Geneva, sans-serif', 467 "name" : 'Verdana, Geneva, sans-serif' 468 }, 469 { 470 "value": 'Georgia, serif', 471 "name" : 'Georgia, serif' 472 }, 473 { 474 "value": "'Palatino Linotype', 'Book Antiqua', Palatino, serif", 475 "name" : "'Palatino Linotype', 'Book Antiqua', Palatino, serif" 476 }, 477 { 478 "value": "'Times New Roman', Times, serif", 479 "name" : "'Times New Roman', Times, serif" 480 }, 481 { 482 "value": "'Courier New', Courier, monospace", 483 "name" : "'Courier New', Courier, monospace" 484 }, 485 { 486 "value": "'Lucida Console', Monaco, monospace", 487 "name" : "'Lucida Console', Monaco, monospace" 488 } 489 490 ] 491 } 492 ), 493 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 494 "Font Style", 495 "font-style", 496 { 497 "type": "select", 498 "titleMap": [ 499 { 500 "value": 'normal', 501 "name" : 'Normal' 502 }, 503 { 504 "value": 'initial', 505 "name" : 'Initial' 506 }, 507 { 508 "value": 'inherit', 509 "name" : 'Inherit' 510 }, 511 { 512 "value": 'italic', 513 "name" : 'Italic' 514 }, 515 { 516 "value": 'oblique', 517 "name" : 'Oblique' 518 }, 519 ] 520 } 521 ), 522 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 523 "Text decoration", 524 "text-decoration", 525 { 526 "type": "select", 527 "titleMap": [ 528 { 529 "value": 'none', 530 "name" : 'None' 531 }, 532 { 533 "value": "initial", 534 "name": "Initial" 535 }, 536 { 537 "value": "inherit", 538 "name": "Inherit" 539 }, 540 { 541 "value": 'underline', 542 "name" : 'Underline' 543 }, 544 { 545 "value": 'overline', 546 "name" : 'Overline' 547 }, 548 { 549 "value": 'line-through', 550 "name" : 'Line through' 551 }, 552 553 ] 554 } 555 ), 556 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 557 "Font Size", 558 "font-size", 559 { 560 "type": "text", 561 "feedback": "{'glyphicon': true, 'glyphicon-ok': hasSuccess(), 'glyphicon-star': !hasSuccess() }", 562 "validationMessage": { 563 202 : "String must be valid css size specifier", 564 "default": "There is something wrong with the value" 565 566 } 567 } 568 ), 569 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 570 "Text alignment", 571 "text-align", 572 { 573 "type": "select", 574 "titleMap": [ 575 576 { 577 "value": "initial", 578 "name": "Initial" 579 }, 580 { 581 "value": "inherit", 582 "name": "Inherit" 583 }, 584 { 585 "value": 'left', 586 "name" : 'Left' 587 }, 588 { 589 "value": 'right', 590 "name" : 'Right' 591 }, 592 { 593 "value": 'center', 594 "name" : 'Center' 595 }, 596 { 597 "value": 'justified', 598 "name" : 'Justified' 599 }, 600 601 ] 602 } 603 ), 604 605 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 606 "Text Color", 607 "color", 608 { 609 "type" : "colorpicker", 610 "colorFormat" : "rgb", 611 "spectrumOptions": { 612 "preferredFormat": "rgb", 613 "showAlpha": true, 614 "showInput": true, 615 "allowEmpty": true, 616 617 } 618 } 619 ), 620 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 621 "Font Weight", 622 "font-weight", 623 { 624 "type": "text" 625 } 626 ), 627 628 // ----------------------------------------------------------------------- 629 // BORDERS 630 // ----------------------------------------------------------------------- 631 // All borders 632 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 633 "Border style (applies to all sides)", 634 "border-style", 635 { 636 "type": "select", 637 "titleMap": { 638 "none": "None", 639 "initial": "Initial", 640 "inherit": "Inherit", 641 "hidden": "Hidden", 642 "dotted": "Dotted", 643 "dashed": "Dashed", 644 "solid": "Solid", 645 "double": "Double", 646 "groove": "Groove", 647 "ridge": "Ridge", 648 "inset": "Inset", 649 "outset": "Outset" 650 } 651 } 652 ), 653 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 654 "Border width (applies to all sides)", 655 "border-width", 656 { 657 "type": "text" 658 } 659 ), 660 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 661 "Border color (applies to all sides)", 662 "border-color", 663 { 664 "type" : "colorpicker", 665 "colorFormat" : "rgb", 666 "spectrumOptions": { 667 "preferredFormat": "rgb", 668 "showAlpha": true, 669 "showInput": true, 670 "allowEmpty": true, 671 672 } 673 } 674 ), 675 676 // Top border 677 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 678 "Top border style", 679 "border-top-style", 680 { 681 "type": "select", 682 "titleMap": { 683 "none": "None", 684 "initial": "Initial", 685 "inherit": "Inherit", 686 "hidden": "Hidden", 687 "dotted": "Dotted", 688 "dashed": "Dashed", 689 "solid": "Solid", 690 "double": "Double", 691 "groove": "Groove", 692 "ridge": "Ridge", 693 "inset": "Inset", 694 "outset": "Outset" 695 } 696 } 697 ), 698 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 699 "Top border width", 700 "border-top-width", 701 { 702 "type": "text" 703 } 704 ), 705 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 706 "Top border color", 707 "border-top-color", 708 { 709 "type" : "colorpicker", 710 "colorFormat" : "rgb", 711 "spectrumOptions": { 712 "preferredFormat": "rgb", 713 "showAlpha": true, 714 "showInput": true, 715 "allowEmpty": true, 716 717 } 718 } 719 ), 720 721 // Right border 722 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 723 "Right border style", 724 "border-right-style", 725 { 726 "type": "select", 727 "titleMap": { 728 "none": "None", 729 "initial": "Initial", 730 "inherit": "Inherit", 731 "hidden": "Hidden", 732 "dotted": "Dotted", 733 "dashed": "Dashed", 734 "solid": "Solid", 735 "double": "Double", 736 "groove": "Groove", 737 "ridge": "Ridge", 738 "inset": "Inset", 739 "outset": "Outset" 740 } 741 } 742 ), 743 744 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 745 "Right border width", 746 "border-right-width", 747 { 748 "type": "text" 749 } 750 ), 751 752 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 753 "Right border color", 754 "border-right-color", 755 { 756 "type" : "colorpicker", 757 "colorFormat" : "rgb", 758 "spectrumOptions": { 759 "preferredFormat": "rgb", 760 "showAlpha": true, 761 "showInput": true, 762 "allowEmpty": true, 763 764 } 765 } 766 ), 767 768 // Bottom border 769 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 770 "Bottom border style", 771 "border-bottom-style", 772 { 773 "type": "select", 774 "titleMap": { 775 "none": "None", 776 "initial": "Initial", 777 "inherit": "Inherit", 778 "hidden": "Hidden", 779 "dotted": "Dotted", 780 "dashed": "Dashed", 781 "solid": "Solid", 782 "double": "Double", 783 "groove": "Groove", 784 "ridge": "Ridge", 785 "inset": "Inset", 786 "outset": "Outset" 787 } 788 } 789 ), 790 791 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 792 "Bottom border width", 793 "border-bottom-width", 794 { 795 "type": "text" 796 } 797 ), 798 799 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 800 "Bottom border color", 801 "border-bottom-color", 802 { 803 "type" : "colorpicker", 804 "colorFormat" : "rgb", 805 "spectrumOptions": { 806 "preferredFormat": "rgb", 807 "showAlpha": true, 808 "showInput": true, 809 "allowEmpty": true, 810 811 } 812 } 813 ), 814 815 // Left border 816 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 817 "Left border style", 818 "border-left-style", 819 { 820 "type": "select", 821 "titleMap": [ 822 { 823 "value": "none", 824 "name": "None" 825 }, 826 { 827 "value": "initial", 828 "name": "Initial" 829 }, 830 { 831 "value": "inherit", 832 "name": "Inherit" 833 }, 834 { 835 "value": "hidden", 836 "name": "Hidden" 837 }, 838 { 839 "value": "dotted", 840 "name": "Dotted" 841 }, 842 { 843 "value": "dashed", 844 "name": "Dashed" 845 }, 846 { 847 "value": "solid", 848 "name": "Solid" 849 }, 850 { 851 "value": "double", 852 "name": "Double" 853 }, 854 { 855 "value": "groove", 856 "name": "Groove" 857 }, 858 { 859 "value": "ridge", 860 "name": "Ridge" 861 }, 862 { 863 "value": "inset", 864 "name": "Inset" 865 }, 866 { 867 "value": "outset", 868 "name": "Outset" 869 }, 870 871 ] 872 } 873 ), 874 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 875 "Left border width", 876 "border-left-width", 877 { 878 "type": "text" 879 } 880 ), 881 882 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 883 "Left border color", 884 "border-left-color", 885 { 886 "type" : "colorpicker", 887 "colorFormat" : "rgb", 888 "spectrumOptions": { 889 "preferredFormat": "rgb", 890 "showAlpha": true, 891 "showInput": true, 892 "allowEmpty": true, 893 894 } 895 } 896 ), 897 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 898 "Margin left", 899 "margin-left", 900 { 901 "type": "text" 902 } 903 ), 904 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 905 "Margin right", 906 "margin-right", 907 { 908 "type": "text" 909 } 910 ), 911 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key,
912 "Margin top", 913 "margin-top", 914 { 915 "type": "text" 916 } 917 ), 918 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 919 "Margin bottom", 920 "margin-bottom", 921 { 922 "type": "text" 923 } 924 ), 925 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 926 "Padding left", 927 "padding-left", 928 { 929 "type": "text" 930 } 931 ), 932 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 933 "Padding right", 934 "padding-right", 935 { 936 "type": "text" 937 } 938 ), 939 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 940 "Padding top", 941 "padding-top", 942 { 943 "type": "text" 944 } 945 ), 946 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 947 "Padding bottom", 948 "padding-bottom", 949 { 950 "type": "text" 951 } 952 ), 953 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 954 "Background Color", 955 "background-color", 956 { 957 "type" : "colorpicker", 958 "colorFormat" : "rgb", 959 "spectrumOptions": { 960 "preferredFormat": "rgb", 961 "showAlpha": true, 962 "showInput": true, 963 "allowEmpty": true, 964 965 } 966 } 967 ), 968 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 969 "List style type", 970 "list-style-type", 971 { 972 "type" : "select", 973 "titleMap": [ 974 { 975 "value": "none", 976 "name": "None" 977 }, 978 { 979 "value": "initial", 980 "name": "Initial" 981 }, 982 { 983 "value": "inherit", 984 "name": "Inherit" 985 }, 986 { 987 "value": "disc", 988 "name": "Disc" 989 }, 990 991 { 992 "value": "circle", 993 "name": "circle" 994 }, 995 { 996 "value": "square", 997 "name": "Square" 998 }, 999 1000 { 1001 "value": "decimal", 1002 "name": "Decimal" 1003 }, 1004 { 1005 "value": "decimal-leading-zero", 1006 "name": "Decimal Leading Zero" 1007 }, 1008 1009 { 1010 "value": "cjk-ideographic", 1011 "name": "CJK Ideographic" 1012 }, 1013 { 1014 "value": "armenian", 1015 "name": "Armenian" 1016 }, 1017 { 1018 "value": "georgian", 1019 "name": "Georgian" 1020 }, 1021 { 1022 "value": "hebrew", 1023 "name": "Hebrew" 1024 }, 1025 { 1026 "value": "hiragana", 1027 "name": "Hiragana" 1028 }, 1029 { 1030 "value": "hiragana-iroha", 1031 "name": "Hiragana Iroha" 1032 }, 1033 { 1034 "value": "katakana", 1035 "name": "Katakana" 1036 }, 1037 { 1038 "value": "katakana-iroha", 1039 "name": "Katakana Iroha" 1040 }, 1041 { 1042 "value": "lower-alpha", 1043 "name": "Lower Alpha" 1044 }, 1045 { 1046 "value": "upper-alpha", 1047 "name": "Upper Alpha" 1048 }, 1049 { 1050 "value": "lower-greek", 1051 "name": "Lower Greek" 1052 }, 1053 { 1054 "value": "upper-greek", 1055 "name": "Upper Greek" 1056 }, 1057 { 1058 "value": "lower-latin", 1059 "name": "Lower Latin" 1060 }, 1061 { 1062 "value": "upper-latin", 1063 "name": "Upper Latin" 1064 }, 1065 { 1066 "value": "upper-roman", 1067 "name": "Upper roman" 1068 }, 1069 1070 ] 1071 } 1072 ), 1073 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 1074 "List style position", 1075 "list-style-position", 1076 { 1077 "type" : "select", 1078 "titleMap": [ 1079 { 1080 "value": "initial", 1081 "name": "Initial" 1082 }, 1083 { 1084 "value": "inherit", 1085 "name": "Inherit" 1086 }, 1087 { 1088 "value": "inside", 1089 "name": "Inside" 1090 }, 1091 { 1092 "value": "outside", 1093 "name": "Outside" 1094 }, 1095 1096 1097 1098 ] 1099 } 1100 ), 1101 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 1102 "Box shadow", 1103 "box-shadow", 1104 { 1105 "type": "text" 1106 } 1107 ), 1108 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 1109 "Text shadow", 1110 "text-shadow", 1111 { 1112 "type": "text" 1113 } 1114 ), 1115 generateCSSEditorRow(module.data.form_meta.style_elements[sid].key, 1116 "Border radius", 1117 "border-radius", 1118 { 1119 "type": "text" 1120 } 1121 ) 1122 ]; 1123 1124 1125 forms[module.data.form_meta.style_elements[sid].key] = formobject; 1126 } 1127 return forms; 1128 } 1129 } 1130 }); 1131 1132 1133 modalInstance.rendered.catch(function(err){ 1134 console.log(err); 1135 }); 1136 modalInstance.rendered.then(function() { 1137 // TODO: Tee refresh accordionia avattaessa, ei toimi tässä enää for whatever reason 1138 console.log('Module modal rendered'); 1139 1140 var codemirrors = document.querySelector('.modal-body').querySelectorAll('[ui-codemirror]'); 1141 1142 angular.forEach(codemirrors, function(cm, idx) { 1143 angular.element(cm).next()[0].CodeMirror.refresh(); 1144 }); 1145 1146 }).catch(function(error){ 1147 console.log(error); 1148 }) 1149 1150 moduleEditModalInstance.result.catch(function( err ){ 1151 if (!err) throw err; 1152 }).then(function( result ){ 1153 if (!result) return; 1154 1155 console.log( result ); 1156 console.log("modal closed"); 1157 }).catch(function(error){ 1158 console.error( error ); 1159 }).finally(function(){ 1160 moduleEditModalInstance = null; 1161 }); 1162 }; 1163 1164 return $delegate; 1165 }]); 1166 }]); 1167})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.