args-handler 0.0.1 → 0.0.2
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.
- data/VERSION +1 -1
- data/args-handler.gemspec +2 -2
- data/lib/args-handler.rb +20 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/args-handler.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "args-handler"
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kaspernj"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-05-28"
|
13
13
|
s.description = "A small library to generate HTML for wished arguments form hashes."
|
14
14
|
s.email = "k@spernj.org"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/args-handler.rb
CHANGED
@@ -28,6 +28,8 @@ class ArgsHandler
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
html = html.html_safe if html.respond_to?(:html_safe)
|
32
|
+
|
31
33
|
return html
|
32
34
|
end
|
33
35
|
|
@@ -124,7 +126,7 @@ class ArgsHandler
|
|
124
126
|
attr["disabled"] = "disabled" if args[:disabled]
|
125
127
|
attr["maxlength"] = args[:maxlength] if args.key?(:maxlength)
|
126
128
|
|
127
|
-
raise "No name given to the
|
129
|
+
raise "No name given to the ArgsHandler::input()-method." if !args[:name] and args[:type] != :info and args[:type] != :textshow and args[:type] != :plain and args[:type] != :spacer and args[:type] != :headline
|
128
130
|
|
129
131
|
css = {}
|
130
132
|
css["text-align"] = args[:align] if args.key?(:align)
|
@@ -301,6 +303,8 @@ class ArgsHandler
|
|
301
303
|
end
|
302
304
|
|
303
305
|
html << "<tr#{classes_tr_html}><td colspan=\"2\" class=\"tdd\">#{args[:descr]}</td></tr>" if args[:descr]
|
306
|
+
html = html.html_safe if html.respond_to?(:html_safe)
|
307
|
+
|
304
308
|
return html
|
305
309
|
end
|
306
310
|
|
@@ -359,4 +363,19 @@ class ArgsHandler
|
|
359
363
|
raise "Dont know how to HTML-escape string..."
|
360
364
|
end
|
361
365
|
end
|
366
|
+
|
367
|
+
#Returns the HTML using simle-form.
|
368
|
+
def self.input_sf(args)
|
369
|
+
arg = args[:arg]
|
370
|
+
f = args[:sf]
|
371
|
+
|
372
|
+
input_args = {:label => arg[:title], :id => arg[:id], :value => arg[:value]}
|
373
|
+
|
374
|
+
if arg[:type] == :select
|
375
|
+
input_args[:collection] = args[:opts].collect{ |key, val| [val, key] }
|
376
|
+
input_args[:include_blank] = false
|
377
|
+
end
|
378
|
+
|
379
|
+
return f.input(arg[:name], input_args)
|
380
|
+
end
|
362
381
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: args-handler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- kaspernj
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
segments:
|
143
143
|
- 0
|
144
|
-
hash: -
|
144
|
+
hash: -624555932264670138
|
145
145
|
version: '0'
|
146
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
147
|
none: false
|