scrivito_sdk 0.18.1 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/blobs_controller.rb +1 -2
  3. data/app/controllers/scrivito/default_cms_controller.rb +9 -75
  4. data/app/controllers/scrivito/objs_controller.rb +107 -119
  5. data/app/controllers/scrivito/tasks_controller.rb +1 -1
  6. data/app/controllers/scrivito/users_controller.rb +1 -1
  7. data/app/controllers/scrivito/webservice_controller.rb +6 -2
  8. data/app/controllers/scrivito/workspaces_controller.rb +57 -17
  9. data/app/helpers/scrivito_helper.rb +285 -0
  10. data/app/views/google_maps_widget/show.html.erb +1 -0
  11. data/app/views/scrivito/_editing_auth_warning.html.erb +43 -0
  12. data/app/views/scrivito/blobs/upload_permission.json.jbuilder +1 -0
  13. data/app/views/scrivito/objs/copy.json.jbuilder +1 -0
  14. data/app/views/scrivito/objs/copy_widget.html.erb +1 -1
  15. data/app/views/scrivito/objs/create.json.jbuilder +1 -0
  16. data/app/views/scrivito/objs/create_widget.html.erb +1 -1
  17. data/app/views/scrivito/objs/details.json.jbuilder +1 -0
  18. data/app/views/scrivito/objs/format_missing_error.json.jbuilder +1 -0
  19. data/app/views/scrivito/objs/modification.json.jbuilder +1 -0
  20. data/app/views/scrivito/objs/page_class_selection.json.jbuilder +1 -0
  21. data/app/views/scrivito/objs/search.json.jbuilder +6 -0
  22. data/app/views/scrivito/objs/search_only_size.json.jbuilder +1 -0
  23. data/app/views/scrivito/objs/update.json.jbuilder +1 -0
  24. data/app/views/scrivito/objs/widget_class_selection.json.jbuilder +1 -0
  25. data/app/views/scrivito/objs/widget_modification.json.jbuilder +1 -0
  26. data/app/views/scrivito/tasks/show.json.jbuilder +3 -0
  27. data/app/views/scrivito/users/suggest.json.jbuilder +1 -0
  28. data/app/views/scrivito/webservice/empty.json +1 -0
  29. data/app/views/scrivito/webservice/error.json.jbuilder +2 -0
  30. data/app/views/scrivito/workspaces/_workspace.json.jbuilder +5 -0
  31. data/app/views/scrivito/workspaces/check.json.jbuilder +1 -0
  32. data/app/views/scrivito/workspaces/create.json.jbuilder +1 -0
  33. data/app/views/scrivito/workspaces/index.json.jbuilder +1 -0
  34. data/app/views/scrivito/workspaces/show.json.jbuilder +1 -0
  35. data/app/views/scrivito/workspaces/task.json.jbuilder +5 -0
  36. data/config/ca-bundle.crt +259 -234
  37. data/config/cms_routes.rb +2 -2
  38. data/config/routes.rb +3 -0
  39. data/lib/assets/javascripts/{scrivito_editing.js → scrivito_sdk.js} +1662 -1180
  40. data/lib/assets/stylesheets/{scrivito_editing.css → scrivito_sdk.css} +242 -6
  41. data/lib/generators/scrivito/install/install_generator.rb +62 -0
  42. data/lib/generators/scrivito/install/templates/app/controllers/cms_controller.rb +3 -0
  43. data/lib/generators/scrivito/install/templates/app/controllers/page_controller.rb +2 -0
  44. data/lib/generators/scrivito/install/templates/app/models/headline_widget.rb +7 -0
  45. data/lib/generators/scrivito/install/templates/app/models/image.rb +5 -0
  46. data/lib/generators/scrivito/install/templates/app/models/image_widget.rb +7 -0
  47. data/lib/generators/scrivito/install/templates/app/models/obj.rb +2 -0
  48. data/lib/generators/scrivito/install/templates/app/models/page.rb +8 -0
  49. data/lib/generators/scrivito/install/templates/app/models/text_widget.rb +7 -0
  50. data/lib/generators/scrivito/install/templates/app/models/widget.rb +2 -0
  51. data/lib/generators/scrivito/install/templates/app/views/headline_widget/show.html.erb +1 -0
  52. data/lib/generators/scrivito/install/templates/app/views/headline_widget/thumbnail.html.erb +3 -0
  53. data/lib/generators/scrivito/install/templates/app/views/image_widget/show.html.erb +1 -0
  54. data/lib/generators/scrivito/install/templates/app/views/image_widget/thumbnail.html.erb +3 -0
  55. data/lib/generators/scrivito/install/templates/app/views/page/details.html.erb +1 -0
  56. data/lib/generators/scrivito/install/templates/app/views/page/index.html.erb +16 -0
  57. data/lib/generators/scrivito/install/templates/app/views/page/thumbnail.html.erb +3 -0
  58. data/lib/generators/scrivito/install/templates/app/views/text_widget/show.html.erb +1 -0
  59. data/lib/generators/scrivito/install/templates/app/views/text_widget/thumbnail.html.erb +3 -0
  60. data/lib/generators/scrivito/install/templates/config/initializers/scrivito.rb +10 -0
  61. data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito.rb +49 -0
  62. data/lib/generators/scrivito/migration/USAGE +9 -0
  63. data/lib/generators/{cms → scrivito}/migration/migration_generator.rb +4 -9
  64. data/lib/generators/{cms → scrivito}/migration/templates/migration.erb +3 -3
  65. data/lib/generators/{cms → scrivito}/widget/templates/details.html.erb +0 -0
  66. data/lib/generators/{cms → scrivito}/widget/templates/migration.erb +0 -0
  67. data/lib/generators/{cms → scrivito}/widget/templates/model.erb +0 -0
  68. data/lib/generators/{cms → scrivito}/widget/templates/show.html.erb +0 -0
  69. data/lib/generators/scrivito/widget/templates/thumbnail.html.erb +3 -0
  70. data/lib/generators/{cms → scrivito}/widget/widget_generator.rb +3 -2
  71. data/lib/obj.rb +17 -3
  72. data/lib/scrivito/attribute_collection.rb +7 -12
  73. data/lib/scrivito/attribute_content.rb +31 -12
  74. data/lib/scrivito/basic_obj.rb +186 -96
  75. data/lib/scrivito/basic_widget.rb +25 -10
  76. data/lib/scrivito/binary.rb +75 -0
  77. data/lib/scrivito/cache_garbage_collector.rb +19 -4
  78. data/lib/scrivito/child_list_tag.rb +108 -0
  79. data/lib/scrivito/client_config.rb +2 -1
  80. data/lib/scrivito/client_error.rb +3 -2
  81. data/lib/scrivito/cms_backend.rb +81 -16
  82. data/lib/scrivito/cms_dispatch_controller.rb +7 -0
  83. data/lib/scrivito/cms_env.rb +0 -2
  84. data/lib/scrivito/cms_field_tag.rb +44 -35
  85. data/lib/scrivito/cms_rest_api.rb +23 -6
  86. data/lib/scrivito/cms_rest_api/attribute_serializer.rb +1 -1
  87. data/lib/scrivito/cms_routing.rb +120 -0
  88. data/lib/scrivito/configuration.rb +69 -58
  89. data/lib/scrivito/connection_manager.rb +30 -1
  90. data/lib/scrivito/content_service.rb +10 -7
  91. data/lib/scrivito/controller_actions.rb +108 -0
  92. data/lib/scrivito/diff.rb +30 -15
  93. data/lib/scrivito/editing_context.rb +4 -0
  94. data/lib/scrivito/editing_context_helper.rb +19 -0
  95. data/lib/scrivito/editing_context_middleware.rb +20 -1
  96. data/lib/scrivito/image_tag_helper.rb +44 -0
  97. data/lib/scrivito/layout_tags.rb +33 -0
  98. data/lib/scrivito/link.rb +4 -2
  99. data/lib/scrivito/membership.rb +0 -8
  100. data/lib/scrivito/migrations.rb +0 -1
  101. data/lib/scrivito/migrations/installer.rb +1 -1
  102. data/lib/scrivito/migrations/migration.rb +0 -2
  103. data/lib/scrivito/migrations/migrator.rb +2 -3
  104. data/lib/scrivito/obj_class.rb +64 -16
  105. data/lib/scrivito/obj_class_data.rb +4 -0
  106. data/lib/scrivito/obj_search_enumerator.rb +1 -1
  107. data/lib/scrivito/routing_helper.rb +42 -0
  108. data/lib/scrivito/{engine.rb → sdk_engine.rb} +15 -29
  109. data/lib/scrivito/tag_renderer.rb +40 -0
  110. data/lib/scrivito/test_request.rb +40 -0
  111. data/lib/scrivito/type_computer.rb +1 -6
  112. data/lib/scrivito/user.rb +33 -15
  113. data/lib/scrivito/user_definition.rb +34 -6
  114. data/lib/scrivito/widget_tag.rb +67 -0
  115. data/lib/scrivito/workspace.rb +12 -24
  116. data/lib/scrivito_sdk.rb +17 -1
  117. data/lib/tasks/cache.rake +4 -5
  118. data/lib/tasks/migration.rake +1 -1
  119. data/lib/widget.rb +21 -3
  120. metadata +119 -70
  121. data/README +0 -6
  122. data/app/controllers/cms_controller.rb +0 -7
  123. data/app/helpers/cms_helper.rb +0 -7
  124. data/app/helpers/cms_routing_helper.rb +0 -7
  125. data/app/helpers/scrivito/cms_asset_helper.rb +0 -110
  126. data/app/helpers/scrivito/cms_tag_helper.rb +0 -232
  127. data/app/helpers/scrivito/default_cms_helper.rb +0 -21
  128. data/app/helpers/scrivito/default_cms_routing_helper.rb +0 -128
  129. data/app/helpers/scrivito/display_helper.rb +0 -64
  130. data/app/helpers/scrivito/editing_helper.rb +0 -32
  131. data/app/helpers/scrivito/layout_helper.rb +0 -21
  132. data/app/models/named_link.rb +0 -2
  133. data/app/views/cms/_index.html.erb +0 -7
  134. data/app/views/cms/index.html.erb +0 -1
  135. data/app/views/scrivito/_editing_javascript.html.erb +0 -7
  136. data/app/views/scrivito/default_cms/show_widget.html.erb +0 -1
  137. data/lib/assets/stylesheets/scrivito.css +0 -199
  138. data/lib/generators/cms/migration/USAGE +0 -9
  139. data/lib/generators/cms/widget/templates/thumbnail.html.erb +0 -2
  140. data/lib/scrivito/blob.rb +0 -48
  141. data/lib/scrivito/cms_accessible.rb +0 -30
  142. data/lib/scrivito/cms_rest_api/blob_uploader.rb +0 -18
  143. data/lib/scrivito/cms_test_request.rb +0 -23
  144. data/lib/scrivito/migrations/migration_dsl.rb +0 -180
@@ -325,7 +325,7 @@ html.scrivito_bottombar_on {
325
325
  .scrivito_menu_box:after,
326
326
  .scrivito_menu_box:before {
327
327
  bottom: 100%;
328
- border: solid transparent;
328
+ border: solid #222;
329
329
  content: " ";
330
330
  height: 0;
331
331
  width: 0;
@@ -334,7 +334,7 @@ html.scrivito_bottombar_on {
334
334
  }
335
335
  .scrivito_menu_box:after {
336
336
  border-color: rgba(0, 0, 0, 0);
337
- border-bottom-color: #3a3a3a;
337
+ border-bottom-color: rgba(34, 34, 34, 0.9);
338
338
  border-width: 7px;
339
339
  left: 5px;
340
340
  margin-right: -7px;
@@ -382,8 +382,15 @@ html.scrivito_bottombar_on {
382
382
  border-top: 1px solid #222;
383
383
  }
384
384
  .scrivito_menu_separator {
385
- height: 2px;
386
- background: #222;
385
+ min-height: 4px;
386
+ background: rgba(0, 0, 0, 0.4);
387
+ }
388
+ .scrivito_menu_separator span {
389
+ display: block;
390
+ font-size: 10px;
391
+ padding: 3px 4px 2px;
392
+ color: #aaa;
393
+ text-shadow: 0 1px 1px #000;
387
394
  }
388
395
  .scrivito_menu_box .scrivito_menu_item:first-child {
389
396
  border-top: none;
@@ -456,6 +463,9 @@ html.scrivito_bottombar_on {
456
463
  color: #696969!important;
457
464
  cursor: help;
458
465
  }
466
+ .scrivito_menu_box .scrivito_menu_item.scrivito_highlight {
467
+ background: rgba(192, 175, 62, 0.4);
468
+ }
459
469
  body.scrivito_editing_active {
460
470
  padding-top: 45px;
461
471
  }
@@ -622,6 +632,23 @@ body.scrivito_editing_active {
622
632
  .scrivito_topbar .scrivito_button_label:first-child {
623
633
  padding: 0;
624
634
  }
635
+ .scrivito_topbar .scrivito_button_notice {
636
+ display: block;
637
+ padding: 0 0 0 3px;
638
+ margin: -2px 0 0 30px;
639
+ color: #d3dade;
640
+ font-size: 9px;
641
+ line-height: 13px;
642
+ max-height: 14px;
643
+ max-width: 180px;
644
+ text-overflow: ellipsis;
645
+ white-space: nowrap;
646
+ overflow: hidden;
647
+ }
648
+ .scrivito_topbar .scrivito_button_notice .scrivito_icon {
649
+ font-size: 9px;
650
+ padding: 0 3px 0 0;
651
+ }
625
652
  .scrivito_topbar .scrivito_button_bar.scrivito_right {
626
653
  float: right;
627
654
  }
@@ -938,6 +965,13 @@ body.scrivito_editing_active {
938
965
  color: #eee;
939
966
  text-shadow: 0 1px 0 #333;
940
967
  }
968
+ .scrivito_editing_marker,
969
+ .scrivito_icon,
970
+ .scrivito_editing_marker_title {
971
+ webkit-box-sizing: border-box;
972
+ -moz-box-sizing: border-box;
973
+ box-sizing: border-box;
974
+ }
941
975
  .scrivito_editing_marker {
942
976
  display: block;
943
977
  position: absolute;
@@ -1011,6 +1045,8 @@ body.scrivito_editing_active {
1011
1045
  cursor: move;
1012
1046
  }
1013
1047
  .scrivito_editing_marker .scrivito_editing_marker_title {
1048
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
1049
+ font-weight: normal;
1014
1050
  display: block;
1015
1051
  position: absolute;
1016
1052
  top: 0;
@@ -2274,9 +2310,10 @@ a.scrivito_button:active {
2274
2310
  text-align: center;
2275
2311
  background: #fff;
2276
2312
  }
2277
- .scrivito_editing_widget_preview .scrivito_editing_widget_visualization i.scrivito_icon {
2278
- font-size: 80px;
2313
+ .scrivito_editing_widget_preview .scrivito_editing_widget_visualization > * {
2314
+ font-size: 110px;
2279
2315
  color: #666;
2316
+ vertical-align: middle;
2280
2317
  }
2281
2318
  .scrivito_editing_widget_preview .scrivito_editing_widget_title {
2282
2319
  font-size: 14px;
@@ -2907,3 +2944,202 @@ html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
2907
2944
  top: 16px;
2908
2945
  right: 0px;
2909
2946
  }
2947
+ /*
2948
+
2949
+ */
2950
+
2951
+
2952
+ [data-scrivito-field-type="widget"] { min-height: 25px;}
2953
+
2954
+ .scrivito_empty_widget_field {
2955
+ -webkit-box-shadow: 0 0 5px rgba(0,0,0,.3) inset;
2956
+ background: rgba(0,0,0,.05);
2957
+ box-shadow: 0 0 5px rgba(0,0,0,.3) inset;
2958
+ min-height: 50px;
2959
+ visibility: visible!important;
2960
+ }
2961
+
2962
+ .scrivito_widget_drop_placeholder,
2963
+ .scrivito_empty_widget_field.scrivito_widget_drop_allowed {
2964
+ -webkit-box-shadow: 0 0 5px rgba(152,187,225,.9) inset;
2965
+ background: rgba(152,187,225,.3);
2966
+ box-shadow: 0 0 5px rgba(152,187,225,.9) inset;
2967
+ max-height: 150px;
2968
+ min-height: 100px;
2969
+ visibility: visible!important;
2970
+ }
2971
+
2972
+ body.scrivito_editing_active .scrivito_empty_widget_field.scrivito_widget_drop_allowed {
2973
+ max-height: 200px;
2974
+ min-height: 100px;
2975
+ }
2976
+
2977
+ [data-scrivito-private-widget-id] .scrivito_empty_widget_field { min-height: 100px; }
2978
+
2979
+ .ui-sortable-helper { opacity:0.5;}
2980
+
2981
+ /* widgets */
2982
+ [data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class] {
2983
+ -webkit-box-shadow:0 0 0 2px transparent;
2984
+ box-shadow:0 0 0 2px transparent;
2985
+ -webkit-transition: box-shadow linear .3s;
2986
+ transition: box-shadow linear .3s;
2987
+ }
2988
+ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class],
2989
+ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"],
2990
+ [data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class]:hover,
2991
+ [data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class]:hover *[data-scrivito-field-type="widget"] {
2992
+ -webkit-box-shadow:0 0 0 2px #439439;
2993
+ box-shadow:0 0 0 2px #439439;
2994
+ }
2995
+
2996
+ body.scrivito_widget_dragging_active[data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"]:not(.scrivito_empty_widget_field) {
2997
+ min-height: 100px;
2998
+ }
2999
+
3000
+ /* margin for nested widgets */
3001
+ [data-scrivito-display-mode="editing"] *[data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"],
3002
+ [data-scrivito-display-mode="added"] *[data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"],
3003
+ [data-scrivito-display-mode="diff"] [data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"],
3004
+ [data-scrivito-display-mode="deleted"] *[data-scrivito-widget-obj-class] *[data-scrivito-field-type="widget"] { margin-top: 35px;}
3005
+
3006
+ /* highlight cms fields */
3007
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="string"],
3008
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="text"],
3009
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="html"],
3010
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="reference"],
3011
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="referencelist"],
3012
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="linklist"],
3013
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="enum"],
3014
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="multienum"],
3015
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="date"] {
3016
+ outline: 2px dotted transparent;
3017
+ -webkit-transition: outline-color linear .3s;
3018
+ transition: outline-color linear .3s;
3019
+ }
3020
+
3021
+ /* highlight cms fields on hover */
3022
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="string"]:hover,
3023
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="text"]:hover,
3024
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="html"]:hover,
3025
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="reference"]:hover,
3026
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="referencelist"]:hover,
3027
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="linklist"]:hover,
3028
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="enum"]:hover,
3029
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="multienum"]:hover,
3030
+ [data-scrivito-display-mode="editing"] *[data-scrivito-field-type="date"]:hover {
3031
+ outline: 2px dotted #439439;
3032
+ }
3033
+
3034
+ /* highlight unmodified but moved widgets */
3035
+ [data-scrivito-private-widget-placement-modification="deleted"] {
3036
+ -webkit-box-shadow:0 0 0 2px #808080;
3037
+ box-shadow:0 0 0 2px #808080;
3038
+ }
3039
+
3040
+ [data-scrivito-private-widget-placement-modification="deleted"] * {
3041
+ opacity:.7;
3042
+ }
3043
+
3044
+ [data-scrivito-private-widget-placement-modification="deleted"] .scrivito_editing_marker,
3045
+ [data-scrivito-private-widget-placement-modification="deleted"] .scrivito_editing_marker .scrivito_icon,
3046
+ [data-scrivito-private-widget-modification="edited"][data-scrivito-private-widget-placement-modification="deleted"] * {
3047
+ opacity:1;
3048
+ }
3049
+
3050
+ /* highlight modified "edited" cms widget */
3051
+ [data-scrivito-private-widget-modification="edited"],
3052
+ [data-scrivito-private-child-list-modification="edited"],
3053
+ [data-scrivito-private-widget-placement-modification="new"] {
3054
+ -webkit-box-shadow:0 0 0 2px #4f749d;
3055
+ box-shadow:0 0 0 2px #4f749d;
3056
+ }
3057
+ /* highlight modified "added" cms widget */
3058
+ [data-scrivito-private-widget-modification="new"], [data-scrivito-private-obj-modification="new"] {
3059
+ -webkit-box-shadow:0 0 0 2px #4c8c07;
3060
+ box-shadow:0 0 0 2px #4c8c07;
3061
+ }
3062
+ /* highlight modified "deleted" cms widget */
3063
+ [data-scrivito-private-widget-modification="deleted"], [data-scrivito-private-obj-modification="deleted"] {
3064
+ -webkit-box-shadow:0 0 0 2px #ff1f01;
3065
+ box-shadow:0 0 0 2px #ff1f01;
3066
+ }
3067
+
3068
+
3069
+ /* highlight modified "edited" cms fields */
3070
+ [data-scrivito-field-type="widget"] *[data-scrivito-field-modification="edited"],
3071
+ [data-scrivito-field-type="widget"] *[data-scrivito-field-modification="new"] ,
3072
+ [data-scrivito-field-type="widget"] *[data-scrivito-field-modification="deleted"] {
3073
+ outline: 2px dotted transparent;
3074
+ -webkit-transition: outline-color linear .3s;
3075
+ transition: outline-color linear .3s;
3076
+ }
3077
+
3078
+ *[data-scrivito-field-modification="edited"],
3079
+ [data-scrivito-field-type="widget"]:hover *[data-scrivito-field-modification="edited"],
3080
+ .scrivito_details_dialog *[data-scrivito-field-modification="edited"] {
3081
+ outline: 2px dotted #4f749d;
3082
+ outline: 2px dotted rgba(79, 116, 157, 1);
3083
+ }
3084
+ /* highlight modified "added" cms fields */
3085
+ [data-scrivito-field-type="widget"]:hover *[data-scrivito-field-modification="new"],
3086
+ .scrivito_details_dialog *[data-scrivito-field-modification="new"]{
3087
+ outline: 2px dotted #4c8c07;
3088
+ outline: 2px dotted rgba(76, 140, 7, 1);
3089
+ }
3090
+ /* highlight modified "deleted" cms fields */
3091
+ [data-scrivito-field-type="widget"]:hover *[data-scrivito-field-modification="deleted"],
3092
+ .scrivito_details_dialog *[data-scrivito-field-modification="deleted"]{
3093
+ outline: 2px dotted #ff1f01;
3094
+ outline: 2px dotted rgba(255, 31, 1, 1);
3095
+ }
3096
+
3097
+ /* highlight ins and del tags in cms fields with textual diff */
3098
+ [data-scrivito-field-type="string"] .scrivito_insertion,
3099
+ [data-scrivito-field-type="html"] .scrivito_insertion,
3100
+ [data-scrivito-field-type="text"] .scrivito_insertion {
3101
+ background-color: rgba(76, 140, 7, 0.3);
3102
+ }
3103
+ [data-scrivito-field-type="string"] .scrivito_deletion,
3104
+ [data-scrivito-field-type="html"] .scrivito_deletion,
3105
+ [data-scrivito-field-type="text"] .scrivito_deletion {
3106
+ background-color: rgba(255, 31, 1, 0.3);
3107
+ }
3108
+
3109
+ /* scrivito_editing_marker edit colors */
3110
+ .scrivito_editing_marker {background: #439439; background:rgba(67, 148, 57, .5);}
3111
+ .scrivito_editing_marker:hover,
3112
+ .scrivito_editing_marker:active { background: #439439; background: rgba(67, 148, 57, 1); }
3113
+
3114
+ [data-scrivito-display-mode="editing"] [data-scrivito-private-child-list-path]:hover > .scrivito_editing_marker,
3115
+ [data-scrivito-display-mode="editing"] [data-scrivito-widget-obj-class]:hover > .scrivito_editing_marker {
3116
+ background: #439439; background: rgba(67, 148, 57, 1);
3117
+ }
3118
+
3119
+ /* scrivito_editing_marker edited/new/deleted colors */
3120
+ [data-scrivito-private-widget-modification="edited"] .scrivito_editing_marker,
3121
+ [data-scrivito-private-widget-modification="edited"] .scrivito_editing_marker .scrivito_editing_marker_title,
3122
+ [data-scrivito-field-modification="edited"] .scrivito_editing_marker,
3123
+ [data-scrivito-private-widget-modification="edited"][data-scrivito-private-widget-placement-modification="new"] .scrivito_editing_marker,
3124
+ [data-scrivito-private-widget-modification="edited"][data-scrivito-private-widget-placement-modification="deleted"] .scrivito_editing_marker {
3125
+ background: #4f749d;
3126
+ }
3127
+
3128
+ [data-scrivito-private-widget-modification="new"] .scrivito_editing_marker,
3129
+ [data-scrivito-private-widget-modification="new"] .scrivito_editing_marker .scrivito_editing_marker_title,
3130
+ [data-scrivito-field-modification="new"] .scrivito_editing_marker,
3131
+ [data-scrivito-private-widget-modification="new"][data-scrivito-private-widget-placement-modification="new"] .scrivito_editing_marker {
3132
+ background: #4c8c07;
3133
+ }
3134
+ [data-scrivito-private-widget-modification="deleted"] .scrivito_editing_marker,
3135
+ [data-scrivito-private-widget-modification="deleted"] .scrivito_editing_marker .scrivito_editing_marker_title,
3136
+ [data-scrivito-field-modification="deleted"] .scrivito_editing_marker,
3137
+ [data-scrivito-private-widget-modification="deleted"][data-scrivito-private-widget-placement-modification="deleted"] .scrivito_editing_marker {
3138
+ background: #ff1f01;
3139
+ }
3140
+
3141
+ /* scrivito_editing_marker colors for unmodified but moved widgets */
3142
+ :not([data-scrivito-private-widget-modification])[data-scrivito-private-widget-placement-modification="deleted"] .scrivito_editing_marker,
3143
+ :not([data-scrivito-private-widget-modification])[data-scrivito-private-widget-placement-modification="deleted"] .scrivito_editing_marker .scrivito_editing_marker_title {
3144
+ background: #808080;
3145
+ }
@@ -0,0 +1,62 @@
1
+ module Scrivito
2
+ module Generators
3
+ class InstallGenerator < ::Rails::Generators::Base
4
+ include ::Rails::Generators::Migration
5
+
6
+ source_root File.expand_path('../templates', __FILE__)
7
+
8
+ def self.next_migration_number(dirname)
9
+ migration_number = current_migration_number(dirname) + 1
10
+ [Time.now.utc.strftime('%Y%m%d%H%M%S'), '%.14d' % migration_number].max
11
+ end
12
+
13
+ def copy_initializer
14
+ copy_file 'config/initializers/scrivito.rb'
15
+ end
16
+
17
+ def copy_obj_and_widget_model
18
+ copy_file 'app/models/obj.rb'
19
+ copy_file 'app/models/widget.rb'
20
+ end
21
+
22
+ def copy_cms_controller
23
+ copy_file 'app/controllers/cms_controller.rb'
24
+ end
25
+
26
+ def copy_migration
27
+ destination_path = File.join(Scrivito::Configuration.migration_path, 'install_scrivito.rb')
28
+ migration_template 'scrivito/migrate/install_scrivito.rb', destination_path
29
+ end
30
+
31
+ def copy_page_resources
32
+ copy_file 'app/models/page.rb'
33
+ copy_file 'app/controllers/page_controller.rb'
34
+ copy_file 'app/views/page/details.html.erb'
35
+ copy_file 'app/views/page/index.html.erb'
36
+ copy_file 'app/views/page/thumbnail.html.erb'
37
+ end
38
+
39
+ def copy_image_resources
40
+ copy_file 'app/models/image.rb'
41
+ end
42
+
43
+ def copy_headline_widget_resources
44
+ copy_file 'app/models/headline_widget.rb'
45
+ copy_file 'app/views/headline_widget/show.html.erb'
46
+ copy_file 'app/views/headline_widget/thumbnail.html.erb'
47
+ end
48
+
49
+ def copy_text_widget_resources
50
+ copy_file 'app/models/text_widget.rb'
51
+ copy_file 'app/views/text_widget/show.html.erb'
52
+ copy_file 'app/views/text_widget/thumbnail.html.erb'
53
+ end
54
+
55
+ def copy_image_widget_resources
56
+ copy_file 'app/models/image_widget.rb'
57
+ copy_file 'app/views/image_widget/show.html.erb'
58
+ copy_file 'app/views/image_widget/thumbnail.html.erb'
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,3 @@
1
+ class CmsController < ApplicationController
2
+ include Scrivito::ControllerActions
3
+ end
@@ -0,0 +1,2 @@
1
+ class PageController < CmsController
2
+ end
@@ -0,0 +1,7 @@
1
+ class HeadlineWidget < Widget
2
+ #
3
+ # HeadlineWidget (not binary)
4
+ #
5
+ # headline :string
6
+ #
7
+ end
@@ -0,0 +1,5 @@
1
+ class Image < Obj
2
+ #
3
+ # Image (binary)
4
+ #
5
+ end
@@ -0,0 +1,7 @@
1
+ class ImageWidget < Widget
2
+ #
3
+ # ImageWidget (not binary)
4
+ #
5
+ # image :reference
6
+ #
7
+ end
@@ -0,0 +1,2 @@
1
+ class Obj < Scrivito::BasicObj
2
+ end
@@ -0,0 +1,8 @@
1
+ class Page < ::Obj
2
+ #
3
+ # Page (not binary)
4
+ #
5
+ # title :string
6
+ # content :widgets
7
+ #
8
+ end
@@ -0,0 +1,7 @@
1
+ class TextWidget < Widget
2
+ #
3
+ # TextWidget (not binary)
4
+ #
5
+ # content :html
6
+ #
7
+ end
@@ -0,0 +1,2 @@
1
+ class Widget < Scrivito::BasicWidget
2
+ end
@@ -0,0 +1 @@
1
+ <%= scrivito_tag :h2, widget, :headline %>
@@ -0,0 +1,3 @@
1
+ <%= scrivito_thumbnail 'Headline Widget', :headline do %>
2
+ A headline widget.
3
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= scrivito_image_tag widget, :image %>
@@ -0,0 +1,3 @@
1
+ <%= scrivito_thumbnail 'Image Widget', :image do %>
2
+ A widget with an image.
3
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= scrivito_tag :div, @obj, :title %>
@@ -0,0 +1,16 @@
1
+ <div>
2
+ <p><%= link_to 'Home', scrivito_path(Obj.homepage) %></p>
3
+
4
+ <%= scrivito_tag_list :ul, Obj.homepage, :toclist do |list, page| %>
5
+ <%= list.tag :li do %>
6
+ <%= link_to page[:title].presence || '(Untitled)', scrivito_path(page) %>
7
+ <% end %>
8
+ <% end %>
9
+
10
+ <% if Obj.homepage.toclist.empty? && scrivito_in_editable_view? %>
11
+ <p>(Hint: Click on the Scrivito icon to the right to create the first subpage.)</p>
12
+ <% end %>
13
+ </div>
14
+
15
+ <%= scrivito_tag :h1, @obj, :title %>
16
+ <%= scrivito_tag :div, @obj, :body %>