css3-progress-bar-rails 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fd2cdd0323e7b1c9b84dbef4f33cdc1ce7f31d40
4
+ data.tar.gz: 8939667a889c4950745cb57cbc0a1a99e1a13f04
5
+ SHA512:
6
+ metadata.gz: 7b02936d5f65c9263764f8de29b4d3dfb9df88e329016666df761d315d628ba3afc6902819ba77c226032f7fea77ce85428d3dada502f697ddd57a8381ec27b1
7
+ data.tar.gz: da625d9b40afbc4b0b128bbf099ac99bde8f36311b08d1f81701588fb8bb740b927ce0856e3d0ba5734eb63570e8c78a877b2b4ceaab66d3d79326cbec48e185
@@ -1,12 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.8.7
4
- - 1.9.2
5
3
  - 1.9.3
6
- - ree
4
+ - 2.0.0
7
5
  - jruby
8
- # - rbx-19mode # rbx-19mode dies on nokogiri dependency
9
- - rbx-18mode
10
6
  branches:
11
7
  only:
12
8
  - master
@@ -1,8 +1,8 @@
1
- # CSS3 Progress Bars for Rails
1
+ ## CSS3 Progress Bars for Rails
2
2
 
3
3
  [![Travis CI Build Status](http://travis-ci.org/yrgoldteeth/css3-progress-bar-rails.png)](http://travis-ci.org/yrgoldteeth/css3-progress-bar-rails)
4
4
 
5
- ## Inspiration
5
+ ### Inspiration
6
6
 
7
7
  [Josh Sullivan][js] made some very pretty [progress bars][blog] in CSS3.
8
8
 
@@ -10,7 +10,7 @@
10
10
 
11
11
  Thought it might be useful.
12
12
 
13
- ## Instruction
13
+ ### Instruction
14
14
 
15
15
  This gem assumes you're using Rails 3.1+, including the asset pipeline.
16
16
 
@@ -33,7 +33,7 @@ progress bar styling as well. To use:
33
33
 
34
34
  [View Examples Here][examples]
35
35
 
36
- ## Indication
36
+ ### Indication
37
37
 
38
38
  Except where indicated:
39
39
  Copyright (c) 2012 [Nicholas Fine][vanity], released under the MIT license.
@@ -0,0 +1,18 @@
1
+ .progress {
2
+ position: relative;
3
+ }
4
+
5
+ .progress-bar {
6
+ z-index: 1;
7
+ position: absolute;
8
+ }
9
+
10
+ .progress span {
11
+ position: absolute;
12
+ top: 0;
13
+ z-index: 2;
14
+ text-align: center;
15
+ width: 100%;
16
+ color: black;
17
+ font-size: 12px;
18
+ }
@@ -36,8 +36,14 @@ module Css3ProgressBarsHelper
36
36
  def bootstrap_progress_bar percentage, *opts
37
37
  percentage = scrub_percentage(percentage)
38
38
  options = opts.extract_options!
39
+ message = ''
39
40
 
40
41
  container_classes = %w(progress)
42
+ content_classes = %w(progress-bar)
43
+
44
+ if options[:message] && options[:message] != ''
45
+ message = options[:message]
46
+ end
41
47
 
42
48
  if options[:striped] && options[:striped] == true
43
49
  container_classes << 'progress-striped'
@@ -47,12 +53,17 @@ module Css3ProgressBarsHelper
47
53
  container_classes << 'active'
48
54
  end
49
55
 
50
- if options[:color] && %w(info success danger).include?(options[:color])
51
- container_classes << "progress-#{options[:color]}"
52
- end
53
-
54
- bar_html = bar_div(%w('bar'), bar_style(percentage))
56
+ if options[:color] && %w(info success warning danger).include?(options[:color])
57
+ if options[:bootstrap] && options[:bootstrap] == 2
58
+ container_classes << "progress-#{options[:color]}"
55
59
 
60
+ bar_html = bar_div(%w('bar'), bar_style(percentage))
61
+ else
62
+ content_classes << "progress-bar-#{options[:color]}"
63
+ bar_html = bar_div(content_classes, bar_style(percentage))
64
+ bar_html << bar_span(message)
65
+ end
66
+ end
56
67
  content_tag :div, bar_html, :class => container_classes.join(' ')
57
68
  end
58
69
 
@@ -135,6 +146,10 @@ module Css3ProgressBarsHelper
135
146
  content_tag :div, '', :style => style, :class => classes.join(' ')
136
147
  end
137
148
 
149
+ def bar_span text
150
+ content_tag :span, text
151
+ end
152
+
138
153
  def mortice_div bar_html, classes
139
154
  content_tag :div, bar_html, :class => classes.join(' ')
140
155
  end
@@ -2,7 +2,7 @@ module Css3
2
2
  module Progress
3
3
  module Bar
4
4
  module Rails
5
- VERSION = "0.4.0"
5
+ VERSION = "0.5.0"
6
6
  end
7
7
  end
8
8
  end
@@ -11,26 +11,44 @@ describe Css3ProgressBarsHelper do
11
11
  describe 'with the color option' do
12
12
  describe 'using an invalid color option' do
13
13
  it 'does not set a color class in container div' do
14
- Nokogiri::HTML(bootstrap_progress_bar(33, :color => 'foo')).search('div.progress').first.attributes["class"].wont_match /progress-foo/
14
+ Nokogiri::HTML(bootstrap_progress_bar(33, color: 'foo')).search('div.progress').first.attributes["class"].wont_match /progress-foo/
15
15
  end
16
16
  end
17
17
 
18
18
  describe 'using a valid color option' do
19
19
  it 'sets the correct class in container div' do
20
- Nokogiri::HTML(bootstrap_progress_bar(33, :color => 'info')).search('div.progress').first.attributes["class"].must_match /progress-info/
20
+ Nokogiri::HTML(bootstrap_progress_bar(33, color: 'info')).search('div.progress-bar').first.attributes["class"].must_match /progress-bar-info/
21
+ end
22
+ end
23
+
24
+ describe 'using a valid color with option and twitter bootstrap 2' do
25
+ it 'sets the correct class in container div using twitter bootstrap 2' do
26
+ Nokogiri::HTML(bootstrap_progress_bar(33, bootstrap: 2, color: 'info')).search('div.progress').first.attributes["class"].must_match /progress-info/
21
27
  end
22
28
  end
23
29
  end
24
30
 
25
31
  describe 'with the striped option' do
26
32
  it 'sets the correct class in container div' do
27
- Nokogiri::HTML(bootstrap_progress_bar(33, :striped => true)).search('div.progress').first.attributes["class"].must_match /progress-striped/
33
+ Nokogiri::HTML(bootstrap_progress_bar(33, striped: true)).search('div.progress').first.attributes["class"].must_match /progress-striped/
34
+ end
35
+ end
36
+
37
+ describe 'with the striped option using twitter bootstrap 2' do
38
+ it 'sets the correct class in container div using twitter bootstrap 2' do
39
+ Nokogiri::HTML(bootstrap_progress_bar(33, bootstrap: 2, striped: true)).search('div.progress').first.attributes["class"].must_match /progress-striped/
28
40
  end
29
41
  end
30
42
 
31
43
  describe 'with the active option' do
32
44
  it 'sets the correct class in container div' do
33
- Nokogiri::HTML(bootstrap_progress_bar(12, :active => true)).search('div.progress').first.attributes["class"].must_match /active/
45
+ Nokogiri::HTML(bootstrap_progress_bar(12, active: true)).search('div.progress').first.attributes["class"].must_match /active/
46
+ end
47
+ end
48
+
49
+ describe 'with the active option using twitter bootstrap 2' do
50
+ it 'sets the correct class in container div using twitter bootstrap 2' do
51
+ Nokogiri::HTML(bootstrap_progress_bar(12, bootstrap: 2, active: true)).search('div.progress').first.attributes["class"].must_match /active/
34
52
  end
35
53
  end
36
54
  end
metadata CHANGED
@@ -1,122 +1,101 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: css3-progress-bar-rails
3
- version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease:
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Nicholas Fine
14
8
  - Josh Sullivan
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2012-01-31 00:00:00 -06:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
12
+ date: 2013-09-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
23
15
  name: rails
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 5
31
- segments:
32
- - 3
33
- - 1
34
- version: "3.1"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '3.1'
35
21
  type: :runtime
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: minitest
39
22
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - ">="
44
- - !ruby/object:Gem::Version
45
- hash: 3
46
- segments:
47
- - 0
48
- version: "0"
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '3.1'
28
+ - !ruby/object:Gem::Dependency
29
+ name: minitest
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
49
35
  type: :development
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: nokogiri
53
36
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
55
- none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 3
60
- segments:
61
- - 0
62
- version: "0"
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: nokogiri
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
63
49
  type: :development
64
- version_requirements: *id003
65
- description: Integrates Josh Sullivan's CSS3 Progress Bars into Rails and adds ActionView helpers for generation.
66
- email:
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description: Integrates Josh Sullivan's CSS3 Progress Bars into Rails and adds ActionView
57
+ helpers for generation.
58
+ email:
67
59
  - nicholas.fine@gmail.com
68
60
  - josh@dipperstove.com
69
61
  executables: []
70
-
71
62
  extensions: []
72
-
73
63
  extra_rdoc_files: []
74
-
75
- files:
64
+ files:
76
65
  - .gitignore
77
66
  - .travis.yml
78
67
  - Gemfile
79
68
  - README.markdown
80
69
  - Rakefile
81
70
  - app/assets/stylesheets/css3-progress-bar.css
71
+ - app/assets/stylesheets/progress-me.css
82
72
  - app/helpers/css3_progress_bars_helper.rb
83
73
  - css3-progress-bar-rails.gemspec
84
74
  - lib/css3-progress-bar-rails.rb
85
75
  - lib/css3-progress-bar-rails/version.rb
86
76
  - test/css3_progress_bars_helper_test.rb
87
- has_rdoc: true
88
77
  homepage: http://ndfine.com/2012/01/03/css3-progress-bars-for-rails.html
89
78
  licenses: []
90
-
79
+ metadata: {}
91
80
  post_install_message:
92
81
  rdoc_options: []
93
-
94
- require_paths:
82
+ require_paths:
95
83
  - lib
96
- required_ruby_version: !ruby/object:Gem::Requirement
97
- none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
- required_rubygems_version: !ruby/object:Gem::Requirement
106
- none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- hash: 3
111
- segments:
112
- - 0
113
- version: "0"
84
+ required_ruby_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
114
94
  requirements: []
115
-
116
95
  rubyforge_project: css3-progress-bar-rails
117
- rubygems_version: 1.4.2
96
+ rubygems_version: 2.0.3
118
97
  signing_key:
119
- specification_version: 3
98
+ specification_version: 4
120
99
  summary: Integrates Josh Sullivan's CSS3 Progress Bars into Rails 3.1+ Projects.
121
- test_files: []
122
-
100
+ test_files:
101
+ - test/css3_progress_bars_helper_test.rb