rbbt-rest 1.7.14 → 1.7.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rbbt/rest/common/misc.rb +8 -1
- data/lib/rbbt/rest/common/render.rb +16 -6
- data/lib/rbbt/rest/knowledge_base.rb +3 -0
- data/lib/rbbt/rest/main.rb +1 -1
- data/share/views/partials/table.haml +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7bb233c1577c8a190d0bcdacd86f8014620de6f
|
4
|
+
data.tar.gz: 6989d8b3be1b51a817022fa35ee2f8124ff5dc87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9963a51751edb4971bd7c87309010299f7f1f449c4e5a29bec3cf59e402919816ed648dd84fae44d779e204924c2e8eeea01c3f33f472c7f507e746417909a96
|
7
|
+
data.tar.gz: 6e0a31491b8046ca5e2dc34b799772a88c9547592c66627fe1c076bc30a66aeffb654d77b3ccc941ef13fcf02809e020189f447cbd167760288ee7d8d2240eb1
|
@@ -222,7 +222,14 @@ module RbbtRESTHelpers
|
|
222
222
|
end
|
223
223
|
|
224
224
|
def remove_GET_param(url, param)
|
225
|
-
|
225
|
+
if Array === param
|
226
|
+
param.each do |p|
|
227
|
+
url = remove_GET_param(url, p)
|
228
|
+
end
|
229
|
+
url
|
230
|
+
else
|
231
|
+
url.gsub(/&?#{param}=[^&]+/,'').sub(/\?$/, '')
|
232
|
+
end
|
226
233
|
end
|
227
234
|
|
228
235
|
def add_GET_param(url, param, value)
|
@@ -174,27 +174,37 @@ module RbbtRESTHelpers
|
|
174
174
|
text ||= filename
|
175
175
|
|
176
176
|
filename = Misc.sanitize_filename(filename)
|
177
|
-
|
177
|
+
|
178
|
+
if @step
|
179
|
+
url = add_GET_param(remove_GET_param(@fullpath, ["_update", "_"]), "_fragment", "html_resources/#{ filename }")
|
180
|
+
f = @step.file(:html_resources)[filename].find
|
181
|
+
else
|
182
|
+
url = "/files/#{ filename }"
|
183
|
+
f = settings.file_dir[filename].find
|
184
|
+
end
|
185
|
+
|
178
186
|
FileUtils.mkdir_p(File.dirname(f))
|
187
|
+
|
179
188
|
yield(f)
|
180
189
|
|
190
|
+
|
181
191
|
type ||= :link
|
182
192
|
case type
|
183
193
|
when :image
|
184
|
-
"<img src='
|
194
|
+
"<img src='#{url}' alt='#{text}' class='file_resource'/>"
|
185
195
|
when :link
|
186
|
-
"<a href='
|
196
|
+
"<a href='#{url}' class='file_resource'>#{ text }</a>"
|
187
197
|
when :linked_image
|
188
|
-
"<a href='
|
198
|
+
"<a href='#{url}' class='file_resource' target='_blank'><img src='#{url}' class='file_resource'/></a>"
|
189
199
|
when :zoomable_image
|
190
200
|
id = options[:id] || Misc.digest(filename)
|
191
201
|
width, height= [600, 600]
|
192
|
-
"<div class='zoomable_image'><img id='#{id}' style='width:#{width}px; height:#{height}px' rel='
|
202
|
+
"<div class='zoomable_image'><img id='#{id}' style='width:#{width}px; height:#{height}px' rel='#{url}' src='#{url}' class='file_resource'/></div>"
|
193
203
|
when :mapped_image
|
194
204
|
mapid = options[:mapid] || options[:id] + '_map'
|
195
205
|
width, height= [300, 300]
|
196
206
|
mapfile = f.sub(/\.[^.]+$/, '.html')
|
197
|
-
"<div class='mapped_image'>#{Open.read(mapfile)}<img class='has_map' usemap='##{mapid}' rel='
|
207
|
+
"<div class='mapped_image'>#{Open.read(mapfile)}<img class='has_map' usemap='##{mapid}' rel='#{url}' src='#{url}' class='file_resource'/></div>"
|
198
208
|
else
|
199
209
|
raise "Type not understood: #{ type }"
|
200
210
|
end
|
@@ -7,11 +7,14 @@ require 'rbbt/rest/knowledge_base/query'
|
|
7
7
|
require 'rbbt/rest/knowledge_base/helpers'
|
8
8
|
require 'rbbt/rest/knowledge_base/locate'
|
9
9
|
require 'rbbt/rest/knowledge_base/render'
|
10
|
+
require "sinatra/multi_route"
|
10
11
|
|
11
12
|
module Sinatra
|
12
13
|
module RbbtRESTKnowledgeBase
|
13
14
|
def self.registered(base)
|
14
15
|
base.module_eval do
|
16
|
+
register Sinatra::MultiRoute
|
17
|
+
|
15
18
|
include RbbtRESTHelpers
|
16
19
|
include KnowledgeBaseRESTHelpers
|
17
20
|
|
data/lib/rbbt/rest/main.rb
CHANGED
@@ -50,9 +50,9 @@
|
|
50
50
|
- field = header ? header[i] : nil
|
51
51
|
- val = table_value(value, field, :list_id => list_id, :unnamed => unnamed, :entity_options => entity_options, :span => span)
|
52
52
|
- case val.to_s
|
53
|
-
- when 'true'
|
53
|
+
- when 'true', 'Yes', 'yes'
|
54
54
|
%td.true= val.to_s
|
55
|
-
- when 'false'
|
55
|
+
- when 'false', 'No', 'no'
|
56
56
|
%td.false= val.to_s
|
57
57
|
- else
|
58
58
|
%td= Float === val ? "%.5g" % val : val.to_s
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbbt-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Vazquez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|