css_grid 0.0.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.
data/.DS_Store ADDED
Binary file
data/.gitignore ADDED
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ coverage
6
+ InstalledFiles
7
+ lib/bundler/man
8
+ pkg
9
+ rdoc
10
+ spec/reports
11
+ test/tmp
12
+ test/version_tmp
13
+ tmp
14
+
15
+ # YARD artifacts
16
+ .yardoc
17
+ _yardoc
18
+ doc/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in css_grid.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,63 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ css_grid (0.0.1)
5
+ hash_extend
6
+ railties (>= 3.1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actionpack (3.2.8)
12
+ activemodel (= 3.2.8)
13
+ activesupport (= 3.2.8)
14
+ builder (~> 3.0.0)
15
+ erubis (~> 2.7.0)
16
+ journey (~> 1.0.4)
17
+ rack (~> 1.4.0)
18
+ rack-cache (~> 1.2)
19
+ rack-test (~> 0.6.1)
20
+ sprockets (~> 2.1.3)
21
+ activemodel (3.2.8)
22
+ activesupport (= 3.2.8)
23
+ builder (~> 3.0.0)
24
+ activesupport (3.2.8)
25
+ i18n (~> 0.6)
26
+ multi_json (~> 1.0)
27
+ builder (3.0.0)
28
+ erubis (2.7.0)
29
+ hash_extend (1.0.1)
30
+ hike (1.2.1)
31
+ i18n (0.6.0)
32
+ journey (1.0.4)
33
+ json (1.7.5)
34
+ multi_json (1.3.6)
35
+ rack (1.4.1)
36
+ rack-cache (1.2)
37
+ rack (>= 0.4)
38
+ rack-ssl (1.3.2)
39
+ rack
40
+ rack-test (0.6.1)
41
+ rack (>= 1.0)
42
+ railties (3.2.8)
43
+ actionpack (= 3.2.8)
44
+ activesupport (= 3.2.8)
45
+ rack-ssl (~> 1.3.2)
46
+ rake (>= 0.8.7)
47
+ rdoc (~> 3.4)
48
+ thor (>= 0.14.6, < 2.0)
49
+ rake (0.9.2.2)
50
+ rdoc (3.12)
51
+ json (~> 1.4)
52
+ sprockets (2.1.3)
53
+ hike (~> 1.2)
54
+ rack (~> 1.0)
55
+ tilt (~> 1.1, != 1.3.0)
56
+ thor (0.16.0)
57
+ tilt (1.3.3)
58
+
59
+ PLATFORMS
60
+ ruby
61
+
62
+ DEPENDENCIES
63
+ css_grid!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Thomas Petrachi
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,29 @@
1
+ # CssGrid
2
+
3
+ In Dev Gem, please, come back later.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'css_grid'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install css_grid
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/css_grid.gemspec ADDED
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/css_grid/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Thomas Petrachi"]
6
+ gem.email = ["thomas.petrachi@vodeclic.com"]
7
+ gem.description = %q{In DEV GEM : Provide CSS grid stylesheet, plus several helpers}
8
+ gem.summary = %q{In DEV GEM : 1140_grid.css and GridHelper module}
9
+ gem.homepage = "https://github.com/petrachi/css_grid"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "css_grid"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = CssGrid::VERSION
17
+
18
+ gem.add_dependency "railties", ">= 3.1.0"
19
+ gem.add_dependency "hash_extend"
20
+ end
data/lib/.DS_Store ADDED
Binary file
Binary file
Binary file
@@ -0,0 +1,60 @@
1
+ @mixin span($width) { width: $width; margin: 0 1.74%; float: left; min-height: 1px; }
2
+ @mixin offset($width) { margin-left: $width + 5.22%; }
3
+
4
+
5
+ .container {
6
+
7
+ .row {
8
+ width: 100%; max-width: 1140px; min-width: 755px; margin: 0 auto; overflow: hidden;
9
+
10
+ .one_span { @include span(4.85%); } /* 55px */
11
+ .two_span { @include span(13.18%); } /* 150px */
12
+ .three_span { @include span(21.51%); } /* 245px */
13
+ .four_span { @include span(29.84%); } /* 340px */
14
+ .five_span { @include span(38.17%); }
15
+ .six_span { @include span(46.5%); } /* 530px */
16
+ .seven_span { @include span(54.83%); }
17
+ .eight_span { @include span(63.16%); }
18
+ .nine_span { @include span(71.49%); }
19
+ .ten_span { @include span(79.82%); }
20
+ .eleven_span { @include span(88.15%); }
21
+ .twelve_span { @include span(96.47%); }
22
+
23
+ .offset_one { @include offset(4.85%); }
24
+ .offset_two { @include offset(13.18%); }
25
+ .offset_three { @include offset(21.51%); }
26
+ .offset_four { @include offset(29.84%); }
27
+ .offset_five { @include offset(38.17%); }
28
+ .offset_six { @include offset(46.5%); }
29
+ .offset_seven { @include offset(54.83%); }
30
+ .offset_eight { @include offset(63.16%); }
31
+ .offset_nine { @include offset(71.49%); }
32
+ .offset_ten { @include offset(79.82%); }
33
+ .offset_eleven { @include offset(88.15%); }
34
+ .offset_twelve { @include offset(96.47%); }
35
+ }
36
+
37
+ img, object, embed { max-width: 100%; }
38
+ img { height: auto; }
39
+
40
+ }
41
+
42
+
43
+ /* Smaller screens */
44
+ @media only screen and (max-width: 1023px) {
45
+ body { font-size: 0.8em; line-height: 1.5em; }
46
+ }
47
+
48
+
49
+ /* Mobile */
50
+ @media handheld, only screen and (max-width: 767px) {
51
+ body { font-size: 16px; -webkit-text-size-adjust: none; }
52
+
53
+ .container{
54
+ .row { min-width: 0; padding: 0;
55
+ .one_span, .two_span, .three_span, .four_span, .five_span, .six_span, .seven_span, .eight_span, .nine_span, .ten_span, .eleven_span, .twelve_span {
56
+ width: auto; float: none; margin: 0; padding: 0 20px;
57
+ }
58
+ }
59
+ }
60
+ }
@@ -0,0 +1,6 @@
1
+ module CssGrid
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module CssGrid
2
+ VERSION = "0.0.1"
3
+ end
data/lib/css_grid.rb ADDED
@@ -0,0 +1,99 @@
1
+ require "css_grid/version"
2
+ require "css_grid/engine"
3
+
4
+ module CssGridHelper
5
+
6
+
7
+ #module GridHelper
8
+ TWELVE_STRING_INTS = {:one => 1, :two => 2, :three => 3, :four => 4, :five => 5, :six => 6, :seven => 7, :eight => 8, :nine => 9, :ten => 10, :evelen => 11, :twelve => 12}
9
+
10
+ def grid element_class, options = Hash.new, &block
11
+ html_id, html_class, offset = options.delete_many :id, :class, :offset
12
+ offset = TWELVE_STRING_INTS.invert[offset] if offset.class == Fixnum
13
+
14
+ content_tag(:div, nil, :id => html_id, :class => "#{ element_class } #{ html_class } #{ "offset_#{ offset }" if offset }" , &block)
15
+ end
16
+
17
+ def col col_number, options = Hash.new, &block
18
+ html_id, html_class, collection = options.delete_many :id, :class, :collection
19
+ collection ||= [1]
20
+
21
+ collection_length = TWELVE_STRING_INTS[col_number.to_sym]
22
+ span_width = TWELVE_STRING_INTS.invert[ 12 / collection_length ]
23
+
24
+ raise ArgumentError, "collection.size must be <= #{ collection_length }" if collection.size > collection_length
25
+
26
+ cols = collection.map do |elt|
27
+ eval %{
28
+ #{ span_width }_span do
29
+ capture(elt, &block)
30
+ end }
31
+ end
32
+
33
+ row :id => html_id, :class => html_class do
34
+ cols.inject(ActiveSupport::SafeBuffer.new){ |buffer, col| buffer.safe_concat(col) }
35
+ end
36
+ end
37
+
38
+ def recollect size, collection
39
+ recollected = Array.new
40
+ 0.step(collection.size - 1, size) do |i|
41
+ recollected << collection[i..i + size - 1]
42
+ end
43
+ recollected
44
+ end
45
+
46
+ def rows col_number, options = Hash.new, &block
47
+ html_id, html_class, collection = options.delete_many :id, :class, :collection
48
+ collection ||= [1]
49
+
50
+ recollection_size = TWELVE_STRING_INTS[col_number.to_sym]
51
+
52
+ rows = recollect(recollection_size, collection).map do |collection_mini|
53
+ col col_number, {:collection => collection_mini}, &block
54
+ end
55
+
56
+ container :id => html_id, :class => html_class do
57
+ rows.inject(ActiveSupport::SafeBuffer.new){ |buffer, col| buffer.safe_concat(col) }
58
+ end
59
+ end
60
+
61
+
62
+ def method_missing method_name, *args, &block
63
+ case method_name.to_s
64
+ when /^(container|row|(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)_span)$/
65
+ self.grid($1, *args, &block)
66
+ when /^(one|two|three|four|six|twelve)_col_row$/
67
+ self.col($1, *args, &block)
68
+ when /^(one|two|three|four|six|twelve)_col_container$/
69
+ self.rows($1, *args, &block)
70
+ else super
71
+ end
72
+ end
73
+
74
+ def respond_to? method_name
75
+ case method_name.to_s
76
+ when /^(container|row|(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)_span)$/,
77
+ /^(one|two|three|four|six|twelve)_col_row$/,
78
+ /^(one|two|three|four|six|twelve)_col_container$/
79
+ true
80
+ else super
81
+ end
82
+ end
83
+
84
+
85
+ =begin
86
+ def dynamic_method method_name, *args, &block
87
+ case method_name.to_s
88
+ when /^(container|row|(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve)_span)$/
89
+ lambda{ self.grid($1, *args, &block) }
90
+ when /^(one|two|three|four|six|twelve)_col_row$/
91
+ lambda{ self.col($1, *args, &block) }
92
+ when /^(one|two|three|four|six|twelve)_col_container$/
93
+ lambda{ self.rows($1, *args, &block) }
94
+ else super
95
+ end
96
+ end
97
+ =end
98
+ #end
99
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: css_grid
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Thomas Petrachi
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-01 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: railties
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.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.1.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: hash_extend
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: ! 'In DEV GEM : Provide CSS grid stylesheet, plus several helpers'
47
+ email:
48
+ - thomas.petrachi@vodeclic.com
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .DS_Store
54
+ - .gitignore
55
+ - Gemfile
56
+ - Gemfile.lock
57
+ - LICENSE
58
+ - README.md
59
+ - Rakefile
60
+ - css_grid.gemspec
61
+ - lib/.DS_Store
62
+ - lib/assets/.DS_Store
63
+ - lib/assets/stylesheets/.DS_Store
64
+ - lib/assets/stylesheets/grid.css.scss
65
+ - lib/css_grid.rb
66
+ - lib/css_grid/engine.rb
67
+ - lib/css_grid/version.rb
68
+ homepage: https://github.com/petrachi/css_grid
69
+ licenses: []
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ segments:
81
+ - 0
82
+ hash: 3557974454186978587
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ! '>='
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ segments:
90
+ - 0
91
+ hash: 3557974454186978587
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 1.8.24
95
+ signing_key:
96
+ specification_version: 3
97
+ summary: ! 'In DEV GEM : 1140_grid.css and GridHelper module'
98
+ test_files: []