golden-theme 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/app/assets/javascripts/golden/theme/bootstrap.js.coffee +7 -0
- data/app/assets/javascripts/golden/theme/foundation.js.coffee +7 -0
- data/app/assets/javascripts/golden/theme/foundation/ajax-chosen.js.coffee +10 -0
- data/app/assets/javascripts/golden/theme/foundation/ajax-tabs.js.coffee +42 -0
- data/app/assets/javascripts/golden/theme/foundation/bench-util-jquery.js.coffee +48 -0
- data/app/assets/javascripts/golden/theme/foundation/modal.js.coffee +60 -0
- data/app/assets/stylesheets/golden/theme/foundation.css.sass +4 -0
- data/app/assets/stylesheets/golden/theme/foundation/devise.css.sass +2 -0
- data/app/controllers/concerns/golden/theme/foundation/pagination.rb +33 -0
- data/app/views/application/{_flash_messages.html.erb → bootstrap/_flash_messages.html.erb} +1 -1
- data/app/views/application/bootstrap/_main_navigation.html.erb +1 -1
- data/app/views/application/bootstrap/_user_navigation.html.erb +3 -3
- data/app/views/application/foundation/_flash_messages.html.erb +10 -0
- data/app/views/application/foundation/_header.html.erb +17 -0
- data/app/views/application/foundation/_main_navigation.html.erb +5 -0
- data/app/views/application/foundation/_pagination.html.erb +9 -0
- data/app/views/application/foundation/_user_navigation.html.erb +19 -0
- data/config/locales/application.en.yml +16 -0
- data/config/locales/application.zh-TW.yml +16 -0
- data/golden-theme.gemspec +6 -1
- data/lib/golden/theme.rb +7 -0
- data/lib/golden/theme/bootstrap/alert_helper.rb +25 -0
- data/{app/helpers → lib}/golden/theme/bootstrap/button_helper.rb +1 -1
- data/{app/helpers → lib}/golden/theme/bootstrap/common_helper.rb +6 -6
- data/lib/golden/theme/bootstrap/deprecated_helper.rb +95 -0
- data/{app/helpers → lib}/golden/theme/bootstrap/dropdown_helper.rb +4 -4
- data/{app/helpers → lib}/golden/theme/bootstrap/link_helper.rb +10 -10
- data/lib/golden/theme/bootstrap/link_renderer.rb +3 -3
- data/{app/helpers → lib}/golden/theme/bootstrap/modal_helper.rb +7 -8
- data/{app/helpers → lib}/golden/theme/bootstrap/tab_helper.rb +19 -19
- data/lib/golden/theme/engine.rb +3 -0
- data/lib/golden/theme/foundation/alerts_helper.rb +19 -0
- data/lib/golden/theme/foundation/buttons_helper.rb +11 -0
- data/lib/golden/theme/foundation/common_helper.rb +66 -0
- data/lib/golden/theme/foundation/dropdowns_helper.rb +47 -0
- data/lib/golden/theme/foundation/link_helper.rb +56 -0
- data/lib/golden/theme/foundation/link_renderer.rb +63 -0
- data/lib/golden/theme/foundation/reveal_modal_helper.rb +63 -0
- data/lib/golden/theme/foundation/sub_nav_helper.rb +11 -0
- data/lib/golden/theme/foundation/tabs_helper.rb +58 -0
- data/lib/golden/theme/foundation/top_bar_helper.rb +16 -0
- data/lib/golden/theme/helpers.rb +24 -0
- data/lib/golden/theme/version.rb +1 -1
- metadata +79 -12
- data/app/assets/javascripts/golden/theme/bootstrap.js +0 -7
- data/app/helpers/golden/theme/bootstrap/alert_helper.rb +0 -24
@@ -1,10 +1,10 @@
|
|
1
1
|
module Golden::Theme::Bootstrap
|
2
2
|
module CommonHelper
|
3
|
-
def
|
4
|
-
options,
|
5
|
-
yield
|
3
|
+
def bootstrap_ul_tag li = [], options = {}
|
4
|
+
options, li = li, [] if li.is_a? Hash
|
5
|
+
yield li if block_given?
|
6
6
|
items = ''.html_safe
|
7
|
-
|
7
|
+
li.each_with_index do |item, index|
|
8
8
|
if item.is_a? Array
|
9
9
|
item_options = item.pop
|
10
10
|
item_content = item.join('').html_safe
|
@@ -15,7 +15,7 @@ module Golden::Theme::Bootstrap
|
|
15
15
|
|
16
16
|
item_class = []
|
17
17
|
item_class << 'first' if index == 0
|
18
|
-
item_class << 'last' if index == (
|
18
|
+
item_class << 'last' if index == (li.length - 1)
|
19
19
|
link = item_content.match(/href=(["'])(.*?)(\1)/)[2] rescue nil
|
20
20
|
item_class << 'current active' if link and (current_page?(link) rescue false)
|
21
21
|
item_class << item_options.delete(:class) if item_options[:class]
|
@@ -26,7 +26,7 @@ module Golden::Theme::Bootstrap
|
|
26
26
|
content_tag :ul, items, options
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def bootstrap_callback_button callback_id, options = {}
|
30
30
|
options = {
|
31
31
|
data: {
|
32
32
|
callback_id: callback_id
|
@@ -0,0 +1,95 @@
|
|
1
|
+
module Golden::Theme::Bootstrap
|
2
|
+
module DeprecatedHelper
|
3
|
+
def flash_box *args, &block
|
4
|
+
bootstrap_flash_box *args, &block
|
5
|
+
end
|
6
|
+
|
7
|
+
def render_btn_group *args, &block
|
8
|
+
bootstrap_btn_group *args, &block
|
9
|
+
end
|
10
|
+
|
11
|
+
def render_list *args, &block
|
12
|
+
bootstrap_ul_tag *args, &block
|
13
|
+
end
|
14
|
+
|
15
|
+
def link_to_callback_button *args, &block
|
16
|
+
bootstrap_callback_button *args, &block
|
17
|
+
end
|
18
|
+
|
19
|
+
def dropdown_toggle *args, &block
|
20
|
+
bootstrap_dropdown_toggle *args, &block
|
21
|
+
end
|
22
|
+
|
23
|
+
def dropdown_btn *args, &block
|
24
|
+
bootstrap_dropdown_btn *args, &block
|
25
|
+
end
|
26
|
+
|
27
|
+
def dropdown_menu *args, &block
|
28
|
+
bootstrap_dropdown_menu *args, &block
|
29
|
+
end
|
30
|
+
|
31
|
+
def iconed_link_to *args, &block
|
32
|
+
bootstrap_iconed_link_to *args, &block
|
33
|
+
end
|
34
|
+
|
35
|
+
def link_to_show *args, &block
|
36
|
+
bootstrap_link_to_show *args, &block
|
37
|
+
end
|
38
|
+
|
39
|
+
def link_to_new *args, &block
|
40
|
+
bootstrap_link_to_new *args, &block
|
41
|
+
end
|
42
|
+
|
43
|
+
def link_to_edit *args, &block
|
44
|
+
bootstrap_link_to_edit *args, &block
|
45
|
+
end
|
46
|
+
|
47
|
+
def link_to_destroy *args, &block
|
48
|
+
bootstrap_link_to_destroy *args, &block
|
49
|
+
end
|
50
|
+
|
51
|
+
def link_to_modal *args, &block
|
52
|
+
bootstrap_modal_open_link_to *args, &block
|
53
|
+
end
|
54
|
+
|
55
|
+
def link_to_open_modal *args, &block
|
56
|
+
bootstrap_modal_open_iconed_link_to *args, &block
|
57
|
+
end
|
58
|
+
|
59
|
+
def link_to_edit_modal *args, &block
|
60
|
+
bootstrap_modal_edit_link_to *args, &block
|
61
|
+
end
|
62
|
+
|
63
|
+
def link_to_close_button *args, &block
|
64
|
+
bootstrap_modal_close_button *args, &block
|
65
|
+
end
|
66
|
+
|
67
|
+
def modal_close_button *args, &block
|
68
|
+
bootstrap_modal_close_icon *args, &block
|
69
|
+
end
|
70
|
+
|
71
|
+
def link_to_tab *args, &block
|
72
|
+
bootstrap_tab_link_to *args, &block
|
73
|
+
end
|
74
|
+
|
75
|
+
def nav_tab *args, &block
|
76
|
+
bootstrap_tab_nav *args, &block
|
77
|
+
end
|
78
|
+
|
79
|
+
def tab_pane *args, &block
|
80
|
+
bootstrap_tab_pane *args, &block
|
81
|
+
end
|
82
|
+
|
83
|
+
def link_to_remote_tab *args, &block
|
84
|
+
bootstrap_remote_tab_link_to *args, &block
|
85
|
+
end
|
86
|
+
|
87
|
+
def remote_nav_tab *args, &block
|
88
|
+
bootstrap_remote_tab_nav *args, &block
|
89
|
+
end
|
90
|
+
|
91
|
+
def remote_tab_pane *args, &block
|
92
|
+
bootstrap_remote_tab_pane *args, &block
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Golden::Theme::Bootstrap
|
2
2
|
module DropdownHelper
|
3
|
-
def
|
3
|
+
def bootstrap_dropdown_toggle text, url = '', options = {}
|
4
4
|
text = text.html_safe << ' '
|
5
5
|
text << content_tag(:span, nil, class: 'caret')
|
6
6
|
options = {
|
@@ -10,7 +10,7 @@ module Golden::Theme::Bootstrap
|
|
10
10
|
link_to text, url, options
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def bootstrap_dropdown_btn text, options = {}
|
14
14
|
text = text.html_safe << ' '
|
15
15
|
text << content_tag(:span, nil, class: 'caret')
|
16
16
|
options = {
|
@@ -22,12 +22,12 @@ module Golden::Theme::Bootstrap
|
|
22
22
|
button_tag text, options
|
23
23
|
end
|
24
24
|
|
25
|
-
def
|
25
|
+
def bootstrap_dropdown_menu options = {}, &block
|
26
26
|
options = {
|
27
27
|
role: 'menu',
|
28
28
|
class: 'dropdown-menu'
|
29
29
|
}.deep_merge options
|
30
|
-
|
30
|
+
bootstrap_ul_tag options, &block
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module Golden::Theme::Bootstrap
|
2
2
|
module LinkHelper
|
3
|
-
def
|
4
|
-
icon_class = options.delete
|
3
|
+
def bootstrap_iconed_link_to text, url, options = {}
|
4
|
+
icon_class = options.delete :icon_class
|
5
5
|
text = content_tag(:i, nil, class: icon_class) << ' ' << text
|
6
6
|
link_to text, url, options
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
9
|
+
def bootstrap_link_to_show url, options = {}
|
10
10
|
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-eye-open'
|
11
11
|
options = {
|
12
12
|
role: 'button',
|
@@ -15,10 +15,10 @@ module Golden::Theme::Bootstrap
|
|
15
15
|
title: t('helpers.show')
|
16
16
|
}.deep_merge options
|
17
17
|
default_options = { }
|
18
|
-
|
18
|
+
bootstrap_iconed_link_to nil, url, options
|
19
19
|
end
|
20
20
|
|
21
|
-
def
|
21
|
+
def bootstrap_link_to_new url, options = {}
|
22
22
|
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-plus'
|
23
23
|
options = {
|
24
24
|
role: 'button',
|
@@ -26,10 +26,10 @@ module Golden::Theme::Bootstrap
|
|
26
26
|
icon_class: icon_class,
|
27
27
|
title: t('helpers.new')
|
28
28
|
}.deep_merge options
|
29
|
-
|
29
|
+
bootstrap_iconed_link_to nil, url, options
|
30
30
|
end
|
31
31
|
|
32
|
-
def
|
32
|
+
def bootstrap_link_to_edit url, options = {}
|
33
33
|
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-edit'
|
34
34
|
options = {
|
35
35
|
role: 'button',
|
@@ -37,10 +37,10 @@ module Golden::Theme::Bootstrap
|
|
37
37
|
icon_class: icon_class,
|
38
38
|
title: t('helpers.edit')
|
39
39
|
}.deep_merge options
|
40
|
-
|
40
|
+
bootstrap_iconed_link_to nil, url, options
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def bootstrap_link_to_destroy url, options = {}
|
44
44
|
icon_class = options.delete(:icon_class) || 'glyphicon glyphicon-trash'
|
45
45
|
options = {
|
46
46
|
method: :delete,
|
@@ -50,7 +50,7 @@ module Golden::Theme::Bootstrap
|
|
50
50
|
icon_class: icon_class,
|
51
51
|
title: t('helpers.destroy')
|
52
52
|
}.deep_merge options
|
53
|
-
|
53
|
+
bootstrap_iconed_link_to nil, url, options
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -29,11 +29,11 @@ module Golden::Theme
|
|
29
29
|
|
30
30
|
protected
|
31
31
|
|
32
|
-
def html_container
|
32
|
+
def html_container html
|
33
33
|
tag :ul, html, container_attributes
|
34
34
|
end
|
35
35
|
|
36
|
-
def page_number
|
36
|
+
def page_number page
|
37
37
|
options = { rel: rel_value(page) }
|
38
38
|
options.deep_merge! link_options unless link_options.blank?
|
39
39
|
unless page == current_page
|
@@ -47,7 +47,7 @@ module Golden::Theme
|
|
47
47
|
tag :li, link(super, nil), class: 'disabled'
|
48
48
|
end
|
49
49
|
|
50
|
-
def previous_or_next_page
|
50
|
+
def previous_or_next_page page, text, class_name
|
51
51
|
options = {}
|
52
52
|
options.deep_merge! link_options unless link_options.blank?
|
53
53
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Golden::Theme::Bootstrap
|
2
2
|
module ModalHelper
|
3
|
-
def
|
3
|
+
def bootstrap_modal_open_link_to text, url, modal_id, options = {}
|
4
4
|
options = {
|
5
5
|
remote: true,
|
6
6
|
data: {
|
@@ -13,7 +13,7 @@ module Golden::Theme::Bootstrap
|
|
13
13
|
link_to text, url, options
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
16
|
+
def bootstrap_modal_open_iconed_link_to text, url, modal_id, options = {}
|
17
17
|
options = {
|
18
18
|
remote: true,
|
19
19
|
data: {
|
@@ -23,10 +23,10 @@ module Golden::Theme::Bootstrap
|
|
23
23
|
},
|
24
24
|
class: 'modal-open'
|
25
25
|
}.deep_merge options
|
26
|
-
|
26
|
+
bootstrap_iconed_link_to text, url, options
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def bootstrap_modal_edit_link_to url, modal_id, options = {}
|
30
30
|
options = {
|
31
31
|
remote: true,
|
32
32
|
data: {
|
@@ -36,10 +36,10 @@ module Golden::Theme::Bootstrap
|
|
36
36
|
},
|
37
37
|
class: 'modal-open btn btn-default'
|
38
38
|
}.deep_merge options
|
39
|
-
|
39
|
+
bootstrap_link_to_edit url, options
|
40
40
|
end
|
41
41
|
|
42
|
-
def
|
42
|
+
def bootstrap_modal_close_button
|
43
43
|
options = {
|
44
44
|
type: 'button',
|
45
45
|
name: nil,
|
@@ -49,11 +49,10 @@ module Golden::Theme::Bootstrap
|
|
49
49
|
button_tag t('helpers.close'), options
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def bootstrap_modal_close_icon
|
53
53
|
options = {
|
54
54
|
type: 'button',
|
55
55
|
name: nil,
|
56
|
-
'aria-hidden' => 'true',
|
57
56
|
data: { dismiss: 'modal' },
|
58
57
|
class: 'close'
|
59
58
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Golden::Theme::Bootstrap
|
2
2
|
module TabHelper
|
3
|
-
def
|
3
|
+
def bootstrap_tab_link_to text, tab_pane_id, options = {}
|
4
4
|
options = {
|
5
5
|
data: {
|
6
6
|
toggle: 'tab',
|
@@ -10,25 +10,13 @@ module Golden::Theme::Bootstrap
|
|
10
10
|
link_to text, tab_pane_id, options
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
options = {
|
15
|
-
remote: true,
|
16
|
-
data: {
|
17
|
-
toggle: 'tab',
|
18
|
-
target: tab_pane_id,
|
19
|
-
type: 'html'
|
20
|
-
}
|
21
|
-
}.deep_merge options
|
22
|
-
link_to text, url, options
|
23
|
-
end
|
24
|
-
|
25
|
-
def nav_tab text, tag_id, default
|
13
|
+
def bootstrap_tab_nav text, tag_id, default
|
26
14
|
active = tag_id == default
|
27
15
|
li_class = 'active' if active
|
28
|
-
[
|
16
|
+
[ bootstrap_tab_link_to(text, "##{tag_id}"), { class: li_class } ]
|
29
17
|
end
|
30
18
|
|
31
|
-
def
|
19
|
+
def bootstrap_tab_pane tag_id, default
|
32
20
|
active = tag_id == default
|
33
21
|
tab_class = 'tab-pane fade'
|
34
22
|
tab_class << ' active in' if active
|
@@ -37,13 +25,25 @@ module Golden::Theme::Bootstrap
|
|
37
25
|
end
|
38
26
|
end
|
39
27
|
|
40
|
-
def
|
28
|
+
def bootstrap_remote_tab_link_to text, url, tab_pane_id, options = {}
|
29
|
+
options = {
|
30
|
+
remote: true,
|
31
|
+
data: {
|
32
|
+
toggle: 'tab',
|
33
|
+
target: tab_pane_id,
|
34
|
+
type: 'html'
|
35
|
+
}
|
36
|
+
}.deep_merge options
|
37
|
+
link_to text, url, options
|
38
|
+
end
|
39
|
+
|
40
|
+
def bootstrap_remote_tab_nav text, url, tag_id, default
|
41
41
|
active = current_page?(url) || tag_id == default
|
42
42
|
li_class = 'active' if active
|
43
|
-
[
|
43
|
+
[ bootstrap_remote_tab_link_to(text, url, "##{tag_id}"), { class: li_class } ]
|
44
44
|
end
|
45
45
|
|
46
|
-
def
|
46
|
+
def bootstrap_remote_tab_pane url, tag_id, default
|
47
47
|
active = current_page?(url) || tag_id == default
|
48
48
|
tab_class = 'tab-pane fade'
|
49
49
|
tab_class << ' active in' if active
|
data/lib/golden/theme/engine.rb
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Golden::Theme::Foundation
|
2
|
+
module AlertsHelper
|
3
|
+
def foundation_alert_box key, value
|
4
|
+
alert_class = 'alert-box radius'
|
5
|
+
alert_class << case key.to_sym
|
6
|
+
when :notice, :alert
|
7
|
+
" warning #{key}"
|
8
|
+
when :error
|
9
|
+
" alert #{key}"
|
10
|
+
else
|
11
|
+
" #{key}"
|
12
|
+
end
|
13
|
+
content_tag :div, class: alert_class, data: { alert: true } do
|
14
|
+
concat value
|
15
|
+
concat link_to('×'.html_safe, '#', class: 'close')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Golden::Theme::Foundation
|
2
|
+
module ButtonsHelper
|
3
|
+
def foundation_button_group options = {}, &block
|
4
|
+
html_class = options.delete :class
|
5
|
+
options = {
|
6
|
+
class: "button-group #{html_class}".strip
|
7
|
+
}.deep_merge options
|
8
|
+
foundation_ul_tag options, &block
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Golden::Theme::Foundation
|
2
|
+
module CommonHelper
|
3
|
+
def foundation_ul_tag li = [], options = {}
|
4
|
+
options, li = li, [] if li.is_a? Hash
|
5
|
+
yield li if block_given?
|
6
|
+
items = ''.html_safe
|
7
|
+
li.each_with_index do |item, index|
|
8
|
+
if item.is_a? Array
|
9
|
+
item_options = item.pop
|
10
|
+
item_content = item.join('').html_safe
|
11
|
+
else
|
12
|
+
item_options = {}
|
13
|
+
item_content = item
|
14
|
+
end
|
15
|
+
|
16
|
+
item_class = []
|
17
|
+
item_class << 'first' if index == 0
|
18
|
+
item_class << 'last' if index == (li.length - 1)
|
19
|
+
link = item_content.match(/href=(["'])(.*?)(\1)/)[2] rescue nil
|
20
|
+
item_class << 'current active' if link and (current_page?(link) rescue false)
|
21
|
+
item_class << item_options.delete(:class) if item_options[:class]
|
22
|
+
|
23
|
+
li_class = item_class.empty? ? nil : item_class.join(' ')
|
24
|
+
items << content_tag(:li, item_content, item_options.merge(class: li_class) )
|
25
|
+
end
|
26
|
+
content_tag :ul, items, options
|
27
|
+
end
|
28
|
+
|
29
|
+
def foundation_dl_tag dt = [], dd = [], options = {}
|
30
|
+
options, dt, dd = dt, [], [] if dt.is_a? Hash or dd.is_a? Hash
|
31
|
+
yield dt, dd if block_given?
|
32
|
+
items = ''.html_safe
|
33
|
+
items << dt if dt.present?
|
34
|
+
dd.each_with_index do |item, index|
|
35
|
+
if item.is_a? Array
|
36
|
+
item_options = item.pop
|
37
|
+
item_content = item.join('').html_safe
|
38
|
+
else
|
39
|
+
item_options = {}
|
40
|
+
item_content = item
|
41
|
+
end
|
42
|
+
|
43
|
+
item_class = []
|
44
|
+
item_class << 'first' if index == 0
|
45
|
+
item_class << 'last' if index == (dd.length - 1)
|
46
|
+
link = item_content.match(/href=(["'])(.*?)(\1)/)[2] rescue nil
|
47
|
+
item_class << 'active' if link and (current_page?(link) rescue false)
|
48
|
+
item_class << item_options.delete(:class) if item_options[:class]
|
49
|
+
|
50
|
+
dd_class = item_class.empty? ? nil : item_class.join(' ')
|
51
|
+
items << content_tag(:dd, item_content, item_options.merge(class: dd_class) )
|
52
|
+
end
|
53
|
+
content_tag :dl, items, options
|
54
|
+
end
|
55
|
+
|
56
|
+
def foundation_callback_button callback_id, options = {}
|
57
|
+
options = {
|
58
|
+
data: {
|
59
|
+
callback_id: callback_id
|
60
|
+
},
|
61
|
+
class: 'callback hide'
|
62
|
+
}.deep_merge options
|
63
|
+
link_to nil, '', options
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|