locomotivecms 3.0.0.pre.alpha.2 → 3.0.0.pre.alpha.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (178) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -2
  3. data/README.md +1 -1
  4. data/app/api/locomotive/api/forms/membership_form.rb +13 -0
  5. data/app/api/locomotive/api/resources/membership_resource.rb +5 -3
  6. data/app/assets/javascripts/locomotive.js +2 -0
  7. data/app/assets/javascripts/locomotive/utils/backbone_patches.js.coffee +15 -1
  8. data/app/assets/javascripts/locomotive/utils/file.js.coffee +20 -0
  9. data/app/assets/javascripts/locomotive/utils/nprogress.js.coffee +5 -0
  10. data/app/assets/javascripts/locomotive/utils/rails_ujs.js.coffee +36 -0
  11. data/app/assets/javascripts/locomotive/utils/wysihtml5.js.coffee +1 -1
  12. data/app/assets/javascripts/locomotive/views/content_assets/picker_view.js.coffee +9 -17
  13. data/app/assets/javascripts/locomotive/views/editable_elements/edit_view.js.coffee +39 -0
  14. data/app/assets/javascripts/locomotive/views/editable_elements/index_view.js.coffee +104 -1
  15. data/app/assets/javascripts/locomotive/views/inputs/file_view.js.coffee +79 -10
  16. data/app/assets/javascripts/locomotive/views/inputs/rte/file_view.js.coffee +24 -4
  17. data/app/assets/javascripts/locomotive/views/inputs/rte_view.js.coffee.erb +18 -0
  18. data/app/assets/javascripts/locomotive/views/pages/new_view.js.coffee +3 -6
  19. data/app/assets/javascripts/locomotive/views/shared/drawer_view.js.coffee +24 -8
  20. data/app/assets/javascripts/locomotive/views/shared/form_view.js.coffee +21 -148
  21. data/app/assets/stylesheets/locomotive/application.scss +6 -0
  22. data/app/assets/stylesheets/locomotive/base/_form.scss +1 -0
  23. data/app/assets/stylesheets/locomotive/base/form/_base.scss +9 -0
  24. data/app/assets/stylesheets/locomotive/base/form/_file_input.scss +1 -1
  25. data/app/assets/stylesheets/locomotive/base/form/_link.scss +13 -0
  26. data/app/assets/stylesheets/locomotive/base/form/_select2.scss +28 -1
  27. data/app/assets/stylesheets/locomotive/components/_drawer.scss +8 -18
  28. data/app/assets/stylesheets/locomotive/components/_live_editing.scss +83 -0
  29. data/app/assets/stylesheets/locomotive/components/_transitions.scss +63 -1
  30. data/app/assets/stylesheets/locomotive/components/header/_base.scss +5 -1
  31. data/app/assets/stylesheets/locomotive/components/misc/_notify.scss +5 -7
  32. data/app/assets/stylesheets/locomotive/globals/_bootstrap.scss +4 -4
  33. data/app/assets/stylesheets/locomotive/globals/_mixins.scss +16 -0
  34. data/app/assets/stylesheets/locomotive/globals/_nprogress.scss +3 -0
  35. data/app/assets/stylesheets/locomotive/globals/_variables.scss +57 -49
  36. data/app/assets/stylesheets/locomotive/layouts/_live_editing.scss +29 -0
  37. data/app/controllers/locomotive/editable_elements_controller.rb +49 -2
  38. data/app/controllers/locomotive/pages_controller.rb +2 -2
  39. data/app/helpers/locomotive/custom_fields_helper.rb +1 -1
  40. data/app/helpers/locomotive/editable_elements_helper.rb +40 -0
  41. data/app/helpers/locomotive/pages_helper.rb +0 -1
  42. data/app/inputs/locomotive/array_input.rb +1 -1
  43. data/app/inputs/locomotive/file_input.rb +35 -7
  44. data/app/inputs/locomotive/rte_input.rb +2 -1
  45. data/app/inputs/locomotive/toggle_input.rb +1 -1
  46. data/app/models/locomotive/concerns/content_entry/localized.rb +4 -4
  47. data/app/models/locomotive/concerns/content_type/sync.rb +0 -5
  48. data/app/models/locomotive/concerns/page/redirect.rb +1 -1
  49. data/app/models/locomotive/content_entry.rb +5 -11
  50. data/app/models/locomotive/content_type.rb +22 -0
  51. data/app/models/locomotive/editable_control.rb +12 -27
  52. data/app/models/locomotive/editable_element.rb +8 -0
  53. data/app/models/locomotive/editable_file.rb +0 -1
  54. data/app/models/locomotive/editable_text.rb +10 -10
  55. data/app/models/locomotive/page.rb +1 -1
  56. data/app/policies/locomotive/page_policy.rb +1 -1
  57. data/app/services/locomotive/editable_element_service.rb +47 -0
  58. data/app/services/locomotive/page_parsing_service.rb +85 -31
  59. data/app/uploaders/locomotive/editable_file_uploader.rb +5 -1
  60. data/app/views/locomotive/editable_elements/_edit.html.haml +49 -0
  61. data/app/views/locomotive/editable_elements/_edit_with_content_entry.html.haml +21 -0
  62. data/app/views/locomotive/editable_elements/_form.html.haml +23 -0
  63. data/app/views/locomotive/editable_elements/index.html.haml +8 -2
  64. data/app/views/locomotive/editable_elements/index_without_preview.html.haml +33 -0
  65. data/app/views/locomotive/layouts/{preview.html.haml → live_editing.html.haml} +9 -9
  66. data/app/views/locomotive/my_account/form/_main.html.haml +1 -1
  67. data/app/views/locomotive/pages/form/_actions.html.haml +8 -1
  68. data/app/views/locomotive/pages/form/_main.html.haml +1 -1
  69. data/app/views/locomotive/pages/form/_tabs.html.haml +2 -2
  70. data/app/views/locomotive/pages/new.html.haml +1 -1
  71. data/app/views/locomotive/shared/header/_site.html.haml +1 -1
  72. data/app/views/locomotive/shared/rte/_image_popover.html.haml +2 -2
  73. data/app/views/locomotive/shared/rte/_link_popover.html.haml +1 -1
  74. data/app/views/locomotive/shared/sidebar/_page.html.haml +5 -2
  75. data/config/locales/admin_ui.en.yml +10 -16
  76. data/config/locales/inputs.en.yml +18 -11
  77. data/config/locales/simple_form.en.yml +13 -1
  78. data/config/routes.rb +3 -1
  79. data/lib/locomotive.rb +1 -1
  80. data/lib/locomotive/action_controller/responder.rb +16 -0
  81. data/lib/locomotive/carrierwave/patches.rb +54 -0
  82. data/lib/locomotive/dependencies.rb +1 -0
  83. data/lib/locomotive/engine.rb +9 -3
  84. data/lib/locomotive/middlewares.rb +1 -1
  85. data/lib/locomotive/middlewares/page_editing.rb +41 -0
  86. data/lib/locomotive/middlewares/site.rb +2 -0
  87. data/lib/locomotive/simple_form.rb +6 -5
  88. data/lib/locomotive/steam_adaptor.rb +2 -0
  89. data/lib/locomotive/version.rb +1 -1
  90. data/lib/tasks/development.rake +4 -0
  91. data/spec/dummy/config/environments/production.rb +2 -0
  92. data/spec/dummy/config/initializers/devise.rb +2 -0
  93. data/spec/dummy/config/mongoid.yml +2 -2
  94. data/spec/models/locomotive/content_entry_spec.rb +11 -2
  95. data/spec/support/factories.rb +0 -1
  96. data/vendor/assets/javascripts/locomotive/history.js +2122 -0
  97. data/vendor/assets/javascripts/locomotive/subscribe.js +206 -329
  98. metadata +44 -127
  99. data/lib/locomotive/middlewares/permalink.rb +0 -22
  100. data/lib/locomotive/previous_liquid/asset_host.rb +0 -51
  101. data/lib/locomotive/previous_liquid/drops/base.rb +0 -40
  102. data/lib/locomotive/previous_liquid/drops/content_entry.rb +0 -78
  103. data/lib/locomotive/previous_liquid/drops/content_types.rb +0 -119
  104. data/lib/locomotive/previous_liquid/drops/current_user.rb +0 -21
  105. data/lib/locomotive/previous_liquid/drops/page.rb +0 -115
  106. data/lib/locomotive/previous_liquid/drops/proxy_collection.rb +0 -64
  107. data/lib/locomotive/previous_liquid/drops/session_proxy.rb +0 -16
  108. data/lib/locomotive/previous_liquid/drops/site.rb +0 -29
  109. data/lib/locomotive/previous_liquid/drops/uploader.rb +0 -21
  110. data/lib/locomotive/previous_liquid/errors.rb +0 -8
  111. data/lib/locomotive/previous_liquid/filters/base.rb +0 -61
  112. data/lib/locomotive/previous_liquid/filters/date.rb +0 -82
  113. data/lib/locomotive/previous_liquid/filters/html.rb +0 -117
  114. data/lib/locomotive/previous_liquid/filters/misc.rb +0 -75
  115. data/lib/locomotive/previous_liquid/filters/resize.rb +0 -18
  116. data/lib/locomotive/previous_liquid/filters/text.rb +0 -53
  117. data/lib/locomotive/previous_liquid/filters/translate.rb +0 -38
  118. data/lib/locomotive/previous_liquid/patches.rb +0 -21
  119. data/lib/locomotive/previous_liquid/tags/consume.rb +0 -104
  120. data/lib/locomotive/previous_liquid/tags/csrf.rb +0 -40
  121. data/lib/locomotive/previous_liquid/tags/editable.rb +0 -4
  122. data/lib/locomotive/previous_liquid/tags/editable/base.rb +0 -88
  123. data/lib/locomotive/previous_liquid/tags/editable/control.rb +0 -41
  124. data/lib/locomotive/previous_liquid/tags/editable/file.rb +0 -43
  125. data/lib/locomotive/previous_liquid/tags/editable/text.rb +0 -79
  126. data/lib/locomotive/previous_liquid/tags/extends.rb +0 -47
  127. data/lib/locomotive/previous_liquid/tags/fetch_page.rb +0 -36
  128. data/lib/locomotive/previous_liquid/tags/google_analytics.rb +0 -39
  129. data/lib/locomotive/previous_liquid/tags/hybrid.rb +0 -25
  130. data/lib/locomotive/previous_liquid/tags/inherited_block.rb +0 -31
  131. data/lib/locomotive/previous_liquid/tags/inline_editor.rb +0 -40
  132. data/lib/locomotive/previous_liquid/tags/javascript.rb +0 -16
  133. data/lib/locomotive/previous_liquid/tags/link_to.rb +0 -43
  134. data/lib/locomotive/previous_liquid/tags/locale_switcher.rb +0 -83
  135. data/lib/locomotive/previous_liquid/tags/model_form.rb +0 -75
  136. data/lib/locomotive/previous_liquid/tags/nav.rb +0 -164
  137. data/lib/locomotive/previous_liquid/tags/paginate.rb +0 -114
  138. data/lib/locomotive/previous_liquid/tags/path_helper.rb +0 -85
  139. data/lib/locomotive/previous_liquid/tags/path_to.rb +0 -21
  140. data/lib/locomotive/previous_liquid/tags/seo.rb +0 -72
  141. data/lib/locomotive/previous_liquid/tags/session_assign.rb +0 -39
  142. data/lib/locomotive/previous_liquid/tags/snippet.rb +0 -75
  143. data/lib/locomotive/previous_liquid/tags/with_scope.rb +0 -65
  144. data/spec/fixtures/portfolio/Gemfile +0 -21
  145. data/spec/fixtures/portfolio/app/content_types/messages.yml +0 -57
  146. data/spec/fixtures/portfolio/app/content_types/projects.yml +0 -74
  147. data/spec/fixtures/portfolio/app/views/pages/404.liquid.haml +0 -10
  148. data/spec/fixtures/portfolio/app/views/pages/index.liquid.haml +0 -213
  149. data/spec/fixtures/portfolio/app/views/snippets/footer.liquid.haml +0 -2
  150. data/spec/fixtures/portfolio/config.ru +0 -3
  151. data/spec/fixtures/portfolio/config/deploy.yml +0 -18
  152. data/spec/fixtures/portfolio/config/site.yml +0 -33
  153. data/spec/fixtures/portfolio/config/translations.yml +0 -8
  154. data/spec/fixtures/portfolio/data/messages.yml +0 -1
  155. data/spec/fixtures/portfolio/data/projects.yml +0 -41
  156. data/spec/fixtures/portfolio/icon.png +0 -0
  157. data/spec/fixtures/portfolio/public/javascripts/bootstrap.min.js +0 -6
  158. data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.js +0 -44
  159. data/spec/fixtures/portfolio/public/javascripts/cbpAnimatedHeader.min.js +0 -11
  160. data/spec/fixtures/portfolio/public/javascripts/classie.js +0 -80
  161. data/spec/fixtures/portfolio/public/javascripts/contact_me.js +0 -65
  162. data/spec/fixtures/portfolio/public/javascripts/freelancer.js +0 -37
  163. data/spec/fixtures/portfolio/public/javascripts/jqBootstrapValidation.js +0 -912
  164. data/spec/fixtures/portfolio/public/samples/portfolio/cabin.png +0 -0
  165. data/spec/fixtures/portfolio/public/samples/portfolio/cake.png +0 -0
  166. data/spec/fixtures/portfolio/public/samples/portfolio/circus.png +0 -0
  167. data/spec/fixtures/portfolio/public/samples/portfolio/game.png +0 -0
  168. data/spec/fixtures/portfolio/public/samples/portfolio/safe.png +0 -0
  169. data/spec/fixtures/portfolio/public/samples/portfolio/submarine.png +0 -0
  170. data/spec/fixtures/portfolio/public/samples/profile.png +0 -0
  171. data/spec/fixtures/portfolio/public/stylesheets/bootstrap.min.css +0 -7
  172. data/spec/fixtures/portfolio/public/stylesheets/freelancer.css +0 -445
  173. data/spec/lib/locomotive/liquid/tags/editable/file_spec.rb +0 -72
  174. data/spec/lib/locomotive/liquid/tags/editable/text_spec.rb +0 -85
  175. data/spec/lib/locomotive/liquid/tags/extends_spec.rb +0 -58
  176. data/vendor/assets/javascripts/locomotive/editable_field.js +0 -50
  177. data/vendor/assets/javascripts/locomotive/form_submit_notification.js +0 -39
  178. data/vendor/assets/javascripts/locomotive/slugify.js +0 -47
@@ -5,30 +5,20 @@
5
5
  padding: 20px 0px 10px 0px;
6
6
  }
7
7
 
8
+ .header-row {
9
+ padding: 15px 0px;
10
+ }
11
+
8
12
  h1 {
9
13
  font-size: 22px;
10
14
  font-family: $font-family-sans-serif;
11
- color: $main_title_color;
15
+ // color: $main_title_color;
16
+ color: $drawer_title_color;
12
17
  margin: 0px;
13
18
  }
14
19
 
15
20
  > .close-button {
16
- position: absolute;
17
- z-index: 991;
18
- top: 0px;
19
- right: 0px;
20
- font-size: 15px;
21
- cursor: pointer;
22
- width: $drawer_close_button_size;
23
- height: $drawer_close_button_size;
24
- line-height: $drawer_close_button_size;
25
- text-align: center;
26
- background: $drawer_close_background_color;
27
- color: $drawer_close_button_color;
28
- }
29
-
30
- h1 {
31
- color: $drawer_title_color;
21
+ @include control-window-button;
32
22
  }
33
23
 
34
- }
24
+ }
@@ -0,0 +1,83 @@
1
+ body.live-editing {
2
+
3
+ .content .close-button, .content .expand-button {
4
+ @include control-window-button;
5
+ z-index: 995;
6
+ }
7
+
8
+ .content .close-button {
9
+ @include opacity(0);
10
+ left: 0px;
11
+ }
12
+
13
+ &.full-width-preview {
14
+ .content .close-button {
15
+ @include opacity(1);
16
+ }
17
+
18
+ .content.expand-button {
19
+ display: none;
20
+ }
21
+
22
+ .content {
23
+ background-color: $live_editing_content_alt_background_color;
24
+ > .inner {
25
+ @include opacity(0);
26
+ }
27
+ }
28
+ }
29
+
30
+ .preview {
31
+ border-left: $live_editing_content_width solid #fff;
32
+ left: -$live_editing_content_width;
33
+ }
34
+
35
+ .content {
36
+ background-color: $live_editing_content_background_color;
37
+ > .inner {
38
+ border-left: 1px solid $live_editing_content_border_color;
39
+ }
40
+
41
+ .scrollable {
42
+ margin-top: 173px;
43
+
44
+ &.no-editable-elements {
45
+ margin-top: 105px;
46
+ }
47
+
48
+ fieldset.inputs {
49
+ padding-top: 0px;
50
+ }
51
+ }
52
+
53
+ .header-row {
54
+ padding: 15px 0px 15px 0px;
55
+ }
56
+
57
+ .info-row {
58
+ p {
59
+ margin-bottom: 0px;
60
+ line-height: 30px;
61
+ color: $main_title_color;
62
+
63
+ a {
64
+ color: $main_title_color;
65
+ }
66
+
67
+ button {
68
+ margin-left: 20px;
69
+ }
70
+ }
71
+
72
+ fieldset.inputs {
73
+ .form-group.input {
74
+ margin-bottom: 0px;
75
+ }
76
+ }
77
+ }
78
+
79
+ .editable-elements fieldset:first-child {
80
+ padding-top: 0px;
81
+ }
82
+ }
83
+ }
@@ -5,7 +5,7 @@
5
5
  }
6
6
 
7
7
  .content {
8
- @include transition(left 0.3s ease-in-out);
8
+ @include transition(left 0.3s ease-in-out, right 0.3s ease-in-out);
9
9
  }
10
10
 
11
11
  body.sidebar-closed {
@@ -24,6 +24,57 @@ body.slide-right-sidebar {
24
24
  }
25
25
  }
26
26
 
27
+ // Live editing
28
+
29
+ body.live-editing {
30
+
31
+ // STATE: SHRINKED
32
+
33
+ .content {
34
+ @include transform(translate3d(0, 0, 0));
35
+ @include transition(transform 0.3s ease-in-out);
36
+
37
+ > .inner {
38
+ @include transition(opacity 0.0s ease-in-out);
39
+ }
40
+
41
+ .close-button {
42
+ @include transition(opacity 0.0s ease-in-out);
43
+ }
44
+ }
45
+
46
+ .preview {
47
+ @include transform(translate3d(0, 0, 0));
48
+ @include transition(transform 0.3s ease-in-out, border-left-width 0.6s ease);
49
+ }
50
+
51
+ &.full-width-preview {
52
+
53
+ // STATE: EXPANDED
54
+
55
+ .content {
56
+ @include transform(translate3d($live_editing_content_width - 2em, 0, 0));
57
+
58
+ @include transition(transform 0.3s ease-in-out, background-color 0.1s ease-in-out 0.2s);
59
+ > .inner {
60
+ @include transition(opacity 0.1s ease-in-out 0.2s);
61
+ }
62
+
63
+ .close-button {
64
+ @include transition(opacity 0.2s ease-in-out 0.2s);
65
+ }
66
+ }
67
+
68
+ .preview {
69
+ @include transform(translate3d($live_editing_content_width - 2em, 0, 0));
70
+ border-left-width: 2em;
71
+ @include transition(transform 0.3s ease-in-out);
72
+ }
73
+
74
+ }
75
+
76
+ }
77
+
27
78
  // Drawer
28
79
 
29
80
  .content > .overlay {
@@ -76,3 +127,14 @@ body.drawer-opened {
76
127
 
77
128
  }
78
129
 
130
+ // body.inline-editing {
131
+
132
+ // .content {
133
+ // @include transition(left 0.3s ease-in-out, right 0.1s linear);
134
+ // }
135
+
136
+ // .drawer {
137
+ // @include transition(all 0.1s linear);
138
+ // }
139
+ // }
140
+
@@ -64,8 +64,12 @@ $header_site_arrow_color: #349cb0;
64
64
  li {
65
65
  a {
66
66
  display: inline-block;
67
+
68
+ &:first-child {
69
+ padding-right: 0px;
70
+ }
71
+
67
72
  span.arrow {
68
- margin-left: 5px;
69
73
  position: relative;
70
74
  top: 1px;
71
75
 
@@ -4,10 +4,14 @@
4
4
  [data-notify="icon"] {
5
5
  font-size: 18px;
6
6
  margin-right: 9px;
7
- color: #fff;
8
7
  }
9
8
 
10
9
  [data-notify="message"] {
10
+ }
11
+ }
12
+
13
+ [data-notify="container"].alert-success, [data-notify="container"].alert-danger {
14
+ [data-notify="icon"], [data-notify="message"] {
11
15
  color: #fff;
12
16
  }
13
17
  }
@@ -19,9 +23,3 @@
19
23
  [data-notify="container"].alert-danger {
20
24
  background-color: $brand-danger;
21
25
  }
22
-
23
- [data-notify="container"].alert-info {
24
- [data-notify="icon"], [data-notify="message"] {
25
- color: $state-info-text;
26
- }
27
- }
@@ -464,8 +464,8 @@ $nav-tabs-active-link-hover-border-color: $brand-primary !default; // #5199
464
464
  // $state-info-bg: #d9edf7 !default;
465
465
  // $state-info-border: darken(adjust-hue($state-info-bg, -10), 7%) !default;
466
466
 
467
- // $state-warning-text: #8a6d3b !default;
468
- // $state-warning-bg: #fcf8e3 !default;
467
+ $state-warning-text: #8a6d3b !default;
468
+ $state-warning-bg: #fcf8e3 !default;
469
469
  // $state-warning-border: darken(adjust-hue($state-warning-bg, -10), 5%) !default;
470
470
 
471
471
  // $state-danger-text: #a94442 !default;
@@ -592,8 +592,8 @@ $nav-tabs-active-link-hover-border-color: $brand-primary !default; // #5199
592
592
  // $alert-info-text: $state-info-text !default;
593
593
  // $alert-info-border: $state-info-border !default;
594
594
 
595
- // $alert-warning-bg: $state-warning-bg !default;
596
- // $alert-warning-text: $state-warning-text !default;
595
+ $alert-warning-bg: $state-warning-bg !default;
596
+ $alert-warning-text: $state-warning-text !default;
597
597
  // $alert-warning-border: $state-warning-border !default;
598
598
 
599
599
  // $alert-danger-bg: $state-danger-bg !default;
@@ -63,3 +63,19 @@
63
63
  @include user-select(none);
64
64
  }
65
65
 
66
+ @mixin control-window-button
67
+ {
68
+ position: absolute;
69
+ z-index: 991;
70
+ top: 0px;
71
+ right: 0px;
72
+ font-size: 15px;
73
+ cursor: pointer;
74
+ width: $control_window_button_size;
75
+ height: $control_window_button_size;
76
+ line-height: $control_window_button_size;
77
+ text-align: center;
78
+ background: $control_window_background_color;
79
+ color: $control_window_button_color;
80
+ }
81
+
@@ -0,0 +1,3 @@
1
+ $nprogress-color: #fec145;
2
+ $nprogress-height: 10px;
3
+ $nprogress-zindex: 10100;
@@ -1,54 +1,62 @@
1
1
  // custom variables go here
2
2
 
3
- $alt-font-family-sans-serif: "Muli", sans-serif;
4
-
5
- $background_gradient_start: #54b9cd;
6
- $background_gradient_end: #5488cc;
7
-
8
- $overlay_background: #333;
9
-
10
- $main_title_color: #666;
11
- $main_background_color: #fff;
12
-
13
- $paragraph_color: #595959;
14
-
15
- $header_default_color: #fff;
16
-
17
- $background_content_list: #f1f4f5;
18
-
19
- $sidebar_width: 21em;
20
- $sidebar_darker_background_color: #2f2f2f;
21
- $sidebar_background_color: #383838;
22
- $sidebar_text_color: #fff;
23
- $sidebar_section_border_color: #474747;
24
- $sidebar_section_title_color: #949999;
25
- $sidebar_link_color: rgba(#fff, 0.8);
26
- $sidebar_hovered_link_color: #fff;
27
- $sidebar_font_size: $font-size-base - 1;
28
- $sidebar_title_font_size: $font-size-base - 2;
29
-
30
- $sidebar_link_height: 45px;
31
- $sidebar_link_arrow_color: #616161;
32
- $sidebar_link_icon_color: #949999;
33
- $sidebar_link_background_hover_color: #474747;
34
-
35
- $drawer_width: 40em;
36
- $drawer_background_color: white;
37
- $drawer_close_button_size: 30px;
38
- $drawer_close_button_color: #fff; //#333;
39
- $drawer_close_background_color: #333;
40
- $drawer_title_color: #666;
41
-
42
- $form_input_background_color: #f7f7f7;
43
- $form_input_padding: 15px;
44
- $form_input_radius: 4px;
45
- $form_input_label_color: #555;
46
- $form_input_label_size: 11px;
47
- $form_input_control_border_size: 4px;
48
- $form_input_control_border_color: #d7d7d7;
49
- $form_input_help_color: #828787;
50
- $form_input_help_size: 12px;
51
- $form_input_wrapper_background_color: #fff;
3
+ $alt-font-family-sans-serif: "Muli", sans-serif;
4
+
5
+ $background_gradient_start: #54b9cd;
6
+ $background_gradient_end: #5488cc;
7
+
8
+ $overlay_background: #333;
9
+
10
+ $main_title_color: #666;
11
+ $main_background_color: #fff;
12
+
13
+ $paragraph_color: #595959;
14
+
15
+ $header_default_color: #fff;
16
+
17
+ $background_content_list: #f1f4f5;
18
+
19
+ $sidebar_width: 21em;
20
+ $sidebar_darker_background_color: #2f2f2f;
21
+ $sidebar_background_color: #383838;
22
+ $sidebar_text_color: #fff;
23
+ $sidebar_section_border_color: #474747;
24
+ $sidebar_section_title_color: #949999;
25
+ $sidebar_link_color: rgba(#fff, 0.8);
26
+ $sidebar_hovered_link_color: #fff;
27
+ $sidebar_font_size: $font-size-base - 1;
28
+ $sidebar_title_font_size: $font-size-base - 2;
29
+
30
+ $sidebar_link_height: 45px;
31
+ $sidebar_link_arrow_color: #616161;
32
+ $sidebar_link_icon_color: #949999;
33
+ $sidebar_link_background_hover_color: #474747;
34
+
35
+ $drawer_width: 40em;
36
+ $drawer_background_color: white;
37
+ $drawer_title_color: #666;
38
+
39
+ $control_window_button_size: 30px;
40
+ $control_window_button_color: #fff; //#333;
41
+ $control_window_background_color: #333;
42
+
43
+ $live_editing_content_width: 40em;
44
+ $live_editing_content_border_color: $navbar-default-bg;
45
+ $live_editing_content_background_color: #fff;
46
+ $live_editing_content_alt_background_color: #333;
47
+
48
+ $form_input_background_color: #f7f7f7;
49
+ $form_input_hovered_background_color: #f7f8d1;
50
+ $form_input_padding: 15px;
51
+ $form_input_radius: 4px;
52
+ $form_input_label_color: #555;
53
+ $form_input_label_size: 11px;
54
+ $form_input_control_border_size: 4px;
55
+ $form_input_control_border_color: #d7d7d7;
56
+ $form_input_hovered_control_border_color: #d9d9ba;
57
+ $form_input_help_color: #828787;
58
+ $form_input_help_size: 12px;
59
+ $form_input_wrapper_background_color: #fff;
52
60
 
53
61
  $form_input_array_item_height: 30px;
54
62
  $form_input_array_draggable_color: #ccc;
@@ -0,0 +1,29 @@
1
+ body.live-editing {
2
+
3
+ .preview {
4
+ position: absolute;
5
+ top: 0px;
6
+ bottom: 0px;
7
+ left: 0px;
8
+ right: $live_editing_content_width;
9
+ }
10
+
11
+ .content {
12
+ left: auto;
13
+ right: 0px;
14
+ width: $live_editing_content_width;
15
+
16
+ .inner {
17
+ position: absolute;
18
+ top: 0px;
19
+ left: 0px;
20
+ right: 0px;
21
+ bottom: 0px;
22
+ }
23
+ }
24
+
25
+ &.sidebar-closed .content {
26
+ left: auto;
27
+ }
28
+
29
+ }
@@ -6,20 +6,67 @@ module Locomotive
6
6
  localized
7
7
 
8
8
  before_filter :load_page
9
+ after_filter :store_location_if_content_entry
9
10
 
10
- layout 'locomotive/layouts/preview'
11
+ layout :editable_elements_layout
11
12
 
12
13
  def index
13
14
  authorize @page
14
- respond_with(@page)
15
+
16
+ @editable_elements = parsing_service.find_or_create_editable_elements(@page)
17
+
18
+ respond_with(@page) do |format|
19
+ format.html { render_index }
20
+ end
21
+ end
22
+
23
+ def update_all
24
+ authorize @page, :update?
25
+
26
+ @editable_elements = persisting_service.update_all(page_params[:editable_elements_attributes].values)
27
+
28
+ respond_with(@page, notice: t(:notice, scope: 'flash.locomotive.pages.update'), location: editable_elements_path(current_site, @page)) do |format|
29
+ format.html { render_index }
30
+ end
15
31
  end
16
32
 
17
33
  private
18
34
 
35
+ def editable_elements_layout
36
+ @page.default_response_type? ? 'locomotive/layouts/live_editing' : '/locomotive/layouts/application'
37
+ end
38
+
19
39
  def load_page
20
40
  @page = current_site.pages.find(params[:page_id])
21
41
  end
22
42
 
43
+ def page_params
44
+ params.require(:page).permit(editable_elements_attributes: [:id, :page_id, :source, :remove_source, :remote_source_url, :content])
45
+ end
46
+
47
+ def parsing_service
48
+ @parsing_service ||= Locomotive::PageParsingService.new(current_site, current_content_locale)
49
+ end
50
+
51
+ def persisting_service
52
+ @persisting_service ||= Locomotive::EditableElementService.new(current_site, current_locomotive_account)
53
+ end
54
+
55
+ def render_index
56
+ @editable_elements_by_block = @editable_elements.group_by { |(_, e)| e.block }
57
+
58
+ @content_entry = @page.content_type.entries.find(params[:content_entry_id]) if params[:content_entry_id]
59
+
60
+ if request.xhr?
61
+ render partial: 'edit'
62
+ else
63
+ render @page.default_response_type? ? 'index' : 'index_without_preview'
64
+ end
65
+ end
66
+
67
+ def store_location_if_content_entry
68
+ store_location if @content_entry
69
+ end
23
70
 
24
71
  end
25
72
  end