bootstrap_leather 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +21 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +175 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/app/helpers/bootstrap_leather_helper.rb +158 -0
- data/app/views/bootstrap_leather/_alert.html.haml +5 -0
- data/app/views/bootstrap_leather/_alert_flash_messages.html.haml +4 -0
- data/app/views/bootstrap_leather/_badge.html.haml +3 -0
- data/app/views/bootstrap_leather/_dropdown_nav_item.html.haml +10 -0
- data/app/views/bootstrap_leather/_footer_javascript.html.haml +1 -0
- data/app/views/bootstrap_leather/_head_css.html.haml +1 -0
- data/app/views/bootstrap_leather/_hero_unit.html.haml +2 -0
- data/app/views/bootstrap_leather/_icon.html.haml +1 -0
- data/app/views/bootstrap_leather/_modal.html.haml +8 -0
- data/app/views/bootstrap_leather/_nav_item.html.haml +2 -0
- data/app/views/bootstrap_leather/_nav_list.html.haml +2 -0
- data/app/views/bootstrap_leather/_navbar.html.haml +10 -0
- data/app/views/bootstrap_leather/_navbar_in_container.haml +4 -0
- data/app/views/bootstrap_leather/_navbar_with_container.haml +4 -0
- data/app/views/bootstrap_leather/_tabs.html.haml +10 -0
- data/app/views/bootstrap_leather/_thumbnail.html.haml +3 -0
- data/app/views/bootstrap_leather/_widget.html.haml +3 -0
- data/app/views/bootstrap_leather/_widgets.html.haml +2 -0
- data/bin/rails +4 -0
- data/bootstrap_leather.gemspec +156 -0
- data/lib/bootstrap_leather.rb +11 -0
- data/lib/bootstrap_leather/configuration.rb +23 -0
- data/lib/bootstrap_leather/engine.rb +5 -0
- data/lib/bootstrap_leather/localization.rb +31 -0
- data/lib/bootstrap_leather/railtie.rb +9 -0
- data/lib/bootstrap_leather/version.rb +7 -0
- data/lib/generators/bootstrap_leather/install/install_generator.rb +28 -0
- data/lib/generators/bootstrap_leather/install/templates/initializer.rb +6 -0
- data/lib/generators/bootstrap_leather/utils.rb +16 -0
- data/spec/bootstrap_leather_spec.rb +7 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +15 -0
- data/spec/dummy/app/assets/javascripts/customizable_bootstrap/index.js +15 -0
- data/spec/dummy/app/assets/stylesheets/application.css.scss +15 -0
- data/spec/dummy/app/assets/stylesheets/customizable_bootstrap/colors.css.scss +100 -0
- data/spec/dummy/app/assets/stylesheets/customizable_bootstrap/font.css.scss +9 -0
- data/spec/dummy/app/assets/stylesheets/customizable_bootstrap/grid.css.scss +7 -0
- data/spec/dummy/app/assets/stylesheets/customizable_bootstrap/index.css.scss +13 -0
- data/spec/dummy/app/assets/stylesheets/customizable_bootstrap/layers.css.scss +7 -0
- data/spec/dummy/app/assets/stylesheets/customizable_bootstrap/overrides.css.scss +23 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/welcome_controller.rb +9 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/mailers/.keep +0 -0
- data/spec/dummy/app/models/.keep +0 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/views/layouts/application.html.haml +68 -0
- data/spec/dummy/app/views/welcome/index.html.haml +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/config/application.rb +28 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +23 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/bootstrap_leather.rb +6 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +56 -0
- data/spec/dummy/lib/assets/.keep +0 -0
- data/spec/dummy/log/.keep +0 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/spec_helper.rb +12 -0
- metadata +287 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NWMyNjI5ZGY0ZjBiYTgyNGZmYmU4ZTdiYTE5ODM0OGZlZDYyYjFkZQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZmI1OTY1NzNiYzRkZGFhMWRjYWEzOTgxZWI4NDVmNTU4NGQxNTdhMA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjgwMDQwMWVkODE1MjQyY2E3NjA0MTYzNGQzMGNiZTVkOTE3YjU4NWRiNDBm
|
10
|
+
NDY4MjVmMjM4NDk4OTgxZTdiMWFlNjhiMGY2MTc4Zjg0NWI5ZThkNWI4NTk2
|
11
|
+
MTY3OWJiZTI4NjJiZDljNzE3Yzc1Njg2OTVjODIyMjVjNWNhMjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZTliNDMyY2FkNTVmNmJmZDEwOWIyYWUzZmEwZDEwYmFiNjgzNTdmMTZkNmRm
|
14
|
+
MmViOWEwYWIyZWZiMTMzMjhmZTdjMmI5M2JkNzk3MTRmZWJjYzVlMDhhZGQ4
|
15
|
+
NTk1NjI3YjRiOTNjNDQ5YTBjN2VkMTRjMjliYTNiYmFjOTc0NjE=
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem 'activesupport', '>= 2.3.5'
|
5
|
+
|
6
|
+
# Add dependencies to develop your gem here.
|
7
|
+
# Include everything needed to run rake, tests, features, etc.
|
8
|
+
group :development, :test do
|
9
|
+
gem 'rspec'
|
10
|
+
gem 'shoulda-matchers'
|
11
|
+
gem 'capybara'
|
12
|
+
gem 'rdoc'
|
13
|
+
gem 'bundler'
|
14
|
+
gem 'jeweler'
|
15
|
+
gem 'puma'
|
16
|
+
gem 'customizable_bootstrap'
|
17
|
+
gem 'jquery-rails'
|
18
|
+
end
|
19
|
+
|
20
|
+
gem 'rails'
|
21
|
+
gem 'haml'
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 Sour Cherry Web
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
= BootstrapLeather
|
2
|
+
|
3
|
+
BootstrapLeather is a collection of view helpers that makes it easier to create apps using Twitter Bootstrap.
|
4
|
+
|
5
|
+
== Installation
|
6
|
+
|
7
|
+
Install the gem
|
8
|
+
gem 'bootstrap_leather'
|
9
|
+
bundle install
|
10
|
+
|
11
|
+
You will need to install bootstrap as a separate gem. I recommend my own customizable_bootstrap gem, which makes use of boostrap-sass as a backend, but provides a set of files to make modifying it easier.
|
12
|
+
|
13
|
+
== Usage Examples
|
14
|
+
|
15
|
+
=== SEO tools for head and body alike: Title, Keywords, Description, Oh My!
|
16
|
+
|
17
|
+
In your view, assuming your model implements the given methods on the Item model (otherwise, omit):
|
18
|
+
|
19
|
+
- add_title @item.title
|
20
|
+
|
21
|
+
- add_keywords @item.keywords
|
22
|
+
|
23
|
+
- add_description @item.description
|
24
|
+
|
25
|
+
- add_head_css do
|
26
|
+
= @item.css
|
27
|
+
|
28
|
+
- add_footer_javascript do
|
29
|
+
= @item.javascript
|
30
|
+
|
31
|
+
In your layout:
|
32
|
+
%head
|
33
|
+
= render_title # For the title tag, including SEO content
|
34
|
+
= render_keywords # Defaults to what you put in the config file
|
35
|
+
= render_description # Can be hooked up within a mountable rails engine, too.
|
36
|
+
= responsive_meta_tag # If you're using the responsive features, you need this in your head
|
37
|
+
|
38
|
+
<...>
|
39
|
+
|
40
|
+
= render_head_css
|
41
|
+
|
42
|
+
%body
|
43
|
+
<...>
|
44
|
+
|
45
|
+
.container
|
46
|
+
= render_h1 # For the h1 tag containing the title alone
|
47
|
+
|
48
|
+
<...>
|
49
|
+
|
50
|
+
%footer
|
51
|
+
= render_footer_javascript
|
52
|
+
|
53
|
+
=== Hero Units
|
54
|
+
|
55
|
+
To tell a view to add a hero unit, do:
|
56
|
+
- add_hero_unit do
|
57
|
+
%h1 This is a Hero Unit.
|
58
|
+
%p This is its description paragraph, which isn't very clever but at least it's not lorem ipsum.
|
59
|
+
|
60
|
+
Then put one of these somewhere in your layout:
|
61
|
+
= render_hero_unit
|
62
|
+
|
63
|
+
=== Alerts
|
64
|
+
|
65
|
+
To get all alerts, do:
|
66
|
+
= alert_flash_messages
|
67
|
+
|
68
|
+
To create one alert, do:
|
69
|
+
= alert 'alert-info', 'The message you want to alert with goes here.'
|
70
|
+
|
71
|
+
=== Widgets
|
72
|
+
|
73
|
+
To add a widget in any of your views:
|
74
|
+
- add_widget do
|
75
|
+
%h3 A widget is...
|
76
|
+
%p Not a bootstrap concept, but useful all the same.
|
77
|
+
|
78
|
+
To render the ones you have saved up:
|
79
|
+
= render_widgets
|
80
|
+
|
81
|
+
=== Modals
|
82
|
+
= modal 'Title of the modal here.' do
|
83
|
+
%p Lorem ipsum, baby.
|
84
|
+
|
85
|
+
=== Badges and Labels
|
86
|
+
= badge '25'
|
87
|
+
= label 'unread'
|
88
|
+
|
89
|
+
=== Icons
|
90
|
+
= icon 'check'
|
91
|
+
|
92
|
+
=== Navbars
|
93
|
+
For a wide navbar, try this:
|
94
|
+
|
95
|
+
= navbar_with_container :class => 'navbar-static-top navbar-inverse' do
|
96
|
+
= nav_list do
|
97
|
+
= dropdown_nav_item 'Lorem', '#' do
|
98
|
+
= nav_item 'Ipsum', '#'
|
99
|
+
= nav_item 'Dolor', '#'
|
100
|
+
= nav_item 'Sit', '#'
|
101
|
+
= nav_item 'Ipsum', '#'
|
102
|
+
= nav_item 'Dolor', '#'
|
103
|
+
= nav_item 'Sit', '#'
|
104
|
+
= nav_list :class => 'pull-right' do
|
105
|
+
= nav_item 'Amet', '#', :data => {:toggle => 'modal', :target => '#modal'}
|
106
|
+
|
107
|
+
or for a narrow one:
|
108
|
+
|
109
|
+
= navbar_in_container :class => 'navbar-static-top navbar-inverse' do
|
110
|
+
= nav_list do
|
111
|
+
= dropdown_nav_item 'Lorem', '#' do
|
112
|
+
= nav_item 'Ipsum', '#'
|
113
|
+
= nav_item 'Dolor', '#'
|
114
|
+
= nav_item 'Sit', '#'
|
115
|
+
= nav_item 'Ipsum', '#'
|
116
|
+
= nav_item 'Dolor', '#'
|
117
|
+
= nav_item 'Sit', '#'
|
118
|
+
= nav_list :class => 'pull-right' do
|
119
|
+
= nav_item 'Amet', '#'
|
120
|
+
|
121
|
+
=== Nav List
|
122
|
+
= nav_list :class => 'nav-pills' do
|
123
|
+
= nav_item 'Ipsum', '#'
|
124
|
+
= nav_item 'Dolor', '#'
|
125
|
+
= nav_item 'Sit', '#'
|
126
|
+
|
127
|
+
=== Tabs
|
128
|
+
|
129
|
+
First, add them all, then render them.
|
130
|
+
- add_tab 'First Tab' do
|
131
|
+
%p Tab contents go inside.
|
132
|
+
- add_tab 'Second Tab' do
|
133
|
+
%p Tab contents go inside here too.
|
134
|
+
- add_tab 'Third Tab' do
|
135
|
+
%p Yep, tab contents go inside.
|
136
|
+
= render_tabs 'left'
|
137
|
+
|
138
|
+
=== Thumbnail
|
139
|
+
|
140
|
+
= thumbnail link_to image_tag(image_url), path
|
141
|
+
|
142
|
+
== Great Bootstrap functionality outside the scope of this gem
|
143
|
+
|
144
|
+
The following are not covered because there are already so many wonderful resources providing this functionality.
|
145
|
+
|
146
|
+
* Bootstrap itself (I use my customizable_bootstrap, which is powered by bootstrap-sass, but you can use anything)
|
147
|
+
* Consider the possibilities:
|
148
|
+
* Any form of Bootstrap for Rails you want.
|
149
|
+
* Less
|
150
|
+
* Sass
|
151
|
+
* A themed bootstrap replacement:
|
152
|
+
* Kickstrap
|
153
|
+
* Bootswatch
|
154
|
+
* A theme generated on the fly:
|
155
|
+
* Bootstrap ThemeRoller
|
156
|
+
* Bootstrap Magic
|
157
|
+
* Jquery UI theme for bootstrap (I use jquery-ui-bootstrap-rails-asset)
|
158
|
+
* Forms (I recommend bootstrap_forms)
|
159
|
+
* Breadcrumb generation (try breadcrumbs_on_rails)
|
160
|
+
* Pagination (Try my bootstrap_pager)
|
161
|
+
|
162
|
+
== Contributing to BootstrapLeather
|
163
|
+
|
164
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
165
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
166
|
+
* Fork the project.
|
167
|
+
* Start a feature/bugfix branch.
|
168
|
+
* Commit and push until you are happy with your contribution.
|
169
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
170
|
+
* 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.
|
171
|
+
|
172
|
+
== Copyright
|
173
|
+
|
174
|
+
Copyright (c) 2013 Sour Cherry Web. See LICENSE.txt for further details.
|
175
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
17
|
+
gem.name = "bootstrap_leather"
|
18
|
+
gem.homepage = "http://github.com/nerakdon/bootstrap_leather"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{BootstrapLeather makes it easier to create apps using Twitter Bootstrap}
|
21
|
+
gem.description = %Q{BootstrapLeather is a collection of view helpers that makes it easier to create apps using Twitter Bootstrap}
|
22
|
+
gem.email = "webmaster@sourcherryweb.com"
|
23
|
+
gem.authors = ["Karen Lundgren"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rspec/core'
|
29
|
+
require 'rspec/core/rake_task'
|
30
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
31
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
32
|
+
end
|
33
|
+
|
34
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
35
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
36
|
+
spec.rcov = true
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :spec
|
40
|
+
|
41
|
+
require 'rdoc/task'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
44
|
+
|
45
|
+
rdoc.rdoc_dir = 'rdoc'
|
46
|
+
rdoc.title = "bootstrap_leather #{version}"
|
47
|
+
rdoc.rdoc_files.include('README*')
|
48
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
49
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module BootstrapLeatherHelper
|
2
|
+
|
3
|
+
def add_title(title)
|
4
|
+
@title = title
|
5
|
+
end
|
6
|
+
|
7
|
+
def add_description(description)
|
8
|
+
@description = description
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_keywords(keywords)
|
12
|
+
@keywords = keywords
|
13
|
+
end
|
14
|
+
|
15
|
+
def add_head_css(&block)
|
16
|
+
content_for :head_css, &block
|
17
|
+
end
|
18
|
+
|
19
|
+
def add_footer_javascript(&block)
|
20
|
+
content_for :footer_javascript, &block
|
21
|
+
end
|
22
|
+
|
23
|
+
def render_keywords
|
24
|
+
tag :meta, :name => :keywords, :content => @keywords || BootstrapLeather.configuration.application_keywords
|
25
|
+
end
|
26
|
+
|
27
|
+
def render_description
|
28
|
+
tag :meta, :name => :description, :content => @description || BootstrapLeather.configuration.application_keywords
|
29
|
+
end
|
30
|
+
|
31
|
+
def render_title
|
32
|
+
page_title = []
|
33
|
+
page_title << @title
|
34
|
+
page_title << BootstrapLeather.configuration.application_title
|
35
|
+
page_title << @keywords
|
36
|
+
content_tag :title, page_title.compact.join(': ')
|
37
|
+
end
|
38
|
+
|
39
|
+
def render_h1(html_options = {})
|
40
|
+
content_tag :h1, @title, html_options
|
41
|
+
end
|
42
|
+
|
43
|
+
def responsive_meta_tag
|
44
|
+
tag :meta, :name => :viewport, :content => 'width=device-width, initial-scale=1.0'
|
45
|
+
end
|
46
|
+
|
47
|
+
def flash_class(level)
|
48
|
+
case level
|
49
|
+
when :notice then 'alert-info'
|
50
|
+
when :error then 'alert-error'
|
51
|
+
when :alert then 'alert-warning'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def alert_flash_messages(html_options = {})
|
56
|
+
render(:partial => 'bootstrap_leather/alert_flash_messages', :locals => {:html_options => html_options})
|
57
|
+
end
|
58
|
+
|
59
|
+
def modal(title = '', close_text = 'Close', html_options = {}, &block)
|
60
|
+
render(:partial => 'bootstrap_leather/modal', :locals => {:close_text => close_text, :title => title, :block => capture(&block), :html_options => html_options})
|
61
|
+
end
|
62
|
+
|
63
|
+
def nav_item(text, href, options = {})
|
64
|
+
render(:partial => 'bootstrap_leather/nav_item', :locals => {:text => text, :href => href, :options => options})
|
65
|
+
end
|
66
|
+
|
67
|
+
def nav_list(html_options = {}, &block)
|
68
|
+
render(:partial => 'bootstrap_leather/nav_list', :locals => {:block => capture(&block), :html_options => html_options})
|
69
|
+
end
|
70
|
+
|
71
|
+
def navbar(html_options = {}, &block)
|
72
|
+
render(:partial => 'bootstrap_leather/navbar', :locals => {:block => capture(&block), :html_options => html_options})
|
73
|
+
end
|
74
|
+
|
75
|
+
def navbar_with_container(html_options = {}, &block)
|
76
|
+
render(:partial => 'bootstrap_leather/navbar_with_container', :locals => {:block => capture(&block), :html_options => html_options})
|
77
|
+
end
|
78
|
+
|
79
|
+
def navbar_in_container(html_options = {}, &block)
|
80
|
+
render(:partial => 'bootstrap_leather/navbar_in_container', :locals => {:block => capture(&block), :html_options => html_options})
|
81
|
+
end
|
82
|
+
|
83
|
+
def add_widget(html_options = {}, &block)
|
84
|
+
content_for :widgets do
|
85
|
+
render(:partial => 'bootstrap_leather/widget', :locals => {:block => capture(&block), :html_options => html_options})
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def add_hero_unit(&block)
|
90
|
+
content_for :hero_unit, &block
|
91
|
+
end
|
92
|
+
|
93
|
+
def dropdown_nav_item(text, href, active = false, &block)
|
94
|
+
render(:partial => 'bootstrap_leather/dropdown_nav_item', :locals => {:block => capture(&block), :text => text, :href => href, :active => active})
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_tab(label, id, args = {}, &block)
|
98
|
+
active = false
|
99
|
+
if @tabs.nil?
|
100
|
+
@tabs = []
|
101
|
+
active = true
|
102
|
+
end
|
103
|
+
before_link = args[:before_link] ? args[:before_link] : ''
|
104
|
+
@tabs << {:id => id, :label => label, :active => active, :before_link =>before_link, :content => capture(&block)}
|
105
|
+
end
|
106
|
+
|
107
|
+
def render_tabs(orientation = 'top')
|
108
|
+
html = render(:partial => 'bootstrap_leather/tabs', :locals => {:tabs => @tabs, :orientation => orientation})
|
109
|
+
@tabs = nil
|
110
|
+
html.html_safe
|
111
|
+
end
|
112
|
+
|
113
|
+
def badge(content, type)
|
114
|
+
render(:partial => 'bootstrap_leather/badge', :locals => {:content => content, :type => type})
|
115
|
+
end
|
116
|
+
|
117
|
+
def thumbnail(content = '', &block)
|
118
|
+
render(:partial => 'bootstrap_leather/thumbnail', :locals => {:content => content ? content : capture(&block)})
|
119
|
+
end
|
120
|
+
|
121
|
+
def icon(type)
|
122
|
+
render(:partial => 'bootstrap_leather/icon', :locals => {:type => type})
|
123
|
+
end
|
124
|
+
|
125
|
+
def alert(css_class, title, message = nil)
|
126
|
+
render(:partial => 'bootstrap_leather/alert', :locals => {:css_class => css_class, :title => title, :message => message})
|
127
|
+
end
|
128
|
+
|
129
|
+
def error_messages(object)
|
130
|
+
if object.try(:errors) and object.errors.full_messages.any?
|
131
|
+
title = I18n.t('bootstrap_forms.errors.header', :model => object.class.model_name.human.downcase)
|
132
|
+
message = render(:partial => 'layouts/list', :locals => {:items => object.errors.full_messages.map})
|
133
|
+
alert('alert-error', title, message).html_safe
|
134
|
+
else
|
135
|
+
'' # return empty string
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def render_widgets
|
140
|
+
render(:partial => 'bootstrap_leather/widgets')
|
141
|
+
end
|
142
|
+
|
143
|
+
def render_hero_unit
|
144
|
+
render(:partial => 'bootstrap_leather/hero_unit')
|
145
|
+
end
|
146
|
+
|
147
|
+
def render_head_css
|
148
|
+
render(:partial => 'bootstrap_leather/head_css')
|
149
|
+
end
|
150
|
+
|
151
|
+
def render_footer_javascript
|
152
|
+
render(:partial => 'bootstrap_leather/footer_javascript')
|
153
|
+
end
|
154
|
+
|
155
|
+
alias_method :nav_bar, :navbar
|
156
|
+
alias_method :nav_bar_in_container, :navbar_in_container
|
157
|
+
alias_method :nav_bar_with_container, :navbar_with_container
|
158
|
+
end
|