asples_sinatra 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b9cb808f0a7d6d8f6aeccc4e11a69049de5bc626
4
+ data.tar.gz: fe293fb75b72c8fbe6ca0510ff51b06b26e728df
5
+ SHA512:
6
+ metadata.gz: a0676888f822f3eb5f807cbc0b527b1366037739c6a687d8653160a423b3007a5bed4f9db7cb23a8679e36b4e0b45d840060735263f4e576289e3bb3f82f6a2b
7
+ data.tar.gz: 7f9e3076e8731d49df1c9dc09ead45d4154776868e052304ad1331fa20568fe12ea90bf113ea5bd1ae82075762915fb0ebbf41317770dacac3cd75cb12f7dbb6
@@ -0,0 +1,7 @@
1
+ module AsplesSinatra
2
+ module Helpers
3
+ def input(name, options={})
4
+ haml :input, {layout: false}, options.merge!({field_name: name})
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,4 @@
1
+ require 'sinatra/base'
2
+ require 'asples_sinatra/helpers'
3
+
4
+ Sinatra.helpers AsplesSinatra::Helpers
@@ -0,0 +1,3 @@
1
+ module AsplesSinatra
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,10 @@
1
+ require "asples_sinatra/version"
2
+ require "asples_sinatra/sinatra"
3
+ require 'active_support'
4
+ require 'active_support/core_ext'
5
+
6
+
7
+
8
+ module AsplesSinatra
9
+ # Your code goes here...
10
+ end
data/views/input.haml ADDED
@@ -0,0 +1,8 @@
1
+ %div{class: "form-group #{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.errors.any?
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: asples_sinatra
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Per Evensen
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-09-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '11.2'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '11.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sinatra
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.4'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: haml
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '4.0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '4.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: activesupport
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '4.0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '4.0'
97
+ description:
98
+ email:
99
+ - per.evensen@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - lib/asples_sinatra.rb
105
+ - lib/asples_sinatra/helpers.rb
106
+ - lib/asples_sinatra/sinatra.rb
107
+ - lib/asples_sinatra/version.rb
108
+ - views/input.haml
109
+ homepage: https://github.com/asplespng/asples_sinatra
110
+ licenses:
111
+ - MIT
112
+ metadata: {}
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.5.1
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Helpers for base sinatra app
133
+ test_files: []