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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc4938e203f45de7b2525fe72cf2f42554db7397
4
- data.tar.gz: ee20eb6cdb7af95604a6520b7d267b7ebe156912
3
+ metadata.gz: 786bf436387da3ca76abd44f24e135a2ec786ca3
4
+ data.tar.gz: 67a5a6eb0209ae28e9636d3b0f86be31e27f4581
5
5
  SHA512:
6
- metadata.gz: dab565ead0e62ae0e6fed97368509db826e530823007ab4986c6a8c17e278e653859ade93a1b134a7184736b4fd00301a2fc18c64a748c4760d0930054b079db
7
- data.tar.gz: dcc203c98183b826313e1232fd952afaea02283c8645e263db10709f0c072ae6d94e4c8c571fb3a715aa36f2807901684cb39bdf7385c5c8e7a6bd596c501618
6
+ metadata.gz: 27505f2fd489a2a68d0da725cae948b52e4d8665854de02bb57c1b135b53bab1d1057973bbdd4716fb57f1efe4825494cd2548d2a50766f188c4aeb98fbfda1c
7
+ data.tar.gz: a0ea727d02fa67b17688ef2036c19c66bb3580aba66e5e2d6e7d1066f5b248686adf60461cae6152964faa682cbcc69fa2a4d9541789e6ae67672dca5f16ef95
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # Bootstrap2Helpers
2
- Short description and motivation.
2
+
3
+ Export of bread_crumps and flush helpers from bootstrap2, patched to bootstrap 3
3
4
 
4
5
  ## Usage
5
6
  gem 'bootstrap_2_helpers'
@@ -1,18 +1,18 @@
1
1
  module BootstrapFlashHelper
2
- AVALIABLE_TYPES = %i(info success warning danger)
2
+ AVALIABLE_TYPES = %w(info success warning danger).freeze
3
3
  def bootstrap_flash
4
- flash_messages = []
5
- flash.each do |type, message|
6
- # Skip Devise :timeout and :timedout flags
7
- next if type == :timeout
8
- next if type == :timedout
9
- type = :error if type == :danger
10
- use_type = AVALIABLE_TYPES.include?(type) ? type : :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
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('&times;'), :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(type, message)
12
- raw(content_tag(:div, :class => "alert alert-#{use_type}") do
13
- content_tag(:a, raw("&times;"),:class => 'close', :data => {:dismiss => 'alert'}) +
11
+ def flash_container(_type, message)
12
+ raw(content_tag(:div, class: "alert alert-#{use_type}") do
13
+ content_tag(:a, raw('&times;'), class: 'close', data: { dismiss: 'alert' }) +
14
14
  message
15
15
  end)
16
16
  end
@@ -1,42 +1,41 @@
1
1
  module ModalHelper
2
2
  def modal_dialog(options = {}, escape = true, &block)
3
- default_options = {:class => "bootstrap-modal modal"}
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 = {:class => 'modal-header'}
8
+ default_options = { class: 'modal-header' }
9
9
  content_tag :div, nil, options.merge(default_options), escape do
10
- raw("<button class=\"close\" data-dismiss=\"modal\">&times;</button>" + capture(&block))
10
+ raw('<button class="close" data-dismiss="modal">&times;</button>' + capture(&block))
11
11
  end
12
12
  end
13
13
 
14
14
  def modal_body(options = {}, escape = true, &block)
15
- default_options = {:class => 'modal-body'}
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 = {:class => 'modal-footer'}
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', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
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', "data-toggle" => "modal", "href" => options[:dialog]}.merge(options)
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 content, options = {}
37
- default_options = {:class => "btn bootstrap-modal-cancel-button"}
36
+ def modal_cancel_button(content, options = {})
37
+ default_options = { class: 'btn bootstrap-modal-cancel-button' }
38
38
 
39
- content_tag_string "a", content, default_options.merge(options)
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 :partial => 'twitter-bootstrap/breadcrumbs', :locals => { :divider => divider }
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
- initializer 'twitter-bootstrap-rails.setup_helpers' do |app|
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
- @breadcrumbs << {:name => name, :url => url, :options => options}
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, :scope => scope
33
+ I18n.t name, scope: scope
34
34
  end
35
35
 
36
36
  def render_breadcrumbs(divider = '/')
37
- s = render :partial => 'twitter-bootstrap/breadcrumbs', :locals => {:divider => divider}
37
+ s = render partial: 'twitter-bootstrap/breadcrumbs', locals: { divider: divider }
38
38
  s.first
39
39
  end
40
40
  end
@@ -1,3 +1,3 @@
1
1
  module Bootstrap2Helpers
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'.freeze
3
3
  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.2
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-07-14 00:00:00.000000000 Z
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: