volt 0.5.1 → 0.5.2
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.
- checksums.yaml +4 -4
- data/Readme.md +1 -0
- data/VERSION +1 -1
- data/app/volt/assets/css/notices.css.scss +2 -2
- data/app/volt/views/notices/index.html +6 -1
- data/lib/volt/controllers/model_controller.rb +4 -0
- data/lib/volt/models/model.rb +14 -0
- data/lib/volt/page/page.rb +5 -1
- data/lib/volt/reactive/reactive_value.rb +1 -1
- data/templates/project/app/home/views/index/index.html +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c74190b05a5b42b727d604da7f629b80a6ebf3e4
|
4
|
+
data.tar.gz: ffa0259324ef491269df57363e032efe6af6faf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86c8aeffbf38fc0493171e41af44740e99e42bc169d2402c555cb7c9f3ca24fd5d26a3b777d6c6553be2bc3b72838967ee6b7147b83455dbc612813fa58862d0
|
7
|
+
data.tar.gz: 6cffee5934e2017a8adaeddb03602d9af33e4356a72bb1957ed9bd6cdabfbb97c53f1e2f70cab6a72ca04d19f978a4e68e8e6c807f9ee1655414fdf6b0f1d3fa
|
data/Readme.md
CHANGED
@@ -346,6 +346,7 @@ Above I mentioned that Volt comes with many default collection models accessable
|
|
346
346
|
| store | store syncs the data to the backend database and provides query methods. |
|
347
347
|
| session | values will be stored in a session cookie. |
|
348
348
|
| params | values will be stored in the params and url. Routes can be setup to change how params are shown in the url. (See routes for more info) |
|
349
|
+
| flash | any strings assigned will be shown at the top of the page and cleared as the user navigates between pages. |
|
349
350
|
| controller| a model for the current controller |
|
350
351
|
|
351
352
|
**more storage locations are planned**
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.2
|
@@ -2,10 +2,15 @@
|
|
2
2
|
{#if page._reloading}
|
3
3
|
<div class="notices alert alert-info">Reloading...</div>
|
4
4
|
{/}
|
5
|
-
{#if channel.
|
5
|
+
{#if !channel.connected?}
|
6
6
|
<div class="notices alert alert-info">
|
7
7
|
Connection Lost... {channel.error}...
|
8
8
|
{#if channel.reconnect_interval} Reconnecting in {(channel.reconnect_interval / 1000.0).round} sec{/}
|
9
9
|
</div>
|
10
10
|
{/}
|
11
|
+
{#if !flash.empty?}
|
12
|
+
<div class="notices alert alert-info">
|
13
|
+
<p>{flash._notice}</p>
|
14
|
+
</div>
|
15
|
+
{/}
|
11
16
|
</:body>
|
data/lib/volt/models/model.rb
CHANGED
@@ -84,6 +84,20 @@ class Model
|
|
84
84
|
@persistor.removed(args[0]) if @persistor
|
85
85
|
end
|
86
86
|
|
87
|
+
tag_method(:clear) do
|
88
|
+
destructive!
|
89
|
+
end
|
90
|
+
def clear
|
91
|
+
attributes.each_pair do |key,value|
|
92
|
+
__clear_element(key)
|
93
|
+
end
|
94
|
+
|
95
|
+
attributes.clear
|
96
|
+
trigger!('changed')
|
97
|
+
|
98
|
+
@persistor.removed(nil) if @persistor
|
99
|
+
end
|
100
|
+
|
87
101
|
tag_all_methods do
|
88
102
|
pass_reactive! do |method_name|
|
89
103
|
method_name[0] == '_' && method_name[-1] == '='
|
data/lib/volt/page/page.rb
CHANGED
@@ -32,7 +32,7 @@ require 'volt/page/draw_cycle'
|
|
32
32
|
require 'volt/page/tasks'
|
33
33
|
|
34
34
|
class Page
|
35
|
-
attr_reader :url, :params, :page, :store, :templates, :routes, :draw_cycle
|
35
|
+
attr_reader :url, :params, :page, :store, :flash, :templates, :routes, :draw_cycle
|
36
36
|
|
37
37
|
def initialize
|
38
38
|
|
@@ -42,6 +42,7 @@ class Page
|
|
42
42
|
|
43
43
|
# Run the code to setup the page
|
44
44
|
@page = ReactiveValue.new(Model.new)
|
45
|
+
@flash = ReactiveValue.new(Model.new)
|
45
46
|
@store = ReactiveValue.new(Model.new({}, persistor: Persistors::StoreFactory.new(tasks)))
|
46
47
|
|
47
48
|
@url = ReactiveValue.new(URL.new)
|
@@ -83,6 +84,9 @@ class Page
|
|
83
84
|
host = `document.location.host`
|
84
85
|
@url.parse("http://#{host}" + url)
|
85
86
|
end
|
87
|
+
|
88
|
+
# Clear the flash
|
89
|
+
flash.clear
|
86
90
|
end
|
87
91
|
|
88
92
|
# We provide a binding_name, so we can bind events on the document
|
@@ -62,7 +62,7 @@ class ReactiveValue < BasicObject
|
|
62
62
|
if last_char == '=' && method_name[-2] != '='
|
63
63
|
# Method is an assignment (and not a comparator ==)
|
64
64
|
return true
|
65
|
-
elsif last_char == '!' || last_char == '<'
|
65
|
+
elsif method_name.size > 1 && last_char == '!' || last_char == '<'
|
66
66
|
# Method is tagged as destructive, or is a push ( << )
|
67
67
|
return true
|
68
68
|
elsif ::DestructiveMethods.might_be_destructive?(method_name)
|
@@ -3,8 +3,6 @@
|
|
3
3
|
</:title>
|
4
4
|
|
5
5
|
<:body>
|
6
|
-
<:volt:notices />
|
7
|
-
|
8
6
|
<div class="container">
|
9
7
|
<div class="header">
|
10
8
|
<ul class="nav nav-pills pull-right">
|
@@ -14,6 +12,8 @@
|
|
14
12
|
<h3 class="text-muted">Project name</h3>
|
15
13
|
</div>
|
16
14
|
|
15
|
+
<:volt:notices />
|
16
|
+
|
17
17
|
{#template params._view.or('home')}
|
18
18
|
|
19
19
|
<div class="footer">
|