scrivito_sdk 0.40.0 → 0.41.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/objs_controller.rb +5 -1
  3. data/app/helpers/scrivito_helper.rb +22 -11
  4. data/app/models/scrivito/content_widget.rb +11 -0
  5. data/app/views/scrivito/content_widget/show.html.erb +7 -0
  6. data/config/ca-bundle.crt +1 -1
  7. data/config/cms_routes.rb +3 -1
  8. data/config/routes.rb +0 -1
  9. data/lib/assets/javascripts/scrivito_sdk.js +1 -1
  10. data/lib/assets/javascripts/scrivito_ui.js +415 -137
  11. data/lib/assets/stylesheets/scrivito_sdk.css +13 -0
  12. data/lib/assets/stylesheets/scrivito_ui.css +121 -0
  13. data/lib/generators/scrivito/install/install_generator.rb +6 -1
  14. data/lib/generators/scrivito/install/templates/app/views/download/embed.html.erb +1 -0
  15. data/lib/generators/scrivito/install/templates/app/views/image/embed.html.erb +1 -0
  16. data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito_migration.rb +4 -0
  17. data/lib/scrivito/basic_obj.rb +9 -1
  18. data/lib/scrivito/basic_widget.rb +5 -1
  19. data/lib/scrivito/cache/chainable.rb +52 -0
  20. data/lib/scrivito/cache/file_store.rb +26 -0
  21. data/lib/scrivito/cache/ram_store.rb +32 -0
  22. data/lib/scrivito/cache.rb +1 -40
  23. data/lib/scrivito/cache_garbage_collector.rb +1 -1
  24. data/lib/scrivito/cms_backend.rb +5 -5
  25. data/lib/scrivito/{cms_cache_storage.rb → cms_data_cache.rb} +22 -10
  26. data/lib/scrivito/cms_rest_api/widget_extractor.rb +1 -1
  27. data/lib/scrivito/configuration.rb +41 -6
  28. data/lib/scrivito/content_state.rb +6 -6
  29. data/lib/scrivito/controller_actions.rb +8 -2
  30. data/lib/scrivito/obj_params_parser.rb +4 -2
  31. data/lib/scrivito/workspace_data_from_service.rb +2 -2
  32. metadata +12 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f47f2f02b39eb33fc827fe70fc6e8811176d223
4
- data.tar.gz: 01f242b21b1009bb2eb015926fafa41c6213e65c
3
+ metadata.gz: 89a64283aa9e79b8a6c8ced8a53b72a081935820
4
+ data.tar.gz: 2ed35eb7b75e516209295ea0178c424e2e9cdd1e
5
5
  SHA512:
6
- metadata.gz: 8e7bccf5971954d0949156785a15f2c502d9f046859acb284fe4005ed285f80113d89d55cb43f29d505e658e3d46eaf12bae80fa0d0d8cd9991f4fb041be4fb4
7
- data.tar.gz: 30ed9d04932dd45eda4e6e7b9b9760fb54c78049007372ea7989dbeb6ae236c737782f9d7e0bd0dedd4619d6b1a78748d4cc7f8008e6f2af18fc26675c9e0872
6
+ metadata.gz: e1f36dfc18acfdf77dd15ab6ea51dee7b9958fdf04517207e2735532b3dc4c5352cd58926bf612a25ba760c7e4f543cb36ee89d4aec25362fc9b4e04060511c6
7
+ data.tar.gz: 66b0024d79000f5966cd3c6aa0bb337f0ee0ca4018d4e751aa0ff93719e6f131748f4ebacbfffdf41740224ac127becd1ba592db19333a24395083ca7f2eca4f
@@ -189,7 +189,7 @@ module Scrivito
189
189
  end
190
190
 
191
191
  def valid_widget_classes
192
- (widget_classes_from_widget || widget_classes_from_obj || Widget.descendants).map(&:to_s)
192
+ (widget_classes_from_widget || widget_classes_from_obj || widget_descendants).map(&:to_s)
193
193
  end
194
194
 
195
195
  def widget_classes_from_widget
@@ -202,6 +202,10 @@ module Scrivito
202
202
  current_obj.valid_widget_classes_for(params[:field_name])
203
203
  end
204
204
 
205
+ def widget_descendants
206
+ Widget.descendants.reject(&:hide_from_widget_class_selection?)
207
+ end
208
+
205
209
  def assert_dialog_layout
206
210
  view_context.lookup_context.find('layouts/scrivito_dialog')
207
211
  rescue ActionView::MissingTemplate
@@ -8,32 +8,42 @@ module ScrivitoHelper
8
8
  include Scrivito::RoutingHelper
9
9
 
10
10
  #
11
- # Returns an HTML block tag containing content from an Obj.
12
- # Add HTML attributes by passing an attributes hash to options.
13
- # The helper method is somewhat similar to (and internally uses)
11
+ # Renders a field within the given HTML tag.
12
+ #
13
+ # This method also renders additional attributes, which are needed for in-place editing.
14
+ # These attributes are only rendered when appropriate, i.e. not for a regular visitor.
15
+ #
16
+ # The helper is similar to (and internally uses)
14
17
  # http://api.rubyonrails.org/classes/ActionView/Helpers/TagHelper.html#method-i-content_tag.
18
+ # You can add additional HTML attributes by passing them in +html_options+.
15
19
  #
16
20
  # @api public
17
21
  #
18
- # This helper method also renders additional data attributes, which are needed for inplace editing.
19
- # These attributes are only rendered when appropriate, i.e. not for a regular visitor.
22
+ # @note If the param +field_name+ is of type +widget+, then +tag_name+ must be a block tag,
23
+ # like +div+ or +h1+. An inline tag like +p+ or +span+ could result in broken HTML output, since
24
+ # the widgets are rendered within block tags.
20
25
  #
21
- # @param tag_name [String, Symbol] Name of the html tag (e.g. +:h1+ or +:div+).
26
+ # @param tag_name [String, Symbol] Name of the HTML tag (e.g. +:h1+ or +:div+).
27
+ # If the param +field_name+ is of type +widget+, then +tag_name+ must be a block tag,
28
+ # like +div+ or +h1+. An inline tag like +p+ or +span+ could result in broken HTML output, since
29
+ # the widgets are rendered within block tags.
22
30
  # @param obj_or_widget [Scrivito::BasicObj, Scrivito::BasicWidget] A {Scrivito::BasicObj}
23
31
  # or {Scrivito::BasicWidget} from which the +field_name+ is read.
24
32
  # @param field_name [String, Symbol] Which field of the Obj should be rendered.
25
33
  # @param html_options [Hash] HTML options to be passed to +content_tag+.
26
34
  # @param block [Proc] Optional block to render inner HTML. If none given the value of attribute
27
35
  # will be rendered instead. +block+ is not allowed for fields of type +widget+.
36
+ #
28
37
  # @raise ArgumentError if the field behind +field_name+ is of type +widget+ and a +block+ is given.
29
- # @return [String] The rendered html tag
30
38
  #
31
- # @example Renders an <h2> tag containing the text of the +headline+ attribute of +@obj+ and assigns the tag a css class called +very_important+.
39
+ # @return [String] The rendered HTML tag.
40
+ #
41
+ # @example Renders an <h2> tag containing the text of the +headline+ attribute of +@obj+ and assigns the tag a css class called +very_important+
32
42
  # <%= scrivito_tag :h2, @obj, :headline, class: "very_important" %>
33
43
  #
34
- # @example Renders an <h2> tag containing an escaped +headline+.
35
- # <%= scrivito_tag :h2, @obj, :headline do %>
36
- # <%= strip_tags @obj.headline %>
44
+ # @example Renders an <h2> tag containing a truncated +headline+ of the +widget+
45
+ # <%= scrivito_tag :h2, widget, :headline do %>
46
+ # <%= truncate widget.headline %>
37
47
  # <% end %>
38
48
  #
39
49
  # @example Render a download link for a PDF document
@@ -44,6 +54,7 @@ module ScrivitoHelper
44
54
  # Drop PDF here to upload
45
55
  # <% end %>
46
56
  # <% end %>
57
+ #
47
58
  def scrivito_tag(tag_name, obj_or_widget, field_name, html_options = {}, &block)
48
59
  Scrivito::CmsFieldTag.new(
49
60
  self, tag_name, obj_or_widget, field_name.to_s
@@ -0,0 +1,11 @@
1
+ module Scrivito
2
+ class ContentWidget < ::Widget
3
+ def self.hide_from_widget_class_selection?
4
+ true
5
+ end
6
+
7
+ def description_for_editor
8
+ content.try(:description_for_editor).presence || 'Content Widget'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,7 @@
1
+ <% if content = widget.content %>
2
+ <% if lookup_context.exists?(content.embed_view_path) %>
3
+ <%= render template: content.embed_view_path, locals: {obj: content} %>
4
+ <% else %>
5
+ <%= content.display_title %>
6
+ <% end %>
7
+ <% end %>
data/config/ca-bundle.crt CHANGED
@@ -1,7 +1,7 @@
1
1
  ##
2
2
  ## Bundle of CA Root Certificates
3
3
  ##
4
- ## Certificate data from Mozilla as of: Mon Jan 26 18:22:57 2015
4
+ ## Certificate data from Mozilla as of: Thu Feb 5 15:33:13 2015
5
5
  ##
6
6
  ## This is a bundle of X.509 certificates of public Certificate Authorities
7
7
  ## (CA). These were automatically extracted from Mozilla's root certificates
data/config/cms_routes.rb CHANGED
@@ -4,7 +4,9 @@ Rails.application.routes.draw do
4
4
  get '__scrivito/render_widget/:id/show_widget/:widget_id' => 'scrivito/cms_dispatch#show_widget'
5
5
  get '__scrivito/render_widget/:id/widget_details/:widget_id' => 'scrivito/cms_dispatch#widget_details'
6
6
 
7
- get '/__scrivito/details_page/:resource_id' => 'scrivito/cms_dispatch#details_page'
7
+ get '__scrivito/page_details/:id' => 'scrivito/cms_dispatch#page_details'
8
+
9
+ get '/__scrivito/resource_details/:resource_id' => 'scrivito/cms_dispatch#resource_details'
8
10
 
9
11
  match ':id(/*slug)',
10
12
  to: 'scrivito/cms_dispatch#index',
data/config/routes.rb CHANGED
@@ -7,7 +7,6 @@ Rails.application.routes.draw do
7
7
  end
8
8
 
9
9
  member do
10
- get :details
11
10
  get :widget_class_selection
12
11
  get :modification
13
12
  get :widget_modification
@@ -11,7 +11,7 @@
11
11
  if (scrivito_ui.is_inited()) {
12
12
  if (!dom_config) {
13
13
  // UI is already running, but editing is not allowed: reload UI to make it disappear.
14
- window.parent.location.reload();
14
+ window.parent.location = window.location;
15
15
  }
16
16
  } else {
17
17
  if (!dom_config) {