snails 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snails/app.rb +6 -7
- data/snails.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12edd5e69eff773039b1dd01d6bc48b1fa74caaa5d9e3cf6dadf9a8fc0040b22
|
4
|
+
data.tar.gz: b635cf9923574edd45ba1cca32d824c14c68232f2bfa44dc2c53e6978422c25b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '098f1a014fcb9cbe63151b57b3341e6f030006c4463ca6dc31ae0276542bb14b9c54c7ed573d07ec5d91517f70101f75c1fb901092b2dca52f9f9554cb8402e2'
|
7
|
+
data.tar.gz: 5e0c8475560c72e0be2ed81faab31ed3f3b524ed90ea838503fec1af5631f8ae4d3a11ffa0829d8637cc0dce9657fd608a458df29d7c0af1f200cbfc964350bd
|
data/lib/snails/app.rb
CHANGED
@@ -219,7 +219,7 @@ module Snails
|
|
219
219
|
def form_input(object, field, options = {})
|
220
220
|
id, name, index, label = input_base(object, field, options)
|
221
221
|
type = (options[:type] || :text).to_sym
|
222
|
-
value = options[:value] ? "value
|
222
|
+
value = options[:value] ? "value=\"#{options[:value]}\"" : (type == :password ? '' : "value=\"#{object.send(field)}\"")
|
223
223
|
|
224
224
|
classes = object.errors[field].any? ? 'has-errors' : ''
|
225
225
|
label + raw_input(index, type, id, name, value, options[:placeholder], classes, options[:required])
|
@@ -263,12 +263,12 @@ module Snails
|
|
263
263
|
list.map do |name, val|
|
264
264
|
val = name if val.nil?
|
265
265
|
sel = val == selected ? 'selected="selected"' : ''
|
266
|
-
"<option #{sel} value
|
266
|
+
"<option #{sel} value=\"#{val}\">#{name}</option>"
|
267
267
|
end.join("\n")
|
268
268
|
end
|
269
269
|
|
270
270
|
def form_put
|
271
|
-
|
271
|
+
"<input type='hidden' name='_method' value='put' />"
|
272
272
|
end
|
273
273
|
|
274
274
|
def form_submit(text = 'Actualizar', classes = '')
|
@@ -364,13 +364,12 @@ module Snails
|
|
364
364
|
i == 0 ? "" : "/page/#{i}"
|
365
365
|
end
|
366
366
|
|
367
|
-
def show_pager(array, path)
|
367
|
+
def show_pager(array, path, per_page = 30)
|
368
368
|
# remove page from path
|
369
369
|
path = (env['SCRIPT_NAME'] + path.gsub(/[?|&|\/]page[=|\/]\d+/,''))
|
370
370
|
|
371
|
-
prevlink =
|
372
|
-
nextlink = array.
|
373
|
-
: '<li>' + link_to("#{path}#{get_page(1)}", 'Next →').sub('//', '/') + '</li>'
|
371
|
+
prevlink = "<li><a href='#{path}#{get_page(-1).sub('//', '/')}'>← Prev</li>"
|
372
|
+
nextlink = array.size != per_page ? "" : "<li><a href='#{path}#{get_page(1).sub('//', '/')}'>Next →</li>"
|
374
373
|
|
375
374
|
str = params[:page] ? prevlink + nextlink : nextlink
|
376
375
|
str != "" ? "<ul class='pager'>" + str + "</ul>" : ''
|
data/snails.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomás Pollak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|