bootstrap_2_helpers 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/helpers/bootstrap_flash_helper.rb +15 -15
- data/app/helpers/flash_block_helper.rb +3 -3
- data/app/helpers/modal_helper.rb +10 -11
- data/app/helpers/twitter_breadcrumbs_helper.rb +5 -5
- data/lib/bootstrap_2_helpers/bootstrap/rails/engine.rb +1 -1
- data/lib/bootstrap_2_helpers/bootstrap/rails/twitter-bootstrap-breadcrumbs.rb +3 -3
- data/lib/bootstrap_2_helpers/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 786bf436387da3ca76abd44f24e135a2ec786ca3
|
4
|
+
data.tar.gz: 67a5a6eb0209ae28e9636d3b0f86be31e27f4581
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27505f2fd489a2a68d0da725cae948b52e4d8665854de02bb57c1b135b53bab1d1057973bbdd4716fb57f1efe4825494cd2548d2a50766f188c4aeb98fbfda1c
|
7
|
+
data.tar.gz: a0ea727d02fa67b17688ef2036c19c66bb3580aba66e5e2d6e7d1066f5b248686adf60461cae6152964faa682cbcc69fa2a4d9541789e6ae67672dca5f16ef95
|
data/README.md
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
module BootstrapFlashHelper
|
2
|
-
AVALIABLE_TYPES = %
|
2
|
+
AVALIABLE_TYPES = %w(info success warning danger).freeze
|
3
3
|
def bootstrap_flash
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
4
|
+
flash_messages = []
|
5
|
+
flash.each do |type, message|
|
6
|
+
# Skip Devise :timeout and :timedout flags
|
7
|
+
type_to_s = type.to_s
|
8
|
+
next if type_to_s == 'timeout' || type_to_s == 'timedout'
|
9
|
+
type_to_s = 'error' if type_to_s == 'danger'
|
10
|
+
use_type = AVALIABLE_TYPES.include?(type_to_s) ? type_to_s : :info
|
11
|
+
text = content_tag(:div,
|
12
|
+
content_tag(:button, raw('×'), :class => 'close', 'data-dismiss' => 'alert') +
|
13
|
+
message, class: "alert fade in alert-#{use_type}")
|
14
|
+
flash_messages << text if message
|
15
|
+
end
|
16
|
+
flash_messages.join("\n").html_safe
|
17
17
|
end
|
18
|
-
end
|
18
|
+
end
|
@@ -8,9 +8,9 @@ module FlashBlockHelper
|
|
8
8
|
raw(output)
|
9
9
|
end
|
10
10
|
|
11
|
-
def flash_container(
|
12
|
-
raw(content_tag(:div, :
|
13
|
-
content_tag(:a, raw(
|
11
|
+
def flash_container(_type, message)
|
12
|
+
raw(content_tag(:div, class: "alert alert-#{use_type}") do
|
13
|
+
content_tag(:a, raw('×'), class: 'close', data: { dismiss: 'alert' }) +
|
14
14
|
message
|
15
15
|
end)
|
16
16
|
end
|
data/app/helpers/modal_helper.rb
CHANGED
@@ -1,42 +1,41 @@
|
|
1
1
|
module ModalHelper
|
2
2
|
def modal_dialog(options = {}, escape = true, &block)
|
3
|
-
default_options = {:
|
3
|
+
default_options = { class: 'bootstrap-modal modal' }
|
4
4
|
content_tag :div, nil, options.merge(default_options), escape, &block
|
5
5
|
end
|
6
6
|
|
7
7
|
def modal_header(options = {}, escape = true, &block)
|
8
|
-
default_options = {:
|
8
|
+
default_options = { class: 'modal-header' }
|
9
9
|
content_tag :div, nil, options.merge(default_options), escape do
|
10
|
-
raw(
|
10
|
+
raw('<button class="close" data-dismiss="modal">×</button>' + capture(&block))
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
def modal_body(options = {}, escape = true, &block)
|
15
|
-
default_options = {:
|
15
|
+
default_options = { class: 'modal-body' }
|
16
16
|
content_tag :div, nil, options.merge(default_options), escape, &block
|
17
17
|
end
|
18
18
|
|
19
19
|
def modal_footer(options = {}, escape = true, &block)
|
20
|
-
default_options = {:
|
20
|
+
default_options = { class: 'modal-footer' }
|
21
21
|
content_tag :div, nil, options.merge(default_options), escape, &block
|
22
22
|
end
|
23
23
|
|
24
24
|
def modal_toggle(content_or_options = nil, options = {}, &block)
|
25
25
|
if block_given?
|
26
26
|
options = content_or_options if content_or_options.is_a?(Hash)
|
27
|
-
default_options = {:class => 'btn',
|
27
|
+
default_options = { :class => 'btn', 'data-toggle' => 'modal', 'href' => options[:dialog] }.merge(options)
|
28
28
|
|
29
29
|
content_tag :a, nil, default_options, true, &block
|
30
30
|
else
|
31
|
-
default_options = {:class => 'btn',
|
31
|
+
default_options = { :class => 'btn', 'data-toggle' => 'modal', 'href' => options[:dialog] }.merge(options)
|
32
32
|
content_tag :a, content_or_options, default_options, true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def modal_cancel_button
|
37
|
-
default_options = {:
|
36
|
+
def modal_cancel_button(content, options = {})
|
37
|
+
default_options = { class: 'btn bootstrap-modal-cancel-button' }
|
38
38
|
|
39
|
-
content_tag_string
|
39
|
+
content_tag_string 'a', content, default_options.merge(options)
|
40
40
|
end
|
41
41
|
end
|
42
|
-
|
@@ -1,5 +1,5 @@
|
|
1
|
-
module TwitterBreadcrumbsHelper
|
2
|
-
def render_breadcrumbs(divider = '/')
|
3
|
-
render :
|
4
|
-
end
|
5
|
-
end
|
1
|
+
module TwitterBreadcrumbsHelper
|
2
|
+
def render_breadcrumbs(divider = '/')
|
3
|
+
render partial: 'twitter-bootstrap/breadcrumbs', locals: { divider: divider }
|
4
|
+
end
|
5
|
+
end
|
@@ -9,7 +9,7 @@ module Bootstrap2Helpers
|
|
9
9
|
module Bootstrap
|
10
10
|
module Rails
|
11
11
|
class Engine < ::Rails::Engine
|
12
|
-
|
12
|
+
initializer 'twitter-bootstrap-rails.setup_helpers' do |app|
|
13
13
|
app.config.to_prepare do
|
14
14
|
ActionController::Base.send :include, BreadCrumbs
|
15
15
|
ActionController::Base.send :helper, FlashBlockHelper
|
@@ -21,7 +21,7 @@ module Bootstrap2Helpers
|
|
21
21
|
@breadcrumbs ||= []
|
22
22
|
name = translate_breadcrumb(name, self.class.name) if name.is_a?(Symbol)
|
23
23
|
url = eval(url.to_s) if url =~ /_path|_url|@/
|
24
|
-
|
24
|
+
@breadcrumbs << { name: name, url: url, options: options }
|
25
25
|
end
|
26
26
|
|
27
27
|
def translate_breadcrumb(name, class_name)
|
@@ -30,11 +30,11 @@ module Bootstrap2Helpers
|
|
30
30
|
namespace.last.sub!('_controller', '')
|
31
31
|
scope += namespace
|
32
32
|
|
33
|
-
I18n.t name, :
|
33
|
+
I18n.t name, scope: scope
|
34
34
|
end
|
35
35
|
|
36
36
|
def render_breadcrumbs(divider = '/')
|
37
|
-
s = render :
|
37
|
+
s = render partial: 'twitter-bootstrap/breadcrumbs', locals: { divider: divider }
|
38
38
|
s.first
|
39
39
|
end
|
40
40
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bootstrap_2_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
|
- Kvokka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -82,4 +82,3 @@ signing_key:
|
|
82
82
|
specification_version: 4
|
83
83
|
summary: Bootstrap2Helpers.
|
84
84
|
test_files: []
|
85
|
-
has_rdoc:
|