rbbt-rest 1.8.45 → 1.8.46
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.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/common/render.rb +28 -3
- data/lib/rbbt/rest/entity/entity_card.rb +11 -0
- data/lib/rbbt/rest/entity/entity_list_card.rb +9 -0
- data/lib/rbbt/rest/entity/locate.rb +33 -383
- data/lib/rbbt/rest/helpers.rb +12 -0
- data/share/views/compass/app.sass +60 -0
- data/share/views/compass/card_templates.sass +1 -0
- data/share/views/compass/documentation.sass +11 -0
- data/share/views/compass/layout.sass +3 -1
- data/share/views/compass/tab_menu.sass +12 -4
- data/share/views/documented_section.haml +10 -0
- data/share/views/entity_partials/action_card.haml +42 -37
- data/share/views/entity_partials/action_controller.haml +1 -1
- data/share/views/entity_partials/entity_card.haml +75 -56
- data/share/views/entity_partials/entity_list_card.haml +109 -1
- data/share/views/entity_partials/entity_map_card.haml +2 -1
- data/share/views/layout.haml +0 -1
- data/share/views/layout/header.haml +1 -1
- data/share/views/partials/tabs.haml +0 -2
- data/share/views/public/js/app.js +18 -1
- data/share/views/public/js/helpers/_ajax_replace.js +5 -1
- data/share/views/public/js/rbbt.documentation.js +25 -0
- data/share/views/public/js/rbbt.modal.js +5 -3
- data/share/views/tools/nvd3.haml +1 -1
- data/share/views/tools/nvd3/chart.haml +6 -1
- data/share/views/tools/nvd3/histogram.haml +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 013635d75dfba290ea900db49c1a5a30d1aa5f3a
|
4
|
+
data.tar.gz: df1f05df4f7ca4e209e9cf8677cbdadc9b0e3f3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c402f490a4702ee8cef75bf4464a2f6ee2a1644dc89ff397505ca32304045090b8ba1039f6ba16610a90bdbce3d3ebb9ef7836b9177a9a1b2327926a0dbf7a1e
|
7
|
+
data.tar.gz: 210dfe6a670779757b221deecd2b0b820e32cdfe4d6048e0fbf48f78e20d3fba60cedad382f36e4a560403ad918a11f250ad22749996382288c67973d23bda4a
|
@@ -58,20 +58,45 @@ module RbbtRESTHelpers
|
|
58
58
|
raise TemplateMissing, "Template #{ template_file } not found" unless template_file.exists?
|
59
59
|
raise TemplateMissing, "Template #{ layout_file } not found" unless layout_file.nil? or layout_file.exists?
|
60
60
|
layout_file = layout_file.find if layout_file.respond_to? :find
|
61
|
-
|
61
|
+
|
62
|
+
if Path === template_file
|
63
|
+
documentation_file = template_file.annotate((template_file.original || template_file).sub(/haml$/, 'md'))
|
64
|
+
template_file = template_file.find
|
65
|
+
documentation_file = documentation_file.find
|
66
|
+
else
|
67
|
+
documentation_file = template_file.sub(/haml$/, 'md')
|
68
|
+
end
|
69
|
+
|
62
70
|
if layout_file
|
63
71
|
Tilt::HamlTemplate.new(layout_file, :filename => layout_file, :ugly => production?).render(self, locals) do
|
64
72
|
Log.debug{ "Rendering #{template_file} with layout #{Misc.fingerprint cache_options}" }
|
65
73
|
cache(cache, locals.merge(:_template_file => template_file, :user => user).merge(cache_options)) do
|
66
|
-
|
74
|
+
if Open.exists?(documentation_file)
|
75
|
+
documentation_layout_file = locate_template('documented_section').find
|
76
|
+
markdown = Open.read(documentation_file)
|
77
|
+
Tilt::HamlTemplate.new(documentation_layout_file, :filename => documentation_layout_file, :ugly => production?).render(self, :markdown => markdown) do
|
78
|
+
Tilt::HamlTemplate.new(template_file, :filename => template_file, :ugly => production?).render(self, locals)
|
79
|
+
end
|
80
|
+
else
|
81
|
+
Tilt::HamlTemplate.new(template_file, :filename => template_file, :ugly => production?).render(self, locals)
|
82
|
+
end
|
67
83
|
end
|
68
84
|
end
|
69
85
|
else
|
70
86
|
Log.debug{ "Rendering #{template_file} without layout #{Misc.fingerprint cache_options}" }
|
71
87
|
cache(cache, locals.merge(:_template_file => template_file, :user => user).merge(cache_options)) do
|
72
|
-
|
88
|
+
if Open.exists?(documentation_file)
|
89
|
+
markdown = Open.read(documentation_file)
|
90
|
+
documentation_layout_file = locate_template('documented_section').find
|
91
|
+
Tilt::HamlTemplate.new(documentation_layout_file, :filename => documentation_layout_file, :ugly => production?).render(self, :markdown => markdown) do
|
92
|
+
Tilt::HamlTemplate.new(template_file, :filename => template_file, :ugly => production?).render(self, locals)
|
93
|
+
end
|
94
|
+
else
|
95
|
+
Tilt::HamlTemplate.new(template_file, :filename => template_file, :ugly => production?).render(self, locals)
|
96
|
+
end
|
73
97
|
end
|
74
98
|
end
|
99
|
+
|
75
100
|
end
|
76
101
|
|
77
102
|
def render_sass(file)
|
@@ -3,11 +3,21 @@ class EntityCard
|
|
3
3
|
attr_accessor :entity
|
4
4
|
attr_accessor :name, :long_name, :description, :meta
|
5
5
|
attr_accessor :list_container, :action_controller
|
6
|
+
attr_accessor :sections
|
6
7
|
|
7
8
|
def initialize(entity)
|
8
9
|
@entity = entity
|
9
10
|
end
|
10
11
|
|
12
|
+
|
13
|
+
def sections
|
14
|
+
@sections ||= IndiferentHash.setup({})
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_section(name, &block)
|
18
|
+
sections[name] = block
|
19
|
+
end
|
20
|
+
|
11
21
|
%w(name long_name description meta).each do |method|
|
12
22
|
self.send(:define_method, method.to_sym) do |&block|
|
13
23
|
if block
|
@@ -24,3 +34,4 @@ module EntityRESTHelpers
|
|
24
34
|
partial_render('entity_partials/entity_card', :card => card, :block => block)
|
25
35
|
end
|
26
36
|
end
|
37
|
+
|
@@ -3,11 +3,20 @@ class EntityListCard
|
|
3
3
|
attr_accessor :list, :list_id
|
4
4
|
attr_accessor :meta, :description
|
5
5
|
attr_accessor :action_controller, :list_container
|
6
|
+
attr_accessor :sections
|
6
7
|
|
7
8
|
def initialize(list, list_id)
|
8
9
|
@list, @list_id = list, list_id
|
9
10
|
end
|
10
11
|
|
12
|
+
def sections
|
13
|
+
@sections ||= IndiferentHash.setup({})
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_section(name, &block)
|
17
|
+
sections[name] = block
|
18
|
+
end
|
19
|
+
|
11
20
|
%w(meta description).each do |method|
|
12
21
|
self.send(:define_method, method.to_sym) do |&block|
|
13
22
|
if block
|
@@ -15,21 +15,14 @@ module EntityRESTHelpers
|
|
15
15
|
end
|
16
16
|
|
17
17
|
#{{{ CHECKS
|
18
|
-
|
19
|
-
def
|
20
|
-
|
21
|
-
|
22
|
-
if Path === path
|
23
|
-
path.annotate check_file
|
24
|
-
return false unless check_file.exists?
|
25
|
-
else
|
26
|
-
return false unless File.exists?(check_file)
|
27
|
-
end
|
28
|
-
|
18
|
+
|
19
|
+
def reject?(check_file, binding)
|
20
|
+
return false if check_file.nil? or not check_file.exists?
|
29
21
|
begin
|
30
22
|
code = Open.read(check_file)
|
31
23
|
accept = eval code, binding, check_file, 0
|
32
|
-
|
24
|
+
action = File.basename(check_file).sub('.check', '')
|
25
|
+
Log.debug{"Checking action template: #{action} - #{accept ? 'accepted' : 'rejected'}"}
|
33
26
|
return ! accept
|
34
27
|
rescue
|
35
28
|
Log.exception $!
|
@@ -38,51 +31,22 @@ module EntityRESTHelpers
|
|
38
31
|
false
|
39
32
|
end
|
40
33
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
# if entity == "Default"
|
45
|
-
# path = resource.entity["Default.haml"]
|
46
|
-
# if path.exists?
|
47
|
-
# return path
|
48
|
-
# else
|
49
|
-
# return nil
|
50
|
-
# end
|
51
|
-
# end
|
52
|
-
|
53
|
-
# entity.annotation_types.each do |annotation|
|
54
|
-
# path = resource.entity[annotation.to_s + ".haml"]
|
55
|
-
# return path if path.exists?
|
56
|
-
# end
|
57
|
-
|
58
|
-
# nil
|
59
|
-
#end
|
60
|
-
|
61
|
-
#def locate_entity_template(entity)
|
62
|
-
|
63
|
-
# if entity.respond_to? :dir and Path === entity.dir
|
64
|
-
# entity_views = entity.dir.www.views
|
65
|
-
|
66
|
-
# entity.annotation_types.each do |annotation|
|
67
|
-
# path = entity_views.entity[annotation.to_s + ".haml"]
|
68
|
-
# return path if path.exists?
|
69
|
-
# end
|
70
|
-
# end
|
71
|
-
|
72
|
-
# entity_resources.each do |resource|
|
73
|
-
# path = locate_entity_template_from_resource(resource, entity)
|
74
|
-
# return path if path and path.exists?
|
75
|
-
# end
|
34
|
+
def reject_template(path, binding)
|
35
|
+
return false if path.nil?
|
36
|
+
check_file = path.sub(/\.haml$/, '.check')
|
76
37
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
38
|
+
if Path === path
|
39
|
+
path.annotate check_file
|
40
|
+
return false unless check_file.exists?
|
41
|
+
else
|
42
|
+
return false unless File.exists?(check_file)
|
43
|
+
end
|
81
44
|
|
82
|
-
|
83
|
-
|
45
|
+
reject?(check_file, binding)
|
46
|
+
end
|
84
47
|
|
85
|
-
|
48
|
+
#{{{ ENTITY
|
49
|
+
|
86
50
|
def locate_entity_template(entity)
|
87
51
|
resources = resources_for_entity(entity)
|
88
52
|
|
@@ -99,50 +63,6 @@ module EntityRESTHelpers
|
|
99
63
|
path
|
100
64
|
end
|
101
65
|
|
102
|
-
|
103
|
-
#{{{ ENTITY ACTION
|
104
|
-
|
105
|
-
#def locate_entity_action_template_from_resource(resource, entity, action)
|
106
|
-
# if entity == "Default"
|
107
|
-
# path = resource.entity["Default"][action.to_s + ".haml"]
|
108
|
-
# raise "This action was rejected: #{ action }" if path and reject_template(path,binding)
|
109
|
-
# if path.exists?
|
110
|
-
# return path
|
111
|
-
# else
|
112
|
-
# return nil
|
113
|
-
# end
|
114
|
-
# end
|
115
|
-
|
116
|
-
# entity.annotation_types.each do |annotation|
|
117
|
-
# path = resource.entity[annotation][action.to_s + ".haml"]
|
118
|
-
# raise "This action was rejected: #{ action }" if path and reject_template(path,binding)
|
119
|
-
# return path if path.exists?
|
120
|
-
# end
|
121
|
-
|
122
|
-
# nil
|
123
|
-
#end
|
124
|
-
|
125
|
-
#def locate_entity_action_template(entity, action)
|
126
|
-
|
127
|
-
# if entity.respond_to? :dir and Path === entity.dir
|
128
|
-
# path = locate_entity_action_template_from_resource(entity.dir.www.views, entity, action)
|
129
|
-
# return path if path and path.exists?
|
130
|
-
# end
|
131
|
-
|
132
|
-
# entity_resources.each do |resource|
|
133
|
-
# path = locate_entity_action_template_from_resource(resource, entity, action)
|
134
|
-
# return path if path and path.exists?
|
135
|
-
# end
|
136
|
-
|
137
|
-
# entity_resources.each do |resource|
|
138
|
-
# path = locate_entity_action_template_from_resource(resource, "Default", action)
|
139
|
-
# raise "This action was rejected: #{ action }" if reject_template(path,binding)
|
140
|
-
# return path if path and path.exists?
|
141
|
-
# end
|
142
|
-
|
143
|
-
# raise "Template not found for action #{action}: #{ entity } (#{entity.annotation_types * ", "})"
|
144
|
-
#end
|
145
|
-
|
146
66
|
def locate_entity_action_template(entity, action)
|
147
67
|
resources = resources_for_entity(entity)
|
148
68
|
|
@@ -153,7 +73,8 @@ module EntityRESTHelpers
|
|
153
73
|
types.each do |type|
|
154
74
|
next if path
|
155
75
|
path = locate_server_file(["entity", type, action]*"/", resources, 'haml')
|
156
|
-
|
76
|
+
check_file = locate_server_file(["entity", type, action]*"/", resources, 'check')
|
77
|
+
raise "This action was rejected: #{ action }" if reject?(check_file, binding)
|
157
78
|
end
|
158
79
|
|
159
80
|
raise TemplateMissing, "Template not found for entity action #{action}: #{ entity } (#{entity.annotation_types * ", "})" if path.nil?
|
@@ -168,9 +89,18 @@ module EntityRESTHelpers
|
|
168
89
|
types << "Default"
|
169
90
|
|
170
91
|
paths = types.inject([]) do |acc,type|
|
171
|
-
|
172
|
-
|
92
|
+
all_files = glob_all_server_files(["entity", type, "*.haml"]*"/", resources)
|
93
|
+
all_checks = glob_all_server_files(["entity", type, "*.check"]*"/", resources)
|
94
|
+
rejected = []
|
95
|
+
all_checks.each do |check_file|
|
96
|
+
rejected << File.basename(check_file).sub('.check', '') if reject?(check_file, binding)
|
97
|
+
end
|
98
|
+
|
99
|
+
accepted = all_files.reject{|path|
|
100
|
+
rejected.include? File.basename(path).sub('.haml', '')
|
173
101
|
}
|
102
|
+
|
103
|
+
acc += accepted
|
174
104
|
end
|
175
105
|
|
176
106
|
if check
|
@@ -192,93 +122,8 @@ module EntityRESTHelpers
|
|
192
122
|
actions
|
193
123
|
end
|
194
124
|
|
195
|
-
#def find_all_entity_action_templates_from_resource(resource, entity)
|
196
|
-
# if entity == "Default"
|
197
|
-
# resource.entity["Default"].glob("*.haml").sort
|
198
|
-
# else
|
199
|
-
# entity.annotation_types.collect do |annotation|
|
200
|
-
# resource.entity[annotation].glob('*.haml')
|
201
|
-
# end.compact.flatten.sort
|
202
|
-
# end
|
203
|
-
#end
|
204
|
-
|
205
|
-
#def find_all_entity_action_templates(entity, check = false)
|
206
|
-
# paths = []
|
207
|
-
|
208
|
-
# if entity.respond_to? :dir and Path === entity.dir
|
209
|
-
# paths.concat find_all_entity_action_templates_from_resource(entity.dir.www.views, entity)
|
210
|
-
# end
|
211
|
-
|
212
|
-
# entity_resources.each do |resource|
|
213
|
-
# paths.concat find_all_entity_action_templates_from_resource(resource, entity)
|
214
|
-
# end
|
215
|
-
|
216
|
-
# entity_resources.each do |resource|
|
217
|
-
# paths.concat find_all_entity_action_templates_from_resource(resource, "Default")
|
218
|
-
# end
|
219
|
-
|
220
|
-
# if check
|
221
|
-
# paths = paths.reject do |path|
|
222
|
-
# (path.basename == "edit.haml" or path.basename == 'new.haml')
|
223
|
-
# end
|
224
|
-
# end
|
225
|
-
|
226
|
-
# actions = paths.collect{|file| file.basename.sub('.haml', '') }.uniq
|
227
|
-
|
228
|
-
# actions.select! do |action|
|
229
|
-
# begin
|
230
|
-
# locate_entity_action_template(entity, action)
|
231
|
-
# rescue Exception
|
232
|
-
# false
|
233
|
-
# end
|
234
|
-
# end if check
|
235
|
-
#
|
236
|
-
# actions
|
237
|
-
#end
|
238
125
|
#{{{ ENTITY LIST
|
239
|
-
|
240
|
-
#def locate_entity_list_template_from_resource(resource, list)
|
241
|
-
# if list == "Default"
|
242
|
-
# path = resource.entity_list["Default.haml"]
|
243
|
-
# if path.exists?
|
244
|
-
# return path
|
245
|
-
# else
|
246
|
-
# return nil
|
247
|
-
# end
|
248
|
-
# end
|
249
|
-
|
250
|
-
# list.annotation_types.each do |annotation|
|
251
|
-
# path = resource.entity_list[annotation.to_s + ".haml"]
|
252
|
-
# return path if path.exists?
|
253
|
-
# end
|
254
|
-
|
255
|
-
# nil
|
256
|
-
#end
|
257
|
-
|
258
|
-
#def locate_entity_list_template(list)
|
259
|
-
|
260
|
-
# if list.respond_to? :dir and Path === list.dir
|
261
|
-
# list_views = list.dir.www.views
|
262
|
-
|
263
|
-
# list.annotation_types.each do |annotation|
|
264
|
-
# path = list_views.entity_list[annotation.to_s + ".haml"]
|
265
|
-
# return path if path.exists?
|
266
|
-
# end
|
267
|
-
# end
|
268
|
-
|
269
|
-
# entity_resources.each do |resource|
|
270
|
-
# path = locate_entity_list_template_from_resource(resource, list)
|
271
|
-
# return path if path and path.exists?
|
272
|
-
# end
|
273
|
-
|
274
|
-
# entity_resources.each do |resource|
|
275
|
-
# path = locate_entity_list_template_from_resource(resource, "Default")
|
276
|
-
# return path if path and path.exists?
|
277
|
-
# end
|
278
|
-
|
279
|
-
# raise "Template not found for list (#{list.annotation_types * ", "})"
|
280
|
-
#end
|
281
|
-
|
126
|
+
|
282
127
|
def locate_entity_list_template(list)
|
283
128
|
resources = resources_for_entity(list)
|
284
129
|
|
@@ -295,96 +140,6 @@ module EntityRESTHelpers
|
|
295
140
|
path
|
296
141
|
end
|
297
142
|
|
298
|
-
|
299
|
-
|
300
|
-
#{{{ ENTITY LIST ACTION
|
301
|
-
|
302
|
-
|
303
|
-
#def locate_entity_list_action_template_from_resource(resource, list, action)
|
304
|
-
# if list == "Default"
|
305
|
-
# path = resource.entity_list["Default"][action.to_s + ".haml"]
|
306
|
-
# raise "This action was rejected: #{ action }" if path and reject_template(path,binding)
|
307
|
-
# if path.exists?
|
308
|
-
# return path
|
309
|
-
# else
|
310
|
-
# return nil
|
311
|
-
# end
|
312
|
-
# end
|
313
|
-
|
314
|
-
# list.annotation_types.each do |annotation|
|
315
|
-
# path = resource.entity_list[annotation][action.to_s + ".haml"]
|
316
|
-
# raise "This action was rejected: #{ action }" if path and reject_template(path,binding)
|
317
|
-
# return path if path.exists?
|
318
|
-
# end
|
319
|
-
|
320
|
-
# nil
|
321
|
-
#end
|
322
|
-
|
323
|
-
#def locate_entity_list_action_template(list, action)
|
324
|
-
|
325
|
-
# if list.respond_to? :dir and Path === list.dir
|
326
|
-
# path = locate_entity_list_action_template_from_resource(list.dir.www.views, list, action)
|
327
|
-
# return path if path and path.exists?
|
328
|
-
# end
|
329
|
-
|
330
|
-
# entity_resources.each do |resource|
|
331
|
-
# path = locate_entity_list_action_template_from_resource(resource, list, action)
|
332
|
-
# return path if path and path.exists?
|
333
|
-
# end
|
334
|
-
|
335
|
-
# entity_resources.each do |resource|
|
336
|
-
# path = locate_entity_list_action_template_from_resource(resource, "Default", action)
|
337
|
-
# return path if path and path.exists?
|
338
|
-
# end
|
339
|
-
|
340
|
-
# raise "Template not found for list #{ action } (#{list.annotation_types * ", "})"
|
341
|
-
#end
|
342
|
-
|
343
|
-
#def find_all_entity_list_action_templates_from_resource(resource, entity)
|
344
|
-
|
345
|
-
# if entity == "Default"
|
346
|
-
# resource.entity_list["Default"].glob("*.haml").sort
|
347
|
-
# else
|
348
|
-
# entity.annotation_types.collect do |annotation|
|
349
|
-
# resource.entity_list[annotation].glob('*.haml')
|
350
|
-
# end.compact.flatten.sort
|
351
|
-
# end
|
352
|
-
#end
|
353
|
-
|
354
|
-
#def find_all_entity_list_action_templates(list, check = false)
|
355
|
-
# paths = []
|
356
|
-
|
357
|
-
# if list.respond_to? :dir and Path === list.dir
|
358
|
-
# paths.concat find_all_entity_list_action_templates_from_resource(list.dir.www.views, list)
|
359
|
-
# end
|
360
|
-
|
361
|
-
# entity_resources.each do |resource|
|
362
|
-
# paths.concat find_all_entity_list_action_templates_from_resource(resource, list)
|
363
|
-
# end
|
364
|
-
|
365
|
-
# entity_resources.each do |resource|
|
366
|
-
# paths.concat find_all_entity_list_action_templates_from_resource(resource, "Default")
|
367
|
-
# end
|
368
|
-
|
369
|
-
# if check
|
370
|
-
# paths = paths.reject do |path|
|
371
|
-
# (path.basename == "edit.haml" or path.basename == 'new.haml')
|
372
|
-
# end
|
373
|
-
# end
|
374
|
-
|
375
|
-
# actions = paths.collect{|file| file.basename.sub('.haml', '') }.uniq
|
376
|
-
|
377
|
-
# actions.select! do |action|
|
378
|
-
# begin
|
379
|
-
# locate_entity_list_action_template(list, action)
|
380
|
-
# rescue Exception
|
381
|
-
# false
|
382
|
-
# end
|
383
|
-
# end if check
|
384
|
-
#
|
385
|
-
# actions
|
386
|
-
#end
|
387
|
-
|
388
143
|
def locate_entity_list_action_template(list, action)
|
389
144
|
resources = resources_for_entity(list)
|
390
145
|
|
@@ -434,38 +189,8 @@ module EntityRESTHelpers
|
|
434
189
|
actions
|
435
190
|
end
|
436
191
|
|
437
|
-
#{{{ ENTITY MAP
|
438
|
-
|
439
|
-
#def locate_entity_map_template_from_resource(resource, type)
|
440
|
-
# if type == "Default"
|
441
|
-
# path = resource.entity_map["Default.haml"]
|
442
|
-
# if path.exists?
|
443
|
-
# return path
|
444
|
-
# else
|
445
|
-
# return nil
|
446
|
-
# end
|
447
|
-
# end
|
448
|
-
|
449
|
-
# path = resource.entity_map[type.to_s + ".haml"]
|
450
|
-
# return path if path.exists?
|
451
|
-
|
452
|
-
# nil
|
453
|
-
#end
|
454
|
-
|
455
|
-
#def locate_entity_map_template(type, column)
|
456
|
-
# entity_resources.each do |resource|
|
457
|
-
# path = locate_entity_map_template_from_resource(resource, type)
|
458
|
-
# return path if path and path.exists?
|
459
|
-
# end
|
460
|
-
|
461
|
-
# entity_resources.each do |resource|
|
462
|
-
# path = locate_entity_map_template_from_resource(resource, "Default")
|
463
|
-
# return path if path and path.exists?
|
464
|
-
# end
|
465
|
-
|
466
|
-
# raise "Template not found for list (#{type}--#{column})"
|
467
|
-
#end
|
468
192
|
|
193
|
+
#{{{ ENTITY MAP
|
469
194
|
|
470
195
|
def locate_entity_map_template(type, column = nil)
|
471
196
|
resources = entity_resources
|
@@ -483,81 +208,6 @@ module EntityRESTHelpers
|
|
483
208
|
path
|
484
209
|
end
|
485
210
|
|
486
|
-
|
487
|
-
#{{{ ENTITY MAP ACTION
|
488
|
-
|
489
|
-
#def locate_entity_map_action_template_from_resource(resource, map, action)
|
490
|
-
# field = map.key_field
|
491
|
-
|
492
|
-
# if map.entity_templates[field]
|
493
|
-
# annotation_types = map.entity_templates[field].annotation_types
|
494
|
-
# else
|
495
|
-
# annotation_types = [Entity.formats[field]].compact
|
496
|
-
# end
|
497
|
-
|
498
|
-
# annotation_types += ["Default"]
|
499
|
-
|
500
|
-
# annotation_types.each do |annotation|
|
501
|
-
# path = resource.entity_map[annotation][action.to_s + ".haml"]
|
502
|
-
# raise "This action was rejected: #{ action }" if path and reject_template(path,binding)
|
503
|
-
# return path if path.exists?
|
504
|
-
# end
|
505
|
-
|
506
|
-
# nil
|
507
|
-
#end
|
508
|
-
|
509
|
-
#def locate_entity_map_action_template(map, action)
|
510
|
-
|
511
|
-
# entity_resources.each do |resource|
|
512
|
-
# path = locate_entity_map_action_template_from_resource(resource, map, action)
|
513
|
-
# return path if path and path.exists?
|
514
|
-
# end
|
515
|
-
|
516
|
-
# raise "Template not found for map #{ action } (#{map.key_field * ", "})"
|
517
|
-
#end
|
518
|
-
|
519
|
-
#def find_all_entity_map_action_templates_from_resource(resource, map)
|
520
|
-
# field = map.key_field
|
521
|
-
|
522
|
-
# if map.entity_templates[field]
|
523
|
-
# annotation_types = map.entity_templates[field].annotation_types
|
524
|
-
# else
|
525
|
-
# annotation_types = [Entity.formats[field]].compact
|
526
|
-
# end
|
527
|
-
|
528
|
-
# annotation_types += ["Default"]
|
529
|
-
|
530
|
-
# annotation_types.collect do |annotation|
|
531
|
-
# resource.entity_map[annotation].glob('*.haml')
|
532
|
-
# end.compact.flatten
|
533
|
-
#end
|
534
|
-
|
535
|
-
#def find_all_entity_map_action_templates(map, check = false)
|
536
|
-
# paths = []
|
537
|
-
|
538
|
-
# entity_resources.each do |resource|
|
539
|
-
# paths.concat find_all_entity_map_action_templates_from_resource(resource, map)
|
540
|
-
# end
|
541
|
-
|
542
|
-
# if check
|
543
|
-
# paths = paths.reject do |path|
|
544
|
-
# (path.basename == "edit.haml" or path.basename == 'new.haml')
|
545
|
-
# end
|
546
|
-
# end
|
547
|
-
|
548
|
-
# actions = paths.collect{|file| file.basename.sub('.haml', '') }.uniq
|
549
|
-
|
550
|
-
# actions.select! do |action|
|
551
|
-
# begin
|
552
|
-
# locate_entity_map_action_template(map, action)
|
553
|
-
# rescue Exception
|
554
|
-
# false
|
555
|
-
# end
|
556
|
-
# end if check
|
557
|
-
#
|
558
|
-
# actions
|
559
|
-
#end
|
560
|
-
|
561
211
|
def locate_entity_map_action_template(map, action)
|
562
212
|
resources = entity_resources
|
563
213
|
|