button_helper 0.0.1 → 0.0.3
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/README.md +15 -3
- data/button_helper.gemspec +1 -1
- data/lib/button_helper/version.rb +1 -1
- data/lib/button_helper.rb +7 -5
- data/spec/button_helper_spec.rb +21 -0
- metadata +6 -5
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ButtonHelper
|
2
2
|
|
3
|
-
|
3
|
+
Simple gem which helps in customizing your button class.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -16,10 +16,20 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install button_helper
|
18
18
|
|
19
|
-
## Usage
|
19
|
+
## Sample Usage
|
20
20
|
|
21
|
-
|
21
|
+
In a method definition, call the method btn_class
|
22
|
+
|
23
|
+
ButtonHelper::btn_class(status)
|
24
|
+
|
25
|
+
status here is in_progress/success/failed
|
26
|
+
|
27
|
+
Style your buttons using the sassy buttons.
|
28
|
+
|
29
|
+
## TODO
|
22
30
|
|
31
|
+
Including sassy button CSS in the Gem.
|
32
|
+
|
23
33
|
## Contributing
|
24
34
|
|
25
35
|
1. Fork it
|
@@ -27,3 +37,5 @@ TODO: Write usage instructions here
|
|
27
37
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
28
38
|
4. Push to the branch (`git push origin my-new-feature`)
|
29
39
|
5. Create new Pull Request
|
40
|
+
|
41
|
+
|
data/button_helper.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.email = ["nayana.bhagat1@gmail.com"]
|
9
9
|
gem.description = %q{Generates customized class for buttons}
|
10
10
|
gem.summary = %q{Generates customized class for buttons}
|
11
|
-
gem.homepage = ""
|
11
|
+
gem.homepage = "https://github.com/Gemathon-Lapidarists/button_helper"
|
12
12
|
|
13
13
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
14
14
|
gem.files = `git ls-files`.split("\n")
|
data/lib/button_helper.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
require "button_helper/version"
|
2
2
|
|
3
3
|
module ButtonHelper
|
4
|
-
def self.btn_class(status)
|
4
|
+
def self.btn_class(status=nil)
|
5
5
|
if status=="in_progress"
|
6
|
-
'button in_progress'
|
6
|
+
'button in_progress custom'
|
7
7
|
elsif status=="success"
|
8
|
-
'button
|
9
|
-
|
10
|
-
'button
|
8
|
+
'button green custom'
|
9
|
+
elsif status=="failed"
|
10
|
+
'button red custom'
|
11
|
+
else
|
12
|
+
''
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'button_helper'
|
2
|
+
|
3
|
+
describe ButtonHelper do
|
4
|
+
|
5
|
+
it 'should return in progress css when the status is In progress' do
|
6
|
+
css1 = ButtonHelper.btn_class('in_progress')
|
7
|
+
css1.should == 'button in_progress custom'
|
8
|
+
end
|
9
|
+
it 'should return success css when the status is success' do
|
10
|
+
css1 = ButtonHelper.btn_class('success')
|
11
|
+
css1.should == 'button green custom'
|
12
|
+
end
|
13
|
+
it 'should return failure css when the status is failed' do
|
14
|
+
css1 = ButtonHelper.btn_class('failed')
|
15
|
+
css1.should == 'button red custom'
|
16
|
+
end
|
17
|
+
it 'should not return anything if status is nil' do
|
18
|
+
css1 = ButtonHelper.btn_class(nil)
|
19
|
+
css1.should == ''
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: button_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nayana Bhagat,Vaibhav Kholi,Ankita Kanitkar,Milind Singh,Prabhat Thapa,Swarup Mitra
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2014-02-
|
18
|
+
date: 2014-02-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rspec
|
@@ -49,7 +49,8 @@ files:
|
|
49
49
|
- button_helper.gemspec
|
50
50
|
- lib/button_helper.rb
|
51
51
|
- lib/button_helper/version.rb
|
52
|
-
|
52
|
+
- spec/button_helper_spec.rb
|
53
|
+
homepage: https://github.com/Gemathon-Lapidarists/button_helper
|
53
54
|
licenses: []
|
54
55
|
|
55
56
|
post_install_message:
|