rails_bootstrap_helpers 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
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 rails_bootstrap_helpers.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Aaron Cruz
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # RailsBootstrapHelpers
2
+
3
+ Some helpful Twitter Bootstrap Rails helpers. I felt the pain of the upgrade from Twitter Bootstrap 1.6 to 2.0 and these were the result.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rails_bootstrap_helpers'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Helper methods will be available in your views!
16
+
17
+ ## Usage
18
+
19
+ Read the helper methods in `app/helpers/rails_bootstrap_helpers/layout_helper.rb`. I will add examples if I get any watchers on this repo.
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
26
+ 4. Push to the branch (`git push origin my-new-feature`)
27
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,57 @@
1
+ module RailsBootstrapHelpers
2
+ module LayoutHelper
3
+
4
+ def striped_table(id=nil, &block)
5
+ content = capture(&block)
6
+ content_tag(:table, content, id: id, class: "table table-bordered table-striped")
7
+ end
8
+
9
+ def pills(&block)
10
+ list_builder "nav-pills", &block
11
+ end
12
+
13
+ def tabs(&block)
14
+ list_builder "nav-tabs", &block
15
+ end
16
+
17
+ def stacked_tabs(&block)
18
+ list_builder "nav-tabs", "nav-stacked", &block
19
+ end
20
+
21
+ def stacked_pills(&block)
22
+ list_builder "nav-pills","nav-stacked", &block
23
+ end
24
+
25
+ def bootstrap_link_to(title, link, color, options = {})
26
+ btn_class = bootstrap_button_class(color).concat(options[:class] || "")
27
+ raw(link_to title, link, { class: btn_class }.merge(options))
28
+ end
29
+
30
+ def bootstrap_button_class(color = nil)
31
+ case color
32
+ when :red then "btn btn-danger"
33
+ when :blue then "btn btn-primary"
34
+ when :light_blue then "btn btn-info"
35
+ when :green then "btn btn-success"
36
+ when :yellow then "btn btn-warning"
37
+ else "btn"
38
+ end
39
+ end
40
+
41
+ def bootstrap_label(text, type)
42
+ content_tag(:span, text, class: "label #{type.to_s}")
43
+ end
44
+
45
+ def conditional_bootstrap_label(condition, text, success = :success, failure = :important)
46
+ condition ? bootstrap_label(text, success) : bootstrap_label(text, failure)
47
+ end
48
+
49
+ private
50
+
51
+ def list_builder(*classes, &block)
52
+ content = capture(&block)
53
+ content_tag(:ul, content, class: "nav #{classes.join(' ')}")
54
+ end
55
+
56
+ end
57
+ end
@@ -0,0 +1,2 @@
1
+ require "rails_bootstrap_helpers/version"
2
+ require "rails_bootstrap_helpers/engine"
@@ -0,0 +1,4 @@
1
+ module RailsBootstrapHelpers
2
+ class Engine < Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ module RailsBootstrapHelpers
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/rails_bootstrap_helpers/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Aaron Cruz"]
6
+ gem.email = ["aaron@aaroncruz.com"]
7
+ gem.description = %q{Some helpful Twitter Bootstrap Rails helpers.
8
+ I felt the pain of the upgrade from Twitter Bootstrap
9
+ 1.6 to 2.0 and these were the result.}
10
+ gem.summary = %q{Some helpful Twitter Bootstrap Rails helpers.}
11
+ gem.homepage = "https://github.com/pferdefleisch/rails_bootstrap_helpers"
12
+
13
+ gem.files = `git ls-files`.split($\)
14
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
15
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
+ gem.name = "rails_bootstrap_helpers"
17
+ gem.require_paths = ["lib"]
18
+ gem.add_dependency 'rails', '~> 3.0'
19
+ gem.version = RailsBootstrapHelpers::VERSION
20
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails_bootstrap_helpers
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Aaron Cruz
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '3.0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '3.0'
30
+ description: ! "Some helpful Twitter Bootstrap Rails helpers. \n I
31
+ felt the pain of the upgrade from Twitter Bootstrap \n 1.6
32
+ to 2.0 and these were the result."
33
+ email:
34
+ - aaron@aaroncruz.com
35
+ executables: []
36
+ extensions: []
37
+ extra_rdoc_files: []
38
+ files:
39
+ - .gitignore
40
+ - Gemfile
41
+ - LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - app/helpers/rails_bootstrap_helpers/layout_helper.rb
45
+ - lib/rails_bootstrap_helpers.rb
46
+ - lib/rails_bootstrap_helpers/engine.rb
47
+ - lib/rails_bootstrap_helpers/version.rb
48
+ - rails_bootstrap_helpers.gemspec
49
+ homepage: https://github.com/pferdefleisch/rails_bootstrap_helpers
50
+ licenses: []
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ! '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ requirements: []
68
+ rubyforge_project:
69
+ rubygems_version: 1.8.23
70
+ signing_key:
71
+ specification_version: 3
72
+ summary: Some helpful Twitter Bootstrap Rails helpers.
73
+ test_files: []