asples_sinatra 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fba35e3d005e1e6fc7c5293e885dd21fc3aea70
4
- data.tar.gz: 58baf7bec9be55f934c97a5fb8a10ff80e3ffd0e
3
+ metadata.gz: 7acec41df3af184e9ff065ce3e6a2e64160f1520
4
+ data.tar.gz: 666b7a2a0aeb758595f6578717d762856be857a5
5
5
  SHA512:
6
- metadata.gz: 75e84326bff03ada22a79923e786d59c8e1fdc8006be0d2702163b3f6ac83fb5b4835045ade70545880ae11d08f825d6f3357092557a2d390f0d30075948885b
7
- data.tar.gz: 44875b40c02668890daae52842af7e18b4e41ad1da7fd799cfee934a9c3179dbd7c9cd478c91fc4866eec305f4b8a64cecdb24bbd3602f3bbe3bed62c7b7649f
6
+ metadata.gz: 21f67cc53505d37ea574196359fb1ccf086ad22a44e035d57b718c4d82989ab68ba124c0682d192d92d42b85c6bb80016f7127d2e02e8c444d76574f0a4ae511
7
+ data.tar.gz: 3fa31d7b6c044600e3d675133e76fa38b90fcd69a746f2b46837418bafb6127e132626f6fd29a290b9c5bb03d8a75fb1d021a5bc3743fc53c926e3aa4e9213f2
@@ -1,21 +1,9 @@
1
- enable :inline_templates
2
1
  module AsplesSinatra
3
2
  module Helpers
4
3
  def input(name, options={})
5
- haml :'input', {layout: false}, options.merge!({field_name: name})
4
+ template_path = File.join(File.dirname(File.expand_path(__FILE__)), '/templates/input.haml')
5
+ tmpl = Tilt.new(template_path)
6
+ tmpl.render(self, options.merge!({field_name: name}))
6
7
  end
7
8
  end
8
9
  end
9
-
10
-
11
- __END__
12
-
13
- @@ input
14
- %div{class: "form-group #{object.respond_to?(:errors) && object.errors.has_key?(field_name) && object.errors[field_name].any? && "has-error"}"}
15
- -field_type = defined?(as) && as.present? ? as : :text
16
- -field_label = defined?(label) && label.present? ? label : field_name.to_s.humanize
17
- -field_placeholder = defined?(placeholder) && placeholder.present? ? placeholder : "Enter #{field_name.to_s.humanize.downcase}"
18
- %label.control-label{for: field_name}="#{field_label}:"
19
- %input{type: field_type, name: field_name, class: "form-control", placeholder: field_placeholder, value: object.send(field_name)}
20
- %span.help-block
21
- = object.errors[field_name].join('. ') if object.respond_to?(:errors) && object.errors.has_key?(field_name) && object.errors.any?
@@ -0,0 +1,8 @@
1
+ %div{class: "form-group #{object.respond_to?(:errors) && object.errors.has_key?(field_name) && object.errors[field_name].any? && "has-error"}"}
2
+ -field_type = defined?(as) && as.present? ? as : :text
3
+ -field_label = defined?(label) && label.present? ? label : field_name.to_s.humanize
4
+ -field_placeholder = defined?(placeholder) && placeholder.present? ? placeholder : "Enter #{field_name.to_s.humanize.downcase}"
5
+ %label.control-label{for: field_name}="#{field_label}:"
6
+ %input{type: field_type, name: field_name, class: "form-control", placeholder: field_placeholder, value: object.send(field_name)}
7
+ %span.help-block
8
+ = object.errors[field_name].join('. ') if object.respond_to?(:errors) && object.errors.has_key?(field_name) && object.errors.any?
@@ -1,3 +1,3 @@
1
1
  module AsplesSinatra
2
- VERSION = "0.0.25"
2
+ VERSION = "0.0.26"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asples_sinatra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.25
4
+ version: 0.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Per Evensen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-29 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,6 +105,7 @@ files:
105
105
  - lib/asples_sinatra.rb
106
106
  - lib/asples_sinatra/helpers.rb
107
107
  - lib/asples_sinatra/sinatra.rb
108
+ - lib/asples_sinatra/templates/input.haml
108
109
  - lib/asples_sinatra/version.rb
109
110
  homepage: https://github.com/asplespng/asples_sinatra
110
111
  licenses:
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  version: '0'
127
128
  requirements: []
128
129
  rubyforge_project:
129
- rubygems_version: 2.5.0
130
+ rubygems_version: 2.5.1
130
131
  signing_key:
131
132
  specification_version: 4
132
133
  summary: Helpers for base sinatra app