hanami-helpers 0.0.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/LICENSE.md +22 -0
- data/README.md +362 -9
- data/hanami-helpers.gemspec +16 -12
- data/lib/hanami-helpers.rb +1 -0
- data/lib/hanami/helpers.rb +28 -2
- data/lib/hanami/helpers/escape_helper.rb +271 -0
- data/lib/hanami/helpers/form_helper.rb +424 -0
- data/lib/hanami/helpers/form_helper/form_builder.rb +911 -0
- data/lib/hanami/helpers/form_helper/html_node.rb +79 -0
- data/lib/hanami/helpers/form_helper/values.rb +38 -0
- data/lib/hanami/helpers/html_helper.rb +207 -0
- data/lib/hanami/helpers/html_helper/empty_html_node.rb +92 -0
- data/lib/hanami/helpers/html_helper/html_builder.rb +376 -0
- data/lib/hanami/helpers/html_helper/html_fragment.rb +45 -0
- data/lib/hanami/helpers/html_helper/html_node.rb +70 -0
- data/lib/hanami/helpers/html_helper/text_node.rb +33 -0
- data/lib/hanami/helpers/link_to_helper.rb +135 -0
- data/lib/hanami/helpers/number_formatting_helper.rb +220 -0
- data/lib/hanami/helpers/routing_helper.rb +52 -0
- data/lib/hanami/helpers/version.rb +4 -1
- metadata +60 -14
- data/.gitignore +0 -9
- data/Gemfile +0 -4
- data/Rakefile +0 -2
- data/bin/console +0 -14
- data/bin/setup +0 -8
@@ -0,0 +1,52 @@
|
|
1
|
+
module Hanami
|
2
|
+
module Helpers
|
3
|
+
# Routing helper for full stack Hanami web applications.
|
4
|
+
#
|
5
|
+
# For a given application called <tt>Web::Application</tt>, at runtime
|
6
|
+
# Hanami creates a routes factory called <tt>Web::Routes</tt>.
|
7
|
+
#
|
8
|
+
# By including this module in a view, it makes that factory avaliable as
|
9
|
+
# <tt>routes</tt>.
|
10
|
+
#
|
11
|
+
# @since 0.1.0
|
12
|
+
#
|
13
|
+
# @example Basic usage in template
|
14
|
+
# require 'hanami'
|
15
|
+
#
|
16
|
+
# module Web::Views::Home
|
17
|
+
# class Index
|
18
|
+
# include Web::View
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# # ERB template
|
23
|
+
# # <%= routes.home_path %>
|
24
|
+
#
|
25
|
+
# @example Basic usage in view
|
26
|
+
# require 'hanami'
|
27
|
+
#
|
28
|
+
# module Web::Views::Home
|
29
|
+
# class Index
|
30
|
+
# include Web::View
|
31
|
+
#
|
32
|
+
# def link_to_home
|
33
|
+
# %(<a href="#{ routes.home_path }">Home</a>)
|
34
|
+
# end
|
35
|
+
# end
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# # ERB template
|
39
|
+
# # <%= link_to_home %>
|
40
|
+
module RoutingHelper
|
41
|
+
def self.included(base)
|
42
|
+
factory = "#{ Utils::String.new(base).namespace }::Routes"
|
43
|
+
|
44
|
+
base.class_eval <<-END_EVAL, __FILE__, __LINE__
|
45
|
+
def routes
|
46
|
+
#{ factory }
|
47
|
+
end
|
48
|
+
END_EVAL
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hanami-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Luca Guidi
|
8
|
+
- Trung Lê
|
9
|
+
- Alfonso Uceda
|
8
10
|
autorequire:
|
9
|
-
bindir:
|
11
|
+
bindir: bin
|
10
12
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
13
|
+
date: 2016-01-22 00:00:00.000000000 Z
|
12
14
|
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hanami-utils
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.7'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0.7'
|
13
29
|
- !ruby/object:Gem::Dependency
|
14
30
|
name: bundler
|
15
31
|
requirement: !ruby/object:Gem::Requirement
|
16
32
|
requirements:
|
17
33
|
- - "~>"
|
18
34
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
35
|
+
version: '1.6'
|
20
36
|
type: :development
|
21
37
|
prerelease: false
|
22
38
|
version_requirements: !ruby/object:Gem::Requirement
|
23
39
|
requirements:
|
24
40
|
- - "~>"
|
25
41
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
42
|
+
version: '1.6'
|
27
43
|
- !ruby/object:Gem::Dependency
|
28
44
|
name: rake
|
29
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,24 +54,53 @@ dependencies:
|
|
38
54
|
- - "~>"
|
39
55
|
- !ruby/object:Gem::Version
|
40
56
|
version: '10.0'
|
41
|
-
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: minitest
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '5.5'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '5.5'
|
71
|
+
description: View helpers for Ruby applications
|
42
72
|
email:
|
43
73
|
- me@lucaguidi.com
|
74
|
+
- trung.le@ruby-journal.com
|
75
|
+
- uceda73@gmail.com
|
44
76
|
executables: []
|
45
77
|
extensions: []
|
46
78
|
extra_rdoc_files: []
|
47
79
|
files:
|
48
|
-
-
|
49
|
-
-
|
80
|
+
- CHANGELOG.md
|
81
|
+
- LICENSE.md
|
50
82
|
- README.md
|
51
|
-
- Rakefile
|
52
|
-
- bin/console
|
53
|
-
- bin/setup
|
54
83
|
- hanami-helpers.gemspec
|
84
|
+
- lib/hanami-helpers.rb
|
55
85
|
- lib/hanami/helpers.rb
|
86
|
+
- lib/hanami/helpers/escape_helper.rb
|
87
|
+
- lib/hanami/helpers/form_helper.rb
|
88
|
+
- lib/hanami/helpers/form_helper/form_builder.rb
|
89
|
+
- lib/hanami/helpers/form_helper/html_node.rb
|
90
|
+
- lib/hanami/helpers/form_helper/values.rb
|
91
|
+
- lib/hanami/helpers/html_helper.rb
|
92
|
+
- lib/hanami/helpers/html_helper/empty_html_node.rb
|
93
|
+
- lib/hanami/helpers/html_helper/html_builder.rb
|
94
|
+
- lib/hanami/helpers/html_helper/html_fragment.rb
|
95
|
+
- lib/hanami/helpers/html_helper/html_node.rb
|
96
|
+
- lib/hanami/helpers/html_helper/text_node.rb
|
97
|
+
- lib/hanami/helpers/link_to_helper.rb
|
98
|
+
- lib/hanami/helpers/number_formatting_helper.rb
|
99
|
+
- lib/hanami/helpers/routing_helper.rb
|
56
100
|
- lib/hanami/helpers/version.rb
|
57
101
|
homepage: http://hanamirb.org
|
58
|
-
licenses:
|
102
|
+
licenses:
|
103
|
+
- MIT
|
59
104
|
metadata: {}
|
60
105
|
post_install_message:
|
61
106
|
rdoc_options: []
|
@@ -65,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
110
|
requirements:
|
66
111
|
- - ">="
|
67
112
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
113
|
+
version: 2.0.0
|
69
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
115
|
requirements:
|
71
116
|
- - ">="
|
@@ -76,5 +121,6 @@ rubyforge_project:
|
|
76
121
|
rubygems_version: 2.5.1
|
77
122
|
signing_key:
|
78
123
|
specification_version: 4
|
79
|
-
summary:
|
124
|
+
summary: Hanami helpers
|
80
125
|
test_files: []
|
126
|
+
has_rdoc:
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "hanami/helpers"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|