twitter-bootstrap-components-rails 0.2.1 → 0.2.2

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: cacb231b7e92b5e36741654726564a3865bb3304
4
- data.tar.gz: 81b85b6b71d556ddbebb4b1f79a1bd8bf60b81fc
3
+ metadata.gz: ab91cf36f3a1102b09f44938b28f855f2642892a
4
+ data.tar.gz: b9e0e48b6457589d3252c2bb452fe5362222dc07
5
5
  SHA512:
6
- metadata.gz: 2020b5663d5c244acb2e0563fc82c7f17757d599ad54a64c866ac9b8fa47eff84a33c3dbac047fa2c755c2b6700ba18517b86cb50097ba94e2cf3c684f83decf
7
- data.tar.gz: cbaabb1cf1828c9761683ca6a68690ac66c840f798d4fcd452750cc689018baaa39f8b785ba34053ad56c00f0ae56d813ea23b7d07c8a22605c92662f87b1679
6
+ metadata.gz: cd419a150249dce16e6bb1f4a0ae3e886ee2ce9899b6ef75e997560017b6588a4e9da8bdf680a743142935c176fef088e3d99d2d41c2ed04daffb95e385c7a99
7
+ data.tar.gz: 73040eb841aaec2b082af74e4dafd35ee13533ee8f61c2e80527600cd3c4bc49c10c2b1da8c03d42739a1d8bfb6c0046a88319e93edb5b5c4a27c76e586c26ec
@@ -10,6 +10,7 @@ module Twitter
10
10
  block_output: @block_output,
11
11
  context: context,
12
12
  div_media_object_classes: div_media_object_classes,
13
+ div_container_classes: div_container_classes,
13
14
  image_options: image_options,
14
15
  link_target: link_target,
15
16
  horizontal_alignment: horizontal_alignment
@@ -20,6 +21,14 @@ module Twitter
20
21
  ["media-#{horizontal_alignment}", "media-#{vertical_alignment}"]
21
22
  end
22
23
 
24
+ def div_container_classes
25
+ ['media', additional_div_container_classes]
26
+ end
27
+
28
+ def additional_div_container_classes
29
+ @options[:additional_div_container_classes] || ''
30
+ end
31
+
23
32
  def context
24
33
  @options[:context]
25
34
  end
@@ -3,9 +3,23 @@ module Twitter
3
3
  module Components
4
4
  module V3
5
5
  class ResponsiveMediaObject < Twitter::Bootstrap::Components::V3::MediaObject
6
+ private
7
+
6
8
  def div_media_object_classes
7
9
  ["responsive-media-#{horizontal_alignment}", "responsive-media-#{vertical_alignment}"]
8
10
  end
11
+
12
+ def view_locals
13
+ super.merge(media_columns: media_columns)
14
+ end
15
+
16
+ def media_columns
17
+ @options[:media_columns] || 2
18
+ end
19
+
20
+ def div_container_classes
21
+ ['responsive-media', 'col-lg-12', additional_div_container_classes]
22
+ end
9
23
  end
10
24
  end
11
25
  end
@@ -25,7 +25,7 @@ module Twitter
25
25
  end
26
26
 
27
27
  def context
28
- @options[:context]
28
+ @options[:context] || :default
29
29
  end
30
30
  end
31
31
  end
@@ -8,7 +8,7 @@ module Twitter
8
8
  Twitter::Bootstrap::Components::V4::Alert.new(self, options, &block).perform
9
9
  end
10
10
 
11
- def bootstrap_badge(options, &block)
11
+ def bootstrap_badge(options = {}, &block)
12
12
  Twitter::Bootstrap::Components::V4::Badge.new(self, options, &block).perform
13
13
  end
14
14
 
@@ -1,4 +1,4 @@
1
- .media
1
+ %div{ class: div_container_classes }
2
2
  - if horizontal_alignment == :left
3
3
  %div{ class: div_media_object_classes.join(' ') }
4
4
  -if link_target.present?
@@ -1,14 +1,15 @@
1
- .responsive-media.col-lg-12
2
- - image_div_css_classes = ["col-lg-2"]
3
- - image_div_css_classes << "col-lg-push-10" if horizontal_alignment == :right
4
- - if image_options[:src].present?
5
- %div{ class: image_div_css_classes }
6
- -if link_target.present?
7
- %a{ href: link_target }
1
+ %div{ class: div_container_classes }
2
+ .row
3
+ - image_div_css_classes = ["col-lg-#{media_columns}", "responsive-media-#{horizontal_alignment}"]
4
+ - image_div_css_classes << "col-lg-push-#{12 - media_columns}" if horizontal_alignment == :right
5
+ - if image_options[:src].present?
6
+ %div{ class: image_div_css_classes }
7
+ -if link_target.present?
8
+ %a{ href: link_target }
9
+ %img.responsive-media-object{ image_options }/
10
+ -else
8
11
  %img.responsive-media-object{ image_options }/
9
- -else
10
- %img.responsive-media-object{ image_options }/
11
- - content_div_css_classes = ["responsive-media-body", "col-lg-10"]
12
- - content_div_css_classes << "col-lg-pull-2" if horizontal_alignment == :right
13
- %div{ class: content_div_css_classes }
14
- = block_output
12
+ - content_div_css_classes = ["responsive-media-body", "responsive-media-body-#{horizontal_alignment}", "col-lg-#{12 - media_columns}"]
13
+ - content_div_css_classes << "col-lg-pull-#{media_columns}" if horizontal_alignment == :right
14
+ %div{ class: content_div_css_classes }
15
+ = block_output
@@ -2,7 +2,7 @@ module Twitter
2
2
  module Bootstrap
3
3
  module Components
4
4
  module Rails
5
- VERSION = '0.2.1'
5
+ VERSION = '0.2.2'
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twitter-bootstrap-components-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-05 00:00:00.000000000 Z
11
+ date: 2017-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails