bootstrap_leather 0.9.4 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/.rubocop.yml +23 -0
- data/.rubocop_todo.yml +12 -0
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +5 -0
- data/Gemfile +40 -7
- data/LICENSE.txt +1 -1
- data/README.md +260 -0
- data/Rakefile +35 -20
- data/VERSION +1 -1
- data/app/helpers/bootstrap_leather/alerts_helper.rb +36 -0
- data/app/helpers/bootstrap_leather/application_helper.rb +21 -0
- data/app/helpers/bootstrap_leather/badges_helper.rb +21 -0
- data/app/helpers/bootstrap_leather/carousels_helper.rb +32 -0
- data/app/helpers/bootstrap_leather/foot_helper.rb +14 -0
- data/app/helpers/bootstrap_leather/grid_helper.rb +10 -0
- data/app/helpers/bootstrap_leather/head_helper.rb +67 -0
- data/app/helpers/bootstrap_leather/hero_unit_helper.rb +14 -0
- data/app/helpers/bootstrap_leather/icons_helper.rb +33 -0
- data/app/helpers/bootstrap_leather/modals_helper.rb +20 -0
- data/app/helpers/bootstrap_leather/navigation_helper.rb +71 -0
- data/app/helpers/bootstrap_leather/tabs_helper.rb +28 -0
- data/app/helpers/bootstrap_leather/thumbnails_helper.rb +13 -0
- data/app/helpers/bootstrap_leather/typography_helper.rb +38 -0
- data/app/helpers/bootstrap_leather/widgets_helper.rb +29 -0
- data/app/views/bootstrap_leather/{_alert.html.haml → alerts/_alert.html.haml} +1 -1
- data/app/views/bootstrap_leather/{_alert_flash_messages.html.haml → alerts/_alert_flash_messages.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_badge.html.haml → badges/_badge.html.haml} +1 -1
- data/app/views/bootstrap_leather/badges/_badge_to.html.haml +3 -0
- data/app/views/bootstrap_leather/{_carousel.html.haml → carousels/_carousel.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_carousel_with_thumbnails.html.haml → carousels/_carousel_with_thumbnails.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_footer_javascript.html.haml → foot/_footer_javascript.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_head_css.html.haml → head/_head_css.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_hero_unit.html.haml → hero_unit/_hero_unit.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_icon.html.haml → icons/_icon.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_icon_button_to.html.haml → icons/_icon_button_to.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_icon_link_to.html.haml → icons/_icon_link_to.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_modal.html.haml → modals/_modal.html.haml} +2 -2
- data/app/views/bootstrap_leather/navigation/_dropdown_nav_item.html.haml +6 -0
- data/app/views/bootstrap_leather/navigation/_hamburger_menu.html.haml +6 -0
- data/app/views/bootstrap_leather/{_logo_and_title.html.haml → navigation/_logo_and_title.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_nav_heading.html.haml → navigation/_nav_heading.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_nav_item.html.haml → navigation/_nav_item.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_nav_list.html.haml → navigation/_nav_list.html.haml} +0 -0
- data/app/views/bootstrap_leather/navigation/_navbar.html.haml +14 -0
- data/app/views/bootstrap_leather/navigation/_navbar_contents.html.haml +5 -0
- data/app/views/bootstrap_leather/tabs/_tabs.html.haml +10 -0
- data/app/views/bootstrap_leather/{_thumbnail.html.haml → thumbnails/_thumbnail.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_definition_list.html.haml → typography/_dl.html.haml} +0 -0
- data/app/views/bootstrap_leather/{_page_header.html.haml → typography/_page_header.html.haml} +1 -1
- data/app/views/bootstrap_leather/widgets/_widgets.html.haml +10 -0
- data/bin/rails +15 -0
- data/bootstrap_leather.gemspec +219 -57
- data/config/locales/en.yml +9 -0
- data/lib/bootstrap_leather/configuration.rb +16 -12
- data/lib/bootstrap_leather/engine.rb +19 -4
- data/lib/bootstrap_leather/localization.rb +20 -18
- data/lib/bootstrap_leather/version.rb +4 -1
- data/lib/bootstrap_leather.rb +6 -2
- data/lib/generators/bootstrap_leather/install/install_generator.rb +21 -19
- data/lib/generators/bootstrap_leather/install/templates/initializer.rb +3 -1
- data/lib/generators/bootstrap_leather/utils.rb +13 -4
- data/lib/templates/erb/scaffold/_form.html.erb +11 -0
- data/lib/templates/erb/scaffold/edit.html.erb +9 -0
- data/lib/templates/erb/scaffold/index.html.erb +29 -0
- data/lib/templates/erb/scaffold/new.html.erb +7 -0
- data/lib/templates/erb/scaffold/show.html.erb +12 -0
- data/lib/templates/haml/scaffold/_form.html.haml +10 -0
- data/lib/templates/haml/scaffold/edit.html.haml +8 -0
- data/lib/templates/haml/scaffold/index.html.haml +21 -0
- data/lib/templates/haml/scaffold/new.html.haml +6 -0
- data/lib/templates/haml/scaffold/show.html.haml +10 -0
- data/spec/dummy/Rakefile +9 -0
- data/spec/dummy/app/assets/images/.keep +0 -0
- data/spec/dummy/app/assets/javascripts/application.js +16 -0
- data/spec/dummy/app/assets/stylesheets/application.scss +19 -0
- data/spec/dummy/app/assets/stylesheets/bootstrap-everything.scss +54 -0
- data/spec/dummy/app/controllers/application_controller.rb +6 -0
- data/spec/dummy/app/controllers/concerns/.keep +0 -0
- data/spec/dummy/app/controllers/doo_dads_controller.rb +58 -0
- data/spec/dummy/app/controllers/erbits_controller.rb +58 -0
- data/spec/dummy/app/controllers/whatzits_controller.rb +58 -0
- data/spec/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/dummy/app/mailers/application_mailer.rb +6 -0
- data/spec/dummy/app/models/application_record.rb +5 -0
- data/spec/dummy/app/models/concerns/.keep +0 -0
- data/spec/dummy/app/models/doo_dad.rb +3 -0
- data/spec/dummy/app/models/erbit.rb +2 -0
- data/spec/dummy/app/models/whatzit.rb +2 -0
- data/spec/dummy/app/views/doo_dads/_form.html.haml +16 -0
- data/spec/dummy/app/views/doo_dads/edit.html.haml +7 -0
- data/spec/dummy/app/views/doo_dads/index.html.haml +23 -0
- data/spec/dummy/app/views/doo_dads/new.html.haml +5 -0
- data/spec/dummy/app/views/doo_dads/show.html.haml +12 -0
- data/spec/dummy/app/views/erbits/_form.html.erb +5 -0
- data/spec/dummy/app/views/erbits/edit.html.erb +9 -0
- data/spec/dummy/app/views/erbits/index.html.erb +27 -0
- data/spec/dummy/app/views/erbits/new.html.erb +7 -0
- data/spec/dummy/app/views/erbits/show.html.erb +12 -0
- data/spec/dummy/app/views/layouts/application.html.haml +22 -0
- data/spec/dummy/app/views/pages/index.html.haml +1 -0
- data/spec/dummy/app/views/pages/style_guide.html.haml +801 -0
- data/spec/dummy/app/views/whatzits/_form.html.haml +4 -0
- data/spec/dummy/app/views/whatzits/edit.html.haml +8 -0
- data/spec/dummy/app/views/whatzits/index.html.haml +19 -0
- data/spec/dummy/app/views/whatzits/new.html.haml +6 -0
- data/spec/dummy/app/views/whatzits/show.html.haml +10 -0
- data/spec/dummy/bin/bundle +5 -0
- data/spec/dummy/bin/rails +6 -0
- data/spec/dummy/bin/rake +6 -0
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/config/application.rb +36 -0
- data/spec/dummy/config/boot.rb +7 -0
- data/spec/dummy/config/cable.yml +9 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +7 -0
- data/spec/dummy/config/environments/development.rb +57 -0
- data/spec/dummy/config/environments/test.rb +45 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +7 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +10 -0
- data/spec/dummy/config/initializers/bootstrap_leather.rb +9 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/dummy/config/initializers/high_voltage.rb +5 -0
- data/spec/dummy/config/initializers/inflections.rb +17 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/new_framework_defaults.rb +29 -0
- data/spec/dummy/config/initializers/session_store.rb +5 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +17 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/puma.rb +49 -0
- data/spec/dummy/config/routes.rb +8 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config/spring.rb +8 -0
- data/spec/dummy/config.ru +7 -0
- data/spec/dummy/db/migrate/20170407151055_create_doo_dads.rb +10 -0
- data/spec/dummy/db/migrate/20170408145839_create_whatzits.rb +10 -0
- data/spec/dummy/db/migrate/20170408161201_create_erbits.rb +10 -0
- data/spec/dummy/db/schema.rb +36 -0
- data/spec/dummy/db/seeds.rb +7 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/factories/doo_dad.rb +6 -0
- data/spec/factories/erbit.rb +6 -0
- data/spec/factories/whatzit.rb +6 -0
- data/spec/helpers/bootstrap_leather/alerts_helper_spec.rb +62 -0
- data/spec/helpers/bootstrap_leather/badges_helper_spec.rb +41 -0
- data/spec/helpers/bootstrap_leather/carousels_helper_spec.rb +44 -0
- data/spec/helpers/bootstrap_leather/foot_helper_spec.rb +20 -0
- data/spec/helpers/bootstrap_leather/grid_helper_spec.rb +10 -0
- data/spec/helpers/bootstrap_leather/head_helper_spec.rb +82 -0
- data/spec/helpers/bootstrap_leather/hero_unit_helper_spec.rb +20 -0
- data/spec/helpers/bootstrap_leather/icon_helper_spec.rb +48 -0
- data/spec/helpers/bootstrap_leather/modals_helper_spec.rb +22 -0
- data/spec/helpers/bootstrap_leather/navigation_helper_spec.rb +110 -0
- data/spec/helpers/bootstrap_leather/tabs_helper_spec.rb +39 -0
- data/spec/helpers/bootstrap_leather/thumbnails_helper_spec.rb +20 -0
- data/spec/helpers/bootstrap_leather/typography_helper_spec.rb +43 -0
- data/spec/helpers/bootstrap_leather/widgets_helper_spec.rb +22 -0
- data/spec/rails_helper.rb +88 -0
- data/spec/spec_helper.rb +102 -0
- metadata +360 -44
- data/.document +0 -5
- data/README.rdoc +0 -194
- data/app/helpers/bootstrap_leather_helper.rb +0 -232
- data/app/views/bootstrap_leather/_badge_to.html.haml +0 -4
- data/app/views/bootstrap_leather/_dropdown_nav_item.html.haml +0 -11
- data/app/views/bootstrap_leather/_navbar.html.haml +0 -39
- data/app/views/bootstrap_leather/_tabs.html.haml +0 -10
- data/app/views/bootstrap_leather/_widgets.html.haml +0 -9
- data/lib/bootstrap_leather/railtie.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 335cfc7ce18e6d988f758473bd419de3570a9bcb
|
4
|
+
data.tar.gz: fa6f427d35a840643596e2a42182b3b4314564cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0a4b2b9cf185d0f5909716edb93304934054711a8395cf7cbe67f63215952b74dcf58a9a9ae94531e807b697aaad70d33c34777758ce113b56d40da2bcb6a82
|
7
|
+
data.tar.gz: d8e3ccc4c471eb7096c906316b5d21806a627d3350e0a97a75e871a1970a0a8fa26fee9c18b778b4aa47d511ffd89c16c9bb6a8e13498a505df665b4405524b1
|
data/.rspec
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.3.1
|
5
|
+
DisplayCopNames: true
|
6
|
+
Exclude:
|
7
|
+
- bootstrap_leather.gemspec
|
8
|
+
- spec/dummy/db/schema.rb
|
9
|
+
- spec/dummy/db/migrate/*
|
10
|
+
|
11
|
+
Metrics/BlockLength:
|
12
|
+
Exclude:
|
13
|
+
- config/routes.rb
|
14
|
+
- spec/*
|
15
|
+
- spec/*/*
|
16
|
+
- spec/*/*/*
|
17
|
+
- spec/dummy/db/seeds/*
|
18
|
+
|
19
|
+
Metrics/ModuleLength:
|
20
|
+
Exclude:
|
21
|
+
- spec/*
|
22
|
+
- spec/*/*
|
23
|
+
- spec/*/*/*
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2017-04-06 19:45:20 -0600 using RuboCop version 0.48.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# Configuration parameters: CountComments.
|
11
|
+
Metrics/ModuleLength:
|
12
|
+
Max: 302
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
bootstrap_leather
|
1
|
+
bootstrap_leather
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.1
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,9 +1,42 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# gem 'activesupport', '>= 2.3.5'
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source 'https://rubygems.org'
|
5
4
|
|
6
|
-
gem 'bootstrap-sass', '>= 3.1', '< 4'
|
7
5
|
gem 'rails', '>= 4', '< 6'
|
8
|
-
gem '
|
9
|
-
|
6
|
+
gem 'rails-i18n', '>= 4', '< 6'
|
7
|
+
|
8
|
+
gem 'haml-rails', '~> 0.9'
|
9
|
+
gem 'jquery-rails', '~> 4'
|
10
|
+
|
11
|
+
gem 'bootstrap_form', '~> 2'
|
12
|
+
|
13
|
+
group :development do
|
14
|
+
gem 'bundler', '~> 1.0'
|
15
|
+
gem 'juwelier', '~> 2'
|
16
|
+
gem 'rspec', '~> 3.5.0'
|
17
|
+
gem 'rubocop', '>= 0.48', require: false
|
18
|
+
end
|
19
|
+
|
20
|
+
group :development, :test do
|
21
|
+
gem 'bootstrap-sass', '~> 3.3'
|
22
|
+
gem 'byebug', '~> 9'
|
23
|
+
gem 'factory_girl_rails', '~> 4.5'
|
24
|
+
gem 'faker', '~> 1.4'
|
25
|
+
gem 'high_voltage', '~> 3'
|
26
|
+
gem 'rspec-its', '>= 1'
|
27
|
+
gem 'rspec-rails', '~> 3.5'
|
28
|
+
gem 'seedbank', '~> 0.3'
|
29
|
+
gem 'sqlite3', '~> 1.3'
|
30
|
+
end
|
31
|
+
|
32
|
+
group :test do
|
33
|
+
gem 'capybara', '~> 2.4'
|
34
|
+
gem 'coveralls', '~> 0.8', require: false
|
35
|
+
gem 'database_cleaner', '~> 1.4'
|
36
|
+
gem 'launchy', '~> 2', require: false
|
37
|
+
gem 'poltergeist', '~> 1.14'
|
38
|
+
gem 'rails-controller-testing', '~> 1.0'
|
39
|
+
gem 'rspec-collection_matchers', '>= 1'
|
40
|
+
gem 'rspec-html-matchers', '~> 0.7'
|
41
|
+
gem 'shoulda-matchers', '>= 2.8', '< 3.2'
|
42
|
+
end
|
data/LICENSE.txt
CHANGED
data/README.md
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
# BootstrapLeather
|
2
|
+
Updated for Rails 5
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/bootstrap_leather.svg)](https://badge.fury.io/rb/bootstrap_leather)
|
5
|
+
[![Build Status](https://travis-ci.org/gemvein/bootstrap_leather.svg?branch=master)](https://travis-ci.org/gemvein/bootstrap_leather)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/github/gemvein/bootstrap_leather/badge.svg)](https://coveralls.io/github/gemvein/bootstrap_leather)
|
7
|
+
|
8
|
+
BootstrapLeather is a collection of view helpers that makes it easier to create apps using Twitter Bootstrap.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'bootstrap_leather'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
```bash
|
19
|
+
$ bundle
|
20
|
+
```
|
21
|
+
|
22
|
+
Or install it yourself as:
|
23
|
+
```bash
|
24
|
+
$ gem install bootstrap_leather
|
25
|
+
```
|
26
|
+
You will need to install bootstrap as a separate gem or include the css yourself.
|
27
|
+
|
28
|
+
To install a default initializer:
|
29
|
+
|
30
|
+
```bash
|
31
|
+
$ rails g bootstrap_leather:install
|
32
|
+
```
|
33
|
+
|
34
|
+
## Usage
|
35
|
+
|
36
|
+
Give your views access to the helpers with:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
class ApplicationController < ActionController::Base
|
40
|
+
helper BootstrapLeather::ApplicationHelper
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
### SEO tools for head and body: Title, Keywords, Description
|
45
|
+
|
46
|
+
In your view, assuming your model implements the given methods on the Item model (otherwise, omit):
|
47
|
+
|
48
|
+
```haml
|
49
|
+
- add_title @item.title
|
50
|
+
- add_keywords @item.keywords
|
51
|
+
- add_description @item.description
|
52
|
+
- add_head_css do
|
53
|
+
= @item.css
|
54
|
+
- add_footer_javascript do
|
55
|
+
= @item.javascript
|
56
|
+
```
|
57
|
+
|
58
|
+
In your layout:
|
59
|
+
```haml
|
60
|
+
%html
|
61
|
+
%head
|
62
|
+
= render_title # For the title tag, including SEO content
|
63
|
+
= render_keywords # Defaults to what you put in the config file
|
64
|
+
= render_description # Can be hooked up within a mountable rails engine, too.
|
65
|
+
= responsive_meta_tag # If you're using the responsive features, you need this in your head
|
66
|
+
|
67
|
+
<...>
|
68
|
+
|
69
|
+
= render_head_css
|
70
|
+
%body
|
71
|
+
<...>
|
72
|
+
|
73
|
+
.container
|
74
|
+
= render_page_header # For the h1 tag containing the title and subtitle
|
75
|
+
= yield
|
76
|
+
|
77
|
+
<...>
|
78
|
+
|
79
|
+
%footer
|
80
|
+
= render_footer_javascript
|
81
|
+
```
|
82
|
+
|
83
|
+
### Hero Units
|
84
|
+
|
85
|
+
To tell a view to add a hero unit, do:
|
86
|
+
|
87
|
+
```haml
|
88
|
+
- add_hero_unit do
|
89
|
+
%h1 This is a Hero Unit.
|
90
|
+
%p This is its description paragraph, which isn't very clever but at least it's not lorem ipsum.
|
91
|
+
```
|
92
|
+
Then put one of these somewhere in your layout:
|
93
|
+
|
94
|
+
```haml
|
95
|
+
= render_hero_unit
|
96
|
+
```
|
97
|
+
|
98
|
+
### Alerts
|
99
|
+
|
100
|
+
To get all alerts, do:
|
101
|
+
|
102
|
+
```haml
|
103
|
+
= alert_flash_messages
|
104
|
+
```
|
105
|
+
|
106
|
+
To create one alert, do:
|
107
|
+
|
108
|
+
```haml
|
109
|
+
= alert 'info', 'The message you want to alert with goes here.'
|
110
|
+
```
|
111
|
+
|
112
|
+
### Widgets
|
113
|
+
|
114
|
+
To add a widget in any of your views:
|
115
|
+
|
116
|
+
```haml
|
117
|
+
- add_widget do
|
118
|
+
%h3 A widget is...
|
119
|
+
%p Not a bootstrap concept, but useful all the same.
|
120
|
+
```
|
121
|
+
|
122
|
+
To render the ones you have saved up:
|
123
|
+
```haml
|
124
|
+
= render_widgets 'md', 3
|
125
|
+
```
|
126
|
+
|
127
|
+
### Modals
|
128
|
+
```haml
|
129
|
+
= modal 'css-id', 'Title of the modal here.' do
|
130
|
+
%p Lorem ipsum, baby.
|
131
|
+
```
|
132
|
+
|
133
|
+
### Badges and Labels
|
134
|
+
```haml
|
135
|
+
= badge '25'
|
136
|
+
= label 'unread'
|
137
|
+
```
|
138
|
+
|
139
|
+
### Icons
|
140
|
+
```haml
|
141
|
+
= icon 'check'
|
142
|
+
= icon_link_to 'check', 'Link Text', link_path
|
143
|
+
= icon_button_to 'success', 'check', 'Link Text', link_path
|
144
|
+
```
|
145
|
+
|
146
|
+
### Navbars
|
147
|
+
|
148
|
+
:container_mode is optional and defaults to :none. Can be one of: [:none, :inside, :outside]
|
149
|
+
|
150
|
+
For a wide navbar, try this:
|
151
|
+
|
152
|
+
```haml
|
153
|
+
= navbar :container_mode => :outside, :class => 'navbar-inverse' do
|
154
|
+
= nav_list do
|
155
|
+
= dropdown_nav_item 'Lorem', '#' do
|
156
|
+
= nav_item 'Ipsum', '#'
|
157
|
+
= nav_item 'Dolor', '#'
|
158
|
+
= nav_item 'Sit', '#'
|
159
|
+
= nav_item 'Ipsum', '#'
|
160
|
+
= nav_item 'Dolor', '#'
|
161
|
+
= nav_item 'Sit', '#'
|
162
|
+
= nav_list :class => 'navbar-right' do
|
163
|
+
= nav_item 'Amet', '#', :data => {:toggle => 'modal', :target => '#modal'}
|
164
|
+
```
|
165
|
+
|
166
|
+
|
167
|
+
### Nav List
|
168
|
+
```haml
|
169
|
+
= nav_list :class => 'nav-pills' do
|
170
|
+
= nav_item 'Ipsum', '#'
|
171
|
+
= nav_item 'Dolor', '#'
|
172
|
+
= nav_item 'Sit', '#'
|
173
|
+
```
|
174
|
+
|
175
|
+
### Tabs
|
176
|
+
|
177
|
+
First, add them all:
|
178
|
+
|
179
|
+
```haml
|
180
|
+
- add_tab 'First Tab', 'first-tab' do
|
181
|
+
%p Tab contents go inside.
|
182
|
+
- add_tab 'Second Tab', 'second-tab' do
|
183
|
+
%p Tab contents go inside here too.
|
184
|
+
- add_tab 'Third Tab', 'third-tab' do
|
185
|
+
%p Yep, tab contents go inside.
|
186
|
+
```
|
187
|
+
|
188
|
+
Then render them.
|
189
|
+
|
190
|
+
```haml
|
191
|
+
= render_tabs 'left'
|
192
|
+
```
|
193
|
+
|
194
|
+
### Carousel
|
195
|
+
|
196
|
+
Pass in an id string, items and a block for each slide:
|
197
|
+
|
198
|
+
```haml
|
199
|
+
= carousel 'css-id-for-carousel', @items do |item|
|
200
|
+
.carousel-caption
|
201
|
+
%h3= item.title
|
202
|
+
%p= item.description
|
203
|
+
= image_tag item.image.url(:large)
|
204
|
+
```
|
205
|
+
|
206
|
+
### Carousel with Thumbnails
|
207
|
+
|
208
|
+
Pass in an id string, items and a block for each slide:
|
209
|
+
```haml
|
210
|
+
= carousel_with_thumbnails 'css-id-for-carousel', @items do |item|
|
211
|
+
.carousel-caption
|
212
|
+
%h3= item.title
|
213
|
+
%p= item.description
|
214
|
+
= image_tag item.image.url(:large), data: { thumbnail: item.image.url(:thumb) }
|
215
|
+
```
|
216
|
+
|
217
|
+
### Thumbnail
|
218
|
+
|
219
|
+
```haml
|
220
|
+
= thumbnail link_to image_tag(image_url), path
|
221
|
+
```
|
222
|
+
|
223
|
+
### Definition Lists
|
224
|
+
|
225
|
+
```haml
|
226
|
+
= dl hash_of_terms_and_definitions_or_definition_arrays
|
227
|
+
```
|
228
|
+
|
229
|
+
## Great Bootstrap functionality outside the scope of this gem
|
230
|
+
|
231
|
+
The following are not covered because there are already so many wonderful resources providing this functionality.
|
232
|
+
|
233
|
+
* Bootstrap itself (I use bootstrap-sass, but you can use anything)
|
234
|
+
* Consider the possibilities:
|
235
|
+
* Any form of Bootstrap for Rails you want.
|
236
|
+
* Less
|
237
|
+
* Sass
|
238
|
+
* A themed bootstrap replacement:
|
239
|
+
* Kickstrap
|
240
|
+
* Bootswatch
|
241
|
+
* A theme generated on the fly:
|
242
|
+
* Bootstrap ThemeRoller
|
243
|
+
* Bootstrap Magic
|
244
|
+
* Jquery UI theme for bootstrap (I use jquery-ui-bootstrap-rails-asset)
|
245
|
+
* Forms (I recommend bootstrap_form)
|
246
|
+
* Breadcrumb generation (try breadcrumbs_on_rails)
|
247
|
+
|
248
|
+
## Contributing
|
249
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
250
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
251
|
+
* Fork the project.
|
252
|
+
* Start a feature/bugfix branch.
|
253
|
+
* Commit and push until you are happy with your contribution.
|
254
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
255
|
+
* 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.
|
256
|
+
|
257
|
+
|
258
|
+
## License
|
259
|
+
|
260
|
+
Copyright (c) 2013-2017 [Gem Vein](https://www.gemvein.com/). The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). See LICENSE.txt for further details.
|
data/Rakefile
CHANGED
@@ -1,26 +1,41 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bundler'
|
5
3
|
begin
|
6
|
-
|
7
|
-
rescue
|
8
|
-
|
9
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
-
exit e.status_code
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
11
7
|
end
|
12
|
-
require 'rake'
|
13
8
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
gem
|
9
|
+
APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
10
|
+
# load 'rails/tasks/engine.rake'
|
11
|
+
#
|
12
|
+
# load 'rails/tasks/statistics.rake'
|
13
|
+
#
|
14
|
+
# require 'bundler/gem_tasks'
|
15
|
+
|
16
|
+
require 'juwelier'
|
17
|
+
Juwelier::Tasks.new do |gem|
|
18
|
+
# gem is a Gem::Specification...
|
19
|
+
# see http://guides.rubygems.org/specification-reference/ for more options
|
20
|
+
gem.name = 'bootstrap_leather'
|
21
|
+
gem.homepage = 'http://www.gemvein.com/museum/cases/bootstrap_leather'
|
22
|
+
gem.license = 'MIT'
|
23
|
+
gem.summary = %(BootstrapLeather helps create apps using Twitter Bootstrap)
|
24
|
+
gem.description = 'BootstrapLeather is a collection of view helpers and '\
|
25
|
+
'scaffold generators that makes it easier to create apps using Twitter '\
|
26
|
+
'Bootstrap'
|
27
|
+
gem.email = 'karen.e.lundgren@gmail.com'
|
28
|
+
gem.authors = ['Karen Lundgren']
|
29
|
+
# gem.version = BootstrapLeather::VERSION
|
24
30
|
# dependencies defined in Gemfile
|
25
31
|
end
|
26
|
-
|
32
|
+
Juwelier::RubygemsDotOrgTasks.new
|
33
|
+
|
34
|
+
|
35
|
+
begin
|
36
|
+
require 'rspec/core/rake_task'
|
37
|
+
RSpec::Core::RakeTask.new(:spec)
|
38
|
+
task default: :spec
|
39
|
+
rescue LoadError
|
40
|
+
# no rspec available
|
41
|
+
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.10.4
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Alerts, i.e. messages at the top of the page, usually from flash
|
5
|
+
# or form errors
|
6
|
+
module AlertsHelper
|
7
|
+
def flash_class(level)
|
8
|
+
case level
|
9
|
+
when :notice then
|
10
|
+
'info'
|
11
|
+
when :error then
|
12
|
+
'danger'
|
13
|
+
when :alert then
|
14
|
+
'warning'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def alert(css_class, title, message = nil)
|
19
|
+
render(
|
20
|
+
partial: 'bootstrap_leather/alerts/alert',
|
21
|
+
locals: {
|
22
|
+
css_class: css_class,
|
23
|
+
title: title,
|
24
|
+
message: message
|
25
|
+
}
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def alert_flash_messages(html_options = {})
|
30
|
+
render(
|
31
|
+
partial: 'bootstrap_leather/alerts/alert_flash_messages',
|
32
|
+
locals: { html_options: html_options }
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Main helper for BootstrapLeather
|
5
|
+
module ApplicationHelper
|
6
|
+
include HeadHelper
|
7
|
+
include FootHelper
|
8
|
+
include GridHelper
|
9
|
+
include NavigationHelper
|
10
|
+
include AlertsHelper
|
11
|
+
include WidgetsHelper
|
12
|
+
include ModalsHelper
|
13
|
+
include HeroUnitHelper
|
14
|
+
include TabsHelper
|
15
|
+
include BadgesHelper
|
16
|
+
include ThumbnailsHelper
|
17
|
+
include TypographyHelper
|
18
|
+
include IconsHelper
|
19
|
+
include CarouselsHelper
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Badges, i.e. tiny counts in a pill shape
|
5
|
+
module BadgesHelper
|
6
|
+
def badge_to(text, value, link, html_options = {})
|
7
|
+
html_options[:href] = url_for link
|
8
|
+
render(
|
9
|
+
partial: 'bootstrap_leather/badges/badge_to',
|
10
|
+
locals: { text: text, value: value, html_options: html_options }
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def badge(content, type = nil)
|
15
|
+
render(
|
16
|
+
partial: 'bootstrap_leather/badges/badge',
|
17
|
+
locals: { content: content, type: type }
|
18
|
+
)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Carousels, i.e. slideshows
|
5
|
+
module CarouselsHelper
|
6
|
+
def carousel(id, items, html_options = {}, &block)
|
7
|
+
html_options[:id] = id
|
8
|
+
html_options[:data] ||= {}
|
9
|
+
html_options[:data][:ride] = 'carousel'
|
10
|
+
render(
|
11
|
+
partial: 'bootstrap_leather/carousels/carousel',
|
12
|
+
locals: {
|
13
|
+
id: id, html_options: html_options,
|
14
|
+
slides: items.collect { |item| capture(item, &block) }
|
15
|
+
}
|
16
|
+
)
|
17
|
+
end
|
18
|
+
|
19
|
+
def carousel_with_thumbnails(id, items, html_options = {}, &block)
|
20
|
+
html_options[:id] = id
|
21
|
+
html_options[:data] ||= {}
|
22
|
+
html_options[:data][:ride] = 'carousel'
|
23
|
+
render(
|
24
|
+
partial: 'bootstrap_leather/carousels/carousel_with_thumbnails',
|
25
|
+
locals: {
|
26
|
+
id: id, html_options: html_options,
|
27
|
+
slides: items.collect { |item| capture(item, &block) }
|
28
|
+
}
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Helpers to add things to the head (and foot) of the html document
|
5
|
+
module FootHelper
|
6
|
+
def add_footer_javascript(&block)
|
7
|
+
content_for :footer_javascript, &block
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_footer_javascript
|
11
|
+
render(partial: 'bootstrap_leather/foot/footer_javascript')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Helpers to add things to the head (and foot) of the html document
|
5
|
+
module HeadHelper
|
6
|
+
def responsive_meta_tag
|
7
|
+
tag(
|
8
|
+
:meta,
|
9
|
+
name: :viewport,
|
10
|
+
content: 'width=device-width, initial-scale=1.0'
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_title(title)
|
15
|
+
content_for :title, title
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_subtitle(subtitle)
|
19
|
+
content_for :subtitle, subtitle
|
20
|
+
end
|
21
|
+
|
22
|
+
def render_title
|
23
|
+
page_title = []
|
24
|
+
page_title << content_for(:title)
|
25
|
+
page_title << content_for(:subtitle)
|
26
|
+
page_title << BootstrapLeather.configuration.application_title
|
27
|
+
page_title << content_for(:keywords)
|
28
|
+
content_tag :title, CGI.unescapeHTML(page_title.compact.join(': '))
|
29
|
+
end
|
30
|
+
|
31
|
+
def add_description(description)
|
32
|
+
content_for :description, description
|
33
|
+
end
|
34
|
+
|
35
|
+
def render_description
|
36
|
+
description = content_for(:description)
|
37
|
+
description ||= BootstrapLeather.configuration.application_description
|
38
|
+
tag(
|
39
|
+
:meta,
|
40
|
+
name: :description,
|
41
|
+
content: description
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_keywords(keywords)
|
46
|
+
content_for :keywords, keywords
|
47
|
+
end
|
48
|
+
|
49
|
+
def render_keywords
|
50
|
+
keywords = content_for(:keywords)
|
51
|
+
keywords ||= BootstrapLeather.configuration.application_keywords
|
52
|
+
tag(
|
53
|
+
:meta,
|
54
|
+
name: :keywords,
|
55
|
+
content: keywords
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
def add_head_css(&block)
|
60
|
+
content_for :head_css, &block
|
61
|
+
end
|
62
|
+
|
63
|
+
def render_head_css
|
64
|
+
render(partial: 'bootstrap_leather/head/head_css')
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BootstrapLeather
|
4
|
+
# Hero Unit, i.e. Jumbotron
|
5
|
+
module HeroUnitHelper
|
6
|
+
def add_hero_unit(&block)
|
7
|
+
content_for :hero_unit, &block
|
8
|
+
end
|
9
|
+
|
10
|
+
def render_hero_unit
|
11
|
+
render(partial: 'bootstrap_leather/hero_unit/hero_unit')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|