bootstrap_builders 0.0.61 → 0.0.62

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 250f6cde716d39a305a42b3345c8a388b38bf623
4
- data.tar.gz: bab587be818ec8b518ae3641aebc9d3a4d7a2cfc
3
+ metadata.gz: 8da1df445bfcf916c18945583429d5167bddd3e3
4
+ data.tar.gz: 893a4347741f1ca24df5a3e781bcaae691ca5e60
5
5
  SHA512:
6
- metadata.gz: 17963e7e6bde475d527cfebeee201ea02f66bbc87bb25faf799a594261274973b9c791ea2a72632675bc65b362ec28ae508f6eb751723445a46a6feb2acd2f78
7
- data.tar.gz: 5cfe540f4accaac79d0e2d837e74e9701bbe239802d58b6d180eb0ccf5449208139d02cb1d11582ec22b48daaecaf144270c13d731e5c4269353cfdaa6464a23
6
+ metadata.gz: d260cf53ba5b4c270b079e9d85ad7f3aa3fc4cd375c941ba1bb72d2ba2e0de7ea2ce33d818d9334fba2ebf275df6ae8297d417e029759bd395c7a242c807225b
7
+ data.tar.gz: c922ba4d441a1b02667552307c670afaafeba0db54ef6c4273fa151ad201def4cc207b0c0a47dabf405c935b59d2d02eb0055d2e2f2afdabe72f42830a30a2ec
data/Rakefile CHANGED
@@ -14,7 +14,7 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include("lib/**/*.rb")
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
18
18
  load "rails/tasks/engine.rake"
19
19
  load "rails/tasks/statistics.rake"
20
20
 
@@ -12,7 +12,8 @@ function loadAjaxTab(li) {
12
12
  })
13
13
  }
14
14
 
15
- $(document).ready(function() {
15
+ // Makes sure the correct tab is loaded on page load
16
+ function loadActiveAjaxTabOnPageLoad() {
16
17
  //Loads the dynamic content of a tab when activated and sets the URL to the tab ID
17
18
  $("body").on("click", ".bb-tabs-container .nav li", function() {
18
19
  var li = $(this)
@@ -22,7 +23,6 @@ $(document).ready(function() {
22
23
  } else if(li.data("specific-id-given")) {
23
24
  var urlb = new UrlBuilder(window.location.href)
24
25
  urlb.queryParameters["bb_selected_tab"] = $(this).data("tab-container-id")
25
-
26
26
  window.history.pushState({active_tab: li.data("tab-container-id"), event: "bb-tab-change"}, null, urlb.pathWithQueryParameters())
27
27
  }
28
28
 
@@ -31,6 +31,14 @@ $(document).ready(function() {
31
31
  }
32
32
  })
33
33
 
34
+ var active_tab = $(".bb-tabs-container .nav li.active[data-ajax-url]")
35
+
36
+ if (active_tab.length > 0) {
37
+ loadAjaxTab(active_tab)
38
+ }
39
+ }
40
+
41
+ $(document).ready(function() {
34
42
  // Changes the tab on 'back' and 'forward' events
35
43
  $(window).bind("popstate", function(e) {
36
44
  if (e.originalEvent.state && e.originalEvent.state.event == "bb-tab-change") {
@@ -55,11 +63,8 @@ $(document).ready(function() {
55
63
  $("a", li).click()
56
64
  }
57
65
  })
66
+ })
58
67
 
59
- // Makes sure the correct tab is loaded on page load
60
- var active_tab = $(".bb-tabs-container .nav li.active[data-ajax-url]")
61
-
62
- if (active_tab.length > 0) {
63
- loadAjaxTab(active_tab)
64
- }
68
+ document.addEventListener("turbolinks:load", function() {
69
+ loadActiveAjaxTabOnPageLoad()
65
70
  })
@@ -43,7 +43,7 @@ class BbDatePickerInput < SimpleForm::Inputs::Base
43
43
 
44
44
  html << template.text_field_tag("", val, class: classes, data: {date_format: "yyyy-mm-dd", provide: "datepicker"})
45
45
 
46
- html.html_safe
46
+ html.html_safe # rubocop:disable Rails/OutputSafety
47
47
  end
48
48
 
49
49
  content_tag
@@ -47,7 +47,7 @@ class BbDateTimePickerInput < SimpleForm::Inputs::Base
47
47
 
48
48
  html << template.text_field_tag("", val, class: classes, data: {date_format: "yyyy-mm-dd", provide: "datepicker"})
49
49
 
50
- html.html_safe
50
+ html.html_safe # rubocop:disable Rails/OutputSafety
51
51
  end
52
52
 
53
53
  content_tag
@@ -10,9 +10,7 @@ class BootstrapBuilders::ArgumentsParser
10
10
  @arguments_hash = {}
11
11
  end
12
12
 
13
- if @arguments.last.is_a?(Hash)
14
- @arguments_hash = @arguments_hash.merge(@arguments.pop)
15
- end
13
+ @arguments_hash = @arguments_hash.merge(@arguments.pop) if @arguments.last.is_a?(Hash)
16
14
 
17
15
  @arguments << @arguments_hash
18
16
 
@@ -46,7 +46,7 @@ class BootstrapBuilders::AttributeRows
46
46
  end
47
47
 
48
48
  html = elements.join("\n")
49
- html = html.html_safe if html.respond_to?(:html_safe)
49
+ html = html.html_safe if html.respond_to?(:html_safe) # rubocop:disable Rails/OutputSafety
50
50
  html
51
51
  end
52
52
 
@@ -13,9 +13,7 @@ class BootstrapBuilders::Button
13
13
  is_an_active_record = BootstrapBuilders::IsAChecker.is_a?(args.first, "ActiveRecord::Base")
14
14
  is_a_baza_model = BootstrapBuilders::IsAChecker.is_a?(args.first, "BazaModels::Model")
15
15
 
16
- if args.first.is_a?(Array) || args.first.is_a?(String) || is_an_active_record || is_a_baza_model
17
- args_parser.arguments_hash[:url] ||= args.shift
18
- end
16
+ args_parser.arguments_hash[:url] ||= args.shift if args.first.is_a?(Array) || args.first.is_a?(String) || is_an_active_record || is_a_baza_model
19
17
 
20
18
  args_parser.arguments_hash[:label] ||= args.shift if args.first.is_a?(String)
21
19
  args_parser.arguments_hash
@@ -83,11 +81,9 @@ class BootstrapBuilders::Button
83
81
  html = ""
84
82
  html << @context.content_tag(:i, nil, class: ["fa", "fa-#{@icon}"]) if @icon
85
83
 
86
- if @label && !@mini
87
- html << @context.content_tag(:span, " #{@label}", class: "bb-btn-label")
88
- end
84
+ html << @context.content_tag(:span, " #{@label}", class: "bb-btn-label") if @label && !@mini
89
85
 
90
- html.strip.html_safe
86
+ html.strip.html_safe # rubocop:disable Rails/OutputSafety
91
87
  end
92
88
  end
93
89
 
@@ -121,7 +117,7 @@ private
121
117
  can_object_from_url
122
118
  end
123
119
 
124
- @can_object = false unless @can_object
120
+ @can_object ||= false
125
121
  end
126
122
 
127
123
  @can_object
@@ -20,9 +20,7 @@ class BootstrapBuilders::ButtonDropDown
20
20
 
21
21
  args = args_parser.arguments
22
22
 
23
- if args.first.is_a?(Array) || args.first.is_a?(String) || is_an_active_record || is_a_baza_model
24
- args_parser.arguments_hash[:url] ||= args.shift
25
- end
23
+ args_parser.arguments_hash[:url] ||= args.shift if args.first.is_a?(Array) || args.first.is_a?(String) || is_an_active_record || is_a_baza_model
26
24
 
27
25
  args_parser.arguments_hash[:label] ||= args.shift if args.first.is_a?(String)
28
26
 
@@ -28,7 +28,7 @@ class BootstrapBuilders::ClassAttributeHandler
28
28
  private
29
29
 
30
30
  def convert_to_array(argument)
31
- return unless argument.present?
31
+ return if argument.blank?
32
32
  return argument.split(/\s+/) if argument.is_a?(String)
33
33
  return argument if argument.is_a?(Array)
34
34
  return [] if args.fetch(:class).nil?
@@ -25,7 +25,7 @@ class BootstrapBuilders::Flash
25
25
  end
26
26
  end
27
27
  @context.flash.clear
28
- flash_messages.join("\n").html_safe
28
+ flash_messages.join("\n").html_safe # rubocop:disable Rails/OutputSafety
29
29
  end
30
30
 
31
31
  private
@@ -51,7 +51,7 @@ class BootstrapBuilders::Panel
51
51
  html = @panel.html
52
52
 
53
53
  if html.respond_to?(:html_safe)
54
- html.html_safe
54
+ html.html_safe # rubocop:disable Rails/OutputSafety
55
55
  else
56
56
  html
57
57
  end
@@ -112,7 +112,7 @@ private
112
112
  end
113
113
 
114
114
  def collapse_id
115
- @_collapse_id ||= "bb-collapse-#{SecureRandom.hex(4)}"
115
+ @collapse_id ||= "bb-collapse-#{SecureRandom.hex(4)}"
116
116
  end
117
117
 
118
118
  def container_classes
@@ -1,6 +1,6 @@
1
1
  class BootstrapBuilders::ProgressBar
2
2
  def self.with_parsed_args(*opts)
3
- percent = opts.shift if opts.first.is_a?(Integer) || opts.first.is_a?(Float) || opts.first.is_a?(Fixnum)
3
+ percent = opts.shift if opts.first.is_a?(Integer) || opts.first.is_a?(Float) || opts.first.is_a?(Integer)
4
4
 
5
5
  args_parser = BootstrapBuilders::ArgumentsParser.new(
6
6
  arguments: opts,
@@ -1,3 +1,3 @@
1
1
  module BootstrapBuilders
2
- VERSION = "0.0.61".freeze
2
+ VERSION = "0.0.62".freeze
3
3
  end
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_builders
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.61
4
+ version: 0.0.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-24 00:00:00.000000000 Z
11
+ date: 2018-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: html_gen
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: 0.0.16
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: 4.0.0
26
+ version: 0.0.16
27
27
  - !ruby/object:Gem::Dependency
28
- name: html_gen
28
+ name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.16
33
+ version: 4.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.16
40
+ version: 4.0.0
41
41
  description: A library to generate Bootstrap HTML for Rails.
42
42
  email:
43
43
  - kaspernj@gmail.com