bootstrap_leather 0.9.4 → 0.10.4

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 (174) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -0
  3. data/.rubocop.yml +23 -0
  4. data/.rubocop_todo.yml +12 -0
  5. data/.ruby-gemset +1 -1
  6. data/.ruby-version +1 -1
  7. data/.travis.yml +5 -0
  8. data/Gemfile +40 -7
  9. data/LICENSE.txt +1 -1
  10. data/README.md +260 -0
  11. data/Rakefile +35 -20
  12. data/VERSION +1 -1
  13. data/app/helpers/bootstrap_leather/alerts_helper.rb +36 -0
  14. data/app/helpers/bootstrap_leather/application_helper.rb +21 -0
  15. data/app/helpers/bootstrap_leather/badges_helper.rb +21 -0
  16. data/app/helpers/bootstrap_leather/carousels_helper.rb +32 -0
  17. data/app/helpers/bootstrap_leather/foot_helper.rb +14 -0
  18. data/app/helpers/bootstrap_leather/grid_helper.rb +10 -0
  19. data/app/helpers/bootstrap_leather/head_helper.rb +67 -0
  20. data/app/helpers/bootstrap_leather/hero_unit_helper.rb +14 -0
  21. data/app/helpers/bootstrap_leather/icons_helper.rb +33 -0
  22. data/app/helpers/bootstrap_leather/modals_helper.rb +20 -0
  23. data/app/helpers/bootstrap_leather/navigation_helper.rb +71 -0
  24. data/app/helpers/bootstrap_leather/tabs_helper.rb +28 -0
  25. data/app/helpers/bootstrap_leather/thumbnails_helper.rb +13 -0
  26. data/app/helpers/bootstrap_leather/typography_helper.rb +38 -0
  27. data/app/helpers/bootstrap_leather/widgets_helper.rb +29 -0
  28. data/app/views/bootstrap_leather/{_alert.html.haml → alerts/_alert.html.haml} +1 -1
  29. data/app/views/bootstrap_leather/{_alert_flash_messages.html.haml → alerts/_alert_flash_messages.html.haml} +0 -0
  30. data/app/views/bootstrap_leather/{_badge.html.haml → badges/_badge.html.haml} +1 -1
  31. data/app/views/bootstrap_leather/badges/_badge_to.html.haml +3 -0
  32. data/app/views/bootstrap_leather/{_carousel.html.haml → carousels/_carousel.html.haml} +0 -0
  33. data/app/views/bootstrap_leather/{_carousel_with_thumbnails.html.haml → carousels/_carousel_with_thumbnails.html.haml} +0 -0
  34. data/app/views/bootstrap_leather/{_footer_javascript.html.haml → foot/_footer_javascript.html.haml} +0 -0
  35. data/app/views/bootstrap_leather/{_head_css.html.haml → head/_head_css.html.haml} +0 -0
  36. data/app/views/bootstrap_leather/{_hero_unit.html.haml → hero_unit/_hero_unit.html.haml} +0 -0
  37. data/app/views/bootstrap_leather/{_icon.html.haml → icons/_icon.html.haml} +0 -0
  38. data/app/views/bootstrap_leather/{_icon_button_to.html.haml → icons/_icon_button_to.html.haml} +0 -0
  39. data/app/views/bootstrap_leather/{_icon_link_to.html.haml → icons/_icon_link_to.html.haml} +0 -0
  40. data/app/views/bootstrap_leather/{_modal.html.haml → modals/_modal.html.haml} +2 -2
  41. data/app/views/bootstrap_leather/navigation/_dropdown_nav_item.html.haml +6 -0
  42. data/app/views/bootstrap_leather/navigation/_hamburger_menu.html.haml +6 -0
  43. data/app/views/bootstrap_leather/{_logo_and_title.html.haml → navigation/_logo_and_title.html.haml} +0 -0
  44. data/app/views/bootstrap_leather/{_nav_heading.html.haml → navigation/_nav_heading.html.haml} +0 -0
  45. data/app/views/bootstrap_leather/{_nav_item.html.haml → navigation/_nav_item.html.haml} +0 -0
  46. data/app/views/bootstrap_leather/{_nav_list.html.haml → navigation/_nav_list.html.haml} +0 -0
  47. data/app/views/bootstrap_leather/navigation/_navbar.html.haml +14 -0
  48. data/app/views/bootstrap_leather/navigation/_navbar_contents.html.haml +5 -0
  49. data/app/views/bootstrap_leather/tabs/_tabs.html.haml +10 -0
  50. data/app/views/bootstrap_leather/{_thumbnail.html.haml → thumbnails/_thumbnail.html.haml} +0 -0
  51. data/app/views/bootstrap_leather/{_definition_list.html.haml → typography/_dl.html.haml} +0 -0
  52. data/app/views/bootstrap_leather/{_page_header.html.haml → typography/_page_header.html.haml} +1 -1
  53. data/app/views/bootstrap_leather/widgets/_widgets.html.haml +10 -0
  54. data/bin/rails +15 -0
  55. data/bootstrap_leather.gemspec +219 -57
  56. data/config/locales/en.yml +9 -0
  57. data/lib/bootstrap_leather/configuration.rb +16 -12
  58. data/lib/bootstrap_leather/engine.rb +19 -4
  59. data/lib/bootstrap_leather/localization.rb +20 -18
  60. data/lib/bootstrap_leather/version.rb +4 -1
  61. data/lib/bootstrap_leather.rb +6 -2
  62. data/lib/generators/bootstrap_leather/install/install_generator.rb +21 -19
  63. data/lib/generators/bootstrap_leather/install/templates/initializer.rb +3 -1
  64. data/lib/generators/bootstrap_leather/utils.rb +13 -4
  65. data/lib/templates/erb/scaffold/_form.html.erb +11 -0
  66. data/lib/templates/erb/scaffold/edit.html.erb +9 -0
  67. data/lib/templates/erb/scaffold/index.html.erb +29 -0
  68. data/lib/templates/erb/scaffold/new.html.erb +7 -0
  69. data/lib/templates/erb/scaffold/show.html.erb +12 -0
  70. data/lib/templates/haml/scaffold/_form.html.haml +10 -0
  71. data/lib/templates/haml/scaffold/edit.html.haml +8 -0
  72. data/lib/templates/haml/scaffold/index.html.haml +21 -0
  73. data/lib/templates/haml/scaffold/new.html.haml +6 -0
  74. data/lib/templates/haml/scaffold/show.html.haml +10 -0
  75. data/spec/dummy/Rakefile +9 -0
  76. data/spec/dummy/app/assets/images/.keep +0 -0
  77. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  78. data/spec/dummy/app/assets/stylesheets/application.scss +19 -0
  79. data/spec/dummy/app/assets/stylesheets/bootstrap-everything.scss +54 -0
  80. data/spec/dummy/app/controllers/application_controller.rb +6 -0
  81. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  82. data/spec/dummy/app/controllers/doo_dads_controller.rb +58 -0
  83. data/spec/dummy/app/controllers/erbits_controller.rb +58 -0
  84. data/spec/dummy/app/controllers/whatzits_controller.rb +58 -0
  85. data/spec/dummy/app/helpers/application_helper.rb +4 -0
  86. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  87. data/spec/dummy/app/models/application_record.rb +5 -0
  88. data/spec/dummy/app/models/concerns/.keep +0 -0
  89. data/spec/dummy/app/models/doo_dad.rb +3 -0
  90. data/spec/dummy/app/models/erbit.rb +2 -0
  91. data/spec/dummy/app/models/whatzit.rb +2 -0
  92. data/spec/dummy/app/views/doo_dads/_form.html.haml +16 -0
  93. data/spec/dummy/app/views/doo_dads/edit.html.haml +7 -0
  94. data/spec/dummy/app/views/doo_dads/index.html.haml +23 -0
  95. data/spec/dummy/app/views/doo_dads/new.html.haml +5 -0
  96. data/spec/dummy/app/views/doo_dads/show.html.haml +12 -0
  97. data/spec/dummy/app/views/erbits/_form.html.erb +5 -0
  98. data/spec/dummy/app/views/erbits/edit.html.erb +9 -0
  99. data/spec/dummy/app/views/erbits/index.html.erb +27 -0
  100. data/spec/dummy/app/views/erbits/new.html.erb +7 -0
  101. data/spec/dummy/app/views/erbits/show.html.erb +12 -0
  102. data/spec/dummy/app/views/layouts/application.html.haml +22 -0
  103. data/spec/dummy/app/views/pages/index.html.haml +1 -0
  104. data/spec/dummy/app/views/pages/style_guide.html.haml +801 -0
  105. data/spec/dummy/app/views/whatzits/_form.html.haml +4 -0
  106. data/spec/dummy/app/views/whatzits/edit.html.haml +8 -0
  107. data/spec/dummy/app/views/whatzits/index.html.haml +19 -0
  108. data/spec/dummy/app/views/whatzits/new.html.haml +6 -0
  109. data/spec/dummy/app/views/whatzits/show.html.haml +10 -0
  110. data/spec/dummy/bin/bundle +5 -0
  111. data/spec/dummy/bin/rails +6 -0
  112. data/spec/dummy/bin/rake +6 -0
  113. data/spec/dummy/bin/setup +36 -0
  114. data/spec/dummy/bin/update +31 -0
  115. data/spec/dummy/config/application.rb +36 -0
  116. data/spec/dummy/config/boot.rb +7 -0
  117. data/spec/dummy/config/cable.yml +9 -0
  118. data/spec/dummy/config/database.yml +25 -0
  119. data/spec/dummy/config/environment.rb +7 -0
  120. data/spec/dummy/config/environments/development.rb +57 -0
  121. data/spec/dummy/config/environments/test.rb +45 -0
  122. data/spec/dummy/config/initializers/application_controller_renderer.rb +7 -0
  123. data/spec/dummy/config/initializers/assets.rb +14 -0
  124. data/spec/dummy/config/initializers/backtrace_silencers.rb +10 -0
  125. data/spec/dummy/config/initializers/bootstrap_leather.rb +9 -0
  126. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  127. data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  128. data/spec/dummy/config/initializers/high_voltage.rb +5 -0
  129. data/spec/dummy/config/initializers/inflections.rb +17 -0
  130. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  131. data/spec/dummy/config/initializers/new_framework_defaults.rb +29 -0
  132. data/spec/dummy/config/initializers/session_store.rb +5 -0
  133. data/spec/dummy/config/initializers/wrap_parameters.rb +17 -0
  134. data/spec/dummy/config/locales/en.yml +23 -0
  135. data/spec/dummy/config/puma.rb +49 -0
  136. data/spec/dummy/config/routes.rb +8 -0
  137. data/spec/dummy/config/secrets.yml +22 -0
  138. data/spec/dummy/config/spring.rb +8 -0
  139. data/spec/dummy/config.ru +7 -0
  140. data/spec/dummy/db/migrate/20170407151055_create_doo_dads.rb +10 -0
  141. data/spec/dummy/db/migrate/20170408145839_create_whatzits.rb +10 -0
  142. data/spec/dummy/db/migrate/20170408161201_create_erbits.rb +10 -0
  143. data/spec/dummy/db/schema.rb +36 -0
  144. data/spec/dummy/db/seeds.rb +7 -0
  145. data/spec/dummy/db/test.sqlite3 +0 -0
  146. data/spec/factories/doo_dad.rb +6 -0
  147. data/spec/factories/erbit.rb +6 -0
  148. data/spec/factories/whatzit.rb +6 -0
  149. data/spec/helpers/bootstrap_leather/alerts_helper_spec.rb +62 -0
  150. data/spec/helpers/bootstrap_leather/badges_helper_spec.rb +41 -0
  151. data/spec/helpers/bootstrap_leather/carousels_helper_spec.rb +44 -0
  152. data/spec/helpers/bootstrap_leather/foot_helper_spec.rb +20 -0
  153. data/spec/helpers/bootstrap_leather/grid_helper_spec.rb +10 -0
  154. data/spec/helpers/bootstrap_leather/head_helper_spec.rb +82 -0
  155. data/spec/helpers/bootstrap_leather/hero_unit_helper_spec.rb +20 -0
  156. data/spec/helpers/bootstrap_leather/icon_helper_spec.rb +48 -0
  157. data/spec/helpers/bootstrap_leather/modals_helper_spec.rb +22 -0
  158. data/spec/helpers/bootstrap_leather/navigation_helper_spec.rb +110 -0
  159. data/spec/helpers/bootstrap_leather/tabs_helper_spec.rb +39 -0
  160. data/spec/helpers/bootstrap_leather/thumbnails_helper_spec.rb +20 -0
  161. data/spec/helpers/bootstrap_leather/typography_helper_spec.rb +43 -0
  162. data/spec/helpers/bootstrap_leather/widgets_helper_spec.rb +22 -0
  163. data/spec/rails_helper.rb +88 -0
  164. data/spec/spec_helper.rb +102 -0
  165. metadata +360 -44
  166. data/.document +0 -5
  167. data/README.rdoc +0 -194
  168. data/app/helpers/bootstrap_leather_helper.rb +0 -232
  169. data/app/views/bootstrap_leather/_badge_to.html.haml +0 -4
  170. data/app/views/bootstrap_leather/_dropdown_nav_item.html.haml +0 -11
  171. data/app/views/bootstrap_leather/_navbar.html.haml +0 -39
  172. data/app/views/bootstrap_leather/_tabs.html.haml +0 -10
  173. data/app/views/bootstrap_leather/_widgets.html.haml +0 -9
  174. data/lib/bootstrap_leather/railtie.rb +0 -9
data/README.rdoc DELETED
@@ -1,194 +0,0 @@
1
- = BootstrapLeather
2
-
3
- <b>Updated for Rails 5</b>
4
-
5
- {<img src="https://badge.fury.io/rb/bootstrap_leather.svg" alt="Gem Version" />}[http://badge.fury.io/rb/bootstrap_leather]
6
- {<img src="https://travis-ci.org/gemvein/bootstrap_leather.svg?branch=v0.2.3" alt="Build Status" />}[https://travis-ci.org/gemvein/bootstrap_leather]
7
- {<img src="https://coveralls.io/repos/gemvein/bootstrap_leather/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/gemvein/bootstrap_leather]
8
-
9
-
10
- BootstrapLeather is a collection of view helpers that makes it easier to create apps using Twitter Bootstrap.
11
-
12
- == Installation
13
-
14
- Install the gem
15
- gem 'bootstrap_leather'
16
- bundle install
17
-
18
- You will need to install bootstrap as a separate gem.
19
-
20
- == Usage Examples
21
-
22
- === SEO tools for head and body alike: Title, Keywords, Description, Oh My!
23
-
24
- In your view, assuming your model implements the given methods on the Item model (otherwise, omit):
25
-
26
- - add_title @item.title
27
-
28
- - add_keywords @item.keywords
29
-
30
- - add_description @item.description
31
-
32
- - add_head_css do
33
- = @item.css
34
-
35
- - add_footer_javascript do
36
- = @item.javascript
37
-
38
- In your layout:
39
- %head
40
- = render_title # For the title tag, including SEO content
41
- = render_keywords # Defaults to what you put in the config file
42
- = render_description # Can be hooked up within a mountable rails engine, too.
43
- = responsive_meta_tag # If you're using the responsive features, you need this in your head
44
-
45
- <...>
46
-
47
- = render_head_css
48
-
49
- %body
50
- <...>
51
-
52
- .container
53
- = render_h1 # For the h1 tag containing the title alone
54
-
55
- <...>
56
-
57
- %footer
58
- = render_footer_javascript
59
-
60
- === Hero Units
61
-
62
- To tell a view to add a hero unit, do:
63
- - add_hero_unit do
64
- %h1 This is a Hero Unit.
65
- %p This is its description paragraph, which isn't very clever but at least it's not lorem ipsum.
66
-
67
- Then put one of these somewhere in your layout:
68
- = render_hero_unit
69
-
70
- === Alerts
71
-
72
- To get all alerts, do:
73
- = alert_flash_messages
74
-
75
- To create one alert, do:
76
- = alert 'info', 'The message you want to alert with goes here.'
77
-
78
- === Widgets
79
-
80
- To add a widget in any of your views:
81
- - add_widget do
82
- %h3 A widget is...
83
- %p Not a bootstrap concept, but useful all the same.
84
-
85
- To render the ones you have saved up:
86
- = render_widgets 'md', 3
87
-
88
- === Modals
89
- = modal 'css-id', 'Title of the modal here.' do
90
- %p Lorem ipsum, baby.
91
-
92
- === Badges and Labels
93
- = badge '25'
94
- = label 'unread'
95
-
96
- === Icons
97
- = icon 'check'
98
- = icon_link_to 'check', 'Link Text', link_path
99
- = icon_button_to 'success', 'check', 'Link Text', link_path
100
-
101
- === Navbars
102
-
103
- :container_mode is optional and defaults to :none. Can be one of: [:none, :inside, :outside]
104
- For a wide navbar, try this:
105
-
106
- = navbar :container_mode => :outside, :class => 'navbar-inverse' do
107
- = nav_list do
108
- = dropdown_nav_item 'Lorem', '#' do
109
- = nav_item 'Ipsum', '#'
110
- = nav_item 'Dolor', '#'
111
- = nav_item 'Sit', '#'
112
- = nav_item 'Ipsum', '#'
113
- = nav_item 'Dolor', '#'
114
- = nav_item 'Sit', '#'
115
- = nav_list :class => 'navbar-right' do
116
- = nav_item 'Amet', '#', :data => {:toggle => 'modal', :target => '#modal'}
117
-
118
- === Nav List
119
- = nav_list :class => 'nav-pills' do
120
- = nav_item 'Ipsum', '#'
121
- = nav_item 'Dolor', '#'
122
- = nav_item 'Sit', '#'
123
-
124
- === Tabs
125
-
126
- First, add them all, then render them.
127
- - add_tab 'First Tab', 'first-tab' do
128
- %p Tab contents go inside.
129
- - add_tab 'Second Tab', 'second-tab' do
130
- %p Tab contents go inside here too.
131
- - add_tab 'Third Tab', 'third-tab' do
132
- %p Yep, tab contents go inside.
133
- = render_tabs 'left'
134
-
135
- === Carousel
136
-
137
- Pass in an id string, items and a block for each slide:
138
- = carousel 'css-id-for-carousel', @items do |item|
139
- .carousel-caption
140
- %h3= item.title
141
- %p= item.description
142
- = image_tag item.image.url(:large)
143
-
144
- === Carousel with Thumbnails
145
-
146
- Pass in an id string, items and a block for each slide:
147
- = carousel_with_thumbnails 'css-id-for-carousel', @items do |item|
148
- .carousel-caption
149
- %h3= item.title
150
- %p= item.description
151
- = image_tag item.image.url(:large), data: { thumbnail: item.image.url(:thumb) }
152
-
153
- === Thumbnail
154
-
155
- = thumbnail link_to image_tag(image_url), path
156
-
157
- === Definition Lists
158
-
159
- = dl hash_of_terms_and_definitions_or_definition_arrays
160
-
161
- == Great Bootstrap functionality outside the scope of this gem
162
-
163
- The following are not covered because there are already so many wonderful resources providing this functionality.
164
-
165
- * Bootstrap itself (I use my customizable_bootstrap, which is powered by bootstrap-sass, but you can use anything)
166
- * Consider the possibilities:
167
- * Any form of Bootstrap for Rails you want.
168
- * Less
169
- * Sass
170
- * A themed bootstrap replacement:
171
- * Kickstrap
172
- * Bootswatch
173
- * A theme generated on the fly:
174
- * Bootstrap ThemeRoller
175
- * Bootstrap Magic
176
- * Jquery UI theme for bootstrap (I use jquery-ui-bootstrap-rails-asset)
177
- * Forms (I recommend bootstrap_forms)
178
- * Breadcrumb generation (try breadcrumbs_on_rails)
179
- * Pagination (Try my bootstrap_pager)
180
-
181
- == Contributing to BootstrapLeather
182
-
183
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
184
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
185
- * Fork the project.
186
- * Start a feature/bugfix branch.
187
- * Commit and push until you are happy with your contribution.
188
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
189
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
190
-
191
- == Copyright
192
-
193
- Copyright (c) 2013-2015 Gem Vein. See LICENSE.txt for further details.
194
-
@@ -1,232 +0,0 @@
1
- module BootstrapLeatherHelper
2
-
3
- def add_title(title)
4
- content_for :title, title
5
- end
6
-
7
- def add_subtitle(subtitle)
8
- content_for :subtitle, subtitle
9
- end
10
-
11
- def add_description(description)
12
- content_for :description, description
13
- end
14
-
15
- def add_keywords(keywords)
16
- content_for :keywords, keywords
17
- end
18
-
19
- def add_head_css(&block)
20
- content_for :head_css, &block
21
- end
22
-
23
- def add_footer_javascript(&block)
24
- content_for :footer_javascript, &block
25
- end
26
-
27
- def render_keywords
28
- tag :meta, :name => :keywords, :content => content_for(:keywords) || BootstrapLeather.configuration.application_keywords
29
- end
30
-
31
- def render_description
32
- tag :meta, :name => :description, :content => content_for(:description) || BootstrapLeather.configuration.application_keywords
33
- end
34
-
35
- def render_title
36
- page_title = []
37
- page_title << content_for(:title)
38
- page_title << content_for(:subtitle)
39
- page_title << BootstrapLeather.configuration.application_title
40
- page_title << content_for(:keywords)
41
- content_tag :title, CGI.unescapeHTML(page_title.compact.join(': '))
42
- end
43
-
44
- def render_h1(html_options = {})
45
- page_title = []
46
- page_title << content_for(:title)
47
- if content_for(:subtitle)
48
- page_title << content_tag(:small, content_for(:subtitle))
49
- end
50
- content_tag :h1, page_title.compact.join(' ').html_safe, html_options
51
- end
52
-
53
- def render_page_header(html_options = {})
54
- render(:partial => 'bootstrap_leather/page_header', :locals => {:title => content_for(:title), :subtitle => content_for(:subtitle), :html_options => html_options})
55
- end
56
-
57
- def responsive_meta_tag
58
- tag :meta, :name => :viewport, :content => 'width=device-width, initial-scale=1.0'
59
- end
60
-
61
- def flash_class(level)
62
- case level
63
- when :notice then 'info'
64
- when :error then 'danger'
65
- when :alert then 'warning'
66
- end
67
- end
68
-
69
- def alert_flash_messages(html_options = {})
70
- render(:partial => 'bootstrap_leather/alert_flash_messages', :locals => {:html_options => html_options})
71
- end
72
-
73
- def modal(id, title = '', close_text = 'Close', html_options = {}, &block)
74
- render(:partial => 'bootstrap_leather/modal', :locals => {:id => id, :close_text => close_text, :title => title, :block => capture(&block), :html_options => html_options})
75
- end
76
-
77
- def nav_item(text, href, options = {})
78
- render(:partial => 'bootstrap_leather/nav_item', :locals => {:text => text, :href => href, :options => options})
79
- end
80
-
81
- def nav_heading(text, options = {})
82
- render(:partial => 'bootstrap_leather/nav_heading', :locals => {:text => text, :options => options})
83
- end
84
-
85
- def nav_list(html_options = {}, &block)
86
- render(:partial => 'bootstrap_leather/nav_list', :locals => {:block => capture(&block), :html_options => html_options})
87
- end
88
-
89
- def navbar(html_options = {}, &block)
90
- container_mode = html_options[:container_mode]
91
- html_options[:container_mode] = nil
92
- render(:partial => 'bootstrap_leather/navbar', :locals => { :block => capture(&block), :html_options => html_options, :container_mode => container_mode })
93
- end
94
-
95
- def navbar_with_container(html_options = {}, &block)
96
- html_options[:container_mode] = :with
97
- navbar(html_options, &block)
98
- end
99
-
100
- def navbar_in_container(html_options = {}, &block)
101
- html_options[:container_mode] = :in
102
- navbar(html_options, &block)
103
- end
104
-
105
- def add_widget(html_options = {}, &block)
106
- @widgets ||= []
107
- @widgets << { html_options: html_options, body: capture(&block) }
108
- end
109
-
110
- def widgets
111
- mine = @widgets
112
- @widgets = nil
113
- mine
114
- end
115
-
116
- def render_widgets(device_class = 'md', column_width = 3)
117
- html = render(:partial => 'bootstrap_leather/widgets', :locals => {:widgets => widgets, :column_width => column_width, :device_class => device_class})
118
- html.html_safe
119
- end
120
-
121
- def add_hero_unit(&block)
122
- content_for :hero_unit, &block
123
- end
124
-
125
- def dropdown_nav_item(text, href, active = false, &block)
126
- render(:partial => 'bootstrap_leather/dropdown_nav_item', :locals => {:block => capture(&block), :text => text, :href => href, :active => active})
127
- end
128
-
129
- def add_tab(label, id, args = {}, &block)
130
- active = false
131
- if @tabs.nil?
132
- @tabs = []
133
- active = true
134
- end
135
- before_link = args[:before_link] ? args[:before_link] : ''
136
- @tabs << {:id => id, :label => label, :active => active, :before_link =>before_link, :content => capture(&block)}
137
- end
138
-
139
- def render_tabs(orientation = 'top')
140
- html = render(:partial => 'bootstrap_leather/tabs', :locals => {:tabs => @tabs, :orientation => orientation})
141
- @tabs = nil
142
- html.html_safe
143
- end
144
-
145
- def badge_to(text, value, link, html_options={})
146
- html_options[:href] = url_for link
147
- render(:partial => 'bootstrap_leather/badge_to', :locals => {:text => text, :value => value, :html_options => html_options})
148
- end
149
-
150
- def badge(content, type = nil)
151
- render(:partial => 'bootstrap_leather/badge', :locals => {:content => content, :type => type})
152
- end
153
-
154
- def thumbnail(content = '', &block)
155
- render(:partial => 'bootstrap_leather/thumbnail', :locals => {:content => content ? content : capture(&block)})
156
- end
157
-
158
- def icon_link_to(icon_type, text, link, html_options={})
159
- render(:partial => 'bootstrap_leather/icon_link_to', :locals => {:icon_type => icon_type, :text => text, :link => link, :html_options => html_options})
160
- end
161
-
162
- def icon_button_to(button_class, icon_type, text, link, html_options={})
163
- html_options[:class] = 'btn btn-' + button_class
164
- render(:partial => 'bootstrap_leather/icon_button_to', :locals => {:button_class => button_class, :icon_type => icon_type, :text => text, :link => link, :html_options => html_options})
165
- end
166
-
167
- def icon(type)
168
- render(:partial => 'bootstrap_leather/icon', :locals => {:type => type})
169
- end
170
-
171
- def logo_and_title
172
- render(:partial => 'bootstrap_leather/logo_and_title')
173
- end
174
-
175
- def alert(css_class, title, message = nil)
176
- render(:partial => 'bootstrap_leather/alert', :locals => {:css_class => css_class, :title => title, :message => message})
177
- end
178
-
179
- def error_messages(object)
180
- if object.try(:errors) and object.errors.full_messages.any?
181
- title = I18n.t('bootstrap_forms.errors.header', :model => object.class.model_name.human.downcase)
182
- message = content_tag(:ul) do
183
- object.errors.full_messages.map.each do |item|
184
- concat content_tag(:li, item)
185
- end
186
- end
187
- alert('alert-error', title, message).html_safe
188
- else
189
- '' # return empty string
190
- end
191
- end
192
-
193
- def render_hero_unit
194
- render(:partial => 'bootstrap_leather/hero_unit')
195
- end
196
-
197
- def render_head_css
198
- render(:partial => 'bootstrap_leather/head_css')
199
- end
200
-
201
- def render_footer_javascript
202
- render(:partial => 'bootstrap_leather/footer_javascript')
203
- end
204
-
205
- def column_class(device_class, column_width)
206
- 'col-' + device_class + '-' + column_width.to_s
207
- end
208
-
209
- def definition_list(list, html_options = {})
210
- render(:partial => 'bootstrap_leather/definition_list', :locals => {:list => list, :html_options => html_options})
211
- end
212
-
213
- def carousel(id, items, html_options = {}, &block)
214
- html_options[:id] = id
215
- html_options[:data] ||= {}
216
- html_options[:data][:ride] = 'carousel'
217
- render(:partial => 'bootstrap_leather/carousel', :locals => { :id => id, :slides => items.collect { |item| capture(item, &block) }, :html_options => html_options })
218
- end
219
-
220
- def carousel_with_thumbnails(id, items, html_options = {}, &block)
221
- html_options[:id] = id
222
- html_options[:data] ||= {}
223
- html_options[:data][:ride] = 'carousel'
224
- render(:partial => 'bootstrap_leather/carousel_with_thumbnails', :locals => { :id => id, :slides => items.collect { |item| capture(item, &block) }, :html_options => html_options })
225
- end
226
-
227
-
228
- alias_method :dl, :definition_list
229
- alias_method :nav_bar, :navbar
230
- alias_method :nav_bar_in_container, :navbar_in_container
231
- alias_method :nav_bar_with_container, :navbar_with_container
232
- end
@@ -1,4 +0,0 @@
1
- %a{html_options}
2
- = text
3
- %span.badge
4
- = value.to_s
@@ -1,11 +0,0 @@
1
- - id = Time.now.to_f
2
- - if active
3
- - css_class = 'active'
4
- - else
5
- - css_class = ''
6
- %li{:class => 'dropdown ' + css_class}
7
- %a.dropdown-toggle{:id => id, :href=>href, :data => {:toggle => 'dropdown'}, :role => 'button', aria: { expanded: false } }
8
- = text
9
- %b.caret
10
- %ul.dropdown-menu{:role => 'menu', :aria => {:labelledby => id}}
11
- = block
@@ -1,39 +0,0 @@
1
- - case container_mode
2
- - when :with, :inside
3
- %nav.navbar.navbar-default{ html_options }
4
- .container
5
- .navbar-header
6
- %button.navbar-toggle.collapsed{data:{toggle:'collapse', target:'#navbar-to-collapse'},type:'button'}
7
- %span.sr-only
8
- Toggle navigation
9
- %span.icon-bar
10
- %span.icon-bar
11
- %span.icon-bar
12
- = link_to logo_and_title, BootstrapLeather.configuration.application_path, :class => 'navbar-brand'
13
- .collapse.navbar-collapse#navbar-to-collapse
14
- = block
15
- - when :in, :outside
16
- .container
17
- %nav.navbar.navbar-default{ html_options }
18
- .navbar-header
19
- %button.navbar-toggle.collapsed{data:{toggle:'collapse', target:'#navbar-to-collapse'},type:'button'}
20
- %span.sr-only
21
- Toggle navigation
22
- %span.icon-bar
23
- %span.icon-bar
24
- %span.icon-bar
25
- = link_to logo_and_title, BootstrapLeather.configuration.application_path, :class => 'navbar-brand'
26
- .collapse.navbar-collapse#navbar-to-collapse
27
- = block
28
- - else
29
- %nav.navbar.navbar-default{ html_options }
30
- .navbar-header
31
- %button.navbar-toggle.collapsed{data:{toggle:'collapse', target:'#navbar-to-collapse'},type:'button'}
32
- %span.sr-only
33
- Toggle navigation
34
- %span.icon-bar
35
- %span.icon-bar
36
- %span.icon-bar
37
- = link_to logo_and_title, BootstrapLeather.configuration.application_path, :class => 'navbar-brand'
38
- .collapse.navbar-collapse#navbar-to-collapse
39
- = block
@@ -1,10 +0,0 @@
1
- %div{:class => 'tabbable tabs-' + orientation}
2
- %ul.nav.nav-tabs
3
- - for tab in tabs
4
- %li{:class => tab[:active] ? 'active' : ''}
5
- = tab[:before_link]
6
- = link_to tab[:label].html_safe, '#' + tab[:id], :data => {:toggle => 'tab'}
7
- .tab-content
8
- - for tab in tabs
9
- %div{:id => tab[:id], :class => tab[:active] ? 'tab-pane active' : 'tab-pane'}
10
- =tab[:content].html_safe
@@ -1,9 +0,0 @@
1
- - unless widgets.nil?
2
- - for widget in widgets
3
- - html_options = widget[:html_options]
4
- - content_class = html_options[:content_class]
5
- - html_options[:content_class] = nil
6
- - html_options[:class] = 'column ' + column_class(device_class, column_width)
7
- %div{ html_options }
8
- %div{:class => "well #{content_class}"}
9
- =widget[:body]
@@ -1,9 +0,0 @@
1
- module BootstrapLeather
2
- class Railtie < Rails::Railtie
3
- initializer 'bootstrap_leather.add_view_paths', :after => :add_view_paths do |app|
4
- ActiveSupport.on_load(:action_controller) do
5
- prepend_view_path app.root.join('/app/views/bootstrap_leather').to_s
6
- end
7
- end
8
- end
9
- end