twitter-bootstrap-components-rails 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/twitter-bootstrap-components-rails.css +14 -0
- data/app/assets/stylesheets/twitter/bootstrap/components/rails/application.css +1 -1
- data/app/assets/stylesheets/twitter/bootstrap/components/rails/application/responsive-media-object.css +10 -0
- data/app/components/twitter/bootstrap/components/v3/button.rb +87 -0
- data/app/components/twitter/bootstrap/components/v3/media_object.rb +1 -3
- data/app/components/twitter/bootstrap/components/v3/responsive_media_object.rb +13 -0
- data/app/helpers/twitter/bootstrap/components/rails/v3/components_helper.rb +9 -0
- data/app/views/twitter/bootstrap/components/v3/_button.haml +10 -0
- data/app/views/twitter/bootstrap/components/v3/_responsive_media_object.html.haml +14 -0
- data/config/initializers/assets.rb +1 -0
- data/lib/twitter/bootstrap/components/rails/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9503ecff9e892d5342ed2b9ec7b1d452253a6317
|
4
|
+
data.tar.gz: 42b24abe441dd76e79bb9cf3653ac1321b287c27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17bf1681cbc44a28f334e35a138ee43e1068682c786fbff9e263139c4ad4cd8ec0b8c38b3e702b29654ea8d1ad09aa2daae486698492dbb630bedb602c8fdad4
|
7
|
+
data.tar.gz: e43b1ff36592120c0583918312122c8cc4b226e82e131dec549ca457b8eebc642c1f7e790dc170c10833195afedfcbbecd414132940b881167ab5a0a2564c9c5
|
@@ -0,0 +1,14 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require twitter/bootstrap/components/rails/application
|
14
|
+
*/
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Twitter
|
2
|
+
module Bootstrap
|
3
|
+
module Components
|
4
|
+
module V3
|
5
|
+
class Button < Base
|
6
|
+
SIZE_MAP = {
|
7
|
+
default: 'btn-default',
|
8
|
+
extra_small: 'btn-xs',
|
9
|
+
small: 'btn-sm',
|
10
|
+
large: 'btn-lg'
|
11
|
+
}.freeze
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def view_locals
|
16
|
+
{
|
17
|
+
block_output: block_output,
|
18
|
+
input_options: input_options,
|
19
|
+
link_target: link_target,
|
20
|
+
link_options: link_options,
|
21
|
+
button_options: button_options,
|
22
|
+
element_type: element_type
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def link_target
|
27
|
+
@options[:to]
|
28
|
+
end
|
29
|
+
|
30
|
+
# html element type (:link, :button or :input)
|
31
|
+
def element_type
|
32
|
+
@options[:element_type] ||
|
33
|
+
link_target.present? ? :link : :button
|
34
|
+
end
|
35
|
+
|
36
|
+
def css_classes
|
37
|
+
[*default_css_classes, size_css_class, additional_css_classes].compact
|
38
|
+
end
|
39
|
+
|
40
|
+
def default_css_classes
|
41
|
+
['btn', "btn-#{context}"]
|
42
|
+
end
|
43
|
+
|
44
|
+
def size
|
45
|
+
@options[:size] || :default
|
46
|
+
end
|
47
|
+
|
48
|
+
def size_css_class
|
49
|
+
SIZE_MAP[size]
|
50
|
+
end
|
51
|
+
|
52
|
+
def context
|
53
|
+
@options[:context] || :primary
|
54
|
+
end
|
55
|
+
|
56
|
+
# input type (:button, :submit or :reset)
|
57
|
+
def type
|
58
|
+
@options[:type] || :button
|
59
|
+
end
|
60
|
+
|
61
|
+
def value
|
62
|
+
@options[:value]
|
63
|
+
end
|
64
|
+
|
65
|
+
def additional_css_classes
|
66
|
+
@options[:class]
|
67
|
+
end
|
68
|
+
|
69
|
+
def input_options
|
70
|
+
{ class: css_classes.join(" "), type: type, value: value }
|
71
|
+
end
|
72
|
+
|
73
|
+
def link_options
|
74
|
+
link_options = { class: css_classes.join(" "), role: "button" }
|
75
|
+
link_options[:data] = @options[:data] if @options[:data].present?
|
76
|
+
link_options[:method] = @options[:method] if @options[:method].present?
|
77
|
+
link_options
|
78
|
+
end
|
79
|
+
|
80
|
+
def button_options
|
81
|
+
{ class: css_classes.join(" "), type: "button" }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -3,8 +3,6 @@ module Twitter
|
|
3
3
|
module Components
|
4
4
|
module V3
|
5
5
|
class MediaObject < Base
|
6
|
-
DEFAULT_IMAGE_SRC = "https://placeholdit.imgix.net/~text?txtsize=16&txt=64x64&w=64&h=64".freeze
|
7
|
-
|
8
6
|
private
|
9
7
|
|
10
8
|
def view_locals
|
@@ -43,7 +41,7 @@ module Twitter
|
|
43
41
|
end
|
44
42
|
|
45
43
|
def image_options
|
46
|
-
@image_options ||= (@options[:image_options] || {}).reverse_merge!(alt: nil, src:
|
44
|
+
@image_options ||= (@options[:image_options] || {}).reverse_merge!(alt: nil, src: nil)
|
47
45
|
end
|
48
46
|
|
49
47
|
def link_target
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Twitter
|
2
|
+
module Bootstrap
|
3
|
+
module Components
|
4
|
+
module V3
|
5
|
+
class ResponsiveMediaObject < Twitter::Bootstrap::Components::V3::MediaObject
|
6
|
+
def div_media_object_classes
|
7
|
+
["responsive-media-#{horizontal_alignment}", "responsive-media-#{vertical_alignment}"]
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -12,9 +12,18 @@ module Twitter
|
|
12
12
|
Twitter::Bootstrap::Components::V3::Badge.new(self, options, &block).perform
|
13
13
|
end
|
14
14
|
|
15
|
+
def bootstrap_button(options = {}, &block)
|
16
|
+
Twitter::Bootstrap::Components::V3::Button.new(self, options, &block).perform
|
17
|
+
end
|
18
|
+
|
15
19
|
def bootstrap_button_group(options = {}, &block)
|
16
20
|
Twitter::Bootstrap::Components::V3::ButtonGroup.new(self, options, &block).perform
|
17
21
|
end
|
22
|
+
|
23
|
+
def bootstrap_responsive_media_object(options = {}, &block)
|
24
|
+
Twitter::Bootstrap::Components::V3::ResponsiveMediaObject.new(self, options, &block).perform
|
25
|
+
end
|
26
|
+
|
18
27
|
def bootstrap_media_object(options = {}, &block)
|
19
28
|
Twitter::Bootstrap::Components::V3::MediaObject.new(self, options, &block).perform
|
20
29
|
end
|
@@ -0,0 +1,14 @@
|
|
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 }
|
8
|
+
%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
|
@@ -0,0 +1 @@
|
|
1
|
+
Rails.application.config.assets.precompile += %w(twitter-bootstrap-components-rails.css)
|
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.
|
4
|
+
version: 0.2.0
|
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-
|
11
|
+
date: 2017-04-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -134,12 +134,16 @@ files:
|
|
134
134
|
- Rakefile
|
135
135
|
- app/assets/config/twitter_bootstrap_components_rails_manifest.js
|
136
136
|
- app/assets/javascripts/twitter/bootstrap/components/rails/application.js
|
137
|
+
- app/assets/stylesheets/twitter-bootstrap-components-rails.css
|
137
138
|
- app/assets/stylesheets/twitter/bootstrap/components/rails/application.css
|
139
|
+
- app/assets/stylesheets/twitter/bootstrap/components/rails/application/responsive-media-object.css
|
138
140
|
- app/components/twitter/bootstrap/components/v3/alert.rb
|
139
141
|
- app/components/twitter/bootstrap/components/v3/badge.rb
|
140
142
|
- app/components/twitter/bootstrap/components/v3/base.rb
|
143
|
+
- app/components/twitter/bootstrap/components/v3/button.rb
|
141
144
|
- app/components/twitter/bootstrap/components/v3/button_group.rb
|
142
145
|
- app/components/twitter/bootstrap/components/v3/media_object.rb
|
146
|
+
- app/components/twitter/bootstrap/components/v3/responsive_media_object.rb
|
143
147
|
- app/components/twitter/bootstrap/components/v3/thumbnail.rb
|
144
148
|
- app/components/twitter/bootstrap/components/v4/alert.rb
|
145
149
|
- app/components/twitter/bootstrap/components/v4/badge.rb
|
@@ -162,8 +166,10 @@ files:
|
|
162
166
|
- app/views/layouts/twitter/bootstrap/components/rails/application.html.erb
|
163
167
|
- app/views/twitter/bootstrap/components/v3/_alert.html.haml
|
164
168
|
- app/views/twitter/bootstrap/components/v3/_badge.html.haml
|
169
|
+
- app/views/twitter/bootstrap/components/v3/_button.haml
|
165
170
|
- app/views/twitter/bootstrap/components/v3/_button_group.html.haml
|
166
171
|
- app/views/twitter/bootstrap/components/v3/_media_object.html.haml
|
172
|
+
- app/views/twitter/bootstrap/components/v3/_responsive_media_object.html.haml
|
167
173
|
- app/views/twitter/bootstrap/components/v3/_thumbnail.html.haml
|
168
174
|
- app/views/twitter/bootstrap/components/v4/_alert.html.haml
|
169
175
|
- app/views/twitter/bootstrap/components/v4/_badge.html.haml
|
@@ -178,6 +184,7 @@ files:
|
|
178
184
|
- app/views/twitter/bootstrap/components/v4/card/_blockquote.html.haml
|
179
185
|
- app/views/twitter/bootstrap/components/v4/card/_footer.html.haml
|
180
186
|
- app/views/twitter/bootstrap/components/v4/card/_header.html.haml
|
187
|
+
- config/initializers/assets.rb
|
181
188
|
- config/routes.rb
|
182
189
|
- lib/tasks/twitter/bootstrap/components/rails_tasks.rake
|
183
190
|
- lib/twitter/bootstrap/components/rails.rb
|