forma 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/forma/action.rb +23 -19
- data/lib/forma/field.rb +7 -2
- data/lib/forma/version.rb +1 -1
- metadata +29 -13
- checksums.yaml +0 -7
data/lib/forma/action.rb
CHANGED
@@ -11,6 +11,7 @@ module Forma
|
|
11
11
|
@label = h[:label]
|
12
12
|
@icon = h[:icon]
|
13
13
|
@url = h[:url]
|
14
|
+
@turbolink=h[:turbolink]
|
14
15
|
@method = h[:method]
|
15
16
|
@confirm = h[:confirm]
|
16
17
|
@as = h[:as]
|
@@ -22,28 +23,31 @@ module Forma
|
|
22
23
|
def to_html(model)
|
23
24
|
if eval_condition(model)
|
24
25
|
if @select
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
26
|
+
attrs = {
|
27
|
+
id: @id,
|
28
|
+
class: ['ff-action', 'btn', 'btn-mini', 'ff-select-action', 'btn-xs', 'btn-default'],
|
29
|
+
href: '#',
|
30
|
+
'data-original-title' => @tooltip,
|
31
|
+
'data-value-id' => model.id,
|
32
|
+
'data-value-type' => model.class.name,
|
33
|
+
'data-value-text' => model.to_s
|
34
|
+
}
|
35
|
+
attrs['data-no-turbolink'] = 'true' if @turbolink == false
|
36
|
+
children = [ el('i', attrs: { class: 'icon icon-download fa fa-hand-o-left' }) ]
|
37
|
+
el('a', attrs: attrs, children: children)
|
34
38
|
else
|
35
39
|
children = [ (el('img', attrs: { src: eval_icon(model) }) if @icon.present?), el('span', text: eval_label(model)) ]
|
36
40
|
button = (@as.to_s == 'button')
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
)
|
41
|
+
attrs = {
|
42
|
+
id: @id,
|
43
|
+
class: ['ff-action', ('btn btn-default' if button)],
|
44
|
+
href: eval_url(model),
|
45
|
+
'data-method' => @method,
|
46
|
+
'data-confirm' => @confirm,
|
47
|
+
'data-original-title' => @tooltip
|
48
|
+
}
|
49
|
+
attrs['data-no-turbolink'] = 'true' if @turbolink == false
|
50
|
+
el('a', attrs: attrs, children: children)
|
47
51
|
end
|
48
52
|
end
|
49
53
|
end
|
data/lib/forma/field.rb
CHANGED
@@ -9,7 +9,7 @@ module Forma
|
|
9
9
|
attr_reader :required, :autofocus, :readonly
|
10
10
|
attr_reader :width, :height
|
11
11
|
attr_reader :before, :after
|
12
|
-
attr_reader :url, :icon
|
12
|
+
attr_reader :url, :icon, :turbolink
|
13
13
|
attr_accessor :model, :value, :parent, :child_model_name
|
14
14
|
attr_writer :model_name
|
15
15
|
attr_reader :actions
|
@@ -30,6 +30,7 @@ module Forma
|
|
30
30
|
@empty = h[:empty]
|
31
31
|
@force_nonempty = h[:force_nonempty]
|
32
32
|
@class = h[:class]
|
33
|
+
@turbolink = h[:turbolink]
|
33
34
|
end
|
34
35
|
|
35
36
|
def action(url, h={})
|
@@ -66,7 +67,11 @@ module Forma
|
|
66
67
|
else
|
67
68
|
if val.present? or val == false or @force_nonempty
|
68
69
|
view = view_element(val)
|
69
|
-
|
70
|
+
if @url
|
71
|
+
attrs = { href: eval_url }
|
72
|
+
attrs['data-no-turbolink']=true if @turbolink==false
|
73
|
+
view = el('a', attrs: attrs, children: [ view ])
|
74
|
+
end
|
70
75
|
el('div', attrs: { class: (@class ? eval_with_model(@class) : nil) },
|
71
76
|
children: [ before_element, icon_element, view, after_element, actions_element, inline_hint_element ])
|
72
77
|
else
|
data/lib/forma/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: forma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Dimitri Kurashvili
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-07-06 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - ~>
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :development
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - ~>
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,20 +30,23 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: rake
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
|
-
- - '>='
|
35
|
+
- - ! '>='
|
32
36
|
- !ruby/object:Gem::Version
|
33
37
|
version: '0'
|
34
38
|
type: :development
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
|
-
- - '>='
|
43
|
+
- - ! '>='
|
39
44
|
- !ruby/object:Gem::Version
|
40
45
|
version: '0'
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rspec
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - ~>
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: therubyracer
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - ~>
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - ~>
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: less
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - ~>
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - ~>
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,29 +94,33 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: railties
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
|
-
- - '>='
|
99
|
+
- - ! '>='
|
88
100
|
- !ruby/object:Gem::Version
|
89
101
|
version: '3.1'
|
90
102
|
type: :runtime
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
|
-
- - '>='
|
107
|
+
- - ! '>='
|
95
108
|
- !ruby/object:Gem::Version
|
96
109
|
version: '3.1'
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: activesupport
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
|
-
- - '>='
|
115
|
+
- - ! '>='
|
102
116
|
- !ruby/object:Gem::Version
|
103
117
|
version: '0'
|
104
118
|
type: :runtime
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
|
-
- - '>='
|
123
|
+
- - ! '>='
|
109
124
|
- !ruby/object:Gem::Version
|
110
125
|
version: '0'
|
111
126
|
description: rich forms for ruby
|
@@ -151,26 +166,27 @@ files:
|
|
151
166
|
homepage: http://github.com/dimakura/forma
|
152
167
|
licenses:
|
153
168
|
- MIT
|
154
|
-
metadata: {}
|
155
169
|
post_install_message:
|
156
170
|
rdoc_options: []
|
157
171
|
require_paths:
|
158
172
|
- lib
|
159
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
174
|
+
none: false
|
160
175
|
requirements:
|
161
|
-
- - '>='
|
176
|
+
- - ! '>='
|
162
177
|
- !ruby/object:Gem::Version
|
163
178
|
version: '0'
|
164
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
165
181
|
requirements:
|
166
|
-
- - '>='
|
182
|
+
- - ! '>='
|
167
183
|
- !ruby/object:Gem::Version
|
168
184
|
version: '0'
|
169
185
|
requirements: []
|
170
186
|
rubyforge_project:
|
171
|
-
rubygems_version:
|
187
|
+
rubygems_version: 1.8.24
|
172
188
|
signing_key:
|
173
|
-
specification_version:
|
189
|
+
specification_version: 3
|
174
190
|
summary: rich forms for ruby
|
175
191
|
test_files:
|
176
192
|
- spec/config_spec.rb
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: db864b2082efde787f42ce9ee0f19be45ba57a49
|
4
|
-
data.tar.gz: 8ef26f83babeadb8dca45ded7aae302e93cb4507
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 6170048156e4fae1a784982d160866c95557df6065de5d8dae718d852f243c2c6d7f7055c6fe409be6e7b6b953013f6651826fde0ff145f686bbf92b4382124a
|
7
|
-
data.tar.gz: 3ee1558ce246526dc4ca98c12b07ed0539aaf15829460a8be82304adc8495911835aa9ef6f801cef1906eac7df579a0f89540c278622cadbe3c616f871724e35
|