css_grid 2.5.1 → 2.6.0

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 CHANGED
@@ -172,6 +172,22 @@ Note that 'prepend' accept negative values
172
172
 
173
173
  --
174
174
 
175
+ You can add any attributes just like in content_tag. For example new html5 deta-* attributes.
176
+
177
+ ```erb
178
+ <%= six_span :'data-name'=>"Thomas Petrachi" do %>
179
+ <!-- some html -->
180
+ <% end %>
181
+ ```
182
+
183
+ ```html
184
+ <div class="six_span" data-name="Thomas Petrachi">
185
+ <!-- some html -->
186
+ </div>
187
+ ```
188
+
189
+ --
190
+
175
191
  You can use the 'element' option to specify the html element wich will be created
176
192
 
177
193
  ```erb
@@ -288,7 +304,7 @@ Here is a list of options you can use. Following exemples.
288
304
  * :rows => Hash (authorized keys are :id, :class and :nested) - pass by options to automatic created rows tags.
289
305
 
290
306
  Note :
291
- * You can use procs in :spans/:id, :spans/:class, :rows/:id and :rows/:class
307
+ * You can use procs in any option.
292
308
 
293
309
  Also :
294
310
  * :nested also accept :container as a value (works the same way as :disable). It allows to use *_col_container inside a *_span tag. :nested_with => Integer must be informed in that case, telling the width of the span you'r in.
@@ -631,16 +647,8 @@ Need to test it with the most commons versions of grid stylesheets (twitter boot
631
647
 
632
648
  --
633
649
 
634
- Add option to insert specified attributes in tags. Like 'itemprop', 'itemscope' or personal attribute, 'data-remote' for me ;)
635
-
636
- --
637
-
638
650
  Preprend and Append are not fully handled by the GRID_CONFIG constant. Specialy prepend negative values.
639
651
 
640
- --
641
-
642
- Add ArgumentErrors in helpers.
643
-
644
652
  ## Contributing
645
653
 
646
654
  1. Fork it
@@ -3,7 +3,7 @@ $gutter_width: 1.041666666666;
3
3
  @mixin span($full, $col_num) {
4
4
  width: (($col_num / 12) * 100 - $gutter_width * 2) / 100 * $full;
5
5
  margin: 0 ($gutter_width / 100 * $full);
6
- float: left; min-height: 1px;
6
+ float: left;
7
7
  }
8
8
 
9
9
  @mixin prepend($full, $col_num) { margin-left: (($col_num / 12) * 100 - $gutter_width * 2) / 100 * $full + ($gutter_width * 3 / 100 * $full); }
@@ -1,3 +1,3 @@
1
1
  module CssGrid
2
- VERSION = "2.5.1"
2
+ VERSION = "2.6.0"
3
3
  end
data/lib/css_grid.rb CHANGED
@@ -16,6 +16,10 @@ module GridHelper
16
16
  end
17
17
 
18
18
  def grid tag, options = {}, &block
19
+ options.map_values! do |value|
20
+ value.class == Proc ? value.call(@elt) : value
21
+ end
22
+
19
23
  prepend = if options[:prepend].present?
20
24
  if options[:prepend] > 0
21
25
  TWELVE_STRING_INTS_INVERT[options.delete :prepend]
@@ -42,8 +46,9 @@ module GridHelper
42
46
  content_class << "#{ GRID_CONFIG[:classes][:prepend] }_#{ prepend }" if prepend
43
47
  content_class << "#{ GRID_CONFIG[:classes][:append] }_#{ append }" if append
44
48
  content_class << GRID_CONFIG[:classes][:nested] if options.delete(:nested)
45
-
46
- safe_buffer = content_tag(options.delete(:element) || GRID_CONFIG[:elements][tag], nil, :id => options.delete(:id), :class => content_class.join(" ") , &block)
49
+ options.merge! :class => content_class.join(" ")
50
+
51
+ safe_buffer = content_tag(options.delete(:element) || GRID_CONFIG[:elements][tag], options, &block)
47
52
 
48
53
  @nested_stack.pop if unstack
49
54
  safe_buffer
@@ -76,16 +81,13 @@ module GridHelper
76
81
 
77
82
  rows = recollect(collection_length, options.delete(:collection) || [1]).map do |collection_mini|
78
83
  cols = collection_mini.map do |elt|
79
-
84
+ @elt = elt
85
+
80
86
  if disable.include? :spans
81
87
  capture(elt, &block)
82
88
 
83
89
  else
84
- spans_options = options[:spans].clone
85
- spans_options[:id] = spans_options[:id].call elt if spans_options[:id].class == Proc
86
- spans_options[:class] = spans_options[:class].call elt if spans_options[:class].class == Proc
87
-
88
- grid("#{ span_width }_span".to_sym, spans_options) do
90
+ grid("#{ span_width }_span".to_sym, options[:spans].clone) do
89
91
  safe_buffer = capture(elt, &block)
90
92
  safe_buffer = grid(:row, :nested=>true){ safe_buffer } if nested.include? :spans
91
93
 
@@ -93,16 +95,13 @@ module GridHelper
93
95
  end
94
96
  end
95
97
  end
96
-
97
- rows_options = options[:rows].clone
98
- rows_options[:id] = rows_options[:id].call elt if rows_options[:id].class == Proc
99
- rows_options[:class] = rows_options[:class].call elt if rows_options[:class].class == Proc
100
-
101
- grid(:row, rows_options){ cols.reduce(:safe_concat) }
98
+ @elt = nil
99
+
100
+ grid(:row, options[:rows].clone){ cols.reduce(:safe_concat) }
102
101
  end
103
102
 
104
103
  safe_buffer = rows.reduce(:safe_concat)
105
- safe_buffer = grid(:container, :id=>options.delete(:id), :class=>options.delete(:class), :element=>options.delete(:element)){ safe_buffer } unless disable.delete :container
104
+ safe_buffer = grid(:container, options.except!(:spans, :rows)){ safe_buffer } unless disable.delete :container
106
105
  safe_buffer
107
106
  end
108
107
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: css_grid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-17 00:00:00.000000000 Z
12
+ date: 2012-11-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties