volt-progress-bar 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad3ab7285e106dfdc02526a48cef4f5c9d34e9d9
4
+ data.tar.gz: 2ff668023a4c36b62fed76f476ac4ee3c1b462ab
5
+ SHA512:
6
+ metadata.gz: 14d828fcdda60f29992442b5401963f9b47068754aade89cd8539613dabbcfd46c994da5bbd5e1fc80ab02a55e1f63d0e387212433afc8e7c9a81cf7c1f2f768
7
+ data.tar.gz: 385b5686412c27d37e0408dcd3bdb058b487b85d57b855e62d29c22072100fbc4ac2a13ff8951543bf247b7bbbee1af06fb0955b246cf3a9bfb88122cd3b8cb9
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in volt-progress-bar.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Volt Progress Bar
2
+
3
+ This is a simple progress bar component for Volt. The progress bar updates dynamically with a Volt reactive value.
4
+
5
+ # Install
6
+
7
+ Include the following code in your gemfile:
8
+
9
+ gem 'volt-progress-bar'
10
+
11
+ Add the progress bar component to your config/dependencies.rb.
12
+
13
+ ```ruby
14
+ component 'bootstrap'
15
+ component 'progress-bar'
16
+ ```
17
+
18
+ The bootstrap component is not necessary, but does include styling for the progress bar out of the box. If you wish to not use bootstrap, or you want to use your own styles, read the styling section below.
19
+
20
+ # Use
21
+
22
+ To get a progress bar, simply put this code in a Volt view.
23
+
24
+ <:progress-bar value="{_width}" total="100" />
25
+
26
+ Value must be set to a reactive value and total can either be a reactive value or an integer.
27
+
28
+ # Styling
29
+
30
+ Override the progress and progress-bar classes to customize the progress bar's style.
31
+
32
+ ```css
33
+ .progress{
34
+ width:100px;
35
+ }
36
+ .progress-bar{
37
+ background:green;
38
+ }
39
+ ```
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,26 @@
1
+ module ProgressBar
2
+ class IndexController
3
+ def initialize(data)
4
+ @data = data
5
+ if !@data.locals.has_key?("value")
6
+ raise "Progress Bar requires a value."
7
+ end
8
+ if !@data.locals.has_key?("total")
9
+ raise "Progress Bar requires a total."
10
+ end
11
+ end
12
+
13
+ def width
14
+ w = @data.value.to_f / @data.total.to_f * 100
15
+ w.with {|v| [[v, 0].max, 100].min }
16
+ end
17
+
18
+ def classes
19
+ if @data.locals.has_key?("classes")
20
+ @data.classes
21
+ else
22
+ ""
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,7 @@
1
+ <:body>
2
+ <div class='progress'>
3
+ <div class='progress-bar {classes}' style='width:{width}%;' aria-valuenow="{width.round}" aria-valuemin="0" aria-valuemax="100">
4
+ <span class="sr-only">{width}% Complete (warning)</span>
5
+ </div>
6
+ </div>
7
+ </:body>
@@ -0,0 +1,9 @@
1
+ require "volt/progress/bar/version"
2
+
3
+ class Volt
4
+ class Progress
5
+ class Bar
6
+ # Your code goes here...
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ version = File.read(File.expand_path('../VERSION', __FILE__)).strip
6
+
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "volt-progress-bar"
10
+ spec.version = version
11
+ spec.authors = ["Corey"]
12
+ spec.email = ["coreystout@gmail.com"]
13
+ spec.summary = "A simple progress bar."
14
+ spec.description = "This is a simple progress bar component for Volt. The progress bar updates dynamically with a Volt reactive value."
15
+ spec.homepage = ""
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0")
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "volt", "~> 0.3.0"
24
+ spec.add_development_dependency "rake"
25
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: volt-progress-bar
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Corey
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: volt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: This is a simple progress bar component for Volt. The progress bar updates
42
+ dynamically with a Volt reactive value.
43
+ email:
44
+ - coreystout@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - .gitignore
50
+ - Gemfile
51
+ - README.md
52
+ - Rakefile
53
+ - VERSION
54
+ - app/progress-bar/controllers/index_controller.rb
55
+ - app/progress-bar/views/index/index.html
56
+ - lib/volt/progress/bar.rb
57
+ - volt-progress-bar.gemspec
58
+ homepage: ''
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.1.11
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: A simple progress bar.
82
+ test_files: []
83
+ has_rdoc: