twitter-bootswatch-rails-helpers 2.3.2.1 → 3.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/LICENSE.txt +1 -1
- data/README.md +38 -6
- data/app/helpers/twitter/bootswatch/breadcrumbs_helper.rb +2 -2
- data/app/helpers/twitter/bootswatch/flash_helper.rb +14 -14
- data/app/views/twitter/bootswatch/_breadcrumbs.html.erb +2 -4
- data/lib/twitter/bootswatch/rails/helpers/bootswatch.rb +2 -2
- data/lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb +5 -5
- data/lib/twitter/bootswatch/rails/helpers/version.rb +1 -1
- data/travis.yml +4 -0
- data/twitter-bootswatch-rails-helpers.gemspec +7 -7
- metadata +12 -9
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
ODJlN2Y0OTQxOTAyZTQ5ODVlNjhkZjM5NWJjZmFiMTFlNjRhMzg4MjE1N2Jm
|
10
|
-
MTBiOTkxYzhiZTA3YzBiNjg3YWMzYTQyYTAzNDY1YTc3NzdhMTI5OGJiNzA4
|
11
|
-
ZDg3YjI0NzQ5N2U4NDdjMDNlZWY1ODYyYzEzODQ0YzhmMDFlOTU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NDQ3NDBjMjNhOTJhYzcxZjljZWYxOGRhY2I4OWQxZTM3NjNhZTgwYjFiODA2
|
14
|
-
NTI5MmFiZmU2MzQzNjdhMmE4YjlmMDBhMzJiNDI0NGY0NzM0M2U3MWNjYjg5
|
15
|
-
NWEyMmNjYTA5NGYzMzI5MWJkOTNhYzNiMDllN2UxZjg1NWYxMTk=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eece481656e01db53270de26415bfb9c972fb3ea
|
4
|
+
data.tar.gz: 886ee71461094ffabc70c97655b1cf84fbfbdaa3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8eb42146f647eec5da4cee2c54a03f29b94d0ade375f38fd28bfb9a75c924a794d39104cf39394e20c8e5d987060410ff0b8ad48c1a8a61e5d3b70e870f8c3c8
|
7
|
+
data.tar.gz: 5a1d29df6f19d692d231affa5d0086f49f28cba2cd3740ad2b1cd72f061970722b1072c1e45b4bac1207d13e8299b4c8c4dd4cb145134d9fbc1aff46ec86c98e
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
dev
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p247
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# Bootswatch Rails 3.0.0 Helpers gem
|
2
2
|
|
3
|
-
- Requires [twitter-bootswatch-rails](https://github.com/scottvrosenthal/twitter-bootswatch-
|
4
|
-
- Provides view helpers for
|
3
|
+
- Requires [twitter-bootswatch-rails](https://github.com/scottvrosenthal/twitter-bootswatch-rails/)
|
4
|
+
- Provides rails view helpers for [Twitter Bootstrap](http://getbootstrap.com/) alerts and breadcrumbs
|
5
5
|
|
6
6
|
## Installing Gem
|
7
7
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
|
-
gem 'twitter-bootswatch-rails', '~>
|
10
|
+
gem 'twitter-bootswatch-rails', '~> 3.0.0'
|
11
11
|
|
12
12
|
gem 'twitter-bootswatch-rails-helpers'
|
13
13
|
|
@@ -22,8 +22,38 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usages
|
24
24
|
|
25
|
+
Flashes:
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
def index
|
29
|
+
# alert-warning
|
30
|
+
flash[:warning] = "Test warning flash" # or flash[:default]
|
31
|
+
|
32
|
+
# alert-warning
|
33
|
+
flash[:default] = %Q{<strong>Warning</strong> This <a href="#" class="alert-link">alert</a> needs your attention, but it's not super important.}.html_safe
|
34
|
+
|
35
|
+
# alert-success
|
36
|
+
flash[:notice] = "Test warning flash" # or flash[:success]
|
37
|
+
|
38
|
+
# alert-info
|
39
|
+
flash[:info] = "Test info flash"
|
40
|
+
|
41
|
+
# alert-danger
|
42
|
+
flash[:error] = "Test error flash" # or flash[:alert]
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
```
|
47
|
+
The view helper then loops through current flash object:
|
48
|
+
|
49
|
+
```erb
|
50
|
+
<%= bootswatch_flash %>
|
51
|
+
```
|
52
|
+
|
25
53
|
Alerts:
|
26
54
|
|
55
|
+
For manual alerts that don't use the flash object:
|
56
|
+
|
27
57
|
```erb
|
28
58
|
<%= bootswatch_flash_container(:default, true) do %>
|
29
59
|
<h4>Alert block</h4><p>Best check yo self, you're not looking too good. Nulla vitae elit libero, a pharetra augue. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</p>
|
@@ -35,7 +65,7 @@ Alerts:
|
|
35
65
|
<strong>Error</strong> Change a few things up and try submitting again.
|
36
66
|
<% end %>
|
37
67
|
<%= bootswatch_flash_container(:info) do %>
|
38
|
-
<strong>Information</strong> This alert needs your attention, but it's not super important.
|
68
|
+
<strong>Information</strong> This <a href="#" class="alert-link">alert</a> needs your attention, but it's not super important.
|
39
69
|
<% end %>
|
40
70
|
```
|
41
71
|
|
@@ -45,7 +75,9 @@ Place an add_breadcrumb call in the action of your controller:
|
|
45
75
|
|
46
76
|
```ruby
|
47
77
|
def index
|
48
|
-
add_breadcrumb
|
78
|
+
add_breadcrumb I18n.t('navigation.settings'), admin_settings_path
|
79
|
+
|
80
|
+
add_breadcrumb I18n.t('definitions.index.title'), admin_definitions_path
|
49
81
|
end
|
50
82
|
```
|
51
83
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Twitter
|
2
2
|
module Bootswatch
|
3
3
|
module BreadcrumbsHelper
|
4
|
-
def render_breadcrumbs
|
5
|
-
render :
|
4
|
+
def render_breadcrumbs
|
5
|
+
render partial: 'twitter/bootswatch/breadcrumbs'
|
6
6
|
end
|
7
7
|
end
|
8
8
|
end
|
@@ -2,21 +2,21 @@ module Twitter
|
|
2
2
|
module Bootswatch
|
3
3
|
module FlashHelper
|
4
4
|
|
5
|
-
def bootswatch_flash(
|
6
|
-
|
7
|
-
flash_messages =
|
5
|
+
def bootswatch_flash(alert_dismissable=true)
|
6
|
+
alert_dismissable_class = alert_dismissable ? ' alert-dismissable' : ''
|
7
|
+
flash_messages = ''
|
8
8
|
flash.each do |type, message|
|
9
9
|
alert_type_class = bootswatch_alert_types(type)
|
10
|
-
|
11
|
-
flash_messages <<
|
10
|
+
alert_div = content_tag(:div, raw('<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>') + message, :class => "alert #{alert_type_class}#{alert_dismissable_class}")
|
11
|
+
flash_messages << alert_div if message
|
12
12
|
end
|
13
|
-
flash_messages
|
13
|
+
raw(flash_messages)
|
14
14
|
end
|
15
15
|
|
16
|
-
def bootswatch_flash_block(
|
16
|
+
def bootswatch_flash_block(alert_dismissable=true)
|
17
17
|
output = ''
|
18
18
|
flash.each do |type, message|
|
19
|
-
output << bootswatch_flash_container(type,
|
19
|
+
output << bootswatch_flash_container(type, alert_dismissable) do
|
20
20
|
message
|
21
21
|
end
|
22
22
|
end
|
@@ -24,12 +24,12 @@ module Twitter
|
|
24
24
|
raw(output)
|
25
25
|
end
|
26
26
|
|
27
|
-
def bootswatch_flash_container(type,
|
28
|
-
|
27
|
+
def bootswatch_flash_container(type, alert_dismissable=true, &message)
|
28
|
+
alert_dismissable_class = alert_dismissable ? ' alert-dismissable' : ''
|
29
29
|
alert_type_class = bootswatch_alert_types(type)
|
30
30
|
message_text = capture(&message)
|
31
|
-
output = content_tag(:div, :class => "alert #{alert_type_class}#{
|
32
|
-
|
31
|
+
output = content_tag(:div, :class => "alert #{alert_type_class}#{alert_dismissable_class}") do
|
32
|
+
'<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>'.html_safe.safe_concat(message_text)
|
33
33
|
end
|
34
34
|
|
35
35
|
raw(output)
|
@@ -39,8 +39,8 @@ module Twitter
|
|
39
39
|
case alert_type
|
40
40
|
when :info then 'alert-info'
|
41
41
|
when :notice, :success then 'alert-success'
|
42
|
-
when :alert, :error then 'alert-
|
43
|
-
else 'alert' # warning
|
42
|
+
when :alert, :error then 'alert-danger'
|
43
|
+
else 'alert-warning' # warning
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -1,14 +1,12 @@
|
|
1
1
|
<% if @breadcrumbs.present? %>
|
2
|
-
<
|
3
|
-
<% separator = divider %>
|
2
|
+
<ol class="breadcrumb">
|
4
3
|
<% @breadcrumbs[0..-2].each do |crumb| %>
|
5
4
|
<li>
|
6
5
|
<%= link_to crumb[:name], crumb[:url], crumb[:options] %>
|
7
|
-
<span class="divider"><%= separator %></span>
|
8
6
|
</li>
|
9
7
|
<% end %>
|
10
8
|
<li class="active">
|
11
9
|
<%= link_to @breadcrumbs.last[:name], @breadcrumbs.last[:url], @breadcrumbs.last[:options] %>
|
12
10
|
</li>
|
13
|
-
</
|
11
|
+
</ol>
|
14
12
|
<% end %>
|
@@ -1,2 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'twitter/bootswatch/rails/helpers/engine'
|
2
|
+
require 'twitter/bootswatch/rails/helpers/version'
|
@@ -8,7 +8,7 @@ module Twitter
|
|
8
8
|
end
|
9
9
|
|
10
10
|
module ClassMethods
|
11
|
-
def add_breadcrumb
|
11
|
+
def add_breadcrumb(name, url, options={})
|
12
12
|
before_filter options do |controller|
|
13
13
|
controller.send :add_breadcrumb, name, url
|
14
14
|
end
|
@@ -17,14 +17,14 @@ module Twitter
|
|
17
17
|
|
18
18
|
protected
|
19
19
|
|
20
|
-
def add_breadcrumb
|
20
|
+
def add_breadcrumb(name, url = '', options = {})
|
21
21
|
@breadcrumbs ||= []
|
22
22
|
url = eval(url.to_s) if url =~ /_path|_url|@/
|
23
|
-
|
23
|
+
@breadcrumbs << {name: name, url: url, options: options}
|
24
24
|
end
|
25
25
|
|
26
|
-
def render_breadcrumbs
|
27
|
-
s = render :
|
26
|
+
def render_breadcrumbs
|
27
|
+
s = render partial: 'twitter/bootswatch/breadcrumbs'
|
28
28
|
s.first
|
29
29
|
end
|
30
30
|
end
|
data/travis.yml
ADDED
@@ -4,22 +4,22 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'twitter/bootswatch/rails/helpers/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
7
|
+
gem.name = 'twitter-bootswatch-rails-helpers'
|
8
8
|
gem.version = Twitter::Bootswatch::Rails::Helpers::VERSION
|
9
9
|
gem.required_ruby_version = '>= 1.9.3'
|
10
10
|
gem.required_rubygems_version = '>= 1.8.11'
|
11
11
|
gem.authors = ["Scott V. Rosenthal"]
|
12
12
|
gem.email = ["sr7575@gmail.com"]
|
13
|
-
gem.homepage =
|
14
|
-
gem.summary = %q{
|
15
|
-
gem.description = %q{twitter-bootswatch-rails-helpers gem provides common view helpers for use with the twitter-bootswatch-rails
|
16
|
-
gem.license =
|
13
|
+
gem.homepage = 'https://github.com/scottvrosenthal/twitter-bootswatch-rails-helpers'
|
14
|
+
gem.summary = %q{Bootswatch Rails Helpers gem for use with the twitter-bootswatch-rails gem}
|
15
|
+
gem.description = %q{twitter-bootswatch-rails-helpers gem provides common view helpers for use with the twitter-bootswatch-rails gem}
|
16
|
+
gem.license = 'MIT'
|
17
17
|
gem.licenses = ['MIT', 'GPL-2']
|
18
18
|
|
19
19
|
gem.files = `git ls-files`.split($/)
|
20
20
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
21
|
-
gem.require_paths = [
|
21
|
+
gem.require_paths = ['lib']
|
22
22
|
|
23
|
-
gem.add_dependency 'twitter-bootswatch-rails', '~>
|
23
|
+
gem.add_dependency 'twitter-bootswatch-rails', '~> 3.0.0'
|
24
24
|
|
25
25
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-bootswatch-rails-helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott V. Rosenthal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter-bootswatch-rails
|
@@ -16,16 +16,16 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0
|
27
27
|
description: twitter-bootswatch-rails-helpers gem provides common view helpers for
|
28
|
-
use with the twitter-bootswatch-rails
|
28
|
+
use with the twitter-bootswatch-rails gem
|
29
29
|
email:
|
30
30
|
- sr7575@gmail.com
|
31
31
|
executables: []
|
@@ -33,6 +33,8 @@ extensions: []
|
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
35
|
- .gitignore
|
36
|
+
- .ruby-gemset
|
37
|
+
- .ruby-version
|
36
38
|
- Gemfile
|
37
39
|
- LICENSE.txt
|
38
40
|
- README.md
|
@@ -45,6 +47,7 @@ files:
|
|
45
47
|
- lib/twitter/bootswatch/rails/helpers/breadcrumbs.rb
|
46
48
|
- lib/twitter/bootswatch/rails/helpers/engine.rb
|
47
49
|
- lib/twitter/bootswatch/rails/helpers/version.rb
|
50
|
+
- travis.yml
|
48
51
|
- twitter-bootswatch-rails-helpers.gemspec
|
49
52
|
homepage: https://github.com/scottvrosenthal/twitter-bootswatch-rails-helpers
|
50
53
|
licenses:
|
@@ -57,18 +60,18 @@ require_paths:
|
|
57
60
|
- lib
|
58
61
|
required_ruby_version: !ruby/object:Gem::Requirement
|
59
62
|
requirements:
|
60
|
-
- -
|
63
|
+
- - '>='
|
61
64
|
- !ruby/object:Gem::Version
|
62
65
|
version: 1.9.3
|
63
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
67
|
requirements:
|
65
|
-
- -
|
68
|
+
- - '>='
|
66
69
|
- !ruby/object:Gem::Version
|
67
70
|
version: 1.8.11
|
68
71
|
requirements: []
|
69
72
|
rubyforge_project:
|
70
|
-
rubygems_version: 2.0.
|
73
|
+
rubygems_version: 2.0.6
|
71
74
|
signing_key:
|
72
75
|
specification_version: 4
|
73
|
-
summary:
|
76
|
+
summary: Bootswatch Rails Helpers gem for use with the twitter-bootswatch-rails gem
|
74
77
|
test_files: []
|