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.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +8 -0
  3. data/app/assets/javascripts/golden/theme/bootstrap.js.coffee +7 -0
  4. data/app/assets/javascripts/golden/theme/foundation.js.coffee +7 -0
  5. data/app/assets/javascripts/golden/theme/foundation/ajax-chosen.js.coffee +10 -0
  6. data/app/assets/javascripts/golden/theme/foundation/ajax-tabs.js.coffee +42 -0
  7. data/app/assets/javascripts/golden/theme/foundation/bench-util-jquery.js.coffee +48 -0
  8. data/app/assets/javascripts/golden/theme/foundation/modal.js.coffee +60 -0
  9. data/app/assets/stylesheets/golden/theme/foundation.css.sass +4 -0
  10. data/app/assets/stylesheets/golden/theme/foundation/devise.css.sass +2 -0
  11. data/app/controllers/concerns/golden/theme/foundation/pagination.rb +33 -0
  12. data/app/views/application/{_flash_messages.html.erb → bootstrap/_flash_messages.html.erb} +1 -1
  13. data/app/views/application/bootstrap/_main_navigation.html.erb +1 -1
  14. data/app/views/application/bootstrap/_user_navigation.html.erb +3 -3
  15. data/app/views/application/foundation/_flash_messages.html.erb +10 -0
  16. data/app/views/application/foundation/_header.html.erb +17 -0
  17. data/app/views/application/foundation/_main_navigation.html.erb +5 -0
  18. data/app/views/application/foundation/_pagination.html.erb +9 -0
  19. data/app/views/application/foundation/_user_navigation.html.erb +19 -0
  20. data/config/locales/application.en.yml +16 -0
  21. data/config/locales/application.zh-TW.yml +16 -0
  22. data/golden-theme.gemspec +6 -1
  23. data/lib/golden/theme.rb +7 -0
  24. data/lib/golden/theme/bootstrap/alert_helper.rb +25 -0
  25. data/{app/helpers → lib}/golden/theme/bootstrap/button_helper.rb +1 -1
  26. data/{app/helpers → lib}/golden/theme/bootstrap/common_helper.rb +6 -6
  27. data/lib/golden/theme/bootstrap/deprecated_helper.rb +95 -0
  28. data/{app/helpers → lib}/golden/theme/bootstrap/dropdown_helper.rb +4 -4
  29. data/{app/helpers → lib}/golden/theme/bootstrap/link_helper.rb +10 -10
  30. data/lib/golden/theme/bootstrap/link_renderer.rb +3 -3
  31. data/{app/helpers → lib}/golden/theme/bootstrap/modal_helper.rb +7 -8
  32. data/{app/helpers → lib}/golden/theme/bootstrap/tab_helper.rb +19 -19
  33. data/lib/golden/theme/engine.rb +3 -0
  34. data/lib/golden/theme/foundation/alerts_helper.rb +19 -0
  35. data/lib/golden/theme/foundation/buttons_helper.rb +11 -0
  36. data/lib/golden/theme/foundation/common_helper.rb +66 -0
  37. data/lib/golden/theme/foundation/dropdowns_helper.rb +47 -0
  38. data/lib/golden/theme/foundation/link_helper.rb +56 -0
  39. data/lib/golden/theme/foundation/link_renderer.rb +63 -0
  40. data/lib/golden/theme/foundation/reveal_modal_helper.rb +63 -0
  41. data/lib/golden/theme/foundation/sub_nav_helper.rb +11 -0
  42. data/lib/golden/theme/foundation/tabs_helper.rb +58 -0
  43. data/lib/golden/theme/foundation/top_bar_helper.rb +16 -0
  44. data/lib/golden/theme/helpers.rb +24 -0
  45. data/lib/golden/theme/version.rb +1 -1
  46. metadata +79 -12
  47. data/app/assets/javascripts/golden/theme/bootstrap.js +0 -7
  48. data/app/helpers/golden/theme/bootstrap/alert_helper.rb +0 -24
@@ -0,0 +1,47 @@
1
+ module Golden::Theme::Foundation
2
+ module DropdownsHelper
3
+ def foundation_dropdown_button text, options = {}
4
+ text = text.html_safe
5
+ target = options.delete :target
6
+ options = {
7
+ data: {
8
+ dropdown: target
9
+ }
10
+ }.deep_merge options
11
+ content_tag :button, text, options
12
+ end
13
+
14
+ def foundation_dropdown_link_to text, url = '#', options = {}
15
+ text = text.html_safe
16
+ target = options.delete :target
17
+ options = {
18
+ data: {
19
+ dropdown: target
20
+ }
21
+ }.deep_merge options
22
+ link_to text, url, options
23
+ end
24
+
25
+ def foundation_dropdown_ul_tag options = {}, &block
26
+ html_class = options.delete :class
27
+ options = {
28
+ class: "f-dropdown #{html_class}".strip,
29
+ data: {
30
+ dropdown_content: true
31
+ }
32
+ }.deep_merge options
33
+ foundation_ul_tag options, &block
34
+ end
35
+
36
+ def foundation_dropdown_content options = {}, &block
37
+ html_class = options.delete :class
38
+ options = {
39
+ class: "f-dropdown content #{html_class}".strip,
40
+ data: {
41
+ dropdown_content: true
42
+ }
43
+ }.deep_merge options
44
+ content_tag :div, options, &block
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,56 @@
1
+ module Golden::Theme::Foundation
2
+ module LinkHelper
3
+ def foundation_iconed_link_to text, url, options = {}
4
+ icon_class = options.delete :icon_class
5
+ text = content_tag(:i, nil, class: icon_class) << ' ' << text
6
+ link_to text, url, options
7
+ end
8
+
9
+ def foundation_link_to_show url, options = {}
10
+ icon_class = options.delete(:icon_class) || 'fi-eye'
11
+ options = {
12
+ role: 'button',
13
+ class: 'button tiny',
14
+ icon_class: icon_class,
15
+ title: t('helpers.show')
16
+ }.deep_merge options
17
+ default_options = { }
18
+ foundation_iconed_link_to nil, url, options
19
+ end
20
+
21
+ def foundation_link_to_new url, options = {}
22
+ icon_class = options.delete(:icon_class) || 'fi-plus'
23
+ options = {
24
+ role: 'button',
25
+ class: 'button tiny',
26
+ icon_class: icon_class,
27
+ title: t('helpers.new')
28
+ }.deep_merge options
29
+ foundation_iconed_link_to nil, url, options
30
+ end
31
+
32
+ def foundation_link_to_edit url, options = {}
33
+ icon_class = options.delete(:icon_class) || 'fi-pencil'
34
+ options = {
35
+ role: 'button',
36
+ class: 'button tiny',
37
+ icon_class: icon_class,
38
+ title: t('helpers.edit')
39
+ }.deep_merge options
40
+ foundation_iconed_link_to nil, url, options
41
+ end
42
+
43
+ def foundation_link_to_destroy url, options = {}
44
+ icon_class = options.delete(:icon_class) || 'fi-trash'
45
+ options = {
46
+ method: :delete,
47
+ data: { confirm: t('helpers.are_you_sure') },
48
+ role: 'button',
49
+ class: 'button tiny',
50
+ icon_class: icon_class,
51
+ title: t('helpers.destroy')
52
+ }.deep_merge options
53
+ foundation_iconed_link_to nil, url, options
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,63 @@
1
+ require 'will_paginate/view_helpers/action_view'
2
+
3
+ # you can just use pagination with ajax or not:
4
+ #
5
+ # 1) settings for ajax pagination, ex:
6
+ #
7
+ # Golden::Theme::Foundation::LinkRenderer.link_options = {
8
+ # 'data-remote' => true,
9
+ # 'data-type' => :html,
10
+ # 'data-toggle' => 'tab',
11
+ # 'data-target' => "##{state_name}"
12
+ # }
13
+ #
14
+ # 2) use in views:
15
+ #
16
+ # will_paginate(collection, {
17
+ # renderer: Golden::Theme::Foundation::LinkRenderer,
18
+ # inner_window: 2,
19
+ # outer_window: 0,
20
+ # class: 'pagination',
21
+ # previous_label: '&larr;'.html_safe,
22
+ # next_label: '&rarr;'.html_safe
23
+ # })
24
+ #
25
+ module Golden::Theme
26
+ module Foundation
27
+ class LinkRenderer < ::WillPaginate::ActionView::LinkRenderer
28
+ cattr_accessor :link_options
29
+
30
+ protected
31
+
32
+ def html_container html
33
+ tag :ul, html, container_attributes
34
+ end
35
+
36
+ def page_number page
37
+ options = { rel: rel_value(page) }
38
+ options.deep_merge! link_options unless link_options.blank?
39
+ unless page == current_page
40
+ tag :li, link(page, page, options)
41
+ else
42
+ tag :li, link(page, nil, {}), class: 'current'
43
+ end
44
+ end
45
+
46
+ def gap
47
+ tag :li, link(super, nil), class: 'unavailable'
48
+ end
49
+
50
+ def previous_or_next_page page, text, class_name
51
+ options = {}
52
+ options.deep_merge! link_options unless link_options.blank?
53
+
54
+ class_name = "#{class_name} #{class_name[0..3]} arrow"
55
+ if page
56
+ tag :li, link(text, page, options), class: class_name
57
+ else
58
+ tag :li, link(text, nil, {}), class: class_name + ' unavailable'
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ module Golden::Theme::Foundation
2
+ module RevealModalHelper
3
+ def foundation_modal_open_link_to text, url, modal_id, options = {}
4
+ html_class = options.delete :class
5
+ options = {
6
+ remote: true,
7
+ data: {
8
+ toggle: 'modal',
9
+ reveal_id: modal_id,
10
+ type: 'html'
11
+ },
12
+ class: "modal-open #{html_class}".strip
13
+ }.deep_merge options
14
+ link_to text, url, options
15
+ end
16
+
17
+ def foundation_modal_open_iconed_link_to text, url, modal_id, options = {}
18
+ html_class = options.delete :class
19
+ options = {
20
+ remote: true,
21
+ data: {
22
+ toggle: 'modal',
23
+ reveal_id: modal_id,
24
+ type: 'html'
25
+ },
26
+ class: "modal-open #{html_class}".strip
27
+ }.deep_merge options
28
+ foundation_iconed_link_to text, url, options
29
+ end
30
+
31
+ def foundation_modal_edit_link_to url, modal_id, options = {}
32
+ html_class = options.delete :class
33
+ options = {
34
+ remote: true,
35
+ data: {
36
+ toggle: 'modal',
37
+ reveal_id: modal_id,
38
+ type: 'html'
39
+ },
40
+ class: "modal-open button #{html_class}".strip
41
+ }.deep_merge options
42
+ foundation_link_to_edit url, options
43
+ end
44
+
45
+ def foundation_modal_close_button options = {}
46
+ html_class = options.delete :class
47
+ options = {
48
+ type: 'button',
49
+ name: nil,
50
+ data: { dismiss: 'modal' },
51
+ class: "modal-close button #{html_class}".strip
52
+ }
53
+ button_tag t('helpers.close'), options
54
+ end
55
+
56
+ def foundation_modal_close_icon
57
+ options = {
58
+ class: 'close-reveal-modal'
59
+ }
60
+ link_to '&times;'.html_safe, '#', options
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,11 @@
1
+ module Golden::Theme::Foundation
2
+ module SubNavHelper
3
+ def foundation_sub_nav options = {}, &block
4
+ html_class = options.delete :class
5
+ options = {
6
+ class: "sub-nav #{html_class}".strip
7
+ }.deep_merge options
8
+ foundation_dl_tag options, &block
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,58 @@
1
+ module Golden::Theme::Foundation
2
+ module TabsHelper
3
+ def foundation_tabs options = {}, &block
4
+ html_class = options.delete :class
5
+ options = {
6
+ class: "tabs #{html_class}".strip,
7
+ data: {
8
+ tab: true
9
+ }
10
+ }.deep_merge options
11
+ foundation_dl_tag options, &block
12
+ end
13
+
14
+ def foundation_tab_nav text, tag_id, default
15
+ active = tag_id == default
16
+ dd_class = 'active' if active
17
+ options = {
18
+ data: {
19
+ toggle: 'tab',
20
+ target: "##{tag_id}"
21
+ }
22
+ }
23
+ [ link_to(text, "##{tag_id}", options), { class: dd_class } ]
24
+ end
25
+
26
+ def foundation_tab_pane tag_id, default
27
+ active = tag_id == default
28
+ tab_class = 'content'
29
+ tab_class << ' active' if active
30
+ content_tag :div, class: tab_class, id: tag_id do
31
+ yield active if block_given?
32
+ end
33
+ end
34
+
35
+ def foundation_remote_tab_nav text, url, tag_id, default
36
+ active = current_page?(url) || tag_id == default
37
+ dd_class = 'active' if active
38
+ options = {
39
+ remote: true,
40
+ data: {
41
+ toggle: 'tab',
42
+ target: "##{tag_id}",
43
+ type: 'html'
44
+ }
45
+ }
46
+ [ link_to(text, url, options), { class: dd_class } ]
47
+ end
48
+
49
+ def foundation_remote_tab_pane url, tag_id, default
50
+ active = current_page?(url) || tag_id == default
51
+ tab_class = 'content'
52
+ tab_class << ' active' if active
53
+ content_tag :div, class: tab_class, id: tag_id do
54
+ yield active if block_given?
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,16 @@
1
+ module Golden::Theme::Foundation
2
+ module TopBarHelper
3
+ def foundation_top_bar_dropdown_link_to text, url = '', options = {}
4
+ text = text.html_safe
5
+ link_to text, url, options
6
+ end
7
+
8
+ def foundation_top_bar_dropdown_ul_tag options = {}, &block
9
+ html_class = options.delete :class
10
+ options = {
11
+ class: "dropdown #{html_class}".strip
12
+ }.deep_merge options
13
+ foundation_ul_tag options, &block
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,24 @@
1
+ module Golden
2
+ module Theme
3
+ module Helpers
4
+ extend ActiveSupport::Concern
5
+
6
+ included do
7
+ hide_action :golden_theme_framework
8
+ end
9
+
10
+ def golden_theme_framework name
11
+ set_golden_theme_helpers name
12
+ end
13
+
14
+ protected
15
+
16
+ def set_golden_theme_helpers framework
17
+ path = Golden::Theme::Engine.root.join 'lib/golden/theme', framework.to_s
18
+ ApplicationController.all_helpers_from_path(path).each do |name|
19
+ self.class.helper "golden/theme/#{framework}/#{name}"
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  module Golden
2
2
  module Theme
3
- VERSION = '0.0.1'
3
+ VERSION = '0.0.2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golden-theme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2014-06-24 00:00:00.000000000 Z
11
+ date: 2014-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: compass-rails
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: bootstrap-sass
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -67,7 +81,35 @@ dependencies:
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: compass-rails
84
+ name: autoprefixer-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: foundation-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: foundation-icons-sass-rails
71
113
  requirement: !ruby/object:Gem::Requirement
72
114
  requirements:
73
115
  - - ">="
@@ -162,28 +204,34 @@ files:
162
204
  - LICENSE.txt
163
205
  - README.md
164
206
  - Rakefile
165
- - app/assets/javascripts/golden/theme/bootstrap.js
207
+ - app/assets/javascripts/golden/theme/bootstrap.js.coffee
166
208
  - app/assets/javascripts/golden/theme/bootstrap/ajax-chosen.js.coffee
167
209
  - app/assets/javascripts/golden/theme/bootstrap/ajax-tabs.js.coffee
168
210
  - app/assets/javascripts/golden/theme/bootstrap/bench-util-jquery.js.coffee
169
211
  - app/assets/javascripts/golden/theme/bootstrap/modal.js.coffee
212
+ - app/assets/javascripts/golden/theme/foundation.js.coffee
213
+ - app/assets/javascripts/golden/theme/foundation/ajax-chosen.js.coffee
214
+ - app/assets/javascripts/golden/theme/foundation/ajax-tabs.js.coffee
215
+ - app/assets/javascripts/golden/theme/foundation/bench-util-jquery.js.coffee
216
+ - app/assets/javascripts/golden/theme/foundation/modal.js.coffee
170
217
  - app/assets/stylesheets/golden/theme/bootstrap.css
171
218
  - app/assets/stylesheets/golden/theme/bootstrap/devise.css.sass
219
+ - app/assets/stylesheets/golden/theme/foundation.css.sass
220
+ - app/assets/stylesheets/golden/theme/foundation/devise.css.sass
172
221
  - app/controllers/concerns/golden/theme/bootstrap/pagination.rb
173
- - app/helpers/golden/theme/bootstrap/alert_helper.rb
174
- - app/helpers/golden/theme/bootstrap/button_helper.rb
175
- - app/helpers/golden/theme/bootstrap/common_helper.rb
176
- - app/helpers/golden/theme/bootstrap/dropdown_helper.rb
177
- - app/helpers/golden/theme/bootstrap/link_helper.rb
178
- - app/helpers/golden/theme/bootstrap/modal_helper.rb
179
- - app/helpers/golden/theme/bootstrap/tab_helper.rb
222
+ - app/controllers/concerns/golden/theme/foundation/pagination.rb
180
223
  - app/helpers/golden/theme/common_helper.rb
181
224
  - app/helpers/golden/theme/devise/user_helper.rb
182
- - app/views/application/_flash_messages.html.erb
225
+ - app/views/application/bootstrap/_flash_messages.html.erb
183
226
  - app/views/application/bootstrap/_header.html.erb
184
227
  - app/views/application/bootstrap/_main_navigation.html.erb
185
228
  - app/views/application/bootstrap/_pagination.html.erb
186
229
  - app/views/application/bootstrap/_user_navigation.html.erb
230
+ - app/views/application/foundation/_flash_messages.html.erb
231
+ - app/views/application/foundation/_header.html.erb
232
+ - app/views/application/foundation/_main_navigation.html.erb
233
+ - app/views/application/foundation/_pagination.html.erb
234
+ - app/views/application/foundation/_user_navigation.html.erb
187
235
  - config/locales/application.en.yml
188
236
  - config/locales/application.zh-TW.yml
189
237
  - config/locales/helpers.en.yml
@@ -191,8 +239,27 @@ files:
191
239
  - config/locales/will_paginate.zh-TW.yml
192
240
  - golden-theme.gemspec
193
241
  - lib/golden/theme.rb
242
+ - lib/golden/theme/bootstrap/alert_helper.rb
243
+ - lib/golden/theme/bootstrap/button_helper.rb
244
+ - lib/golden/theme/bootstrap/common_helper.rb
245
+ - lib/golden/theme/bootstrap/deprecated_helper.rb
246
+ - lib/golden/theme/bootstrap/dropdown_helper.rb
247
+ - lib/golden/theme/bootstrap/link_helper.rb
194
248
  - lib/golden/theme/bootstrap/link_renderer.rb
249
+ - lib/golden/theme/bootstrap/modal_helper.rb
250
+ - lib/golden/theme/bootstrap/tab_helper.rb
195
251
  - lib/golden/theme/engine.rb
252
+ - lib/golden/theme/foundation/alerts_helper.rb
253
+ - lib/golden/theme/foundation/buttons_helper.rb
254
+ - lib/golden/theme/foundation/common_helper.rb
255
+ - lib/golden/theme/foundation/dropdowns_helper.rb
256
+ - lib/golden/theme/foundation/link_helper.rb
257
+ - lib/golden/theme/foundation/link_renderer.rb
258
+ - lib/golden/theme/foundation/reveal_modal_helper.rb
259
+ - lib/golden/theme/foundation/sub_nav_helper.rb
260
+ - lib/golden/theme/foundation/tabs_helper.rb
261
+ - lib/golden/theme/foundation/top_bar_helper.rb
262
+ - lib/golden/theme/helpers.rb
196
263
  - lib/golden/theme/version.rb
197
264
  homepage: https://github.com/goldenio/golden-theme
198
265
  licenses: