volt 0.4.17 → 0.4.18

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: 1a2b43155cd2eff6d57093ba3b4b15997a5cfdd3
4
- data.tar.gz: dadd732fcb8340fe213d056448ee6d5352a1d272
3
+ metadata.gz: 0bd56992ff8ae73d3af5d43f4d4a73d528c4a249
4
+ data.tar.gz: eb337a2886b9625c09c90e9f5634bbf975f91768
5
5
  SHA512:
6
- metadata.gz: 83b59d9de4351e1ca97a037c5be7c7f9909345e3e219430da05fb87919a75912e38f4d24354ac4b63f45b0532d2e3f73040f20db8a9e182b699a4ce0511469bc
7
- data.tar.gz: 2c8ec7ffb3d62321648c1bae3ec55908683c208b620f57a341d4263bb40f0abb2fecb8c8f0a3f9388b423effa4a859953399e1cda04ac832d01e665b8e121190
6
+ metadata.gz: 07dc0de1053f83ca3325566dbe61b96f51ac2e14280dd6ef9a336de6afcff122c2544667c83ea31a3e24e10b4c8bb6936ba525f8d6cec990a274f0d44650c699
7
+ data.tar.gz: eff6fe08d0f836de3ebb822795a4704a88852c0eedcd2b42a21a96162e9adf3aa18eb1711124a800406e0bf20c2498accf72320c520920c66e2e0936c003424f
data/Readme.md CHANGED
@@ -398,6 +398,8 @@ For convience, when placing a hash inside of another model, it is automatically
398
398
 
399
399
  Models are accessed differently from hashes. Instead of using model[:symbol] to access, you call a method model.method_name. This provides a dynamic unified store where setters and getters can be added without changing any access code.
400
400
 
401
+ You can get a ruby hash back out by calling .to_h on a Model.
402
+
401
403
  ### Array -> ArrayModel
402
404
 
403
405
  Arrays inside of models are automatically converted to an instance of ArrayModel. ArrayModels behave the same as a normal Array except that they can handle things like being bound to backend data and triggering reactive events.
@@ -431,6 +433,8 @@ To convert a Model or an ArrayModel back to a normal hash, call .to_h or .to_a r
431
433
  items
432
434
  ```
433
435
 
436
+ You can get a normal array again by calling .to_a on an ArrayModel.
437
+
434
438
  # Controllers
435
439
 
436
440
  A controller can be any class in Volt, however it is common to have that class inherit from ModelController. A model controller lets you specify a model that the controller works off of. This is a common pattern in Volt. To assign the current model for a controller, simply call the model method passing in one of the following:
@@ -594,7 +598,7 @@ This means that routes in volt have to go both from url to params and params to
594
598
  Routes are specified on a per-component basis in the config/routes.rb file. Routes simply map from url to params.
595
599
 
596
600
  ```ruby
597
- get "/todos", _controller: 'todos'
601
+ get "/todos", _view: 'todos'
598
602
  ```
599
603
 
600
604
  Routes take two arguments, a path, and a params hash. When a new url is loaded and the path is matched on a route, the params will be set to the params provided for that route.
@@ -606,12 +610,12 @@ When the params are changed, the url will be set to the path for the route that'
606
610
  Route path's can also contain variables similar to bindings.
607
611
 
608
612
  ```ruby
609
- get "/todos/{_index}", _controller: 'todos'
613
+ get "/todos/{_index}", _view: 'todos'
610
614
  ```
611
615
 
612
- In the case above, if any url matches /todos/*, (where * is anything but a slash), it will be the active route. params._controller would be set to 'todos', and params._index would be set to the value in the path.
616
+ In the case above, if any url matches /todos/*, (where * is anything but a slash), it will be the active route. params._view would be set to 'todos', and params._index would be set to the value in the path.
613
617
 
614
- If params._controller is 'todos' and params._index is not nil, the route would be matched.
618
+ If params._view is 'todos' and params._index is not nil, the route would be matched.
615
619
 
616
620
  Routes are matched top to bottom in a routes file.
617
621
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.17
1
+ 0.4.18
@@ -1,4 +1,4 @@
1
- get "/about", _page: 'about'
1
+ get "/about", _view: 'about'
2
2
 
3
3
  # The main route
4
4
  get '/'
@@ -1,5 +1,5 @@
1
1
  <:title>
2
- {#template params._page.or('home'), "title"}
2
+ {#template params._view.or('home'), "title"}
3
3
  </:title>
4
4
 
5
5
  <:body>
@@ -14,7 +14,7 @@
14
14
  <h3 class="text-muted">Project name</h3>
15
15
  </div>
16
16
 
17
- {#template params._page.or('home')}
17
+ {#template params._view.or('home')}
18
18
 
19
19
  <div class="footer">
20
20
  <p>&copy; Company 2014</p>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: volt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.17
4
+ version: 0.4.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Stout