snails 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/snails/app.rb +6 -7
  3. data/snails.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb34f055ffb3271aa618cfbcbc43d6ac26420eaa4d62a52a3b376273077e3494
4
- data.tar.gz: 6ccc14794628cd117f786d6cc7f7f5493be4c4171d053224fa88e33fd789b323
3
+ metadata.gz: 12edd5e69eff773039b1dd01d6bc48b1fa74caaa5d9e3cf6dadf9a8fc0040b22
4
+ data.tar.gz: b635cf9923574edd45ba1cca32d824c14c68232f2bfa44dc2c53e6978422c25b
5
5
  SHA512:
6
- metadata.gz: c42fba53e87ee56339c534de02c1724f556d0fb0048cb0fa09553374a68cdd9f626319be7d6c2298699908a7ad8fcb479a451824de06fac16bf13c00dc073c86
7
- data.tar.gz: 561ff5f6f7a5721803ac435e9e7ca2d0696226ee0433b4f55d55593e58be36eee851aee7ef6713b73a85ab3bac786aae3cc36f6e6e0a5a9ec5e2d686fa227c26
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='#{options[:value]}'" : (type == :password ? '' : "value='#{object.send(field)}'")
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='#{val}'>#{name}</option>"
266
+ "<option #{sel} value=\"#{val}\">#{name}</option>"
267
267
  end.join("\n")
268
268
  end
269
269
 
270
270
  def form_put
271
- '<input type="hidden" name="_method" value="put" />'
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 = '<li>' + link_to("#{path}#{get_page(-1)}", '&larr; Prev').sub('//', '/') + '</li>'
372
- nextlink = array.count != Routes::PER_PAGE ? ""
373
- : '<li>' + link_to("#{path}#{get_page(1)}", 'Next &rarr;').sub('//', '/') + '</li>'
371
+ prevlink = "<li><a href='#{path}#{get_page(-1).sub('//', '/')}'>&larr; Prev</li>"
372
+ nextlink = array.size != per_page ? "" : "<li><a href='#{path}#{get_page(1).sub('//', '/')}'>Next &rarr;</li>"
374
373
 
375
374
  str = params[:page] ? prevlink + nextlink : nextlink
376
375
  str != "" ? "<ul class='pager'>" + str + "</ul>" : ''
data/snails.gemspec CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "snails"
6
- s.version = '0.3.1'
6
+ s.version = '0.3.2'
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ['Tomás Pollak']
9
9
  s.email = ['tomas@forkhq.com']
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.1
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-01-29 00:00:00.000000000 Z
11
+ date: 2019-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler