infopark_fiona7 0.30.0.2 → 0.70.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/fiona7.js +1 -282
- data/app/assets/javascripts/fiona7_ui.js +335 -0
- data/app/assets/stylesheets/fiona7.css.scss +4 -36
- data/app/assets/stylesheets/fiona7_ui.css.scss +39 -0
- data/app/controllers/fiona7/blobs_controller.rb +13 -23
- data/app/controllers/fiona7/release_controller.rb +1 -0
- data/app/controllers/fiona7/sessions_controller.rb +3 -5
- data/app/helpers/fiona7_override_helper.rb +6 -2
- data/app/models/fiona7/edited_obj.rb +6 -1
- data/app/models/fiona7/released_obj.rb +11 -3
- data/app/models/fiona7/write_obj.rb +18 -3
- data/app/models/fiona7_login_page.rb +3 -0
- data/app/views/scrivito/ui/index.html.erb +16 -0
- data/config/routes.rb +2 -0
- data/infopark_fiona7.gemspec +6 -4
- data/lib/fiona7/builder/batch_widget_writer.rb +7 -3
- data/lib/fiona7/builder/obj_builder.rb +130 -42
- data/lib/fiona7/builder/obj_class_builder.rb +3 -59
- data/lib/fiona7/builder/obj_class_updater.rb +7 -44
- data/lib/fiona7/builder/obj_updater.rb +25 -7
- data/lib/fiona7/builder/widget_builder.rb +24 -0
- data/lib/fiona7/builder/widget_building.rb +2 -7
- data/lib/fiona7/builder/widget_updater.rb +21 -0
- data/lib/fiona7/controllers/content_service/obj_controller.rb +16 -25
- data/lib/fiona7/controllers/rest_api/blob_controller.rb +41 -2
- data/lib/fiona7/controllers/rest_api/obj_controller.rb +19 -7
- data/lib/fiona7/controllers/rest_api/workspace_controller.rb +1 -1
- data/lib/fiona7/engine.rb +58 -7
- data/lib/fiona7/fiona_connector_patches/basic_obj.rb +46 -0
- data/lib/fiona7/initializer.rb +15 -11
- data/lib/fiona7/json/obj_decorator.rb +53 -31
- data/lib/fiona7/json/reverse_obj_decorator.rb +36 -0
- data/lib/fiona7/json/widget_decorator.rb +3 -1
- data/lib/fiona7/link_converter/fiona_to_scrivito.rb +45 -13
- data/lib/fiona7/link_converter/scrivito_to_fiona.rb +1 -1
- data/lib/fiona7/middleware/server_detection_middleware.rb +27 -0
- data/lib/fiona7/middleware/table_switching_middleware.rb +33 -0
- data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk.rb +5 -11
- data/lib/fiona7/mode_switch/composite.rb +2 -4
- data/lib/fiona7/naive_search_engine.rb +66 -16
- data/lib/fiona7/routers/rest_api.rb +50 -45
- data/lib/fiona7/routing_monkey_patch.rb +5 -3
- data/lib/fiona7/scrivito_patches/attribute_content.rb +9 -10
- data/lib/fiona7/scrivito_patches/attribute_serializer.rb +15 -0
- data/lib/fiona7/scrivito_patches/basic_obj.rb +25 -19
- data/lib/fiona7/scrivito_patches/basic_widget.rb +4 -0
- data/lib/fiona7/scrivito_patches/binary.rb +452 -33
- data/lib/fiona7/scrivito_patches/client_config.rb +0 -19
- data/lib/fiona7/scrivito_patches/cms_backend.rb +48 -0
- data/lib/fiona7/scrivito_patches/cms_field_tag.rb +19 -0
- data/lib/fiona7/scrivito_patches/cms_rest_api.rb +20 -3
- data/lib/fiona7/scrivito_patches/cms_routing.rb +20 -34
- data/lib/fiona7/scrivito_patches/controller_actions.rb +0 -8
- data/lib/fiona7/scrivito_patches/migrator.rb +4 -0
- data/lib/fiona7/scrivito_patches/objs_controller.rb +18 -0
- data/lib/fiona7/scrivito_patches/type_computer.rb +12 -12
- data/lib/fiona7/scrivito_patches/webservice_controller.rb +21 -0
- data/lib/fiona7/scrivito_patches/workspace.rb +8 -5
- data/lib/fiona7/shadow_classes.rb +74 -0
- data/lib/fiona7/table_switcher.rb +39 -0
- data/lib/fiona7/type_loader.rb +63 -0
- data/lib/fiona7/type_register.rb +170 -89
- data/lib/fiona7/type_synchronizer.rb +68 -0
- data/lib/fiona7/version.rb +1 -1
- data/lib/fiona7/version_helper.rb +35 -54
- data/lib/fiona7/widget_resolver.rb +1 -1
- data/lib/tasks/fiona7_tasks.rake +0 -8
- metadata +57 -18
- data/lib/fiona7/controllers/rest_api/obj_class_controller.rb +0 -39
- data/lib/fiona7/json/obj_class_decorator.rb +0 -45
- data/lib/fiona7/mode_switch/constants.rb +0 -86
- data/lib/fiona7/type_register_mixin.rb +0 -9
@@ -9,28 +9,60 @@ module Fiona7
|
|
9
9
|
|
10
10
|
def convert(content)
|
11
11
|
return content unless content.present?
|
12
|
-
extend RailsConnector::DefaultCmsRoutingHelper unless kind_of?(RailsConnector::DefaultCmsRoutingHelper)
|
13
|
-
extend RailsConnector::DisplayHelper unless kind_of?(RailsConnector::DisplayHelper)
|
14
12
|
|
15
|
-
|
16
|
-
display_value(content)
|
13
|
+
convert_links(content)
|
17
14
|
end
|
18
15
|
|
19
|
-
|
20
|
-
|
16
|
+
protected
|
17
|
+
|
18
|
+
LINK_PATTERN = '<?\binternallink:(\d+)\b>?'
|
19
|
+
LINK_EXPRESSION = %r(#{LINK_PATTERN})
|
20
|
+
|
21
|
+
def link_map
|
22
|
+
@link_map ||= Hash[@obj.attr_values["text_links"].map{|l| [l["link_id"].to_s, l]}]
|
21
23
|
end
|
22
24
|
|
23
|
-
def
|
24
|
-
|
25
|
+
def convert_links(content_attribute)
|
26
|
+
return content_attribute unless content_attribute =~ LINK_EXPRESSION
|
27
|
+
|
28
|
+
content_attribute.gsub(%r(#{LINK_PATTERN}(['"]?))) do
|
29
|
+
link = link_map[$1.to_s]
|
30
|
+
if link.blank?
|
31
|
+
raise "Unable to convert links"
|
32
|
+
"#{RailsConnector::DefaultCmsRoutingHelper::LINK_TO_UNREACHABLE}#{$2}"
|
33
|
+
else
|
34
|
+
|
35
|
+
uri = "#{cms_path(link)}#{$2}"
|
36
|
+
html_link(link, uri)
|
37
|
+
end
|
38
|
+
end
|
25
39
|
end
|
26
40
|
|
27
|
-
def
|
28
|
-
|
29
|
-
|
30
|
-
"
|
41
|
+
def cms_path(link)
|
42
|
+
if link["type"] == "internal"
|
43
|
+
base = "objid:#{link['destination']}"
|
44
|
+
base += "?#{link['search']}" if link['search'].present?
|
45
|
+
base += "##{link['fragment']}" if link['fragment'].present?
|
46
|
+
base
|
31
47
|
else
|
32
|
-
|
48
|
+
link["url"]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def html_link(link, uri)
|
53
|
+
subst = uri
|
54
|
+
name, value =
|
55
|
+
case link["tag_name"]
|
56
|
+
when 'img', 'input'
|
57
|
+
['alt', link["title"] || ""]
|
58
|
+
when 'a', 'link'
|
59
|
+
['title', begin link["title"] unless link["title"].blank? end]
|
60
|
+
end
|
61
|
+
if value
|
62
|
+
subst << %( #{name}="#{h(value)}")
|
33
63
|
end
|
64
|
+
subst << %( target="#{h(link['target'])}") unless link['target'].blank?
|
65
|
+
subst
|
34
66
|
end
|
35
67
|
end
|
36
68
|
end
|
@@ -12,7 +12,7 @@ module Fiona7
|
|
12
12
|
private
|
13
13
|
def serialize_html
|
14
14
|
# TODO: this an incomplete list of possible tags
|
15
|
-
link_expressions = [/(href
|
15
|
+
link_expressions = [/(href)\s*=\s*"([^"]*)"/, /(href)\s*=\s*'([^']*)'/]
|
16
16
|
link_expressions.each do |expr|
|
17
17
|
@value.gsub!(expr) do |string|
|
18
18
|
target = $2
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Fiona7
|
2
|
+
module Middleware
|
3
|
+
class ServerDetectionMiddleware
|
4
|
+
class << self
|
5
|
+
attr_accessor :server_detected
|
6
|
+
attr_accessor :server_name, :server_port
|
7
|
+
|
8
|
+
def server_detected?
|
9
|
+
!!server_detected
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
self.server_detected = false
|
14
|
+
|
15
|
+
def initialize(app)
|
16
|
+
@app = app
|
17
|
+
end
|
18
|
+
|
19
|
+
def call(env)
|
20
|
+
self.class.server_detected = true
|
21
|
+
self.class.server_name = env['SERVER_NAME']
|
22
|
+
self.class.server_port = (env['SERVER_PORT'].presence || 80).to_i
|
23
|
+
@app.call(env)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "fiona7/table_switcher"
|
2
|
+
|
3
|
+
module Fiona7
|
4
|
+
module Middleware
|
5
|
+
class TableSwitchingMiddleware
|
6
|
+
def initialize(app)
|
7
|
+
@app = app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
if Fiona7.mode == :legacy
|
12
|
+
editing_context = env[Scrivito::EditingContextMiddleware::ENVKEY]
|
13
|
+
|
14
|
+
use_preview = editing_context.authenticated_editor? && selected_workspace_id(editing_context) == 'rtc'
|
15
|
+
|
16
|
+
TableSwitcher.new(
|
17
|
+
Fiona7::WriteObj,
|
18
|
+
use_preview ? "preview_objs" : "objs"
|
19
|
+
).switch
|
20
|
+
end
|
21
|
+
|
22
|
+
@app.call(env)
|
23
|
+
end
|
24
|
+
|
25
|
+
def selected_workspace_id(editing_context)
|
26
|
+
# NOTE: this does not require workspace lookup/load_obj
|
27
|
+
# and thus is potentially faster
|
28
|
+
editing_context.instance_variable_get(:@selected_workspace_id).to_s
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -1,16 +1,10 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
2
|
+
match '/', via: :all, to: 'scrivito/cms_dispatch#index', as: :scrivito_root
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
match ':id(/*slug)',
|
10
|
-
to: 'scrivito/cms_dispatch#index',
|
11
|
-
constraints: { id: /\d+|[0-9a-f]{16}/ },
|
12
|
-
as: 'scrivito_id',
|
13
|
-
via: :all
|
4
|
+
with_options via: :all, constraints: {id: /[0-9]{4,16}/} do |proxy|
|
5
|
+
proxy.match '(/)(*slug-):id', to: 'scrivito/cms_dispatch#index', as: :cms_id
|
6
|
+
proxy.match ':id(/*slug)', to: 'scrivito/cms_dispatch#legacy', as: :cms_legacy_id
|
7
|
+
end
|
14
8
|
|
15
9
|
match '/*permalink',
|
16
10
|
to: 'scrivito/cms_dispatch#index',
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'fiona7/mode_switch/abstract_mode_switch'
|
2
2
|
require 'fiona7/mode_switch/views'
|
3
3
|
require 'fiona7/mode_switch/cms_routes'
|
4
|
-
require 'fiona7/mode_switch/constants'
|
5
4
|
|
6
5
|
module Fiona7
|
7
6
|
module ModeSwitch
|
@@ -11,7 +10,6 @@ module Fiona7
|
|
11
10
|
|
12
11
|
@views = Views.new(self.app)
|
13
12
|
@cms_routes = CmsRoutes.new(self.app)
|
14
|
-
@constants = Constants.new(self.app)
|
15
13
|
end
|
16
14
|
|
17
15
|
def standalone
|
@@ -23,10 +21,10 @@ module Fiona7
|
|
23
21
|
end
|
24
22
|
|
25
23
|
protected
|
26
|
-
attr_reader :views, :cms_routes
|
24
|
+
attr_reader :views, :cms_routes
|
27
25
|
|
28
26
|
def switches
|
29
|
-
[self.views, self.cms_routes
|
27
|
+
[self.views, self.cms_routes]
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
@@ -3,6 +3,7 @@ require "fiona7/search_engine"
|
|
3
3
|
module Fiona7
|
4
4
|
class NaiveSearchEngine < SearchEngine
|
5
5
|
def results
|
6
|
+
#debugger
|
6
7
|
fetch_all
|
7
8
|
apply_filters
|
8
9
|
exclude_widgets
|
@@ -12,10 +13,14 @@ module Fiona7
|
|
12
13
|
|
13
14
|
protected
|
14
15
|
def fetch_all
|
15
|
-
obj_class_filter = @query.find {|q| q[:field] == :_obj_class && q[:operator] == :equal }
|
16
|
+
obj_class_filter = @query.find {|q| (q[:field] == :_obj_class || q[:field] == "_obj_class") && q[:operator] == :equal }
|
17
|
+
id_filter = @query.find {|q| (q[:field] == :id || q[:field] == "id") && q[:operator] == :equal }
|
16
18
|
if obj_class_filter
|
17
19
|
@all = @klass.where(obj_class: obj_class_filter[:value])
|
18
20
|
@query.delete(obj_class_filter)
|
21
|
+
elsif id_filter
|
22
|
+
@query.delete(id_filter)
|
23
|
+
@all = @klass.where(obj_id: id_filter[:value])
|
19
24
|
else
|
20
25
|
# FIXME: this is deprecated
|
21
26
|
@all = @klass.all
|
@@ -29,31 +34,65 @@ module Fiona7
|
|
29
34
|
end
|
30
35
|
|
31
36
|
def exclude_widgets
|
37
|
+
# skip when handling ActiveRelation
|
38
|
+
return unless @all.kind_of?(Array)
|
39
|
+
|
32
40
|
widget_regexp = /\/_widgets\/([0-9]+\/){0,1}[^\/]+\Z/
|
33
41
|
@all.to_a.delete_if {|o| o.path =~ widget_regexp }
|
34
42
|
end
|
35
43
|
|
36
44
|
def order_results
|
37
|
-
|
45
|
+
if !@all.kind_of?(Array)
|
46
|
+
field = @sort.to_sym
|
47
|
+
|
48
|
+
if field == :_last_changed
|
49
|
+
@all = @all.order("last_changed" => @order)
|
50
|
+
elsif field == :id
|
51
|
+
@all = @all.order("obj_id" => @order)
|
52
|
+
else
|
53
|
+
# NOTE: we actually ignore sorting here !!
|
54
|
+
@all = @all.order("last_changed" => :desc)
|
55
|
+
end
|
56
|
+
|
57
|
+
return
|
58
|
+
end
|
59
|
+
|
60
|
+
sort_field = @sort
|
38
61
|
@all = @all.to_a
|
39
|
-
|
62
|
+
#@all.sort_by! {|o| o.send(:[], resolve_field_name(o,sort_field)) }
|
63
|
+
@all.sort! do |a,b|
|
64
|
+
a_value = a.send(:[], resolve_field_name(a,sort_field))
|
65
|
+
b_value = b.send(:[], resolve_field_name(b,sort_field))
|
66
|
+
|
67
|
+
if a_value.nil?
|
68
|
+
1
|
69
|
+
elsif b_value.nil?
|
70
|
+
-1
|
71
|
+
else
|
72
|
+
a_value <=> b_value
|
73
|
+
end
|
74
|
+
end
|
40
75
|
@all.reverse! if @order == :desc
|
41
76
|
end
|
42
77
|
|
43
78
|
def limit_size
|
44
|
-
@count = @all.
|
45
|
-
@all
|
79
|
+
@count = @all.count
|
80
|
+
if @all.kind_of?(Array)
|
81
|
+
@all[@offset, @limit] || []
|
82
|
+
else
|
83
|
+
@all.offset(@offset).limit(@limit).to_a
|
84
|
+
end
|
46
85
|
end
|
47
86
|
|
48
87
|
protected
|
49
88
|
def apply_filter(filter)
|
50
|
-
field =
|
89
|
+
field = filter[:field]
|
51
90
|
operator = filter[:operator].to_sym
|
52
91
|
value = filter[:value]
|
53
92
|
|
54
93
|
case filter[:operator]
|
55
94
|
when :equal
|
56
|
-
if field == :
|
95
|
+
if field == :_modification || field == "_modification"
|
57
96
|
if value != ["new", "edited", "deleted"]
|
58
97
|
raise "Unsupported modification values: #{value.inspect}. Only #{["new", "edited", "deleted"].inspect} are supported"
|
59
98
|
else
|
@@ -63,30 +102,41 @@ module Fiona7
|
|
63
102
|
else
|
64
103
|
if value.is_a?(Array)
|
65
104
|
@all = @all.to_a.select do |o|
|
66
|
-
|
105
|
+
resolved_field = resolve_field_name(o, field)
|
106
|
+
field_value = o.send(:[], resolved_field)
|
107
|
+
if resolved_field == :obj_id
|
108
|
+
field_value = field_value.to_s
|
109
|
+
end
|
67
110
|
# FIXME: linklist, referencelist unsupported
|
68
111
|
if field_value.is_a?(Array)
|
69
112
|
!(value & field_value).empty?
|
70
113
|
else
|
71
|
-
value.include?(
|
114
|
+
value.include?(field_value)
|
72
115
|
end
|
73
116
|
end
|
74
117
|
else
|
75
|
-
@all = @all.to_a.select
|
118
|
+
@all = @all.to_a.select do |o|
|
119
|
+
resolved_field = resolve_field_name(o, field)
|
120
|
+
field_value = o.send(:[], resolved_field)
|
121
|
+
if resolved_field == :obj_id
|
122
|
+
field_value = field_value.to_s
|
123
|
+
end
|
124
|
+
field_value == value
|
125
|
+
end
|
76
126
|
end
|
77
127
|
end
|
78
|
-
when :prefix
|
79
|
-
@all = @all.to_a.select {|o| o.send(:[], field).to_s.start_with?(value) }
|
128
|
+
when :prefix, :prefix_search
|
129
|
+
@all = @all.to_a.select {|o| o.send(:[], resolve_field_name(o,field)).to_s.start_with?(value) }
|
80
130
|
when :greater_than
|
81
|
-
@all = @all.to_a.select {|o| o.send(:[], field).to_s > (value) }
|
131
|
+
@all = @all.to_a.select {|o| o.send(:[], resolve_field_name(o,field)).to_s > (value) }
|
82
132
|
when :less_than
|
83
|
-
@all = @all.to_a.select {|o| o.send(:[], field).to_s < (value) }
|
133
|
+
@all = @all.to_a.select {|o| o.send(:[], resolve_field_name(o,field)).to_s < (value) }
|
84
134
|
else
|
85
135
|
raise "Operator: #{filter[:operator]} not supported"
|
86
136
|
end
|
87
137
|
end
|
88
138
|
|
89
|
-
def resolve_field_name(field)
|
139
|
+
def resolve_field_name(obj, field)
|
90
140
|
field = field.to_sym
|
91
141
|
case field
|
92
142
|
when :_obj_class
|
@@ -104,7 +154,7 @@ module Fiona7
|
|
104
154
|
when :_name
|
105
155
|
:name
|
106
156
|
else
|
107
|
-
field
|
157
|
+
Fiona7::TypeRegister.instance.read(obj.obj_class).find_attribute(field).real_name.to_sym
|
108
158
|
end
|
109
159
|
end
|
110
160
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require "fiona7/controllers/rest_api/obj_class_controller"
|
2
1
|
require "fiona7/controllers/rest_api/obj_controller"
|
3
2
|
require "fiona7/controllers/rest_api/blob_controller"
|
4
3
|
require "fiona7/controllers/rest_api/workspace_controller"
|
@@ -15,41 +14,54 @@ class Scrivito::CmsRestApi
|
|
15
14
|
def get(resource_path, payload = nil, options = nil)
|
16
15
|
@number_of_requests += 1 if resource_path == @count_requests
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
|
18
|
+
action = :get
|
19
|
+
ActiveSupport::Notifications.instrumenter.instrument(
|
20
|
+
"backend_request.scrivito",
|
21
|
+
{
|
22
|
+
:path => resource_path,
|
23
|
+
:verb => action,
|
24
|
+
:params => action == :get ? payload : nil
|
25
|
+
}
|
26
|
+
) do
|
21
27
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
28
|
+
if !resource_path.start_with?('/')
|
29
|
+
resource_path = '/' + resource_path
|
30
|
+
end
|
31
|
+
|
32
|
+
#$stdout.puts "DEBUG GET: #{resource_path}"
|
33
|
+
case resource_path
|
34
|
+
when /\A\/?revisions\/[a-zA-Z0-9_-]+\/objs\/[a-zA-Z0-9_-]+\Z/
|
35
|
+
_, _, revision_id, _, obj_id = *resource_path.split("/")
|
36
|
+
Fiona7::Controllers::RestAPI::ObjController.new.fetch_by_id_from_revision(revision_id, obj_id)
|
37
|
+
when /\A\/?workspaces\Z/
|
38
|
+
Fiona7::Controllers::RestAPI::WorkspaceController.new.all
|
39
|
+
when /\A\/?workspaces\/[a-zA-Z0-9_-]+\/objs\/find_by_path/
|
40
|
+
_, _, workspace_id = *resource_path.split("/")
|
41
|
+
path = resource_path.match(/path=(.*)\Z/)[1]
|
42
|
+
Fiona7::Controllers::RestAPI::ObjController.new.fetch_by_path(workspace_id, path)
|
43
|
+
when /\A\/?workspaces\/[a-zA-Z0-9_-]+\/objs\/search/
|
44
|
+
_, _, workspace_id = *resource_path.split("/")
|
45
|
+
Fiona7::Controllers::RestAPI::ObjController.new.search(workspace_id, payload)
|
46
|
+
when /\A\/?workspaces\/[a-zA-Z0-9_-]+\Z/
|
47
|
+
_, _, workspace_id = *resource_path.split("/")
|
48
|
+
Fiona7::Controllers::RestAPI::WorkspaceController.new.fetch(workspace_id)
|
49
|
+
when /\A\/?workspaces\/[a-zA-Z0-9_-]+\/objs\/[a-zA-Z0-9_-]+\Z/
|
50
|
+
_, _, workspace_id, _, obj_id = *resource_path.split("/")
|
51
|
+
Fiona7::Controllers::RestAPI::ObjController.new.fetch_by_id(workspace_id, obj_id)
|
52
|
+
when /\A\/?blobs\/[a-zA-Z0-9_-]+\Z/
|
53
|
+
_, _, blob_id = *resource_path.split("/")
|
54
|
+
Fiona7::Controllers::RestAPI::BlobController.new.fetch(blob_id)
|
55
|
+
when /\A\/?blobs\/[a-zA-Z0-9_-]+\/transform\Z/
|
56
|
+
_, _, blob_id = *resource_path.split("/")
|
57
|
+
Fiona7::Controllers::RestAPI::BlobController.new.fetch(blob_id, payload[:transformation])
|
58
|
+
when /\A\/?blobs\/[a-zA-Z0-9_-]+\/meta_data\Z/
|
59
|
+
_, _, blob_id = *resource_path.split("/")
|
60
|
+
Fiona7::Controllers::RestAPI::BlobController.new.metadata(blob_id)
|
61
|
+
else
|
62
|
+
$stdout.puts "GET: #{resource_path}"
|
63
|
+
original_get(resource_path, payload, options||{})
|
64
|
+
end
|
53
65
|
end
|
54
66
|
end
|
55
67
|
|
@@ -73,7 +85,7 @@ class Scrivito::CmsRestApi
|
|
73
85
|
Fiona7::Controllers::RestAPI::ObjController.new.destroy(workspace_id, obj_id)
|
74
86
|
else
|
75
87
|
#$stdout.puts "DELETE: #{resource_path}"
|
76
|
-
original_delete(resource_path, payload, options)
|
88
|
+
original_delete(resource_path, payload, options||{})
|
77
89
|
end
|
78
90
|
end
|
79
91
|
|
@@ -89,15 +101,12 @@ class Scrivito::CmsRestApi
|
|
89
101
|
case resource_path
|
90
102
|
when /\A\/?workspaces\Z/
|
91
103
|
Fiona7::Controllers::RestAPI::WorkspaceController.new.create(payload)
|
92
|
-
when /\A\/?workspaces\/[a-zA-Z0-9]+\/obj_classes/
|
93
|
-
_, _, workspace_id = *resource_path.split("/")
|
94
|
-
Fiona7::Controllers::RestAPI::ObjClassController.new.create(workspace_id, payload)
|
95
104
|
when /\A\/?workspaces\/[a-zA-Z0-9]+\/objs/
|
96
105
|
_, _, workspace_id = *resource_path.split("/")
|
97
106
|
Fiona7::Controllers::RestAPI::ObjController.new.create(workspace_id, payload)
|
98
107
|
else
|
99
108
|
#$stdout.puts "POST: #{resource_path}"
|
100
|
-
original_post(resource_path, payload, options)
|
109
|
+
original_post(resource_path, payload, options||{})
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
@@ -115,10 +124,6 @@ class Scrivito::CmsRestApi
|
|
115
124
|
_, _, workspace_id, _, obj_id = *resource_path.split("/")
|
116
125
|
payload[:obj][:_id] = obj_id
|
117
126
|
Fiona7::Controllers::RestAPI::ObjController.new.update(workspace_id, payload)
|
118
|
-
when /\A\/?workspaces\/[a-zA-Z0-9]+\/obj_classes\/[a-zA-z0-9_-]+\Z/
|
119
|
-
_, _, workspace_id, _, obj_class_name = *resource_path.split("/")
|
120
|
-
payload[:obj_class][:name] = obj_class_name
|
121
|
-
Fiona7::Controllers::RestAPI::ObjClassController.new.update(workspace_id, payload)
|
122
127
|
when /\A\/?workspaces\/[a-zA-Z0-9]+\/publish/
|
123
128
|
_, _, workspace_id = *resource_path.split("/")
|
124
129
|
Fiona7::Controllers::RestAPI::WorkspaceController.new.publish(workspace_id)
|
@@ -128,7 +133,7 @@ class Scrivito::CmsRestApi
|
|
128
133
|
Fiona7::Controllers::RestAPI::WorkspaceController.new.publish(workspace_id)
|
129
134
|
else
|
130
135
|
#$stdout.puts "PUT: #{resource_path}"
|
131
|
-
original_put(resource_path, payload, options)
|
136
|
+
original_put(resource_path, payload, options||{})
|
132
137
|
end
|
133
138
|
end
|
134
139
|
end
|