twitter-bootstrap-markup-rails 0.3.0 → 0.3.1
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.
- data/.gitignore +1 -0
- data/CONTRIBUTORS.md +1 -0
- data/README.md +4 -2
- data/Rakefile +12 -0
- data/lib/twitter-bootstrap-markup-rails/components.rb +1 -0
- data/lib/twitter-bootstrap-markup-rails/components/progress_bar.rb +51 -0
- data/lib/twitter-bootstrap-markup-rails/helper_collection.rb +5 -5
- data/lib/twitter-bootstrap-markup-rails/helpers.rb +1 -0
- data/lib/twitter-bootstrap-markup-rails/helpers/alert_helpers.rb +1 -1
- data/lib/twitter-bootstrap-markup-rails/helpers/progress_bar_helpers.rb +23 -0
- data/lib/twitter-bootstrap-markup-rails/version.rb +1 -1
- data/spec/helpers/form_helpers_spec.rb +11 -1
- data/spec/helpers/progress_bar_helpers_spec.rb +34 -0
- data/spec/spec_helper.rb +5 -1
- data/spec/support/bootstrap_spec_helper.rb +0 -17
- data/twitter-bootstrap-markup-rails.gemspec +2 -3
- metadata +20 -33
- data/Guardfile +0 -7
data/.gitignore
CHANGED
data/CONTRIBUTORS.md
CHANGED
data/README.md
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
<table>
|
4
4
|
<tr>
|
5
5
|
<th>Version</th>
|
6
|
-
<td>v0.3.
|
6
|
+
<td>v0.3.1</td>
|
7
7
|
</tr>
|
8
8
|
<tr>
|
9
9
|
<th>Build Status</th>
|
@@ -26,7 +26,7 @@ This gem focuses on making it easier to use Twitter's Bootstrap 2.0. It's a coll
|
|
26
26
|
|
27
27
|
Add to your `Gemfile`:
|
28
28
|
|
29
|
-
gem 'twitter-bootstrap-markup-rails', '0.3.
|
29
|
+
gem 'twitter-bootstrap-markup-rails', '0.3.1'
|
30
30
|
|
31
31
|
## Currently Supported
|
32
32
|
|
@@ -34,6 +34,8 @@ Add to your `Gemfile`:
|
|
34
34
|
* Inline labels
|
35
35
|
* Buttons
|
36
36
|
* Button dropdowns
|
37
|
+
* Modal windows
|
38
|
+
* Progress bars
|
37
39
|
|
38
40
|
Documentation
|
39
41
|
---
|
data/Rakefile
CHANGED
@@ -18,3 +18,15 @@ YARD::Rake::YardocTask.new do |t|
|
|
18
18
|
#t.options = ['--plugin', 'yard-tomdoc']
|
19
19
|
end
|
20
20
|
|
21
|
+
if RUBY_VERSION =~ /^1\.9/
|
22
|
+
desc "Code coverage detail"
|
23
|
+
task :simplecov do
|
24
|
+
ENV['COVERAGE'] = "true"
|
25
|
+
Rake::Task['spec'].execute
|
26
|
+
end
|
27
|
+
else
|
28
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
29
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
30
|
+
spec.rcov = true
|
31
|
+
end
|
32
|
+
end
|
@@ -9,6 +9,7 @@ module Twitter::Bootstrap::Markup::Rails
|
|
9
9
|
autoload :ButtonDropdown, 'twitter-bootstrap-markup-rails/components/button_dropdown'
|
10
10
|
autoload :Navigation, 'twitter-bootstrap-markup-rails/components/navigation'
|
11
11
|
autoload :Modal, 'twitter-bootstrap-markup-rails/components/modal'
|
12
|
+
autoload :ProgressBar, 'twitter-bootstrap-markup-rails/components/progress_bar'
|
12
13
|
end
|
13
14
|
end
|
14
15
|
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Twitter::Bootstrap::Markup::Rails::Components
|
2
|
+
class ProgressBar < Base
|
3
|
+
attr_accessor :width
|
4
|
+
|
5
|
+
def initialize(width, options = {})
|
6
|
+
super
|
7
|
+
@width = width
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_s
|
11
|
+
output_buffer << content_tag(:div, build_div_options) do
|
12
|
+
build_bar_tag.html_safe
|
13
|
+
end.html_safe
|
14
|
+
super
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def default_options
|
20
|
+
{
|
21
|
+
:class => 'progress',
|
22
|
+
:type => [],
|
23
|
+
:html_options => {}
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_bar_tag
|
28
|
+
ops = { :class => 'bar', :style => "width: #{width}%;" }
|
29
|
+
content_tag(:div, nil, ops)
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_div_options
|
33
|
+
ops = { :class => build_class }
|
34
|
+
ops.reverse_merge(options[:html_options])
|
35
|
+
end
|
36
|
+
|
37
|
+
def build_class
|
38
|
+
classes = [options[:class]]
|
39
|
+
|
40
|
+
if options[:type].is_a?(Array)
|
41
|
+
classes = classes | options[:type].map { |c| "progress-#{c.to_s}" }
|
42
|
+
else
|
43
|
+
classes << "progress-#{options[:type]}"
|
44
|
+
end
|
45
|
+
|
46
|
+
classes << "active" if options[:active]
|
47
|
+
|
48
|
+
classes.join(" ")
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -34,11 +34,11 @@ module Twitter::Bootstrap::Markup::Rails
|
|
34
34
|
attr_accessor :method, :options, :args
|
35
35
|
|
36
36
|
def initialize(view, symbol, args, block)
|
37
|
-
@view
|
38
|
-
@method
|
37
|
+
@view = view
|
38
|
+
@method = symbol
|
39
39
|
@options = args.extract_options!
|
40
|
-
@args
|
41
|
-
@block
|
40
|
+
@args = args
|
41
|
+
@block = block
|
42
42
|
end
|
43
43
|
|
44
44
|
def to_s
|
@@ -53,4 +53,4 @@ module Twitter::Bootstrap::Markup::Rails
|
|
53
53
|
end
|
54
54
|
|
55
55
|
end
|
56
|
-
end
|
56
|
+
end
|
@@ -6,6 +6,7 @@ module Twitter::Bootstrap::Markup::Rails
|
|
6
6
|
autoload :ButtonHelpers, 'twitter-bootstrap-markup-rails/helpers/button_helpers'
|
7
7
|
autoload :NavigationHelpers, 'twitter-bootstrap-markup-rails/helpers/navigation_helpers'
|
8
8
|
autoload :ModalHelpers, 'twitter-bootstrap-markup-rails/helpers/modal_helpers'
|
9
|
+
autoload :ProgressBarHelpers, 'twitter-bootstrap-markup-rails/helpers/progress_bar_helpers'
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Twitter::Bootstrap::Markup::Rails::Helpers
|
2
|
+
module ProgressBarHelpers
|
3
|
+
# Render a bootstrap progress bar
|
4
|
+
#
|
5
|
+
# @param [Integer] width percent out of 100 progress on bar
|
6
|
+
# @param [Hash] options hash containing options (default: {}):
|
7
|
+
# :type - Additional progress type(s). For one, just specify a string, but
|
8
|
+
# you can also pass an array (of sym or str) for multiple classes
|
9
|
+
# :html_options - Any additional options you'd like to pass to the content_tag that will be created
|
10
|
+
# for this button's a tag (for instance :target can be specified in :html_options).
|
11
|
+
#
|
12
|
+
# Examples
|
13
|
+
#
|
14
|
+
# bootstrap_progress_bar_tag 40, :type => ['info', 'striped'], :active => true
|
15
|
+
#
|
16
|
+
def bootstrap_progress_bar_tag(width, options = {})
|
17
|
+
Twitter::Bootstrap::Markup::Rails::Components::ProgressBar.new(
|
18
|
+
width,
|
19
|
+
options
|
20
|
+
).to_s
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -122,5 +122,15 @@ describe Twitter::Bootstrap::Markup::Rails::Helpers::FormHelpers do
|
|
122
122
|
|
123
123
|
end
|
124
124
|
end
|
125
|
+
|
126
|
+
context "password_field" do
|
127
|
+
it "should wrap a text input within the magical div tags" do
|
128
|
+
build_bootstrap_form do |f|
|
129
|
+
f.password_field 'method'
|
130
|
+
end
|
131
|
+
|
132
|
+
output_buffer.should have_tag('div.control-group div.controls input[type=password]')
|
133
|
+
end
|
134
|
+
end
|
125
135
|
end
|
126
|
-
end
|
136
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Twitter::Bootstrap::Markup::Rails::Helpers::ProgressBarHelpers do
|
4
|
+
include BootstrapSpecHelper
|
5
|
+
|
6
|
+
before do
|
7
|
+
@output_buffer = ''
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'should create a bar with the progress class' do
|
11
|
+
concat bootstrap_progress_bar_tag(40)
|
12
|
+
output_buffer.should have_tag("div.progress div.bar")
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should have the correct width' do
|
16
|
+
concat bootstrap_progress_bar_tag(40)
|
17
|
+
output_buffer.should have_tag(:div, :style => 'width: 40%;')
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'stores sets the type of the progress bar' do
|
21
|
+
concat bootstrap_progress_bar_tag(40, :type => :striped)
|
22
|
+
output_buffer.should have_tag("div.progress.progress-striped")
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'stores sets the types of the progress bar' do
|
26
|
+
concat bootstrap_progress_bar_tag(40, :type => [:striped, :warning])
|
27
|
+
output_buffer.should have_tag("div.progress.progress-striped.progress-warning")
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'stores sets the active flag of the progress bar' do
|
31
|
+
concat bootstrap_progress_bar_tag(40, :active => true)
|
32
|
+
output_buffer.should have_tag("div.progress.active")
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# encoding: utf-8
|
2
|
-
|
2
|
+
|
3
|
+
if RUBY_VERSION =~ /^1\.9/
|
4
|
+
require 'simplecov'
|
5
|
+
ENV["COVERAGE"] && SimpleCov.start
|
6
|
+
end
|
3
7
|
|
4
8
|
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/twitter-bootstrap-markup-rails'))
|
5
9
|
require File.expand_path(File.join(File.dirname(__FILE__), '../lib/twitter-bootstrap-markup-rails/engine'))
|
@@ -25,29 +25,12 @@ module BootstrapSpecHelper
|
|
25
25
|
include ActiveSupport
|
26
26
|
include ActionController::PolymorphicRoutes if defined?(ActionController::PolymorphicRoutes)
|
27
27
|
|
28
|
-
def _routes
|
29
|
-
url_helpers = mock('url_helpers')
|
30
|
-
url_helpers.stub!(:hash_for_posts_path).and_return({})
|
31
|
-
url_helpers.stub!(:hash_for_post_path).and_return({})
|
32
|
-
url_helpers.stub!(:hash_for_post_models_path).and_return({})
|
33
|
-
url_helpers.stub!(:hash_for_authors_path).and_return({})
|
34
|
-
|
35
|
-
mock('_routes',
|
36
|
-
:url_helpers => url_helpers,
|
37
|
-
:url_for => "/mock/path"
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
28
|
def controller
|
42
29
|
env = mock('env', :[] => nil)
|
43
30
|
request = mock('request', :env => env)
|
44
31
|
mock('controller', :controller_path= => '', :params => {}, :request => request)
|
45
32
|
end
|
46
33
|
|
47
|
-
def default_url_options
|
48
|
-
{}
|
49
|
-
end
|
50
|
-
|
51
34
|
def self.included(base)
|
52
35
|
base.class_eval do
|
53
36
|
|
@@ -18,14 +18,13 @@ Gem::Specification.new do |gem|
|
|
18
18
|
|
19
19
|
gem.add_dependency "railties", "~> 3.0"
|
20
20
|
gem.add_development_dependency "rails", "~> 3.0"
|
21
|
-
gem.add_development_dependency "rspec-rails", "~> 2.
|
22
|
-
gem.add_development_dependency "guard", "~> 1.0"
|
23
|
-
gem.add_development_dependency "guard-rspec", "~> 0.6"
|
21
|
+
gem.add_development_dependency "rspec-rails", "~> 2.10"
|
24
22
|
gem.add_development_dependency "rspec_tag_matchers", ">= 1.0"
|
25
23
|
gem.add_development_dependency "rake"
|
26
24
|
gem.add_development_dependency 'yard'
|
27
25
|
gem.add_development_dependency 'redcarpet'
|
28
26
|
gem.add_development_dependency 'yard-tomdoc'
|
29
27
|
gem.add_development_dependency 'simple-navigation'
|
28
|
+
gem.add_development_dependency RUBY_VERSION =~ /^1\.9/ ? "simplecov" : "rcov"
|
30
29
|
end
|
31
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-bootstrap-markup-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: railties
|
@@ -50,7 +50,7 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ~>
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '2.
|
53
|
+
version: '2.10'
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -58,13 +58,13 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '2.
|
61
|
+
version: '2.10'
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: rspec_tag_matchers
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
none: false
|
66
66
|
requirements:
|
67
|
-
- -
|
67
|
+
- - ! '>='
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '1.0'
|
70
70
|
type: :development
|
@@ -72,33 +72,17 @@ dependencies:
|
|
72
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
|
-
- -
|
75
|
+
- - ! '>='
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '1.0'
|
78
78
|
- !ruby/object:Gem::Dependency
|
79
|
-
name:
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0.6'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0.6'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rspec_tag_matchers
|
79
|
+
name: rake
|
96
80
|
requirement: !ruby/object:Gem::Requirement
|
97
81
|
none: false
|
98
82
|
requirements:
|
99
83
|
- - ! '>='
|
100
84
|
- !ruby/object:Gem::Version
|
101
|
-
version: '
|
85
|
+
version: '0'
|
102
86
|
type: :development
|
103
87
|
prerelease: false
|
104
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,9 +90,9 @@ dependencies:
|
|
106
90
|
requirements:
|
107
91
|
- - ! '>='
|
108
92
|
- !ruby/object:Gem::Version
|
109
|
-
version: '
|
93
|
+
version: '0'
|
110
94
|
- !ruby/object:Gem::Dependency
|
111
|
-
name:
|
95
|
+
name: yard
|
112
96
|
requirement: !ruby/object:Gem::Requirement
|
113
97
|
none: false
|
114
98
|
requirements:
|
@@ -124,7 +108,7 @@ dependencies:
|
|
124
108
|
- !ruby/object:Gem::Version
|
125
109
|
version: '0'
|
126
110
|
- !ruby/object:Gem::Dependency
|
127
|
-
name:
|
111
|
+
name: redcarpet
|
128
112
|
requirement: !ruby/object:Gem::Requirement
|
129
113
|
none: false
|
130
114
|
requirements:
|
@@ -140,7 +124,7 @@ dependencies:
|
|
140
124
|
- !ruby/object:Gem::Version
|
141
125
|
version: '0'
|
142
126
|
- !ruby/object:Gem::Dependency
|
143
|
-
name:
|
127
|
+
name: yard-tomdoc
|
144
128
|
requirement: !ruby/object:Gem::Requirement
|
145
129
|
none: false
|
146
130
|
requirements:
|
@@ -156,7 +140,7 @@ dependencies:
|
|
156
140
|
- !ruby/object:Gem::Version
|
157
141
|
version: '0'
|
158
142
|
- !ruby/object:Gem::Dependency
|
159
|
-
name:
|
143
|
+
name: simple-navigation
|
160
144
|
requirement: !ruby/object:Gem::Requirement
|
161
145
|
none: false
|
162
146
|
requirements:
|
@@ -172,7 +156,7 @@ dependencies:
|
|
172
156
|
- !ruby/object:Gem::Version
|
173
157
|
version: '0'
|
174
158
|
- !ruby/object:Gem::Dependency
|
175
|
-
name:
|
159
|
+
name: simplecov
|
176
160
|
requirement: !ruby/object:Gem::Requirement
|
177
161
|
none: false
|
178
162
|
requirements:
|
@@ -200,7 +184,6 @@ files:
|
|
200
184
|
- .travis.yml
|
201
185
|
- CONTRIBUTORS.md
|
202
186
|
- Gemfile
|
203
|
-
- Guardfile
|
204
187
|
- README.md
|
205
188
|
- Rakefile
|
206
189
|
- lib/twitter-bootstrap-markup-rails.rb
|
@@ -216,6 +199,7 @@ files:
|
|
216
199
|
- lib/twitter-bootstrap-markup-rails/components/inline_label.rb
|
217
200
|
- lib/twitter-bootstrap-markup-rails/components/modal.rb
|
218
201
|
- lib/twitter-bootstrap-markup-rails/components/navigation.rb
|
202
|
+
- lib/twitter-bootstrap-markup-rails/components/progress_bar.rb
|
219
203
|
- lib/twitter-bootstrap-markup-rails/engine.rb
|
220
204
|
- lib/twitter-bootstrap-markup-rails/helper_collection.rb
|
221
205
|
- lib/twitter-bootstrap-markup-rails/helper_collection_set.rb
|
@@ -226,6 +210,7 @@ files:
|
|
226
210
|
- lib/twitter-bootstrap-markup-rails/helpers/inline_label_helpers.rb
|
227
211
|
- lib/twitter-bootstrap-markup-rails/helpers/modal_helpers.rb
|
228
212
|
- lib/twitter-bootstrap-markup-rails/helpers/navigation_helpers.rb
|
213
|
+
- lib/twitter-bootstrap-markup-rails/helpers/progress_bar_helpers.rb
|
229
214
|
- lib/twitter-bootstrap-markup-rails/plugins.rb
|
230
215
|
- lib/twitter-bootstrap-markup-rails/plugins/simple_navigation/renderer/bootstrap_topbar_list.rb
|
231
216
|
- lib/twitter-bootstrap-markup-rails/version.rb
|
@@ -236,6 +221,7 @@ files:
|
|
236
221
|
- spec/helpers/inline_label_helpers_spec.rb
|
237
222
|
- spec/helpers/modal_helpers_spec.rb
|
238
223
|
- spec/helpers/navigation_helpers_spec.rb
|
224
|
+
- spec/helpers/progress_bar_helpers_spec.rb
|
239
225
|
- spec/integration/action_view_spec.rb
|
240
226
|
- spec/integration/readme_spec.rb
|
241
227
|
- spec/plugins/bootstrap_topbar_list_spec.rb
|
@@ -267,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
267
253
|
version: '0'
|
268
254
|
requirements: []
|
269
255
|
rubyforge_project:
|
270
|
-
rubygems_version: 1.8.
|
256
|
+
rubygems_version: 1.8.24
|
271
257
|
signing_key:
|
272
258
|
specification_version: 3
|
273
259
|
summary: Ruby on Rails helpers for Bootstrap 2.0 - HTML, CSS, and JS toolkit from
|
@@ -279,6 +265,7 @@ test_files:
|
|
279
265
|
- spec/helpers/inline_label_helpers_spec.rb
|
280
266
|
- spec/helpers/modal_helpers_spec.rb
|
281
267
|
- spec/helpers/navigation_helpers_spec.rb
|
268
|
+
- spec/helpers/progress_bar_helpers_spec.rb
|
282
269
|
- spec/integration/action_view_spec.rb
|
283
270
|
- spec/integration/readme_spec.rb
|
284
271
|
- spec/plugins/bootstrap_topbar_list_spec.rb
|
data/Guardfile
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
guard 'rspec', :version => 2 do
|
2
|
-
watch(%r{^spec/.+_spec\.rb$})
|
3
|
-
watch(%r{^lib/.*(helpers|components)/(.+)\.rb$}) { |m| "spec/#{m[1]}/#{m[2]}_spec.rb" }
|
4
|
-
watch('spec/spec_helper.rb') { "spec" }
|
5
|
-
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
6
|
-
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
7
|
-
end
|