rails-theme-helper 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +2 -2
- data/README.md +2 -0
- data/app/assets/stylesheets/rails_theme/simple_layout.css.sass +2 -2
- data/app/helpers/rails_theme/bootstrap/dropdown_helper.rb +9 -3
- data/app/helpers/rails_theme/bootstrap/form_helper.rb +1 -1
- data/app/helpers/rails_theme/bootstrap/link_helper.rb +12 -8
- data/app/helpers/rails_theme/bootstrap/modal_helper.rb +7 -4
- data/app/helpers/rails_theme/layout_helper.rb +21 -0
- data/app/views/application/_flash_messages.html.erb +1 -3
- data/app/views/application/_header.html.erb +14 -9
- data/config/locales/rails_theme.en.yml +1 -0
- data/config/locales/rails_theme.zh-TW.yml +1 -0
- data/lib/rails-theme-helper/version.rb +1 -1
- metadata +12 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2d0d49950455a4edf8f9e8a589b5cba77c6ebca
|
4
|
+
data.tar.gz: b7b410d215413b1facc06640a89455df6e7a6e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82b2c4f7105201bc05f22446128d3cb08068ee8f1e70084b797faa695fbd6a5f96409389c0eec6815e71e3c2e4da69e6016b730e1e52c8afcafaaa03df129e0c
|
7
|
+
data.tar.gz: 3882856228868b6accb4c13b259ffab48fa3545fe2c5a56fd046d3188ea209b2c7cbd083febb44c0ca7b748e7dbb244f2e421f7434ec6c20968fc549276efb05
|
data/LICENSE.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c) 2012 Tse-Ching Ho
|
1
|
+
Copyright (c) 2012-2014 Tse-Ching Ho
|
2
2
|
|
3
3
|
MIT License
|
4
4
|
|
@@ -19,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
19
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
20
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -11,15 +11,21 @@ module RailsTheme
|
|
11
11
|
link_to text, url, options
|
12
12
|
end
|
13
13
|
|
14
|
-
def dropdown_btn text,
|
14
|
+
def dropdown_btn text, options = {}
|
15
|
+
text = text.html_safe << ' '
|
16
|
+
text << content_tag(:span, nil, class: 'caret')
|
15
17
|
options = {
|
16
|
-
|
18
|
+
name: nil,
|
19
|
+
type: 'button',
|
20
|
+
class: 'btn dropdown-toggle',
|
21
|
+
data: { toggle: 'dropdown' }
|
17
22
|
}.deep_merge options
|
18
|
-
|
23
|
+
button_tag text, options
|
19
24
|
end
|
20
25
|
|
21
26
|
def dropdown_menu options = {}, &block
|
22
27
|
options = {
|
28
|
+
role: 'menu',
|
23
29
|
class: 'dropdown-menu'
|
24
30
|
}.deep_merge options
|
25
31
|
render_list options, &block
|
@@ -8,9 +8,10 @@ module RailsTheme
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def link_to_show url, options = {}
|
11
|
-
icon_class = options.delete(:icon_class) || '
|
11
|
+
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-eye-open'
|
12
12
|
options = {
|
13
|
-
|
13
|
+
role: 'button',
|
14
|
+
class: 'btn btn-default',
|
14
15
|
icon_class: icon_class,
|
15
16
|
title: t('helpers.show')
|
16
17
|
}.deep_merge options
|
@@ -19,9 +20,10 @@ module RailsTheme
|
|
19
20
|
end
|
20
21
|
|
21
22
|
def link_to_new url, options = {}
|
22
|
-
icon_class = options.delete(:icon_class) || '
|
23
|
+
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-plus'
|
23
24
|
options = {
|
24
|
-
|
25
|
+
role: 'button',
|
26
|
+
class: 'btn btn-default',
|
25
27
|
icon_class: icon_class,
|
26
28
|
title: t('helpers.new')
|
27
29
|
}.deep_merge options
|
@@ -29,9 +31,10 @@ module RailsTheme
|
|
29
31
|
end
|
30
32
|
|
31
33
|
def link_to_edit url, options = {}
|
32
|
-
icon_class = options.delete(:icon_class) || '
|
34
|
+
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-edit'
|
33
35
|
options = {
|
34
|
-
|
36
|
+
role: 'button',
|
37
|
+
class: 'btn btn-default',
|
35
38
|
icon_class: icon_class,
|
36
39
|
title: t('helpers.edit')
|
37
40
|
}.deep_merge options
|
@@ -39,11 +42,12 @@ module RailsTheme
|
|
39
42
|
end
|
40
43
|
|
41
44
|
def link_to_destroy url, options = {}
|
42
|
-
icon_class = options.delete(:icon_class) || '
|
45
|
+
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-trash'
|
43
46
|
options = {
|
44
47
|
method: :delete,
|
45
48
|
data: { confirm: t('helpers.are_you_sure') },
|
46
|
-
|
49
|
+
role: 'button',
|
50
|
+
class: 'btn btn-default',
|
47
51
|
icon_class: icon_class,
|
48
52
|
title: t('helpers.destroy')
|
49
53
|
}.deep_merge options
|
@@ -35,27 +35,30 @@ module RailsTheme
|
|
35
35
|
target: modal_id,
|
36
36
|
type: 'html'
|
37
37
|
},
|
38
|
-
class: 'modal-open btn'
|
38
|
+
class: 'modal-open btn btn-default'
|
39
39
|
}.deep_merge options
|
40
40
|
link_to_edit url, options
|
41
41
|
end
|
42
42
|
|
43
43
|
def link_to_close_button
|
44
44
|
options = {
|
45
|
+
type: 'button',
|
46
|
+
name: nil,
|
45
47
|
data: { dismiss: 'modal' },
|
46
|
-
class: 'btn'
|
48
|
+
class: 'btn btn-default'
|
47
49
|
}
|
48
|
-
|
50
|
+
button_tag t('helpers.close'), options
|
49
51
|
end
|
50
52
|
|
51
53
|
def modal_close_button
|
52
54
|
options = {
|
53
55
|
type: 'button',
|
54
56
|
name: nil,
|
57
|
+
'aria-hidden' => 'true',
|
55
58
|
data: { dismiss: 'modal' },
|
56
59
|
class: 'close'
|
57
60
|
}
|
58
|
-
button_tag '
|
61
|
+
button_tag '×'.html_safe, options
|
59
62
|
end
|
60
63
|
end
|
61
64
|
end
|
@@ -25,5 +25,26 @@ module RailsTheme
|
|
25
25
|
end
|
26
26
|
content_tag(:ul, items, options)
|
27
27
|
end
|
28
|
+
|
29
|
+
def flash_box key, value
|
30
|
+
alert_class = case key
|
31
|
+
when :notice
|
32
|
+
'alert-warning'
|
33
|
+
when :error
|
34
|
+
'alert-danger'
|
35
|
+
else
|
36
|
+
"alert-#{key}"
|
37
|
+
end
|
38
|
+
button_options = {
|
39
|
+
type: 'button',
|
40
|
+
name: nil,
|
41
|
+
class: 'close',
|
42
|
+
data: { dismiss: 'alert' },
|
43
|
+
'aria-hidden' => 'true'
|
44
|
+
}
|
45
|
+
content_tag :div, class: "alert #{alert_class} alert-dismissable #{key}" do
|
46
|
+
button_tag('×'.html_safe, button_options) << value
|
47
|
+
end
|
48
|
+
end
|
28
49
|
end
|
29
50
|
end
|
@@ -4,8 +4,6 @@
|
|
4
4
|
|
5
5
|
<div class="messages">
|
6
6
|
<% flash.each do |key, value| %>
|
7
|
-
<%=
|
8
|
-
link_to('×'.html_safe, '#', class: 'close', data: { dismiss: 'alert'}) << value
|
9
|
-
end %>
|
7
|
+
<%= flash_box key, value %>
|
10
8
|
<% end %>
|
11
9
|
</div>
|
@@ -1,10 +1,15 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
|
4
|
-
|
1
|
+
<div class="navbar-header">
|
2
|
+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
3
|
+
<span class="sr-only"><%= t('site.nav_toggle') %></span>
|
4
|
+
<span class="icon-bar"></span>
|
5
|
+
<span class="icon-bar"></span>
|
6
|
+
<span class="icon-bar"></span>
|
7
|
+
</button>
|
8
|
+
<hgroup id="site-name">
|
9
|
+
<h1><%= link_to t('.site_title'), secure_root_url, class: 'navbar-brand' %></h1>
|
10
|
+
<h2><%= t('site.subtitle') %></h2>
|
11
|
+
</hgroup>
|
12
|
+
</div>
|
5
13
|
|
6
|
-
<
|
7
|
-
|
8
|
-
<span class="icon-bar"></span>
|
9
|
-
<span class="icon-bar"></span>
|
10
|
-
</a>
|
14
|
+
<div class="navbar-collapse collapse">
|
15
|
+
</div>
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-theme-helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tse-Ching Ho
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.1.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.1.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: jquery-rails
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails-i18n
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: This gem helps you build themes for rails
|
@@ -59,7 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE.txt
|
65
65
|
- README.md
|
@@ -94,19 +94,18 @@ require_paths:
|
|
94
94
|
- lib
|
95
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
96
|
requirements:
|
97
|
-
- -
|
97
|
+
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
99
|
version: '0'
|
100
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- -
|
102
|
+
- - ">="
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
106
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
107
|
+
rubygems_version: 2.2.2
|
108
108
|
signing_key:
|
109
109
|
specification_version: 4
|
110
110
|
summary: helps you build themes for rails
|
111
111
|
test_files: []
|
112
|
-
has_rdoc:
|