ballast 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 463cb004e99736cfb55f1584675a52703512152c
4
- data.tar.gz: 20a3acc71cb71779579b0dd078888cda80829f76
3
+ metadata.gz: 72d9e7b1097d75ed1e9fe9e8e056bc54b2d9f29a
4
+ data.tar.gz: 706a582324c381cd7f9e90b89d6fb38e6ab3a1b0
5
5
  SHA512:
6
- metadata.gz: 4a5a813ea90cc5ed5b344eeeb75c0cc2574c95295e48969522c737908dee2866bb66db94d2d37109b54d6f6cbda4e560406834a23a29d9f83eab55cf887faf91
7
- data.tar.gz: c119cbe42811bb8042975c3088a36816f6e76918669f57247796bb174ddd77a1923960b7f1f11b446916290fe62f02cb797c5019eb60179b010b3fc7d16d53a8
6
+ metadata.gz: 70620c392ea9e428046389ebf1407cbe5fc0a5b82ab85838173327a950a6efd15b768a6bb605c293c75fe6a0d5326081368ab6f8f32013308660f12ebb42c32c
7
+ data.tar.gz: a2a106dde8f4bf944dbd53a72c5b830a1ff01c9eecbe84a161d61a46ab5f56a896091039e5ccb3d3a823413b8a931c8ed896e1e6542f38200d7d97a29b0478ee
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 1.7.0 / 2014-01-25
2
+
3
+ * Added `Ballast::Concerns::View::set_layout_params`.
4
+ * Added `Ballast::Concerns::View::layout_params`.
5
+ * Added `Ballast::Concerns::View::layout_param`.
6
+
1
7
  ### 1.6.0 / 2014-01-25
2
8
 
3
9
  * `Ballast::Concerns::Ajax#allow_cors`'s parameters are now customizable.
data/ballast.gemspec CHANGED
@@ -26,10 +26,10 @@ Gem::Specification.new do |gem|
26
26
 
27
27
  gem.add_dependency("actionpack", ">= 4.0.0")
28
28
  gem.add_dependency("rack", "~> 1.5.2")
29
- gem.add_dependency("oj", "~> 2.5.3")
29
+ gem.add_dependency("oj", "~> 2.5.4")
30
30
  gem.add_dependency("brauser", "~> 3.2.5")
31
31
  gem.add_dependency("interactor", "~> 2.1.0")
32
32
  gem.add_dependency("addressable", "~> 2.3.5")
33
33
  gem.add_dependency("rack-fiber_pool", ">= 0.9.3")
34
34
  gem.add_dependency("em-synchrony", "~> 1.0.3")
35
- end
35
+ end
data/doc/Ballast.html CHANGED
@@ -121,7 +121,7 @@ Licensed under the MIT license, which can be found at http://www.opensource.org/
121
121
  </div>
122
122
 
123
123
  <div id="footer">
124
- Generated on Sat Jan 25 11:54:04 2014 by
124
+ Generated on Sat Jan 25 13:47:00 2014 by
125
125
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
126
126
  0.8.7.3 (ruby-2.1.0).
127
127
  </div>
@@ -118,7 +118,7 @@
118
118
  </div>
119
119
 
120
120
  <div id="footer">
121
- Generated on Sat Jan 25 11:54:04 2014 by
121
+ Generated on Sat Jan 25 13:47:00 2014 by
122
122
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
123
123
  0.8.7.3 (ruby-2.1.0).
124
124
  </div>
@@ -895,7 +895,7 @@
895
895
  </div>
896
896
 
897
897
  <div id="footer">
898
- Generated on Sat Jan 25 11:54:04 2014 by
898
+ Generated on Sat Jan 25 13:47:00 2014 by
899
899
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
900
900
  0.8.7.3 (ruby-2.1.0).
901
901
  </div>
@@ -1098,7 +1098,7 @@ and <code>%:Z</code> for the zone name considering also DST.</p>
1098
1098
  </div>
1099
1099
 
1100
1100
  <div id="footer">
1101
- Generated on Sat Jan 25 11:54:04 2014 by
1101
+ Generated on Sat Jan 25 13:47:00 2014 by
1102
1102
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1103
1103
  0.8.7.3 (ruby-2.1.0).
1104
1104
  </div>
@@ -291,7 +291,7 @@
291
291
  </div>
292
292
 
293
293
  <div id="footer">
294
- Generated on Sat Jan 25 11:54:04 2014 by
294
+ Generated on Sat Jan 25 13:47:00 2014 by
295
295
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
296
296
  0.8.7.3 (ruby-2.1.0).
297
297
  </div>
@@ -198,6 +198,31 @@
198
198
  <span class="summary_desc"><div class='inline'><p>Outputs the Javascript parameters.</p>
199
199
  </div></span>
200
200
 
201
+ </li>
202
+
203
+
204
+ <li class="public ">
205
+ <span class="summary_signature">
206
+
207
+ <a href="#layout_params-instance_method" title="#layout_params (instance method)">- (Object|Hash) <strong>layout_params</strong>(key = nil, default_value = nil) </a>
208
+
209
+
210
+
211
+ (also: #layout_param)
212
+
213
+ </span>
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+ <span class="summary_desc"><div class='inline'><p>Returns one or all layout parameters.</p>
224
+ </div></span>
225
+
201
226
  </li>
202
227
 
203
228
 
@@ -221,6 +246,29 @@
221
246
  <span class="summary_desc"><div class='inline'><p>Scopes the CSS of the current page using the controller and action name.</p>
222
247
  </div></span>
223
248
 
249
+ </li>
250
+
251
+
252
+ <li class="public ">
253
+ <span class="summary_signature">
254
+
255
+ <a href="#set_layout_params-instance_method" title="#set_layout_params (instance method)">- (Object) <strong>set_layout_params</strong>(**args) </a>
256
+
257
+
258
+
259
+ </span>
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+ <span class="summary_desc"><div class='inline'><p>Adds/Replaces layout parameters.</p>
270
+ </div></span>
271
+
224
272
  </li>
225
273
 
226
274
 
@@ -309,25 +357,25 @@
309
357
  <pre class="lines">
310
358
 
311
359
 
312
- 47
313
- 48
314
- 49
315
- 50
316
- 51
317
- 52
318
- 53
319
- 54
320
- 55
321
- 56
322
- 57
323
- 58
324
- 59</pre>
360
+ 67
361
+ 68
362
+ 69
363
+ 70
364
+ 71
365
+ 72
366
+ 73
367
+ 74
368
+ 75
369
+ 76
370
+ 77
371
+ 78
372
+ 79</pre>
325
373
  </td>
326
374
  <td>
327
- <pre class="code"><span class="info file"># File 'lib/ballast/concerns/view.rb', line 47</span>
375
+ <pre class="code"><span class="info file"># File 'lib/ballast/concerns/view.rb', line 67</span>
328
376
 
329
377
  <span class='kw'>def</span> <span class='id identifier rubyid_add_javascript_params'>add_javascript_params</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_data'>data</span><span class='comma'>,</span> <span class='id identifier rubyid_replace'>replace</span> <span class='op'>=</span> <span class='kw'>false</span><span class='rparen'>)</span>
330
- <span class='ivar'>@javascript_params</span> <span class='op'>||=</span> <span class='const'>HashWithIndifferentAccess</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
378
+ <span class='id identifier rubyid_initialize_view_params'>initialize_view_params</span>
331
379
 
332
380
  <span class='kw'>if</span> <span class='id identifier rubyid_key'>key</span>
333
381
  <span class='ivar'>@javascript_params</span><span class='lbracket'>[</span><span class='id identifier rubyid_key'>key</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='kw'>nil</span> <span class='kw'>if</span> <span class='id identifier rubyid_replace'>replace</span>
@@ -561,15 +609,118 @@
561
609
  <pre class="lines">
562
610
 
563
611
 
612
+ 57
613
+ 58
614
+ 59
615
+ 60</pre>
616
+ </td>
617
+ <td>
618
+ <pre class="code"><span class="info file"># File 'lib/ballast/concerns/view.rb', line 57</span>
619
+
620
+ <span class='kw'>def</span> <span class='id identifier rubyid_javascript_params'>javascript_params</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='symbol'>:details</span><span class='rparen'>)</span>
621
+ <span class='id identifier rubyid_initialize_view_params'>initialize_view_params</span>
622
+ <span class='id identifier rubyid_id'>id</span> <span class='op'>?</span> <span class='id identifier rubyid_content_tag'>content_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='ivar'>@javascript_params</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='period'>.</span><span class='id identifier rubyid_html_safe'>html_safe</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>data-jid</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span><span class='op'>:</span> <span class='ivar'>@javascript_params</span>
623
+ <span class='kw'>end</span></pre>
624
+ </td>
625
+ </tr>
626
+ </table>
627
+ </div>
628
+
629
+ <div class="method_details ">
630
+ <h3 class="signature " id="layout_params-instance_method">
631
+
632
+ - (<tt>Object|Hash</tt>) <strong>layout_params</strong>(key = nil, default_value = nil)
633
+
634
+
635
+
636
+ <span class="aliases">Also known as:
637
+ <span class="names"><span id='layout_param-instance_method'>layout_param</span></span>
638
+ </span>
639
+
640
+
641
+
642
+ </h3><div class="docstring">
643
+ <div class="discussion">
644
+ <p>Returns one or all layout parameters.</p>
645
+
646
+
647
+ </div>
648
+ </div>
649
+ <div class="tags">
650
+ <p class="tag_title">Parameters:</p>
651
+ <ul class="param">
652
+
653
+ <li>
654
+
655
+ <span class='name'>key</span>
656
+
657
+
658
+ <span class='type'>(<tt>String|Symbol|NilClass</tt>)</span>
659
+
660
+
661
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
662
+
663
+
664
+ &mdash;
665
+ <div class='inline'><p>The parameter to return. If set to <code>nil</code>, all the parameters will be returned as an hash.</p>
666
+ </div>
667
+
668
+ </li>
669
+
670
+ <li>
671
+
672
+ <span class='name'>default_value</span>
673
+
674
+
675
+ <span class='type'>(<tt>Object</tt>)</span>
676
+
677
+
678
+ <em class="default">(defaults to: <tt>nil</tt>)</em>
679
+
680
+
681
+ &mdash;
682
+ <div class='inline'><p>The default value if the parameter is not present.</p>
683
+ </div>
684
+
685
+ </li>
686
+
687
+ </ul>
688
+
689
+ <p class="tag_title">Returns:</p>
690
+ <ul class="return">
691
+
692
+ <li>
693
+
694
+
695
+ <span class='type'>(<tt>Object|Hash</tt>)</span>
696
+
697
+
698
+
699
+ &mdash;
700
+ <div class='inline'><p>The parameter or the entire layout parameters hash.</p>
701
+ </div>
702
+
703
+ </li>
704
+
705
+ </ul>
706
+
707
+ </div><table class="source_code">
708
+ <tr>
709
+ <td>
710
+ <pre class="lines">
711
+
712
+
564
713
  38
565
714
  39
566
- 40</pre>
715
+ 40
716
+ 41</pre>
567
717
  </td>
568
718
  <td>
569
719
  <pre class="code"><span class="info file"># File 'lib/ballast/concerns/view.rb', line 38</span>
570
720
 
571
- <span class='kw'>def</span> <span class='id identifier rubyid_javascript_params'>javascript_params</span><span class='lparen'>(</span><span class='id identifier rubyid_id'>id</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_tag'>tag</span> <span class='op'>=</span> <span class='symbol'>:details</span><span class='rparen'>)</span>
572
- <span class='id identifier rubyid_id'>id</span> <span class='op'>?</span> <span class='id identifier rubyid_content_tag'>content_tag</span><span class='lparen'>(</span><span class='id identifier rubyid_tag'>tag</span><span class='comma'>,</span> <span class='ivar'>@javascript_params</span><span class='period'>.</span><span class='id identifier rubyid_to_json'>to_json</span><span class='period'>.</span><span class='id identifier rubyid_html_safe'>html_safe</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>data-jid</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_id'>id</span><span class='rparen'>)</span><span class='op'>:</span> <span class='ivar'>@javascript_params</span>
721
+ <span class='kw'>def</span> <span class='id identifier rubyid_layout_params'>layout_params</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='id identifier rubyid_default_value'>default_value</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='rparen'>)</span>
722
+ <span class='id identifier rubyid_initialize_view_params'>initialize_view_params</span>
723
+ <span class='id identifier rubyid_key'>key</span> <span class='op'>?</span> <span class='ivar'>@layout_params</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span> <span class='id identifier rubyid_default_value'>default_value</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='ivar'>@layout_params</span>
573
724
  <span class='kw'>end</span></pre>
574
725
  </td>
575
726
  </tr>
@@ -631,6 +782,67 @@
631
782
  </td>
632
783
  </tr>
633
784
  </table>
785
+ </div>
786
+
787
+ <div class="method_details ">
788
+ <h3 class="signature " id="set_layout_params-instance_method">
789
+
790
+ - (<tt>Object</tt>) <strong>set_layout_params</strong>(**args)
791
+
792
+
793
+
794
+
795
+
796
+ </h3><div class="docstring">
797
+ <div class="discussion">
798
+ <p>Adds/Replaces layout parameters.</p>
799
+
800
+
801
+ </div>
802
+ </div>
803
+ <div class="tags">
804
+ <p class="tag_title">Parameters:</p>
805
+ <ul class="param">
806
+
807
+ <li>
808
+
809
+ <span class='name'>args</span>
810
+
811
+
812
+ <span class='type'>(<tt>Hash</tt>)</span>
813
+
814
+
815
+
816
+ &mdash;
817
+ <div class='inline'><p>The new parameters to add.</p>
818
+ </div>
819
+
820
+ </li>
821
+
822
+ </ul>
823
+
824
+
825
+ </div><table class="source_code">
826
+ <tr>
827
+ <td>
828
+ <pre class="lines">
829
+
830
+
831
+ 47
832
+ 48
833
+ 49
834
+ 50</pre>
835
+ </td>
836
+ <td>
837
+ <pre class="code"><span class="info file"># File 'lib/ballast/concerns/view.rb', line 47</span>
838
+
839
+ <span class='kw'>def</span> <span class='id identifier rubyid_set_layout_params'>set_layout_params</span><span class='lparen'>(</span><span class='op'>**</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
840
+ <span class='id identifier rubyid_initialize_view_params'>initialize_view_params</span>
841
+ <span class='ivar'>@layout_params</span><span class='period'>.</span><span class='id identifier rubyid_merge!'>merge!</span><span class='lparen'>(</span><span class='id identifier rubyid_args'>args</span><span class='rparen'>)</span>
842
+ <span class='kw'>end</span></pre>
843
+ </td>
844
+ </tr>
845
+ </table>
634
846
  </div>
635
847
 
636
848
  </div>
@@ -638,7 +850,7 @@
638
850
  </div>
639
851
 
640
852
  <div id="footer">
641
- Generated on Sat Jan 25 11:54:04 2014 by
853
+ Generated on Sat Jan 25 13:47:00 2014 by
642
854
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
643
855
  0.8.7.3 (ruby-2.1.0).
644
856
  </div>
@@ -273,7 +273,7 @@ Subfolders are not supported.</p>
273
273
  </div>
274
274
 
275
275
  <div id="footer">
276
- Generated on Sat Jan 25 11:54:05 2014 by
276
+ Generated on Sat Jan 25 13:47:00 2014 by
277
277
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
278
278
  0.8.7.3 (ruby-2.1.0).
279
279
  </div>
@@ -408,7 +408,7 @@
408
408
  </div>
409
409
 
410
410
  <div id="footer">
411
- Generated on Sat Jan 25 11:54:05 2014 by
411
+ Generated on Sat Jan 25 13:47:00 2014 by
412
412
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
413
413
  0.8.7.3 (ruby-2.1.0).
414
414
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sat Jan 25 11:54:04 2014 by
119
+ Generated on Sat Jan 25 13:47:00 2014 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.7.3 (ruby-2.1.0).
122
122
  </div>
@@ -317,7 +317,7 @@
317
317
  </div>
318
318
 
319
319
  <div id="footer">
320
- Generated on Sat Jan 25 11:54:04 2014 by
320
+ Generated on Sat Jan 25 13:47:00 2014 by
321
321
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
322
322
  0.8.7.3 (ruby-2.1.0).
323
323
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Sat Jan 25 11:54:05 2014 by
151
+ Generated on Sat Jan 25 13:47:00 2014 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.8.7.3 (ruby-2.1.0).
154
154
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Sat Jan 25 11:54:05 2014 by
151
+ Generated on Sat Jan 25 13:47:00 2014 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.8.7.3 (ruby-2.1.0).
154
154
  </div>
@@ -148,7 +148,7 @@
148
148
  </div>
149
149
 
150
150
  <div id="footer">
151
- Generated on Sat Jan 25 11:54:05 2014 by
151
+ Generated on Sat Jan 25 13:47:00 2014 by
152
152
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
153
153
  0.8.7.3 (ruby-2.1.0).
154
154
  </div>
@@ -116,7 +116,7 @@
116
116
  </div>
117
117
 
118
118
  <div id="footer">
119
- Generated on Sat Jan 25 11:54:04 2014 by
119
+ Generated on Sat Jan 25 13:47:00 2014 by
120
120
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
121
121
  0.8.7.3 (ruby-2.1.0).
122
122
  </div>
@@ -345,7 +345,7 @@
345
345
  </div>
346
346
 
347
347
  <div id="footer">
348
- Generated on Sat Jan 25 11:54:05 2014 by
348
+ Generated on Sat Jan 25 13:47:01 2014 by
349
349
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
350
350
  0.8.7.3 (ruby-2.1.0).
351
351
  </div>
@@ -1295,7 +1295,7 @@ as owner will be created.</p>
1295
1295
  </div>
1296
1296
 
1297
1297
  <div id="footer">
1298
- Generated on Sat Jan 25 11:54:05 2014 by
1298
+ Generated on Sat Jan 25 13:47:00 2014 by
1299
1299
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
1300
1300
  0.8.7.3 (ruby-2.1.0).
1301
1301
  </div>
@@ -588,7 +588,7 @@ as owner will be created.</p>
588
588
  </div>
589
589
 
590
590
  <div id="footer">
591
- Generated on Sat Jan 25 11:54:05 2014 by
591
+ Generated on Sat Jan 25 13:47:00 2014 by
592
592
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
593
593
  0.8.7.3 (ruby-2.1.0).
594
594
  </div>
@@ -908,7 +908,7 @@
908
908
  </div>
909
909
 
910
910
  <div id="footer">
911
- Generated on Sat Jan 25 11:54:05 2014 by
911
+ Generated on Sat Jan 25 13:47:01 2014 by
912
912
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
913
913
  0.8.7.3 (ruby-2.1.0).
914
914
  </div>
@@ -134,7 +134,7 @@
134
134
 
135
135
  </div>
136
136
  </dt>
137
- <dd><pre class="code"><span class='int'>6</span></pre></dd>
137
+ <dd><pre class="code"><span class='int'>7</span></pre></dd>
138
138
 
139
139
  <dt id="PATCH-constant" class="">PATCH =
140
140
  <div class="docstring">
@@ -180,7 +180,7 @@
180
180
  </div>
181
181
 
182
182
  <div id="footer">
183
- Generated on Sat Jan 25 11:54:04 2014 by
183
+ Generated on Sat Jan 25 13:47:00 2014 by
184
184
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
185
185
  0.8.7.3 (ruby-2.1.0).
186
186
  </div>
data/doc/_index.html CHANGED
@@ -310,7 +310,7 @@
310
310
  </div>
311
311
 
312
312
  <div id="footer">
313
- Generated on Sat Jan 25 11:54:04 2014 by
313
+ Generated on Sat Jan 25 13:46:59 2014 by
314
314
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
315
315
  0.8.7.3 (ruby-2.1.0).
316
316
  </div>
data/doc/file.README.html CHANGED
@@ -106,7 +106,7 @@
106
106
  </div></div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Sat Jan 25 11:54:04 2014 by
109
+ Generated on Sat Jan 25 13:47:00 2014 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
111
  0.8.7.3 (ruby-2.1.0).
112
112
  </div>
data/doc/index.html CHANGED
@@ -106,7 +106,7 @@
106
106
  </div></div>
107
107
 
108
108
  <div id="footer">
109
- Generated on Sat Jan 25 11:54:04 2014 by
109
+ Generated on Sat Jan 25 13:47:00 2014 by
110
110
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
111
111
  0.8.7.3 (ruby-2.1.0).
112
112
  </div>
data/doc/method_list.html CHANGED
@@ -150,32 +150,32 @@
150
150
 
151
151
 
152
152
  <li class="r2 ">
153
- <span class='object_link'><a href="Ballast/OperationsChain.html#initialize-instance_method" title="Ballast::OperationsChain#initialize (method)">#initialize</a></span>
154
- <small>Ballast::OperationsChain</small>
153
+ <span class='object_link'><a href="Ballast/Configuration.html#initialize-instance_method" title="Ballast::Configuration#initialize (method)">#initialize</a></span>
154
+ <small>Ballast::Configuration</small>
155
155
  </li>
156
156
 
157
157
 
158
158
  <li class="r1 ">
159
- <span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html#initialize-instance_method" title="Ballast::Middlewares::DefaultHost#initialize (method)">#initialize</a></span>
160
- <small>Ballast::Middlewares::DefaultHost</small>
159
+ <span class='object_link'><a href="Ballast/Errors/BaseError.html#initialize-instance_method" title="Ballast::Errors::BaseError#initialize (method)">#initialize</a></span>
160
+ <small>Ballast::Errors::BaseError</small>
161
161
  </li>
162
162
 
163
163
 
164
164
  <li class="r2 ">
165
- <span class='object_link'><a href="Ballast/Configuration.html#initialize-instance_method" title="Ballast::Configuration#initialize (method)">#initialize</a></span>
166
- <small>Ballast::Configuration</small>
165
+ <span class='object_link'><a href="Ballast/Middlewares/DefaultHost.html#initialize-instance_method" title="Ballast::Middlewares::DefaultHost#initialize (method)">#initialize</a></span>
166
+ <small>Ballast::Middlewares::DefaultHost</small>
167
167
  </li>
168
168
 
169
169
 
170
170
  <li class="r1 ">
171
- <span class='object_link'><a href="Ballast/Errors/BaseError.html#initialize-instance_method" title="Ballast::Errors::BaseError#initialize (method)">#initialize</a></span>
172
- <small>Ballast::Errors::BaseError</small>
171
+ <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#initialize-instance_method" title="Ballast::RequestDomainMatcher#initialize (method)">#initialize</a></span>
172
+ <small>Ballast::RequestDomainMatcher</small>
173
173
  </li>
174
174
 
175
175
 
176
176
  <li class="r2 ">
177
- <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#initialize-instance_method" title="Ballast::RequestDomainMatcher#initialize (method)">#initialize</a></span>
178
- <small>Ballast::RequestDomainMatcher</small>
177
+ <span class='object_link'><a href="Ballast/OperationsChain.html#initialize-instance_method" title="Ballast::OperationsChain#initialize (method)">#initialize</a></span>
178
+ <small>Ballast::OperationsChain</small>
179
179
  </li>
180
180
 
181
181
 
@@ -204,14 +204,14 @@
204
204
 
205
205
 
206
206
  <li class="r1 ">
207
- <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#matches%3F-instance_method" title="Ballast::RequestDomainMatcher#matches? (method)">#matches?</a></span>
208
- <small>Ballast::RequestDomainMatcher</small>
207
+ <span class='object_link'><a href="Ballast/Concerns/View.html#layout_params-instance_method" title="Ballast::Concerns::View#layout_params (method)">#layout_params</a></span>
208
+ <small>Ballast::Concerns::View</small>
209
209
  </li>
210
210
 
211
211
 
212
212
  <li class="r2 ">
213
- <span class='object_link'><a href="Ballast/Context.html#method_missing-instance_method" title="Ballast::Context#method_missing (method)">#method_missing</a></span>
214
- <small>Ballast::Context</small>
213
+ <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#matches%3F-instance_method" title="Ballast::RequestDomainMatcher#matches? (method)">#matches?</a></span>
214
+ <small>Ballast::RequestDomainMatcher</small>
215
215
  </li>
216
216
 
217
217
 
@@ -222,13 +222,13 @@
222
222
 
223
223
 
224
224
  <li class="r2 ">
225
- <span class='object_link'><a href="Ballast/OperationsChain.html#operations-instance_method" title="Ballast::OperationsChain#operations (method)">#operations</a></span>
226
- <small>Ballast::OperationsChain</small>
225
+ <span class='object_link'><a href="Ballast/Context.html#method_missing-instance_method" title="Ballast::Context#method_missing (method)">#method_missing</a></span>
226
+ <small>Ballast::Context</small>
227
227
  </li>
228
228
 
229
229
 
230
230
  <li class="r1 ">
231
- <span class='object_link'><a href="Ballast/OperationsChain.html#perform-class_method" title="Ballast::OperationsChain.perform (method)">perform</a></span>
231
+ <span class='object_link'><a href="Ballast/OperationsChain.html#operations-instance_method" title="Ballast::OperationsChain#operations (method)">#operations</a></span>
232
232
  <small>Ballast::OperationsChain</small>
233
233
  </li>
234
234
 
@@ -240,83 +240,95 @@
240
240
 
241
241
 
242
242
  <li class="r1 ">
243
+ <span class='object_link'><a href="Ballast/OperationsChain.html#perform-class_method" title="Ballast::OperationsChain.perform (method)">perform</a></span>
244
+ <small>Ballast::OperationsChain</small>
245
+ </li>
246
+
247
+
248
+ <li class="r2 ">
243
249
  <span class='object_link'><a href="Ballast/Concerns/Common.html#perform_operation-instance_method" title="Ballast::Concerns::Common#perform_operation (method)">#perform_operation</a></span>
244
250
  <small>Ballast::Concerns::Common</small>
245
251
  </li>
246
252
 
247
253
 
248
- <li class="r2 ">
254
+ <li class="r1 ">
249
255
  <span class='object_link'><a href="Ballast/Concerns/Common.html#perform_operations_chain-instance_method" title="Ballast::Concerns::Common#perform_operations_chain (method)">#perform_operations_chain</a></span>
250
256
  <small>Ballast::Concerns::Common</small>
251
257
  </li>
252
258
 
253
259
 
254
- <li class="r1 ">
260
+ <li class="r2 ">
255
261
  <span class='object_link'><a href="Ballast/Operation.html#perform_with_handling-instance_method" title="Ballast::Operation#perform_with_handling (method)">#perform_with_handling</a></span>
256
262
  <small>Ballast::Operation</small>
257
263
  </li>
258
264
 
259
265
 
260
- <li class="r2 ">
266
+ <li class="r1 ">
261
267
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#prepare_ajax-instance_method" title="Ballast::Concerns::Ajax#prepare_ajax (method)">#prepare_ajax</a></span>
262
268
  <small>Ballast::Concerns::Ajax</small>
263
269
  </li>
264
270
 
265
271
 
266
- <li class="r1 ">
272
+ <li class="r2 ">
267
273
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#prevent_caching-instance_method" title="Ballast::Concerns::Ajax#prevent_caching (method)">#prevent_caching</a></span>
268
274
  <small>Ballast::Concerns::Ajax</small>
269
275
  </li>
270
276
 
271
277
 
272
- <li class="r2 ">
278
+ <li class="r1 ">
273
279
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_block-instance_method" title="Ballast::RequestDomainMatcher#replace_block (method)">#replace_block</a></span>
274
280
  <small>Ballast::RequestDomainMatcher</small>
275
281
  </li>
276
282
 
277
283
 
278
- <li class="r1 ">
284
+ <li class="r2 ">
279
285
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_pattern-instance_method" title="Ballast::RequestDomainMatcher#replace_pattern (method)">#replace_pattern</a></span>
280
286
  <small>Ballast::RequestDomainMatcher</small>
281
287
  </li>
282
288
 
283
289
 
284
- <li class="r2 ">
290
+ <li class="r1 ">
285
291
  <span class='object_link'><a href="Ballast/RequestDomainMatcher.html#replace_string-instance_method" title="Ballast::RequestDomainMatcher#replace_string (method)">#replace_string</a></span>
286
292
  <small>Ballast::RequestDomainMatcher</small>
287
293
  </li>
288
294
 
289
295
 
290
- <li class="r1 ">
296
+ <li class="r2 ">
291
297
  <span class='object_link'><a href="Ballast/Operation.html#resolve_error-instance_method" title="Ballast::Operation#resolve_error (method)">#resolve_error</a></span>
292
298
  <small>Ballast::Operation</small>
293
299
  </li>
294
300
 
295
301
 
296
- <li class="r2 ">
302
+ <li class="r1 ">
297
303
  <span class='object_link'><a href="Ballast/Errors/BaseError.html#response-instance_method" title="Ballast::Errors::BaseError#response (method)">#response</a></span>
298
304
  <small>Ballast::Errors::BaseError</small>
299
305
  </li>
300
306
 
301
307
 
302
- <li class="r1 ">
308
+ <li class="r2 ">
303
309
  <span class='object_link'><a href="Ballast/Concerns/View.html#scope_css-instance_method" title="Ballast::Concerns::View#scope_css (method)">#scope_css</a></span>
304
310
  <small>Ballast::Concerns::View</small>
305
311
  </li>
306
312
 
307
313
 
308
- <li class="r2 ">
314
+ <li class="r1 ">
309
315
  <span class='object_link'><a href="Ballast/Concerns/Ajax.html#send_ajax-instance_method" title="Ballast::Concerns::Ajax#send_ajax (method)">#send_ajax</a></span>
310
316
  <small>Ballast::Concerns::Ajax</small>
311
317
  </li>
312
318
 
313
319
 
314
- <li class="r1 ">
320
+ <li class="r2 ">
315
321
  <span class='object_link'><a href="Ballast/Concerns/Common.html#sending_data%3F-instance_method" title="Ballast::Concerns::Common#sending_data? (method)">#sending_data?</a></span>
316
322
  <small>Ballast::Concerns::Common</small>
317
323
  </li>
318
324
 
319
325
 
326
+ <li class="r1 ">
327
+ <span class='object_link'><a href="Ballast/Concerns/View.html#set_layout_params-instance_method" title="Ballast::Concerns::View#set_layout_params (method)">#set_layout_params</a></span>
328
+ <small>Ballast::Concerns::View</small>
329
+ </li>
330
+
331
+
320
332
  <li class="r2 ">
321
333
  <span class='object_link'><a href="Ballast/Operation.html#setup_response-instance_method" title="Ballast::Operation#setup_response (method)">#setup_response</a></span>
322
334
  <small>Ballast::Operation</small>
@@ -103,7 +103,7 @@
103
103
  </div>
104
104
 
105
105
  <div id="footer">
106
- Generated on Sat Jan 25 11:54:04 2014 by
106
+ Generated on Sat Jan 25 13:47:00 2014 by
107
107
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
108
108
  0.8.7.3 (ruby-2.1.0).
109
109
  </div>
@@ -30,12 +30,32 @@ module Ballast
30
30
  browser.supported?(conf_file)
31
31
  end
32
32
 
33
+ # Returns one or all layout parameters.
34
+ #
35
+ # @param key [String|Symbol|NilClass] The parameter to return. If set to `nil`, all the parameters will be returned as an hash.
36
+ # @param default_value [Object] The default value if the parameter is not present.
37
+ # @return [Object|Hash] The parameter or the entire layout parameters hash.
38
+ def layout_params(key = nil, default_value = nil)
39
+ initialize_view_params
40
+ key ? @layout_params.fetch(key, default_value) : @layout_params
41
+ end
42
+ alias_method :layout_param, :layout_params
43
+
44
+ # Adds/Replaces layout parameters.
45
+ #
46
+ # @param args [Hash] The new parameters to add.
47
+ def set_layout_params(**args)
48
+ initialize_view_params
49
+ @layout_params.merge!(args)
50
+ end
51
+
33
52
  # Outputs the Javascript parameters.
34
53
  #
35
54
  # @param id [String|NilClass|FalseClass] The id for the tag. If `nil` or `false`, the parameters will be returned as an hash.
36
55
  # @param tag [Symbol] The tag to use for HTML.
37
56
  # @return [String|Hash] Javascript parameters as HTML or the hash.
38
57
  def javascript_params(id = nil, tag = :details)
58
+ initialize_view_params
39
59
  id ? content_tag(tag, @javascript_params.to_json.html_safe, "data-jid" => id): @javascript_params
40
60
  end
41
61
 
@@ -45,7 +65,7 @@ module Ballast
45
65
  # @param data [Hash] The data to add.
46
66
  # @param replace [Boolean] Whether to replace existing data rather than merge.
47
67
  def add_javascript_params(key, data, replace = false)
48
- @javascript_params ||= HashWithIndifferentAccess.new
68
+ initialize_view_params
49
69
 
50
70
  if key
51
71
  @javascript_params[key] = nil if replace
@@ -57,6 +77,13 @@ module Ballast
57
77
  @javascript_params.merge!(data)
58
78
  end
59
79
  end
80
+
81
+ private
82
+ # Prepares parameters for views.
83
+ def initialize_view_params
84
+ @layout_params ||= HashWithIndifferentAccess.new
85
+ @javascript_params ||= HashWithIndifferentAccess.new
86
+ end
60
87
  end
61
88
  end
62
89
  end
@@ -13,7 +13,7 @@ module Ballast
13
13
  MAJOR = 1
14
14
 
15
15
  # The minor version.
16
- MINOR = 6
16
+ MINOR = 7
17
17
 
18
18
  # The patch version.
19
19
  PATCH = 0
@@ -55,6 +55,37 @@ describe Ballast::Concerns::View do
55
55
  end
56
56
  end
57
57
 
58
+ describe "#layout_params" do
59
+ it "should return a single parameter" do
60
+ subject.set_layout_params(a: 1)
61
+ expect(subject.layout_params(:a)).to eq(1)
62
+ end
63
+
64
+ it "should return a default value for a missing parameter" do
65
+ subject.set_layout_params(a: 1)
66
+ expect(subject.layout_params(:b, 2)).to eq(2)
67
+ end
68
+
69
+ it "should never raise an error" do
70
+ expect(subject.layout_params(:a)).to be_nil
71
+ expect(subject.layout_params(:a, 3)).to eq(3)
72
+ end
73
+
74
+ it "should return the entire hash if no arguments are passed" do
75
+ expect(subject.layout_params).to eq({})
76
+ subject.set_layout_params(a: 1)
77
+ expect(subject.layout_params).to eq({"a" => 1})
78
+ end
79
+ end
80
+
81
+ describe "#set_layout_params" do
82
+ it "should merge arguments into the existing parameters" do
83
+ expect(subject.layout_params).to eq({})
84
+ subject.set_layout_params(a: 1, b: 2)
85
+ expect(subject.layout_params).to eq({"a" => 1, "b" => 2})
86
+ end
87
+ end
88
+
58
89
  describe "#javascript_params" do
59
90
  before(:each) do
60
91
  subject.instance_variable_set(:@javascript_params, {a: "1", b: 2})
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ballast
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shogun
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 2.5.3
47
+ version: 2.5.4
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 2.5.3
54
+ version: 2.5.4
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: brauser
57
57
  requirement: !ruby/object:Gem::Requirement