rails-bootstrap-grid 0.1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9bb223a216386b3ea0078358858364d6477a880f
4
+ data.tar.gz: a0e49655dd71157863f59c23016e7dd04fd3a9ca
5
+ SHA512:
6
+ metadata.gz: ac670379eb7019f7ee26b78142858ac4b874e5a176261dcdf609bd0dfebfa3128dc127d7cd875971424f2460ce4b0de3c999a7bf9d3f4cd8f37230f3a1fa7e00
7
+ data.tar.gz: 42a5589742a9cd625c7e3ddd1982183fd3e381ae0f200290c034ec8439850e3e64515ca4a9b9fbf6895d66a19d9b9909cb0877719ba9ad8c971e0497166c8e86
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ *.gem
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bootstrap-grid.gemspec
4
+ gemspec
@@ -0,0 +1,115 @@
1
+ # Rails Bootstrap Grid
2
+
3
+ A Rails Plugin for developers that use Bootstrap.
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/rails-bootstrap-grid.svg)](https://badge.fury.io/rb/rails-bootstrap-grid)
6
+
7
+ ## Dependecies
8
+
9
+ Use in Ruby >= 1.9 and Ruby on Rails >= v4.X and Boostrap load!
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'rails-bootstrap-grid', '0.3.0'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install rails-bootstrap-grid -v '0.3.0'
26
+
27
+ ## Usage
28
+
29
+ Containers availables
30
+ * row
31
+ * container
32
+ * container-fluid
33
+
34
+ Cols Methods availables
35
+ * col_xs_1, col_xs_2, col_xs_3, col_xs_4, col_xs_5, col_xs_6, col_xs_7, etc..
36
+ * col_sm_1, col_sm_2, col_sm_3, col_sm_4, col_sm_5, col_sm_6, col_sm_7, etc..
37
+ * col_md_1, col_md_2, col_md_3, col_md_4, col_md_5, col_md_6, col_md_7, etc..
38
+ * col_lg_1, col_lg_2, col_lg_3, col_lg_4, col_lg_5, col_lg_6, col_lg_7, etc..
39
+
40
+ ## Form Example using the Gem SimpleForm
41
+ ```ruby
42
+ <%= simple_form_for(@model, url: route_path) do |f| %>
43
+ <%= container do %>
44
+ <%= f.error_notification %>
45
+ <%= col_md_3 f.input :name, label: 'Name Canonical' %>
46
+ <%= col_md_3 f.input :username, html: { placeholder: 'Username' } %>
47
+ <%= col_md_3 f.input :password, label: 'Password' %>
48
+ <%= col_md_2 f.input :remember, as: :checkbox %>
49
+ <%= col_md_12 f.submit, html: { class: 'btn btn-primary' } %>
50
+ <% end %>
51
+ <% end %>
52
+ ```
53
+
54
+ use an container with block
55
+
56
+ ```ruby
57
+ <%= container do %>
58
+ more code
59
+ <% end %>
60
+ ```
61
+
62
+ use an row with block
63
+
64
+ ```ruby
65
+ <%= row do %>
66
+ more code
67
+ <% end %>
68
+ ```
69
+
70
+ use an cols with bootstrap
71
+
72
+ ```ruby
73
+ <%= col_md_12 f.input :username, html: { class: '', id: '', data: {} } %>
74
+ ```
75
+
76
+ ```ruby
77
+ <%= col_md_12 do %>
78
+ <%= col_md_6 do %>
79
+ <% f.input :username %>
80
+ <% end >
81
+
82
+ <%= col_md_6 do %>
83
+ <% f.input :password %>
84
+ <% end >
85
+ <% end >
86
+ ```
87
+
88
+ Clean HTML code for ERB Files
89
+
90
+ ```ruby
91
+ <%= col_md_12 html: { data: { error: false } } do %>
92
+ <%= col_md_6 f.input :username %>
93
+ <%= col_md_6 f.input :password %>
94
+ <%= col_md_6 f.input :remember, as: :checkbox %>
95
+ <% end %>
96
+ ```
97
+
98
+ Use with any options HTML
99
+
100
+ ```ruby
101
+ <%= col_md_12 html: { data: { error: false } } do %>
102
+ <%= col_md_6 html: { class: 'username', data: { error: false } } do %>
103
+ <%= f.input :username %>
104
+ <% end >
105
+
106
+ <%= col_md_6 html: { class: 'username', data: { error: false } } do %>
107
+ <%= f.input :password %>
108
+ <% end >
109
+ <% end %>
110
+ ```
111
+
112
+ ## Contributing
113
+
114
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Thadeu/rails-bootstrap-grid.
115
+
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "bootstrap/grid"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,9 @@
1
+ require File.expand_path("../rails-bootstrap-grid/grid", __FILE__)
2
+
3
+ module RailsBootstrapGrid
4
+ class Engine < Rails::Engine
5
+ initializer "rails-bootstrap-grid.grid" do |app|
6
+ ActionView::Base.send :include, RailsBootstrapGrid::Grid
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,44 @@
1
+ module RailsBootstrapGrid
2
+ module Grid
3
+ @grid_columns = (1..12)
4
+
5
+ class << self
6
+
7
+ def load!
8
+ cols(:xs, :sm, :md, :lg)
9
+ containers(:row, :container, "container-fluid")
10
+ end
11
+
12
+ def define_method_html(name_method, css_class)
13
+ define_method "#{name_method}" do |content= nil, html: {}, &block|
14
+ content = capture(&block) if block_given?
15
+
16
+ div_class = "#{css_class} "
17
+ div_class += html[:class] if html[:class].present?
18
+
19
+ html = html.merge({class: div_class})
20
+
21
+ content_tag :div, content, html, &block
22
+ end
23
+ end
24
+
25
+ def containers *arguments
26
+ arguments.each do |name|
27
+ name = name.to_s.gsub(/\-/,'_') if name.to_s =~ %r(-)
28
+ define_method_html(name, name)
29
+ end
30
+ end
31
+
32
+ def cols *arguments
33
+ arguments.each do |name|
34
+ @grid_columns.to_a.each do |n|
35
+ named_methods = ["col", name, n]
36
+ define_method_html(named_methods.join("_"), named_methods.join("-"))
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+
44
+ RailsBootstrapGrid::Grid.load!
@@ -0,0 +1,3 @@
1
+ module RailsBootstrapGrid
2
+ VERSION = "0.1.1"
3
+ end
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require "rails-bootstrap-grid/version"
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = "rails-bootstrap-grid"
10
+ spec.version = RailsBootstrapGrid::VERSION
11
+ spec.authors = ["Thadeu Esteves Jr"]
12
+ spec.email = ["tadeuu@gmail.com"]
13
+
14
+ spec.summary = "A Rails plugin that contains helpers for Bootstrap Grid"
15
+ spec.description = "A Rails plugin that contains helpers for Bootstrap Grid"
16
+ spec.homepage = "https://github.com/Thadeu/rails-bootstrap-grid"
17
+
18
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
+ spec.bindir = "exe"
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.12"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rails-bootstrap-grid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - Thadeu Esteves Jr
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-01 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.12'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.12'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: A Rails plugin that contains helpers for Bootstrap Grid
42
+ email:
43
+ - tadeuu@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - README.md
51
+ - Rakefile
52
+ - bin/console
53
+ - bin/setup
54
+ - lib/rails-bootstrap-grid.rb
55
+ - lib/rails-bootstrap-grid/grid.rb
56
+ - lib/rails-bootstrap-grid/version.rb
57
+ - rails-bootstrap-grid.gemspec
58
+ homepage: https://github.com/Thadeu/rails-bootstrap-grid
59
+ licenses: []
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.5.1
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: A Rails plugin that contains helpers for Bootstrap Grid
81
+ test_files: []