bootstrap-rails-helpers 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +116 -0
- data/bootstrap-rails-helpers.gemspec +2 -2
- data/lib/bootstrap_rails_helpers/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6528628e83f9892fa12123b61de30f0bc1041f5
|
4
|
+
data.tar.gz: 6e5d09c127e3cc6ea865a1880d270f1c751ca5f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af61ee98a3b9fb5b14c5499436dc68a4f4c44375388506182852f1017915732609c88233a78769e43054c48544c0e9c97f7ed850dd2c6fb52aaf935090746656
|
7
|
+
data.tar.gz: e4ed941b4772a7b45187d646263f327261a6ae7f8bc5511cedbb4a7d7ec9bf5b4bdf77053c3abeb210d4846e12192ceb0a5ca20ece59437ba27e5d0756074917
|
data/README.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
bootstrap-rails-helpers
|
2
|
+
=======================
|
3
|
+
|
4
|
+
[Bootstrap](http://twitter.github.com/bootstrap/) is a toolkit from Twitter designed to kickstart development of webapps and sites. It includes base CSS and HTML for typography, forms, buttons, tables, grids, navigation, and more.
|
5
|
+
|
6
|
+
bootstrap-rails-helpers is a lightweight gem that includes many helper methods used in many Rails applications.
|
7
|
+
|
8
|
+
Installation
|
9
|
+
------------
|
10
|
+
|
11
|
+
As most of the heleprs are based off it, if you are already using twitter-bootstrap-rails (https://github.com/seyhunak/twitter-bootstrap-rails), then you already have most of these helpers in place.
|
12
|
+
|
13
|
+
If you haven't already installed Twitter Bootstrap, you will need to add it to your project.
|
14
|
+
|
15
|
+
You can install Bootstrap using one of the following gems:
|
16
|
+
|
17
|
+
- bootstrap-sass (https://github.com/thomas-mcdonald/bootstrap-sass)
|
18
|
+
- sass-twitter-bootstrap (https://github.com/jlong/sass-twitter-bootstrap)
|
19
|
+
- less-rails-bootstrap (https://github.com/metaskills/less-rails-bootstrap)
|
20
|
+
|
21
|
+
Or you could add it directly to your assets pipeline by downloading [Twitter Bootstrap](http://twitter.github.com/bootstrap/) directly.
|
22
|
+
|
23
|
+
Once you have Twitter Bootstrap available you just need to add the following to your Gemfile.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
gem 'bootstrap-rails-helpers'
|
27
|
+
```
|
28
|
+
|
29
|
+
Once that's in place, run `bundle install` and you're ready.
|
30
|
+
|
31
|
+
Helpers
|
32
|
+
-------
|
33
|
+
|
34
|
+
### Flash Messages
|
35
|
+
|
36
|
+
Rails provides a standard convention called flash to display alerts (including error messages) and other notices.
|
37
|
+
|
38
|
+
Add the following tag to `<%= bootstrap_flash %>` to your layout in order for each message to be displayed as an [Alerts](http://twitter.github.com/bootstrap/components.html#alerts).
|
39
|
+
|
40
|
+
Rails uses :notice and :alert as its defailt flash message keys. The `bootstrap_flash` tag converts these statuses to `.alert-success` and `.alert-error`.
|
41
|
+
|
42
|
+
You can add individual alert boxes using the following tag:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
<%= alert_message "Hello Bootstrap", :alert_type => :success %>
|
46
|
+
```
|
47
|
+
|
48
|
+
### Breadcrumbs
|
49
|
+
|
50
|
+
Add the breadcrumbs tag `<%= render_breadcrumbs %>` to your layout to add a series of breadcrumbs to your views.
|
51
|
+
|
52
|
+
From within your views, use the `add_breadcrumb` tag to populate the breadcrumb list.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
# examples/index.html.erb
|
56
|
+
<%- add_breadcrumb :index, examples_url -%>
|
57
|
+
```
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
# examples/show.html.erb
|
61
|
+
<%- add_breadcrumb :index, examples_url -%>
|
62
|
+
<%- add_breadcrumb @example.title, example_url(@example) -%>
|
63
|
+
```
|
64
|
+
|
65
|
+
```ruby
|
66
|
+
# examples/new.html.erb
|
67
|
+
<%- add_breadcrumb :index, examples_url -%>
|
68
|
+
<%- add_breadcrumb :new, new_example_url -%>
|
69
|
+
```
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
# examples/edit.html.erb
|
73
|
+
<%- add_breadcrumb :index, examples_url -%>
|
74
|
+
<%- add_breadcrumb @example.title, example_url(@example) -%>
|
75
|
+
<%- add_breadcrumb :edit, edit_example_url(@example) -%>
|
76
|
+
```
|
77
|
+
|
78
|
+
Ruby symbols used for labes fall back to I18n translations based off the current controller, Translations fall back to the defaults namespace if the exact translation path is not found.
|
79
|
+
|
80
|
+
```yml
|
81
|
+
en:
|
82
|
+
breadcrumbs:
|
83
|
+
defaults:
|
84
|
+
home: 'Home'
|
85
|
+
index: 'Index'
|
86
|
+
edit: 'Edit'
|
87
|
+
show: 'Show'
|
88
|
+
new: 'New'
|
89
|
+
|
90
|
+
examples:
|
91
|
+
index: 'Examples'
|
92
|
+
new: 'New Example'
|
93
|
+
edit: 'Edit Example'
|
94
|
+
```
|
95
|
+
|
96
|
+
### Glyphs
|
97
|
+
|
98
|
+
You can easily use [Icons](http://twitter.github.com/bootstrap/base-css.html#icons) by [Glyphicons](http://glyphicons.com/) in your views by using the `glyph` tag.
|
99
|
+
|
100
|
+
```ruby
|
101
|
+
<%= glyph(:share_alt) %>
|
102
|
+
# => <i class="icon-share-alt"></i>
|
103
|
+
```
|
104
|
+
You can also use the white icon variation:
|
105
|
+
|
106
|
+
```ruby
|
107
|
+
glyph(:lock, :white)
|
108
|
+
# => <i class="icon-lock icon-white"></i>
|
109
|
+
```
|
110
|
+
|
111
|
+
License
|
112
|
+
-------
|
113
|
+
|
114
|
+
Copyright (c) 2013 Ben Morrall
|
115
|
+
|
116
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -7,9 +7,9 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = BootstrapRailsHelpers::VERSION
|
8
8
|
s.authors = ["bmorrall"]
|
9
9
|
s.email = ["bemo56@hotmail.com"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/bmorrall/bootstrap-rails-helpers"
|
11
11
|
s.summary = %q{Twitter Bootstrap Helpers for Rails}
|
12
|
-
s.description = %q{Adds
|
12
|
+
s.description = %q{Adds several ActionView helpers to improve Twitter Bootstrap integration with Rails}
|
13
13
|
|
14
14
|
s.rubyforge_project = "bootstrap-rails-helpers"
|
15
15
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap-rails-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bmorrall
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
|
-
description: Adds
|
70
|
-
|
69
|
+
description: Adds several ActionView helpers to improve Twitter Bootstrap integration
|
70
|
+
with Rails
|
71
71
|
email:
|
72
72
|
- bemo56@hotmail.com
|
73
73
|
executables: []
|
@@ -76,6 +76,7 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- .gitignore
|
78
78
|
- Gemfile
|
79
|
+
- README.md
|
79
80
|
- Rakefile
|
80
81
|
- app/helpers/bootstrap_rails_helpers/breadcrumbs_helper.rb
|
81
82
|
- app/helpers/bootstrap_rails_helpers/flash_helper.rb
|
@@ -96,7 +97,7 @@ files:
|
|
96
97
|
- spec/helpers/bootstrap_rails_helpers/glyph_helper_spec.rb
|
97
98
|
- spec/helpers/bootstrap_rails_helpers/modal_helper_spec.rb
|
98
99
|
- spec/spec_helper.rb
|
99
|
-
homepage:
|
100
|
+
homepage: https://github.com/bmorrall/bootstrap-rails-helpers
|
100
101
|
licenses: []
|
101
102
|
metadata: {}
|
102
103
|
post_install_message:
|