bootstrap-sass-extras 0.0.4 → 0.0.5

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: 550a564e70192941701c65f0c2f260f9214a238e
4
- data.tar.gz: 71be55dfd76ad3476b5fead050a3666693905160
3
+ metadata.gz: d165bd438c4c33acac0cad0864b928f42d436733
4
+ data.tar.gz: 4ab9887d47bd243c30ad59a41cc9a9f3c712de2e
5
5
  SHA512:
6
- metadata.gz: 3d87b9a5f91ad2dc39d345fed78f0807df9cde3f4e99da16424cd01dde79ed616bf3b05770e2bf671d30a15403c406eef52dceeb0a1ddac506784b1527a4dc28
7
- data.tar.gz: eaf9f7312bc58f539c09b3aa4deab8b3cc96f340d124ce5487c51d1f990b6df960856334db0bb9747d72333f99cb12ebcc913bc8f920c91058e212ece3eb3cce
6
+ metadata.gz: 07750ab08f326dcc9d9518471a7fa22d1ae6d0d554aae885827bb4292614b0ced802005d2dd1a37c314e7a3643992235713efcad39a3276b7357854ddea1d90e
7
+ data.tar.gz: 66bf8e69ac9d677bf774850c2e1d08e6623138f3f1787581937ed203fbe0b6cb7009b81e48130a46242c001f20e3eee0dbceae69cccbcacdc31a8d096ee50f4c
@@ -1,6 +1,17 @@
1
1
  # Changelog
2
2
 
3
- ## Relese 0.0.3
3
+ ## Master (unreleased)
4
+
5
+ ## Release 0.0.5
6
+
7
+ * Adjust bootstrap_flash to match bootstrap alerts by [@jonwaghorn][]
8
+ * Rails Form Helper for Bootstrap META tag by [@dabit][]
9
+
10
+ ## Release 0.0.4
11
+
12
+ * Fix BreadCrumbs Helper
13
+
14
+ ## Release 0.0.3
4
15
 
5
16
  * Add glyph, model and breadcrumbs helpers
6
17
  * Update templates
@@ -11,4 +22,8 @@
11
22
 
12
23
  ## Release 0.0.1
13
24
 
14
- * Initial version
25
+ * Initial version
26
+
27
+
28
+ [@jonwaghorn]: https://github.com/jonwaghorn
29
+ [@dabit]: https://github.com/dabit
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bootstrap-sass-extras (0.0.1)
4
+ bootstrap-sass-extras (0.0.4)
5
5
  rails (>= 3.1.0)
6
6
 
7
7
  GEM
@@ -42,11 +42,10 @@ GEM
42
42
  i18n (0.6.1)
43
43
  journey (1.0.4)
44
44
  json (1.7.7)
45
- mail (2.5.3)
46
- i18n (>= 0.4.0)
45
+ mail (2.5.4)
47
46
  mime-types (~> 1.16)
48
47
  treetop (~> 1.4.8)
49
- mime-types (1.21)
48
+ mime-types (1.25)
50
49
  multi_json (1.7.2)
51
50
  polyglot (0.3.3)
52
51
  rack (1.4.5)
@@ -93,7 +92,7 @@ GEM
93
92
  sqlite3 (1.3.7)
94
93
  thor (0.17.0)
95
94
  tilt (1.3.6)
96
- treetop (1.4.12)
95
+ treetop (1.4.15)
97
96
  polyglot
98
97
  polyglot (>= 0.3.1)
99
98
  tzinfo (0.3.37)
data/README.md CHANGED
@@ -73,6 +73,20 @@ Notice the plural usage of the resource to generate bootstrap:themed.
73
73
 
74
74
  ## Using Helpers
75
75
 
76
+ ### Viewport Meta Helper
77
+ Add the viewport meta helper `<%= viewport_meta_tag %>` to your layout
78
+ (built-in with layout generator) to render the required meta tag for Bootstrap:
79
+
80
+ <meta content="width=device-width,initial-scale=1.0" name="viewport" />
81
+
82
+ You can change the content value by passing a hash as an argument:
83
+
84
+ <%= viewport_meta_tag(:maximum_scale => "1.0") %>
85
+
86
+ Renders:
87
+
88
+ <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0" name="viewport" />
89
+
76
90
  ### Flash helper
77
91
  Add flash helper `<%= bootstrap_flash %>` to your layout (built-in with layout generator)
78
92
 
@@ -1,7 +1,13 @@
1
1
  module BootstrapFlashHelper
2
+ ALERT_TYPES = [:error, :info, :success, :warning]
3
+
2
4
  def bootstrap_flash
3
5
  output = ''
4
6
  flash.each do |type, message|
7
+ next if message.blank?
8
+ type = :success if type == :notice
9
+ type = :error if type == :alert
10
+ next unless ALERT_TYPES.include?(type)
5
11
  output += flash_container(type, message)
6
12
  end
7
13
 
@@ -0,0 +1,27 @@
1
+ module BootstrapViewportMetaHelper
2
+ #
3
+ # Creates the meta tag for Bootstrap with the specified parameters:
4
+ #
5
+ # <%= viewport_meta_tag %>
6
+ #
7
+ # Renders:
8
+ #
9
+ # <meta content="width=device-width,initial-scale=1.0" name="viewport" />
10
+ #
11
+ # You can change the content value by passing a hash as an argument:
12
+ #
13
+ # <%= viewport_meta_tag(:maximum_scale => "1.0") %>
14
+ #
15
+ # Renders:
16
+ #
17
+ # <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0" name="viewport" />
18
+ #
19
+ def viewport_meta_tag(*args)
20
+ options = {
21
+ width: "device-width",
22
+ initial_scale: "1.0" }.merge(args[0] || {})
23
+
24
+ content = options.collect {|key,value| "#{key.to_s.dasherize}=#{value}"}.join(",")
25
+ raw(tag(:meta, name: "viewport", content: content))
26
+ end
27
+ end
@@ -4,6 +4,7 @@ module BootstrapSassExtras
4
4
  initializer 'bootstrap-sass-extras.setup_helpers' do |app|
5
5
  app.config.to_prepare do
6
6
  ActionController::Base.send :helper, BootstrapFlashHelper
7
+ ActionController::Base.send :helper, BootstrapViewportMetaHelper
7
8
  ActionController::Base.send :helper, GlyphHelper
8
9
  ActionController::Base.send :helper, ModalHelper
9
10
  ActionController::Base.send :helper, TwitterBreadcrumbsHelper
@@ -1,3 +1,3 @@
1
1
  module BootstrapSassExtras
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8">
5
5
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <%%= viewport_meta_tag %>
7
7
  <title><%%= content_for?(:title) ? yield(:title) : "<%= app_name %>" %></title>
8
8
  <%%= csrf_meta_tags %>
9
9
 
@@ -3,7 +3,7 @@
3
3
  %head
4
4
  %meta(charset="utf-8")
5
5
  %meta(http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1")
6
- %meta(name="viewport" content="width=device-width, initial-scale=1.0")
6
+ = viewport_meta_tag
7
7
  %title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
8
8
  = csrf_meta_tags
9
9
  / Le HTML5 shim, for IE6-8 support of HTML elements
@@ -3,7 +3,7 @@ html lang="en"
3
3
  head
4
4
  meta charset="utf-8"
5
5
  meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1"
6
- meta name="viewport" content="width=device-width, initial-scale=1.0"
6
+ = viewport_meta_tag
7
7
  title= content_for?(:title) ? yield(:title) : "<%= app_name %>"
8
8
  = csrf_meta_tags
9
9
 
@@ -4,13 +4,38 @@ describe BootstrapFlashHelper do
4
4
  describe "bootstrap_flash" do
5
5
 
6
6
  it "should return flash message" do
7
- stub!(:flash).and_return({:warning => "Update Success!"})
8
- bootstrap_flash.should == "<div class=\"alert alert-warning\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Success!</div>"
7
+ stub!(:flash).and_return({:warning => "Update Warning!"})
8
+ bootstrap_flash.should == "<div class=\"alert alert-warning\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Warning!</div>"
9
9
  end
10
10
 
11
- it "should return alert-success message when use notice message" do
11
+ it "should return alert-success message when using notice message" do
12
12
  stub!(:flash).and_return({:notice => "Update Success!"})
13
- bootstrap_flash.should == "<div class=\"alert alert-notice\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Success!</div>"
13
+ bootstrap_flash.should == "<div class=\"alert alert-success\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Success!</div>"
14
+ end
15
+
16
+ it "should return alert-error message when using notice error" do
17
+ stub!(:flash).and_return({:error => "Update Failed!"})
18
+ bootstrap_flash.should == "<div class=\"alert alert-error\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Failed!</div>"
19
+ end
20
+
21
+ it "should return alert-error message when using alert message" do
22
+ stub!(:flash).and_return({:alert => "Update Alert!"})
23
+ bootstrap_flash.should == "<div class=\"alert alert-error\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Alert!</div>"
24
+ end
25
+
26
+ it "should return alert-info message when using info message" do
27
+ stub!(:flash).and_return({:info => "Update Information!"})
28
+ bootstrap_flash.should == "<div class=\"alert alert-info\"><a class=\"close\" data-dismiss=\"alert\">&times;</a>Update Information!</div>"
29
+ end
30
+
31
+ it "should return no message when using an undefined message" do
32
+ stub!(:flash).and_return({:undefined => "Update Undefined!"})
33
+ bootstrap_flash.should == ""
34
+ end
35
+
36
+ it "should return no message when the message is blank" do
37
+ stub!(:flash).and_return({:notice => ""})
38
+ bootstrap_flash.should == ""
14
39
  end
15
40
 
16
41
  end
@@ -0,0 +1,17 @@
1
+ require 'spec_helper'
2
+
3
+ describe BootstrapViewportMetaHelper do
4
+ describe :viewport_meta_tag do
5
+ context "no arguments" do
6
+ it "should return the default viewport meta tag" do
7
+ viewport_meta_tag.should =="<meta content=\"width=device-width,initial-scale=1.0\" name=\"viewport\" />"
8
+ end
9
+ end
10
+
11
+ context "with arguments" do
12
+ it "should return the viewport meta tag with the specified options" do
13
+ viewport_meta_tag(initial_scale: "2.0").should =="<meta content=\"width=device-width,initial-scale=2.0\" name=\"viewport\" />"
14
+ end
15
+ end
16
+ end
17
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootstrap-sass-extras
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - doabit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2013-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -68,6 +68,7 @@ files:
68
68
  - README.md
69
69
  - Rakefile
70
70
  - app/helpers/bootstrap_flash_helper.rb
71
+ - app/helpers/bootstrap_viewport_meta_helper.rb
71
72
  - app/helpers/glyph_helper.rb
72
73
  - app/helpers/modal_helper.rb
73
74
  - app/helpers/twitter_breadcrumbs_helper.rb
@@ -139,6 +140,7 @@ files:
139
140
  - spec/dummy/public/favicon.ico
140
141
  - spec/dummy/script/rails
141
142
  - spec/helpers/bootstrap_flash_helper_spec.rb
143
+ - spec/helpers/bootstrap_viewport_meta_helper_spec.rb
142
144
  - spec/spec_helper.rb
143
145
  homepage: https://github.com/doabit/bootstrap-sass-extras
144
146
  licenses: []
@@ -197,4 +199,6 @@ test_files:
197
199
  - spec/dummy/public/favicon.ico
198
200
  - spec/dummy/script/rails
199
201
  - spec/helpers/bootstrap_flash_helper_spec.rb
202
+ - spec/helpers/bootstrap_viewport_meta_helper_spec.rb
200
203
  - spec/spec_helper.rb
204
+ has_rdoc: