andy_rails_toolbox 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -35
- data/app/helpers/bootstrap_helper.rb +124 -141
- data/app/helpers/qrcode_helper.rb +10 -10
- data/app/helpers/timeago_helper.rb +8 -3
- data/lib/andy_rails_toolbox/version.rb +1 -1
- metadata +60 -5
- data/app/helpers/hash_helper.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 290b2eef6daf36498d9d7bb54ec8c3667ac23454
|
4
|
+
data.tar.gz: c3ead3f7c84415d4ccac7f4bcb020defeb8213f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 619d0caa1528cee00e98b1fba0af73026aecb296e414145444e22ed01168b6334ebff3729bba87c31a62eac8a4eef35560d1bd1de64b413625d10f17f7d4884c
|
7
|
+
data.tar.gz: 7c62f301586d085391ce8cc6e2733a437a6cc1446a0a3dc17d243d313240e756555ea71e7a4b14d8a45ff9d31494ea746281ac8b71bd2a6f463a82a3b17d55d1
|
data/README.md
CHANGED
@@ -47,24 +47,30 @@ bs_icon 'user'
|
|
47
47
|
BUTTONS
|
48
48
|
|
49
49
|
``` ruby
|
50
|
-
|
50
|
+
link_button 'link_label', '/'
|
51
|
+
# => <a class="btn btn-default" href="/">link_label</a>
|
52
|
+
link_button 'link_label', '/', color: 'primary'
|
53
|
+
# => <a class="btn btn-primary" href="/">link_label</a>
|
54
|
+
link_button 'link_label', '/', size: 'sm'
|
55
|
+
# => <a class="btn btn-default btn-sm" href="/">link_label</a>
|
56
|
+
link_button 'link_label', '/', block: true
|
57
|
+
# => <a class="btn btn-default btn-block" href="/">link_label</a>
|
58
|
+
link_button 'link_label', '/', active: true
|
59
|
+
# => <a class="btn btn-default active" href="/">link_label</a>
|
60
|
+
link_button 'link_label', '/', disabled: true
|
61
|
+
# => <a class="btn btn-default disabled" href="/">link_label</a>
|
62
|
+
link_button 'link-button', '/', class: 'preset-class'
|
63
|
+
# => <a class="btn btn-default preset-class" href="/">link_label</a>
|
64
|
+
link_button 'link-button', '/', label_hidden: 'xs'
|
65
|
+
# => <a class="btn btn-default" href="/"><span class="hidden-xs">link_label</span></a>
|
66
|
+
link_button 'link_label', '/', icon: 'user'
|
67
|
+
# => <a class="btn btn-default" href="/"><i class="fa fa-user"></i> link_label</a>
|
68
|
+
button 'button'
|
51
69
|
# => <button name="button" type="button" class="btn btn-default">button</button>
|
52
|
-
html_button 'button', color: 'primary'
|
53
|
-
# => <button name="button" type="button" class="btn btn-primary">button</button>
|
54
|
-
html_button 'button', size: 'sm'
|
55
|
-
# => <button name="button" type="button" class="btn btn-default btn-sm">button</button>
|
56
|
-
html_button 'button', block: true
|
57
|
-
# => <button name="button" type="button" class="btn btn-default btn-block">button</button>
|
58
|
-
html_button 'button', icon: 'user'
|
59
|
-
# => <button name="button" type="button" class="btn btn-default"><i class="fa fa-user"></i> button</button>
|
60
|
-
html_button 'button', active: true
|
61
|
-
# => <button name="button" type="button" class="btn btn-default active">button</button>
|
62
70
|
submit_button 'submit'
|
63
71
|
# => <button name="submit" type="submit" class="btn btn-primary"><i class="fa fa-check"></i> submit</button>
|
64
72
|
reset_button 'reset'
|
65
73
|
# => <button name="reset" type="reset" class="btn btn-default"><i class="fa fa-eraser"></i> reset</button>
|
66
|
-
link_button 'link', '/'
|
67
|
-
# => <a class="btn btn-default" href="/">link</a>
|
68
74
|
```
|
69
75
|
|
70
76
|
IMAGES
|
@@ -155,28 +161,6 @@ fa_icon "user 4x"
|
|
155
161
|
# => <i class="fa fa-user fa-4x"></i>
|
156
162
|
```
|
157
163
|
|
158
|
-
#### HashHelper Examples
|
159
|
-
|
160
|
-
``` ruby
|
161
|
-
options = { a: '1', b: '2', c: '3' }
|
162
|
-
|
163
|
-
get_value :a, options
|
164
|
-
# => '1'
|
165
|
-
get_value :d, options
|
166
|
-
# => nil
|
167
|
-
get_value :d, options, '4'
|
168
|
-
# => '4'
|
169
|
-
|
170
|
-
pop_value :a, options
|
171
|
-
# => '1'
|
172
|
-
# options = { b: '2', c: '3' }
|
173
|
-
pop_value :d, options
|
174
|
-
# => nil
|
175
|
-
pop_value :d, options, '4'
|
176
|
-
# => '4'
|
177
|
-
# options = { a: '1', b: '2', c: '3' }
|
178
|
-
```
|
179
|
-
|
180
164
|
#### TimeagoHelper
|
181
165
|
|
182
166
|
Add below codes to file `app/assets/javascripts/application.js`
|
@@ -6,13 +6,13 @@ module BootstrapHelper
|
|
6
6
|
|
7
7
|
# Generates an icon.
|
8
8
|
def bs_icon(icon, html_options = {})
|
9
|
-
html_options = html_options.
|
9
|
+
html_options = html_options.symbolize_keys
|
10
10
|
classes = ['glyphicon']
|
11
11
|
classes << "glyphicon-#{icon}"
|
12
|
-
if
|
13
|
-
classes <<
|
12
|
+
if html_options[:class]
|
13
|
+
classes << html_options[:class]
|
14
14
|
end
|
15
|
-
html_options[
|
15
|
+
html_options[:class] = classes * ' '
|
16
16
|
|
17
17
|
content_tag(:span, nil, html_options)
|
18
18
|
end
|
@@ -26,76 +26,70 @@ module BootstrapHelper
|
|
26
26
|
html_options, options, label = options, label, capture(&block) if block_given?
|
27
27
|
|
28
28
|
html_options ||= {}
|
29
|
-
html_options = html_options.
|
29
|
+
html_options = html_options.symbolize_keys
|
30
30
|
html_options = normalize_button_options_for_bootstrap(html_options)
|
31
31
|
|
32
|
-
if (label_hidden = html_options.delete(
|
32
|
+
if (label_hidden = html_options.delete(:label_hidden)) && !block_given?
|
33
33
|
label = content_tag :span, label, class: "hidden-#{label_hidden}"
|
34
34
|
end
|
35
35
|
|
36
|
-
if (icon = html_options.delete(
|
36
|
+
if (icon = html_options.delete(:icon)) && !block_given?
|
37
37
|
label = fa_icon(icon, text: label)
|
38
38
|
end
|
39
39
|
|
40
|
-
if html_options[
|
41
|
-
html_options['data-confirm'] = html_options.delete(
|
40
|
+
if html_options[:confirm]
|
41
|
+
html_options[:'data-confirm'] = html_options.delete(:confirm)
|
42
42
|
end
|
43
43
|
|
44
|
-
if html_options[
|
45
|
-
html_options['data-disable-with'] = html_options.delete(
|
44
|
+
if html_options[:disable_with]
|
45
|
+
html_options[:'data-disable-with'] = html_options.delete(:disable_with)
|
46
46
|
end
|
47
47
|
|
48
48
|
link_to(label, options, html_options)
|
49
49
|
end
|
50
50
|
|
51
|
-
def new_button(label = nil, options = nil, html_options =
|
51
|
+
def new_button(label = nil, options = nil, html_options = {})
|
52
52
|
button_options = { icon: 'plus', color: 'primary' }
|
53
|
-
html_options ||= {}
|
54
53
|
html_options.update button_options
|
55
54
|
|
56
55
|
link_button(label, options, html_options)
|
57
56
|
end
|
58
57
|
|
59
58
|
# Generates a link show button.
|
60
|
-
def show_button(label = nil, options = nil, html_options =
|
59
|
+
def show_button(label = nil, options = nil, html_options = {})
|
61
60
|
button_options = { icon: 'search', color: 'info' }
|
62
|
-
html_options ||= {}
|
63
61
|
html_options.update button_options
|
64
62
|
|
65
63
|
link_button(label, options, html_options)
|
66
64
|
end
|
67
65
|
|
68
66
|
# Generates a link edit button.
|
69
|
-
def edit_button(label = nil, options = nil, html_options =
|
67
|
+
def edit_button(label = nil, options = nil, html_options = {})
|
70
68
|
button_options = { icon: 'edit', color: 'warning' }
|
71
|
-
html_options ||= {}
|
72
69
|
html_options.update button_options
|
73
70
|
|
74
71
|
link_button(label, options, html_options)
|
75
72
|
end
|
76
73
|
|
77
74
|
# Generates a link destroy button.
|
78
|
-
def destroy_button(label = nil, options = nil, html_options =
|
75
|
+
def destroy_button(label = nil, options = nil, html_options = {})
|
79
76
|
button_options = { icon: 'trash', color: 'danger', method: :delete, confirm: 'Are you sure?' }
|
80
|
-
html_options ||= {}
|
81
77
|
html_options.update button_options
|
82
78
|
|
83
79
|
link_button(label, options, html_options)
|
84
80
|
end
|
85
81
|
|
86
82
|
# Generates a link back button.
|
87
|
-
def back_button(label = nil, options = nil, html_options =
|
83
|
+
def back_button(label = nil, options = nil, html_options = {})
|
88
84
|
button_options = { icon: 'reply' }
|
89
|
-
html_options ||= {}
|
90
85
|
html_options.update button_options
|
91
86
|
|
92
87
|
link_button(label, options, html_options)
|
93
88
|
end
|
94
89
|
|
95
90
|
# Generates a link cancel button.
|
96
|
-
def cancel_button(label = nil, options = nil, html_options =
|
91
|
+
def cancel_button(label = nil, options = nil, html_options = {})
|
97
92
|
button_options = { icon: 'ban' }
|
98
|
-
html_options ||= {}
|
99
93
|
html_options.update button_options
|
100
94
|
|
101
95
|
link_button(label, options, html_options)
|
@@ -110,43 +104,41 @@ module BootstrapHelper
|
|
110
104
|
html_options, label = label, capture(&block) if block_given?
|
111
105
|
|
112
106
|
html_options ||= {}
|
113
|
-
html_options = html_options.
|
107
|
+
html_options = html_options.symbolize_keys
|
114
108
|
html_options = normalize_button_options_for_bootstrap(html_options, :button)
|
115
109
|
|
116
|
-
html_options[
|
110
|
+
html_options[:type] ||= 'button'
|
117
111
|
|
118
|
-
if (label_hidden = html_options.delete(
|
112
|
+
if (label_hidden = html_options.delete(:label_hidden)) && !block_given?
|
119
113
|
label = content_tag :span, label, class: "hidden-#{label_hidden}"
|
120
114
|
end
|
121
115
|
|
122
|
-
if (icon = html_options.delete(
|
116
|
+
if (icon = html_options.delete(:icon)) && !block_given?
|
123
117
|
label = fa_icon(icon, text: label)
|
124
118
|
end
|
125
119
|
|
126
|
-
if html_options[
|
127
|
-
html_options['data-confirm'] = html_options.delete(
|
120
|
+
if html_options[:confirm]
|
121
|
+
html_options[:'data-confirm'] = html_options.delete(:confirm)
|
128
122
|
end
|
129
123
|
|
130
|
-
if html_options[
|
131
|
-
html_options['data-disable-with'] = html_options.delete(
|
124
|
+
if html_options[:disable_with]
|
125
|
+
html_options[:'data-disable-with'] = html_options.delete(:disable_with)
|
132
126
|
end
|
133
127
|
|
134
128
|
button_tag(label, html_options)
|
135
129
|
end
|
136
130
|
|
137
131
|
# Generates a submit button.
|
138
|
-
def submit_button(label = nil, html_options =
|
132
|
+
def submit_button(label = nil, html_options = {})
|
139
133
|
button_options = { icon: 'check', color: 'primary', name: 'submit', type: 'submit' }
|
140
|
-
html_options ||= {}
|
141
134
|
html_options.update button_options
|
142
135
|
|
143
136
|
button(label, html_options)
|
144
137
|
end
|
145
138
|
|
146
139
|
# Generates a reset button.
|
147
|
-
def reset_button(label = nil, html_options =
|
140
|
+
def reset_button(label = nil, html_options = {})
|
148
141
|
button_options = { icon: 'eraser', name: 'reset', type: 'reset' }
|
149
|
-
html_options ||= {}
|
150
142
|
html_options.update button_options
|
151
143
|
|
152
144
|
button(label, html_options)
|
@@ -157,134 +149,125 @@ module BootstrapHelper
|
|
157
149
|
# ---------- #
|
158
150
|
|
159
151
|
# Generates a responsive-friendly image tag
|
160
|
-
def image_responsive(source,
|
161
|
-
|
162
|
-
image_tag source, options
|
163
|
-
end
|
152
|
+
def image_responsive(source, html_options = {})
|
153
|
+
html_options = html_options.symbolize_keys
|
164
154
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
end
|
155
|
+
classes = ['img-responsive']
|
156
|
+
if html_options[:class]
|
157
|
+
classes << html_options[:class]
|
158
|
+
end
|
170
159
|
|
171
|
-
|
172
|
-
def image_circle(source, options = {})
|
173
|
-
add_css_class 'img-circle', options
|
174
|
-
image_tag source, options
|
175
|
-
end
|
160
|
+
html_options[:class] = classes * ' '
|
176
161
|
|
177
|
-
|
178
|
-
def image_thumbnail(source, options = {})
|
179
|
-
add_css_class 'img-thumbnail', options
|
180
|
-
image_tag source, options
|
162
|
+
image_tag(source, html_options)
|
181
163
|
end
|
182
164
|
|
183
|
-
#
|
184
|
-
|
185
|
-
|
165
|
+
# Generates an image tag with rounded corners.
|
166
|
+
def image_rounded(source, html_options = {})
|
167
|
+
html_options = html_options.symbolize_keys
|
186
168
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
options = content_or_options_with_block if content_or_options_with_block.is_a? Hash
|
191
|
-
normalize_typography_options(options) if options
|
192
|
-
content_tag_string name, capture(&block), options, escape
|
193
|
-
else
|
194
|
-
normalize_typography_options(options) if options
|
195
|
-
content_tag_string name, content_or_options_with_block, options, escape
|
169
|
+
classes = ['img-rounded']
|
170
|
+
if html_options[:class]
|
171
|
+
classes << html_options[:class]
|
196
172
|
end
|
173
|
+
|
174
|
+
html_options[:class] = classes * ' '
|
175
|
+
|
176
|
+
image_tag(source, html_options)
|
197
177
|
end
|
198
178
|
|
199
|
-
|
179
|
+
# Generates an image tag with circle.
|
180
|
+
def image_circle(source, html_options = {})
|
181
|
+
html_options = html_options.symbolize_keys
|
200
182
|
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
classes << "btn-#{color}"
|
205
|
-
else
|
206
|
-
classes << 'btn-default'
|
207
|
-
end
|
208
|
-
if size = html_options.delete('size')
|
209
|
-
classes << "btn-#{size}"
|
210
|
-
end
|
211
|
-
if block = html_options.delete('block')
|
212
|
-
classes << 'btn-block'
|
213
|
-
end
|
214
|
-
if active = html_options.delete('active')
|
215
|
-
classes << 'active'
|
216
|
-
end
|
217
|
-
if type == :link && html_options['disabled']
|
218
|
-
html_options.delete('disabled')
|
219
|
-
classes << 'disabled'
|
220
|
-
end
|
221
|
-
if preset_class = html_options.delete('class')
|
222
|
-
classes << preset_class
|
183
|
+
classes = ['img-circle']
|
184
|
+
if html_options[:class]
|
185
|
+
classes << html_options[:class]
|
223
186
|
end
|
224
187
|
|
225
|
-
html_options[
|
226
|
-
|
188
|
+
html_options[:class] = classes * ' '
|
189
|
+
|
190
|
+
image_tag(source, html_options)
|
227
191
|
end
|
228
192
|
|
229
|
-
#
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
class_names = class_names.split if class_names.is_a? String
|
237
|
-
if symbolize_keys(options).key? :class
|
238
|
-
options_class_names = options[:class].split
|
239
|
-
class_names.each do |value|
|
240
|
-
options_class_names << %(#{value.strip}) unless options_class_names.include? value
|
241
|
-
end
|
242
|
-
class_names = options_class_names
|
193
|
+
# Generates an image tag within thumbnail.
|
194
|
+
def image_thumbnail(source, html_options = {})
|
195
|
+
html_options = html_options.symbolize_keys
|
196
|
+
|
197
|
+
classes = ['img-thumbnail']
|
198
|
+
if html_options[:class]
|
199
|
+
classes << html_options[:class]
|
243
200
|
end
|
244
|
-
options[:class] = %(#{class_names * ' '})
|
245
|
-
end
|
246
201
|
|
247
|
-
|
248
|
-
def add_pull_class(options)
|
249
|
-
pull = pop_value :pull, options
|
250
|
-
add_css_class(%(pull-#{pull}), options) if pull
|
251
|
-
end
|
202
|
+
html_options[:class] = classes * ' '
|
252
203
|
|
253
|
-
|
254
|
-
def add_align_class(options)
|
255
|
-
align = pop_value :align, options
|
256
|
-
add_css_class(%(text-#{align}), options) if align
|
204
|
+
image_tag(source, html_options)
|
257
205
|
end
|
258
206
|
|
259
|
-
#
|
260
|
-
|
261
|
-
|
262
|
-
add_css_class(%(text-#{transform}), options) if transform
|
263
|
-
end
|
207
|
+
# ------------ #
|
208
|
+
# - OVERRIDE - #
|
209
|
+
# ------------ #
|
264
210
|
|
265
|
-
|
266
|
-
|
267
|
-
color = pop_value :color, options
|
268
|
-
add_css_class(%(text-#{color}), options) if color
|
269
|
-
end
|
211
|
+
def content_tag(name, content = nil, options = nil, escape = true, &block)
|
212
|
+
options, content = content, capture(&block) if block_given?
|
270
213
|
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
add_css_class(%(bg-#{bgcolor}), options) if bgcolor
|
275
|
-
end
|
214
|
+
options ||= {}
|
215
|
+
options = options.symbolize_keys
|
216
|
+
options = normalize_options_for_typography(options)
|
276
217
|
|
277
|
-
|
278
|
-
def add_active_class(options)
|
279
|
-
active = pop_value :active, options
|
280
|
-
add_css_class('active', options) if active
|
218
|
+
content_tag_string(name, content, options, escape)
|
281
219
|
end
|
282
220
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
221
|
+
private
|
222
|
+
|
223
|
+
def normalize_button_options_for_bootstrap(html_options = {}, type = :link)
|
224
|
+
classes = ['btn']
|
225
|
+
if color = html_options.delete(:color) { 'default' }
|
226
|
+
classes << "btn-#{color}"
|
227
|
+
end
|
228
|
+
if size = html_options.delete(:size)
|
229
|
+
classes << "btn-#{size}"
|
230
|
+
end
|
231
|
+
if block = html_options.delete(:block)
|
232
|
+
classes << 'btn-block'
|
233
|
+
end
|
234
|
+
if active = html_options.delete(:active)
|
235
|
+
classes << 'active'
|
236
|
+
end
|
237
|
+
if type == :link && html_options[:disabled]
|
238
|
+
html_options.delete(:disabled)
|
239
|
+
classes << 'disabled'
|
240
|
+
end
|
241
|
+
if html_options[:class]
|
242
|
+
classes << html_options[:class]
|
243
|
+
end
|
244
|
+
|
245
|
+
html_options[:class] = classes * ' '
|
246
|
+
html_options
|
247
|
+
end
|
248
|
+
|
249
|
+
def normalize_options_for_typography(html_options = {})
|
250
|
+
classes = []
|
251
|
+
if pull = html_options.delete(:pull)
|
252
|
+
classes << "pull-#{pull}"
|
253
|
+
end
|
254
|
+
if align = html_options.delete(:align)
|
255
|
+
classes << "text-#{align}"
|
256
|
+
end
|
257
|
+
if transform = html_options.delete(:transform)
|
258
|
+
classes << "text-#{transform}"
|
259
|
+
end
|
260
|
+
if color = html_options.delete(:color)
|
261
|
+
classes << "text-#{color}"
|
262
|
+
end
|
263
|
+
if bgcolor = html_options.delete(:bgcolor)
|
264
|
+
classes << "text-#{bgcolor}"
|
265
|
+
end
|
266
|
+
if html_options[:class]
|
267
|
+
classes << html_options[:class]
|
268
|
+
end
|
269
|
+
|
270
|
+
html_options[:class] = classes * ' '
|
271
|
+
html_options
|
272
|
+
end
|
290
273
|
end
|
@@ -1,21 +1,21 @@
|
|
1
1
|
module QrcodeHelper
|
2
2
|
def qrcode(data = '', options = {})
|
3
3
|
# Google API: https://google-developers.appspot.com/chart/infographics/docs/qr_codes
|
4
|
-
width
|
5
|
-
output_encoding
|
6
|
-
error_correction_level =
|
7
|
-
margin
|
4
|
+
width = options.delete(:width) { '200' }
|
5
|
+
output_encoding = options.delete(:output_encoding)
|
6
|
+
error_correction_level = options.delete(:error_correction_level)
|
7
|
+
margin = options.delete(:margin)
|
8
8
|
|
9
9
|
qrcode_url = 'https://chart.googleapis.com/chart?cht=qr'
|
10
10
|
qrcode_url += "&chl=#{data}"
|
11
11
|
qrcode_url += "&chs=#{width}x#{width}"
|
12
|
-
qrcode_url += "&choe=#{output_encoding}"
|
13
|
-
if error_correction_level
|
14
|
-
qrcode_url += "&chld=#{error_correction_level}" unless error_correction_level.nil?
|
15
|
-
qrcode_url += "&chld=|#{margin}" unless margin.nil?
|
16
|
-
else
|
12
|
+
qrcode_url += "&choe=#{output_encoding}" if output_encoding
|
13
|
+
if error_correction_level && margin
|
17
14
|
qrcode_url += "&chld=#{error_correction_level}|#{margin}"
|
15
|
+
else
|
16
|
+
qrcode_url += "&chld=#{error_correction_level}" if error_correction_level
|
17
|
+
qrcode_url += "&chld=|#{margin}" if margin
|
18
18
|
end
|
19
|
-
image_tag
|
19
|
+
image_tag(qrcode_url, alt: data)
|
20
20
|
end
|
21
21
|
end
|
@@ -1,7 +1,12 @@
|
|
1
1
|
module TimeagoHelper
|
2
|
-
def timeago(time,
|
2
|
+
def timeago(time = nil, html_options = {})
|
3
3
|
time = time.to_time if time.is_a? String
|
4
|
-
|
5
|
-
|
4
|
+
classes = ['timeago']
|
5
|
+
if html_options[:class]
|
6
|
+
classes << html_options[:class]
|
7
|
+
end
|
8
|
+
html_options[:class] = classes * ' '
|
9
|
+
html_options[:title] = time.getutc.iso8601
|
10
|
+
content_tag(:abbr, time.try(:to_s), html_options)
|
6
11
|
end
|
7
12
|
end
|
metadata
CHANGED
@@ -1,27 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: andy_rails_toolbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ChouAndy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.3.10
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.3.10
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.2.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.2.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: capybara
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.4
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.4.4
|
13
69
|
- !ruby/object:Gem::Dependency
|
14
70
|
name: bootstrap-sass
|
15
71
|
requirement: !ruby/object:Gem::Requirement
|
16
72
|
requirements:
|
17
|
-
- - "
|
73
|
+
- - ">="
|
18
74
|
- !ruby/object:Gem::Version
|
19
75
|
version: 3.3.4
|
20
76
|
type: :runtime
|
21
77
|
prerelease: false
|
22
78
|
version_requirements: !ruby/object:Gem::Requirement
|
23
79
|
requirements:
|
24
|
-
- - "
|
80
|
+
- - ">="
|
25
81
|
- !ruby/object:Gem::Version
|
26
82
|
version: 3.3.4
|
27
83
|
- !ruby/object:Gem::Dependency
|
@@ -94,7 +150,6 @@ files:
|
|
94
150
|
- app/assets/javascripts/jquery.timeago.load.coffee
|
95
151
|
- app/assets/javascripts/jquery.timeago.zh-TW.js
|
96
152
|
- app/helpers/bootstrap_helper.rb
|
97
|
-
- app/helpers/hash_helper.rb
|
98
153
|
- app/helpers/markdown_helper.rb
|
99
154
|
- app/helpers/qrcode_helper.rb
|
100
155
|
- app/helpers/timeago_helper.rb
|
data/app/helpers/hash_helper.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
module HashHelper
|
2
|
-
|
3
|
-
# -------- #
|
4
|
-
# - Hash - #
|
5
|
-
# -------- #
|
6
|
-
|
7
|
-
# Returns a specific value from the given hash (or the default value if not set).
|
8
|
-
def get_value(key, hash, default_value = nil)
|
9
|
-
value = hash.delete key
|
10
|
-
value = default_value if value.nil? and !default_value.nil?
|
11
|
-
value
|
12
|
-
end
|
13
|
-
|
14
|
-
# Removes and returns a specific value from the given hash (or the default value if not set).
|
15
|
-
def pop_value(key, hash, default_value = nil)
|
16
|
-
symbolize_keys hash unless hash.empty?
|
17
|
-
get_value key.to_sym, hash, default_value
|
18
|
-
end
|
19
|
-
|
20
|
-
# all keys of the given hash symbolize.
|
21
|
-
def symbolize_keys(hash)
|
22
|
-
result = {}
|
23
|
-
hash.each { |key, value| result[key.to_sym] = value }
|
24
|
-
hash.replace result
|
25
|
-
end
|
26
|
-
end
|