twitter-bootstrap-rails 2.1.7 → 2.2.8
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of twitter-bootstrap-rails might be problematic. Click here for more details.
- data/README.md +428 -21
- data/Rakefile +15 -3
- data/app/assets/fonts/fontawesome-webfont.eot +0 -0
- data/app/assets/fonts/fontawesome-webfont.svg +399 -0
- data/app/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/app/assets/fonts/fontawesome-webfont.woff +0 -0
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-affix.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-alert.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-button.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-carousel.js +42 -11
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-collapse.js +18 -7
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-dropdown.js +32 -11
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-modal.js +25 -12
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-popover.js +17 -6
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-scrollspy.js +13 -2
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-tab.js +12 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-tooltip.js +115 -30
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-transition.js +1 -1
- data/{vendor → app}/assets/javascripts/twitter/bootstrap/bootstrap-typeahead.js +38 -13
- data/app/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +890 -0
- data/app/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +787 -0
- data/{vendor → app}/assets/stylesheets/twitter-bootstrap-static/sprites.css.erb +2 -2
- data/app/helpers/badge_label_helper.rb +16 -0
- data/app/helpers/bootstrap_flash_helper.rb +22 -16
- data/app/helpers/glyph_helper.rb +7 -2
- data/app/helpers/modal_helper.rb +29 -16
- data/app/helpers/navbar_helper.rb +194 -0
- data/app/helpers/twitter_breadcrumbs_helper.rb +7 -2
- data/app/views/twitter-bootstrap/_breadcrumbs.html.erb +2 -2
- data/lib/generators/bootstrap/install/install_generator.rb +19 -6
- data/lib/generators/bootstrap/install/templates/bootstrap.coffee +2 -3
- data/lib/generators/bootstrap/install/templates/bootstrap.js +2 -3
- data/lib/generators/bootstrap/install/templates/bootstrap_and_overrides.less +8 -10
- data/lib/generators/bootstrap/install/templates/en.bootstrap.yml +18 -0
- data/lib/generators/bootstrap/layout/templates/layout.html.erb +10 -12
- data/lib/generators/bootstrap/layout/templates/layout.html.haml +8 -11
- data/lib/generators/bootstrap/layout/templates/layout.html.slim +10 -11
- data/lib/generators/bootstrap/themed/templates/edit.html.erb +1 -2
- data/lib/generators/bootstrap/themed/templates/edit.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/edit.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/index.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.erb +1 -2
- data/lib/generators/bootstrap/themed/templates/new.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/new.html.slim +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.erb +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.haml +1 -1
- data/lib/generators/bootstrap/themed/templates/show.html.slim +1 -1
- data/lib/generators/bootstrap/themed/themed_generator.rb +2 -2
- data/lib/twitter/bootstrap/rails/engine.rb +3 -0
- data/lib/twitter/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +14 -2
- data/lib/twitter/bootstrap/rails/version.rb +2 -2
- data/lib/twitter-bootstrap-rails.rb +4 -4
- data/spec/lib/twitter_bootstrap_rails/badge_label_helper_spec.rb +22 -0
- data/spec/lib/twitter_bootstrap_rails/modal_helper_spec.rb +62 -0
- data/spec/lib/twitter_bootstrap_rails/navbar_helper_spec.rb +362 -0
- data/spec/lib/twitter_bootstrap_rails/uri_state_spec.rb +47 -0
- data/spec/spec_helper.rb +11 -0
- data/test/lib/breadcrumbs_test.rb +75 -0
- data/test/test_helper.rb +11 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/bootstrap.css.erb +316 -294
- data/vendor/static-source/fontawesome.less +8 -6
- data/vendor/static-source/sprites.less +3 -2
- data/vendor/toolkit/fontawesome/bootstrap.less +84 -0
- data/vendor/toolkit/fontawesome/core.less +129 -0
- data/vendor/toolkit/fontawesome/extras.less +93 -0
- data/vendor/toolkit/fontawesome/font-awesome-ie7.less +1953 -0
- data/vendor/toolkit/fontawesome/font-awesome.less +33 -0
- data/vendor/toolkit/fontawesome/icons.less +381 -0
- data/vendor/toolkit/fontawesome/mixins.less +48 -0
- data/vendor/toolkit/fontawesome/path.less +14 -0
- data/vendor/toolkit/fontawesome/variables.less +735 -0
- data/vendor/toolkit/twitter/bootstrap/alerts.less +14 -0
- data/vendor/toolkit/twitter/bootstrap/bootstrap.less +4 -4
- data/vendor/toolkit/twitter/bootstrap/breadcrumbs.less +6 -6
- data/vendor/toolkit/twitter/bootstrap/button-groups.less +31 -44
- data/vendor/toolkit/twitter/bootstrap/buttons.less +13 -17
- data/vendor/toolkit/twitter/bootstrap/carousel.less +48 -21
- data/vendor/toolkit/twitter/bootstrap/close.less +2 -1
- data/vendor/toolkit/twitter/bootstrap/code.less +3 -0
- data/vendor/toolkit/twitter/bootstrap/dropdowns.less +32 -21
- data/vendor/toolkit/twitter/bootstrap/forms.less +17 -10
- data/vendor/toolkit/twitter/bootstrap/labels-badges.less +12 -2
- data/vendor/toolkit/twitter/bootstrap/media.less +2 -2
- data/vendor/toolkit/twitter/bootstrap/mixins.less +25 -9
- data/vendor/toolkit/twitter/bootstrap/modals.less +4 -3
- data/vendor/toolkit/twitter/bootstrap/navbar.less +35 -13
- data/vendor/toolkit/twitter/bootstrap/navs.less +45 -21
- data/vendor/toolkit/twitter/bootstrap/pager.less +3 -1
- data/vendor/toolkit/twitter/bootstrap/pagination.less +3 -1
- data/vendor/toolkit/twitter/bootstrap/popovers.less +55 -39
- data/vendor/toolkit/twitter/bootstrap/reset.less +82 -4
- data/vendor/toolkit/twitter/bootstrap/responsive-767px-max.less +2 -2
- data/vendor/toolkit/twitter/bootstrap/responsive-navbar.less +6 -2
- data/vendor/toolkit/twitter/bootstrap/responsive-utilities.less +16 -0
- data/vendor/toolkit/twitter/bootstrap/responsive.less +1 -1
- data/vendor/toolkit/twitter/bootstrap/scaffolding.less +2 -1
- data/vendor/toolkit/twitter/bootstrap/sprites.less +9 -5
- data/vendor/toolkit/twitter/bootstrap/tables.less +54 -46
- data/vendor/toolkit/twitter/bootstrap/thumbnails.less +3 -2
- data/vendor/toolkit/twitter/bootstrap/tooltip.less +6 -6
- data/vendor/toolkit/twitter/bootstrap/type.less +44 -24
- data/vendor/toolkit/twitter/bootstrap/variables.less +3 -3
- metadata +130 -44
- data/lib/generators/bootstrap/partial/templates/_navbar.html.erb +0 -13
- data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.svg +0 -255
- data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
- data/vendor/assets/stylesheets/twitter-bootstrap-static/fontawesome.css.erb +0 -218
- data/vendor/toolkit/font-awesome-ie7.less +0 -245
- data/vendor/toolkit/fontawesome.less +0 -327
- /data/{vendor → app}/assets/images/twitter/bootstrap/glyphicons-halflings-white.png +0 -0
- /data/{vendor → app}/assets/images/twitter/bootstrap/glyphicons-halflings.png +0 -0
- /data/{vendor → app}/assets/javascripts/twitter/bootstrap.js +0 -0
- /data/{vendor → app}/assets/javascripts/twitter/bootstrap_ujs.js +0 -0
@@ -3,7 +3,7 @@
|
|
3
3
|
.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0;}
|
4
4
|
.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}
|
5
5
|
[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("<%= asset_path 'twitter/bootstrap/glyphicons-halflings.png' %>");background-position:14px 14px;background-repeat:no-repeat;margin-top:1px;}
|
6
|
-
.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"]{background-image:url("<%= asset_path 'twitter/bootstrap/glyphicons-halflings-white.png' %>");}
|
6
|
+
.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:focus>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>li>a:focus>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:focus>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"],.dropdown-submenu:focus>a>[class*=" icon-"]{background-image:url("<%= asset_path 'twitter/bootstrap/glyphicons-halflings-white.png' %>");}
|
7
7
|
.icon-glass{background-position:0 0;}
|
8
8
|
.icon-music{background-position:-24px 0;}
|
9
9
|
.icon-search{background-position:-48px 0;}
|
@@ -120,7 +120,7 @@
|
|
120
120
|
.icon-chevron-down{background-position:-313px -119px;}
|
121
121
|
.icon-retweet{background-position:-336px -120px;}
|
122
122
|
.icon-shopping-cart{background-position:-360px -120px;}
|
123
|
-
.icon-folder-close{background-position:-384px -120px;}
|
123
|
+
.icon-folder-close{background-position:-384px -120px;width:16px;}
|
124
124
|
.icon-folder-open{background-position:-408px -120px;width:16px;}
|
125
125
|
.icon-resize-vertical{background-position:-432px -119px;}
|
126
126
|
.icon-resize-horizontal{background-position:-456px -118px;}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module BadgeLabelHelper
|
2
|
+
def badge(*args)
|
3
|
+
badge_label(:badge, *args)
|
4
|
+
end
|
5
|
+
|
6
|
+
def tag_label(*args)
|
7
|
+
badge_label(:label, *args)
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
def badge_label(what, value, type = nil)
|
12
|
+
klass = [what]
|
13
|
+
klass << "#{what}-#{type}" if type.present?
|
14
|
+
content_tag :span, value, :class => "#{klass.join(' ')}"
|
15
|
+
end
|
16
|
+
end
|
@@ -1,17 +1,23 @@
|
|
1
|
-
module BootstrapFlashHelper
|
1
|
+
module BootstrapFlashHelper
|
2
|
+
ALERT_TYPES = [:error, :info, :success, :warning]
|
3
|
+
|
2
4
|
def bootstrap_flash
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
end
|
5
|
+
flash_messages = []
|
6
|
+
flash.each do |type, message|
|
7
|
+
# Skip empty messages, e.g. for devise messages set to nothing in a locale file.
|
8
|
+
next if message.blank?
|
9
|
+
|
10
|
+
type = :success if type == :notice
|
11
|
+
type = :error if type == :alert
|
12
|
+
next unless ALERT_TYPES.include?(type)
|
13
|
+
|
14
|
+
Array(message).each do |msg|
|
15
|
+
text = content_tag(:div,
|
16
|
+
content_tag(:button, raw("×"), :class => "close", "data-dismiss" => "alert") +
|
17
|
+
msg.html_safe, :class => "alert fade in alert-#{type}")
|
18
|
+
flash_messages << text if msg
|
19
|
+
end
|
20
|
+
end
|
21
|
+
flash_messages.join("\n").html_safe
|
22
|
+
end
|
23
|
+
end
|
data/app/helpers/glyph_helper.rb
CHANGED
@@ -4,9 +4,14 @@ module GlyphHelper
|
|
4
4
|
# # => <i class="icon-share-alt"></i>
|
5
5
|
# glyph(:lock, :white)
|
6
6
|
# # => <i class="icon-lock icon-white"></i>
|
7
|
+
# glyph(:thumbs_up, :pull_left)
|
8
|
+
# # => <i class="icon-thumbs-up pull-left"></i>
|
7
9
|
|
8
10
|
def glyph(*names)
|
9
|
-
|
11
|
+
names.map! { |name| name.to_s.gsub('_','-') }
|
12
|
+
names.map! do |name|
|
13
|
+
name =~ /pull-(?:left|right)/ ? name : "icon-#{name}"
|
14
|
+
end
|
15
|
+
content_tag :i, nil, :class => names
|
10
16
|
end
|
11
17
|
end
|
12
|
-
|
data/app/helpers/modal_helper.rb
CHANGED
@@ -1,42 +1,55 @@
|
|
1
1
|
module ModalHelper
|
2
|
-
|
3
|
-
|
4
|
-
|
2
|
+
|
3
|
+
#modals have a header, a body, a footer for options.
|
4
|
+
def modal_dialog(options = {}, &block)
|
5
|
+
content_tag :div, :id => options[:id], :class => "bootstrap-modal modal hide fade" do
|
6
|
+
modal_header(options[:header]) +
|
7
|
+
modal_body(options[:body]) +
|
8
|
+
modal_footer(options[:footer])
|
9
|
+
end
|
5
10
|
end
|
6
11
|
|
7
|
-
def modal_header(options = {},
|
8
|
-
|
9
|
-
|
10
|
-
|
12
|
+
def modal_header(options = {}, &block)
|
13
|
+
content_tag :div, :class => 'modal-header' do
|
14
|
+
if options[:show_close]
|
15
|
+
close_button(options[:dismiss]) +
|
16
|
+
content_tag(:h3, options[:title], &block)
|
17
|
+
else
|
18
|
+
content_tag(:h3, options[:title], &block)
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|
13
22
|
|
14
|
-
def modal_body(options = {},
|
15
|
-
|
16
|
-
content_tag :div, nil, options.merge(default_options), escape, &block
|
23
|
+
def modal_body(options = {}, &block)
|
24
|
+
content_tag :div, options, :class => 'modal-body', &block
|
17
25
|
end
|
18
26
|
|
19
|
-
def modal_footer(options = {},
|
20
|
-
|
21
|
-
|
27
|
+
def modal_footer(options = {}, &block)
|
28
|
+
content_tag :div, options, :class => 'modal-footer', &block
|
29
|
+
end
|
30
|
+
|
31
|
+
def close_button(dismiss)
|
32
|
+
#It doesn't seem to like content_tag, so we do this instead.
|
33
|
+
raw("<button class=\"close\" data-dismiss=\"#{dismiss}\">×</button>")
|
22
34
|
end
|
23
35
|
|
24
36
|
def modal_toggle(content_or_options = nil, options = {}, &block)
|
25
37
|
if block_given?
|
26
38
|
options = content_or_options if content_or_options.is_a?(Hash)
|
27
|
-
default_options = {:class => 'btn', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
|
39
|
+
default_options = { :class => 'btn', "data-toggle" => "modal", "href" => options[:dialog] }.merge(options)
|
28
40
|
|
29
41
|
content_tag :a, nil, default_options, true, &block
|
30
42
|
else
|
31
|
-
default_options = {:class => 'btn', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
|
43
|
+
default_options = { :class => 'btn', "data-toggle" => "modal", "href" => options[:dialog] }.merge(options)
|
32
44
|
content_tag :a, content_or_options, default_options, true
|
33
45
|
end
|
34
46
|
end
|
35
47
|
|
36
48
|
def modal_cancel_button content, options = {}
|
37
|
-
default_options = {:class => "btn bootstrap-modal-cancel-button"}
|
49
|
+
default_options = { :class => "btn bootstrap-modal-cancel-button" }
|
38
50
|
|
39
51
|
content_tag_string "a", content, default_options.merge(options)
|
40
52
|
end
|
53
|
+
|
41
54
|
end
|
42
55
|
|
@@ -0,0 +1,194 @@
|
|
1
|
+
#Credit for this goes to https://github.com/julescopeland/Rails-Bootstrap-Navbar
|
2
|
+
module NavbarHelper
|
3
|
+
def nav_bar(options={}, &block)
|
4
|
+
nav_bar_div(options) do
|
5
|
+
navbar_inner_div do
|
6
|
+
container_div(options[:brand], options[:brand_link], options[:responsive], options[:fluid]) do
|
7
|
+
yield if block_given?
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def menu_group(options={}, &block)
|
14
|
+
pull_class = "pull-#{options[:pull].to_s}" if options[:pull].present?
|
15
|
+
content_tag(:ul, :class => "nav #{pull_class}", &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def menu_item(name=nil, path="#", *args, &block)
|
19
|
+
path = name || path if block_given?
|
20
|
+
options = args.extract_options!
|
21
|
+
content_tag :li, :class => is_active?(path, options) do
|
22
|
+
name, path = path, options if block_given?
|
23
|
+
link_to name, path, options, &block
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def drop_down(name)
|
28
|
+
content_tag :li, :class => "dropdown" do
|
29
|
+
drop_down_link(name) + drop_down_list { yield }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def drop_down_with_submenu(name, &block)
|
34
|
+
content_tag :li, :class => "dropdown" do
|
35
|
+
drop_down_link(name) + drop_down_sublist(&block)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def drop_down_sublist(&block)
|
40
|
+
content_tag :ul, :class => "dropdown-menu", &block
|
41
|
+
end
|
42
|
+
|
43
|
+
def drop_down_submenu(name, &block)
|
44
|
+
content_tag :li, :class => "dropdown-submenu" do
|
45
|
+
link_to(name, "") + drop_down_list(&block)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def drop_down_divider
|
50
|
+
content_tag :li, "", :class => "divider"
|
51
|
+
end
|
52
|
+
|
53
|
+
def drop_down_header(text)
|
54
|
+
content_tag :li, text, :class => "nav-header"
|
55
|
+
end
|
56
|
+
|
57
|
+
def menu_divider
|
58
|
+
content_tag :li, "", :class => "divider-vertical"
|
59
|
+
end
|
60
|
+
|
61
|
+
def menu_text(text=nil, options={}, &block)
|
62
|
+
pull = options.delete(:pull)
|
63
|
+
pull_class = pull.present? ? "pull-#{pull.to_s}" : nil
|
64
|
+
options.append_merge!(:class, pull_class)
|
65
|
+
options.append_merge!(:class, "navbar-text")
|
66
|
+
content_tag :p, options do
|
67
|
+
text || yield
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Returns current url or path state (useful for buttons).
|
72
|
+
# Example:
|
73
|
+
# # Assume we'r currently at blog/categories/test
|
74
|
+
# uri_state('/blog/categories/test', {}) # :active
|
75
|
+
# uri_state('/blog/categories', {}) # :chosen
|
76
|
+
# uri_state('/blog/categories/test', {method: delete}) # :inactive
|
77
|
+
# uri_state('/blog/categories/test/3', {}) # :inactive
|
78
|
+
def uri_state(uri, options={})
|
79
|
+
root_url = request.host_with_port + '/'
|
80
|
+
root = uri == '/' || uri == root_url
|
81
|
+
|
82
|
+
request_uri = if uri.start_with?(root_url)
|
83
|
+
request.url
|
84
|
+
else
|
85
|
+
request.path
|
86
|
+
end
|
87
|
+
|
88
|
+
if !options[:method].nil? || !options["data-method"].nil?
|
89
|
+
:inactive
|
90
|
+
elsif uri == request_uri
|
91
|
+
:active
|
92
|
+
else
|
93
|
+
if request_uri.start_with?(uri) and not(root)
|
94
|
+
:chosen
|
95
|
+
else
|
96
|
+
:inactive
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
private
|
102
|
+
|
103
|
+
def nav_bar_div(options, &block)
|
104
|
+
|
105
|
+
position = "static-#{options[:static].to_s}" if options[:static]
|
106
|
+
position = "fixed-#{options[:fixed].to_s}" if options[:fixed]
|
107
|
+
inverse = (options[:inverse].present? && options[:inverse] == true) ? true : false
|
108
|
+
|
109
|
+
content_tag :div, :class => nav_bar_css_class(position, inverse) do
|
110
|
+
yield
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def navbar_inner_div(&block)
|
115
|
+
content_tag :div, :class => "navbar-inner" do
|
116
|
+
yield
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def container_div(brand, brand_link, responsive, fluid, &block)
|
121
|
+
content_tag :div, :class => "container#{"-fluid" if fluid}" do
|
122
|
+
container_div_with_block(brand, brand_link, responsive, &block)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
def container_div_with_block(brand, brand_link, responsive, &block)
|
127
|
+
output = []
|
128
|
+
if responsive == true
|
129
|
+
output << responsive_button
|
130
|
+
output << brand_link(brand, brand_link)
|
131
|
+
output << responsive_div { capture(&block) }
|
132
|
+
else
|
133
|
+
output << brand_link(brand, brand_link)
|
134
|
+
output << capture(&block)
|
135
|
+
end
|
136
|
+
output.join("\n").html_safe
|
137
|
+
end
|
138
|
+
|
139
|
+
def nav_bar_css_class(position, inverse = false)
|
140
|
+
css_class = ["navbar"]
|
141
|
+
css_class << "navbar-#{position}" if position.present?
|
142
|
+
css_class << "navbar-inverse" if inverse
|
143
|
+
css_class.join(" ")
|
144
|
+
end
|
145
|
+
|
146
|
+
def brand_link(name, url)
|
147
|
+
return "" if name.blank?
|
148
|
+
url ||= root_url
|
149
|
+
link_to(name, url, :class => "brand")
|
150
|
+
end
|
151
|
+
|
152
|
+
def responsive_button
|
153
|
+
%{<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
154
|
+
<span class="icon-bar"></span>
|
155
|
+
<span class="icon-bar"></span>
|
156
|
+
<span class="icon-bar"></span>
|
157
|
+
</a>}
|
158
|
+
end
|
159
|
+
|
160
|
+
def responsive_div(&block)
|
161
|
+
content_tag(:div, :class => "nav-collapse collapse", &block)
|
162
|
+
end
|
163
|
+
|
164
|
+
def is_active?(path, options={})
|
165
|
+
"active" if uri_state(path, options).in?([:active, :chosen])
|
166
|
+
end
|
167
|
+
|
168
|
+
def name_and_caret(name)
|
169
|
+
"#{name} #{content_tag(:b, :class => "caret") {}}".html_safe
|
170
|
+
end
|
171
|
+
|
172
|
+
def drop_down_link(name)
|
173
|
+
link_to(name_and_caret(name), "#", :class => "dropdown-toggle", "data-toggle" => "dropdown")
|
174
|
+
end
|
175
|
+
|
176
|
+
def drop_down_list(&block)
|
177
|
+
content_tag :ul, :class => "dropdown-menu", &block
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
class Hash
|
182
|
+
# appends a string to a hash key's value after a space character (Good for merging CSS classes in options hashes)
|
183
|
+
def append_merge!(key, value)
|
184
|
+
# just return self if value is blank
|
185
|
+
return self if value.blank?
|
186
|
+
|
187
|
+
current_value = self[key]
|
188
|
+
# just merge if it doesn't already have that key
|
189
|
+
self[key] = value and return if current_value.blank?
|
190
|
+
# raise error if we're trying to merge into something that isn't a string
|
191
|
+
raise ArgumentError, "Can only merge strings" unless current_value.is_a?(String)
|
192
|
+
self[key] = [current_value, value].compact.join(" ")
|
193
|
+
end
|
194
|
+
end
|
@@ -1,5 +1,10 @@
|
|
1
1
|
module TwitterBreadcrumbsHelper
|
2
|
-
def render_breadcrumbs(divider = '/')
|
3
|
-
render :partial => 'twitter-bootstrap/breadcrumbs', :locals => { :divider => divider }
|
2
|
+
def render_breadcrumbs(divider = '/', &block)
|
3
|
+
content = render :partial => 'twitter-bootstrap/breadcrumbs', :layout => false, :locals => { :divider => divider }
|
4
|
+
if block_given?
|
5
|
+
capture(content, &block)
|
6
|
+
else
|
7
|
+
content
|
8
|
+
end
|
4
9
|
end
|
5
10
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @breadcrumbs.present? %>
|
2
2
|
<ul class="breadcrumb">
|
3
|
-
<% separator = divider %>
|
3
|
+
<% separator = divider.html_safe %>
|
4
4
|
<% @breadcrumbs[0..-2].each do |crumb| %>
|
5
5
|
<li>
|
6
6
|
<%= link_to crumb[:name], crumb[:url], crumb[:options] %>
|
@@ -11,4 +11,4 @@
|
|
11
11
|
<%= @breadcrumbs.last[:name] %>
|
12
12
|
</li>
|
13
13
|
</ul>
|
14
|
-
<% end %>
|
14
|
+
<% end %>
|
@@ -10,20 +10,24 @@ module Bootstrap
|
|
10
10
|
|
11
11
|
def add_assets
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
js_manifest = 'app/assets/javascripts/application.js'
|
14
|
+
|
15
|
+
if File.exist?(js_manifest)
|
16
|
+
insert_into_file js_manifest, "//= require twitter/bootstrap\n", :after => "jquery_ujs\n"
|
15
17
|
else
|
16
|
-
copy_file "application.js",
|
18
|
+
copy_file "application.js", js_manifest
|
17
19
|
end
|
18
20
|
|
19
|
-
|
21
|
+
css_manifest = 'app/assets/stylesheets/application.css'
|
22
|
+
|
23
|
+
if File.exist?(css_manifest)
|
20
24
|
# Add our own require:
|
21
|
-
content = File.read(
|
25
|
+
content = File.read(css_manifest)
|
22
26
|
if content.match(/require_tree\s+\.\s*$/)
|
23
27
|
# Good enough - that'll include our bootstrap_and_overrides.css.less
|
24
28
|
else
|
25
29
|
style_require_block = " *= require bootstrap_and_overrides\n"
|
26
|
-
insert_into_file
|
30
|
+
insert_into_file css_manifest, style_require_block, :after => "require_self\n"
|
27
31
|
end
|
28
32
|
else
|
29
33
|
copy_file "application.css", "app/assets/stylesheets/application.css"
|
@@ -44,6 +48,15 @@ module Bootstrap
|
|
44
48
|
end
|
45
49
|
end
|
46
50
|
|
51
|
+
def add_locale
|
52
|
+
if File.exist?("config/locales/en.bootstrap.yml")
|
53
|
+
localez = File.read("config/locales/en.bootstrap.yml")
|
54
|
+
insert_into_file "config/locales/en.bootstrap.yml", localez, :after => "en\n"
|
55
|
+
else
|
56
|
+
copy_file "en.bootstrap.yml", "config/locales/en.bootstrap.yml"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
47
60
|
def cleanup_legacy
|
48
61
|
# Remove old requires (if any) that included twitter/bootstrap directly:
|
49
62
|
gsub_file("app/assets/stylesheets/application.css", %r|\s*\*=\s*twitter/bootstrap\s*\n|, "")
|
@@ -2,20 +2,18 @@
|
|
2
2
|
@import "twitter/bootstrap/responsive";
|
3
3
|
|
4
4
|
// Set the correct sprite paths
|
5
|
-
@iconSpritePath:
|
6
|
-
@iconWhiteSpritePath:
|
5
|
+
@iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
|
6
|
+
@iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
|
7
7
|
|
8
8
|
// Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
|
9
|
-
|
10
|
-
|
11
|
-
@
|
12
|
-
@
|
13
|
-
@
|
14
|
-
@fontAwesomeTtfPath: asset-path("fontawesome-webfont.ttf");
|
15
|
-
@fontAwesomeSvgPath: asset-path("fontawesome-webfont.svg");
|
9
|
+
@fontAwesomeEotPath: asset-url("fontawesome-webfont.eot");
|
10
|
+
@fontAwesomeEotPath_iefix: asset-url("fontawesome-webfont.eot?#iefix");
|
11
|
+
@fontAwesomeWoffPath: asset-url("fontawesome-webfont.woff");
|
12
|
+
@fontAwesomeTtfPath: asset-url("fontawesome-webfont.ttf");
|
13
|
+
@fontAwesomeSvgPath: asset-url("fontawesome-webfont.svg#fontawesomeregular");
|
16
14
|
|
17
15
|
// Font Awesome
|
18
|
-
@import "fontawesome";
|
16
|
+
@import "fontawesome/font-awesome";
|
19
17
|
|
20
18
|
// Glyphicons
|
21
19
|
//@import "twitter/bootstrap/sprites.less";
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
|
4
|
+
en:
|
5
|
+
helpers:
|
6
|
+
actions: "Actions"
|
7
|
+
links:
|
8
|
+
back: "Back"
|
9
|
+
cancel: "Cancel"
|
10
|
+
confirm: "Are you sure?"
|
11
|
+
destroy: "Delete"
|
12
|
+
new: "New"
|
13
|
+
edit: "Edit"
|
14
|
+
titles:
|
15
|
+
edit: "Edit %{model}"
|
16
|
+
save: "Save %{model}"
|
17
|
+
new: "New %{model}"
|
18
|
+
delete: "Delete %{model}"
|
@@ -16,23 +16,25 @@
|
|
16
16
|
|
17
17
|
<!-- For third-generation iPad with high-resolution Retina display: -->
|
18
18
|
<!-- Size should be 144 x 144 pixels -->
|
19
|
-
<%%= favicon_link_tag '
|
19
|
+
<%%= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144' %>
|
20
20
|
|
21
21
|
<!-- For iPhone with high-resolution Retina display: -->
|
22
22
|
<!-- Size should be 114 x 114 pixels -->
|
23
|
-
<%%= favicon_link_tag '
|
23
|
+
<%%= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114' %>
|
24
24
|
|
25
25
|
<!-- For first- and second-generation iPad: -->
|
26
26
|
<!-- Size should be 72 x 72 pixels -->
|
27
|
-
<%%= favicon_link_tag '
|
27
|
+
<%%= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72' %>
|
28
28
|
|
29
29
|
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
|
30
30
|
<!-- Size should be 57 x 57 pixels -->
|
31
|
-
<%%= favicon_link_tag '
|
31
|
+
<%%= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png' %>
|
32
32
|
|
33
33
|
<!-- For all other devices -->
|
34
34
|
<!-- Size should be 32 x 32 pixels -->
|
35
|
-
<%%= favicon_link_tag '
|
35
|
+
<%%= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon' %>
|
36
|
+
|
37
|
+
<%%= javascript_include_tag "application" %>
|
36
38
|
</head>
|
37
39
|
<body>
|
38
40
|
|
@@ -77,7 +79,8 @@
|
|
77
79
|
<%- else -%>
|
78
80
|
<div class="row">
|
79
81
|
<div class="span9">
|
80
|
-
|
82
|
+
<%%= bootstrap_flash %>
|
83
|
+
<%%= yield %>
|
81
84
|
</div>
|
82
85
|
<div class="span3">
|
83
86
|
<div class="well sidebar-nav">
|
@@ -94,15 +97,10 @@
|
|
94
97
|
<%- end -%>
|
95
98
|
|
96
99
|
<footer>
|
97
|
-
<p>© Company
|
100
|
+
<p>© Company <%= Date.today.year %></p>
|
98
101
|
</footer>
|
99
102
|
|
100
103
|
</div> <!-- /container -->
|
101
104
|
|
102
|
-
<!-- Javascripts
|
103
|
-
================================================== -->
|
104
|
-
<!-- Placed at the end of the document so the pages load faster -->
|
105
|
-
<%%= javascript_include_tag "application" %>
|
106
|
-
|
107
105
|
</body>
|
108
106
|
</html>
|
@@ -10,11 +10,12 @@
|
|
10
10
|
/[if lt IE 9]
|
11
11
|
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
|
12
12
|
= stylesheet_link_tag "application", :media => "all"
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'
|
14
|
+
= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114'
|
15
|
+
= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'
|
16
|
+
= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
|
17
|
+
= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon'
|
18
|
+
= javascript_include_tag "application"
|
18
19
|
|
19
20
|
|
20
21
|
%body
|
@@ -44,6 +45,7 @@
|
|
44
45
|
%li= link_to "Link 2", "/path2"
|
45
46
|
%li= link_to "Link 3", "/path3"
|
46
47
|
.span9
|
48
|
+
= bootstrap_flash
|
47
49
|
= yield
|
48
50
|
<% else %>
|
49
51
|
.row
|
@@ -60,9 +62,4 @@
|
|
60
62
|
%li= link_to "Link 3", "/path3"
|
61
63
|
<% end %>
|
62
64
|
%footer
|
63
|
-
%p © Company
|
64
|
-
/
|
65
|
-
Javascripts
|
66
|
-
\==================================================
|
67
|
-
/ Placed at the end of the document so the pages load faster
|
68
|
-
= javascript_include_tag "application"
|
65
|
+
%p © Company <%= Date.today.year %>
|
@@ -11,11 +11,14 @@ html lang="en"
|
|
11
11
|
/[if lt IE 9]
|
12
12
|
= javascript_include_tag "//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.6.1/html5shiv.js"
|
13
13
|
= stylesheet_link_tag "application", :media => "all"
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
= favicon_link_tag 'apple-touch-icon-144x144-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '144x144'
|
15
|
+
= favicon_link_tag 'apple-touch-icon-114x114-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '114x114'
|
16
|
+
= favicon_link_tag 'apple-touch-icon-72x72-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png', :sizes => '72x72'
|
17
|
+
= favicon_link_tag 'apple-touch-icon-precomposed.png', :rel => 'apple-touch-icon-precomposed', :type => 'image/png'
|
18
|
+
= favicon_link_tag 'favicon.ico', :rel => 'shortcut icon'
|
19
|
+
= javascript_include_tag "application"
|
20
|
+
|
21
|
+
|
19
22
|
|
20
23
|
body
|
21
24
|
.navbar.navbar-<%= layout_type %>-top
|
@@ -44,6 +47,7 @@ html lang="en"
|
|
44
47
|
li= link_to "Link 2", "/path2"
|
45
48
|
li= link_to "Link 3", "/path3"
|
46
49
|
.span9
|
50
|
+
= bootstrap_flash
|
47
51
|
= yield
|
48
52
|
<% else %>
|
49
53
|
.row
|
@@ -60,9 +64,4 @@ html lang="en"
|
|
60
64
|
li= link_to "Link 3", "/path3"
|
61
65
|
<% end %>
|
62
66
|
footer
|
63
|
-
p © Company
|
64
|
-
/!
|
65
|
-
Javascripts
|
66
|
-
\==================================================
|
67
|
-
/! Placed at the end of the document so the pages load faster
|
68
|
-
= javascript_include_tag "application"
|
67
|
+
p © Company <%= Date.today.year %>
|
@@ -1,6 +1,5 @@
|
|
1
1
|
<%%- model_class = <%= resource_name.classify %> -%>
|
2
2
|
<div class="page-header">
|
3
|
-
<h1><%%=t '.title', :default =>
|
4
|
-
:default => "Edit #{model_class.model_name.human}") %></h1>
|
3
|
+
<h1><%%=t '.title', :default => [:'helpers.titles.edit', 'Edit %{model}'], :model => model_class.model_name.human.titleize %></h1>
|
5
4
|
</div>
|
6
5
|
<%%= render :partial => 'form' %>
|