glia 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -8
- data/lib/glia/cell.rb +7 -3
- data/lib/glia/layout.rb +4 -2
- data/lib/glia/version.rb +1 -1
- data/lib/glia.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7c365840fb404b696b34559a20de1fb19e0ade6
|
4
|
+
data.tar.gz: a8538ba3f88281dd85ccf16e7ea7264b1abd50ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef536f5b333cd5a3db8098ffa736d993a8a3e824dc14202c9f87f93167ca284e9d6e839c81fb64fd5c8e72cf0a11896b936ccef47f57d71fe39daed52b0ff3b0
|
7
|
+
data.tar.gz: 96f03d9af2a0ee4f97f7e6f9cc998fb36806a4ce785348eaa8fc5ef55c30e30e9b4cbe3acb35cdcbfd37a1a7ad6f582b67971c5d4998585fc0286bbb4872b08d
|
data/README.md
CHANGED
@@ -139,12 +139,13 @@ root cell, being contained in its output.
|
|
139
139
|
method. For example, the `'cake_details'` template file might have a call to `cell(:specifications).render` in a
|
140
140
|
specific place to render that specific child cell.
|
141
141
|
* Any other parameters passed to `cell` will be passed through to the cell's constructor.
|
142
|
-
* Anything in the block will operate on this cell. E.g. calling cell
|
142
|
+
* Anything in the block will operate on this cell. E.g. calling cell within the block will create a child cell.
|
143
143
|
|
144
144
|
#### Reference
|
145
145
|
|
146
|
-
The `reference` method refers to a cell that has been added in a previous handle.
|
147
|
-
same parameter defined in a previous handle.
|
146
|
+
The `reference` method refers to a cell that has been added in a previous (or subsequent) handle.
|
147
|
+
Any parameter will overwrite the same parameter defined in a previous handle.
|
148
|
+
Any contents of the block will operate on the previously defined cell.
|
148
149
|
|
149
150
|
The technical difference from the cell method is that instead of requiring the `class` parameter, it disallows it,
|
150
151
|
and a reference without a matching cell would be ignored rather than creating a cell in the layout.
|
@@ -159,7 +160,7 @@ This method will run the specified method (with the given arguments) on the cell
|
|
159
160
|
### Areas
|
160
161
|
|
161
162
|
An 'area' is a distinct layout that is completely separate from another area.
|
162
|
-
For example many apps would have a `:frontend` area, and
|
163
|
+
For example many apps would have a `:frontend` area, and an `:admin` area.
|
163
164
|
|
164
165
|
If you app code is organised into modules, you may wish to keep a layout file in each module.
|
165
166
|
This way, the layout files can each place cells related to their own modules on any page of the app.
|
@@ -263,11 +264,16 @@ class Client::RenderingPolicy < Lotus::RenderingPolicy
|
|
263
264
|
end
|
264
265
|
|
265
266
|
def _render_action(action, response)
|
267
|
+
@area ||= @namespace.name.downcase.to_sym
|
266
268
|
if successful?(response)
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
269
|
+
if response[BODY].empty?
|
270
|
+
RequestStore.store[:action_exposures] = action.exposures
|
271
|
+
layout = Glia.layout(@area, action.handles)
|
272
|
+
layout.view_factory = ViewFactory.new
|
273
|
+
layout.cell(:root, action.exposures).render
|
274
|
+
else
|
275
|
+
Lotus::Views::NullView.new(response[BODY]).render(action.exposures)
|
276
|
+
end
|
271
277
|
end
|
272
278
|
end
|
273
279
|
|
data/lib/glia/cell.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
module Glia
|
2
2
|
module Cell
|
3
|
-
attr_accessor :child_definitions, :layout
|
3
|
+
attr_accessor :child_definitions, :layout, :blocks
|
4
4
|
|
5
5
|
# To be overloaded, but here to prevent errors if we don't define initialize
|
6
|
-
def initialize(config)
|
7
|
-
end
|
6
|
+
# def initialize(config)
|
7
|
+
# end
|
8
8
|
|
9
9
|
def children
|
10
10
|
@children ||= {}
|
@@ -22,5 +22,9 @@ module Glia
|
|
22
22
|
def child_definitions
|
23
23
|
@child_definitions ||= {}
|
24
24
|
end
|
25
|
+
|
26
|
+
def blocks
|
27
|
+
@blocks ||= []
|
28
|
+
end
|
25
29
|
end
|
26
30
|
end
|
data/lib/glia/layout.rb
CHANGED
@@ -7,17 +7,19 @@ module Glia
|
|
7
7
|
attr_accessor :layout_dir, :view_namespace
|
8
8
|
end
|
9
9
|
|
10
|
-
def initialize(area, handles)
|
10
|
+
def initialize(area, handles, options = {})
|
11
|
+
@area = area
|
11
12
|
@update = UpdateRegistry.area(area)
|
12
13
|
@cells = {}
|
13
14
|
@handles = handles
|
14
15
|
@data = @update.merge(@handles)
|
16
|
+
@view_factory = options[:view_factory] unless options[:view_factory].nil?
|
15
17
|
end
|
16
18
|
|
17
19
|
def cell(name, *args)
|
18
20
|
if @cells[name].nil?
|
19
21
|
definition = @data[name]
|
20
|
-
raise Errors::MissingCellError, "Cell #{name} is missing from layout" if definition.nil?
|
22
|
+
raise Errors::MissingCellError, "Cell #{name} is missing from layout #{@area}" if definition.nil?
|
21
23
|
code = definition.delete(:class)
|
22
24
|
actions = definition.delete(:actions)
|
23
25
|
children = definition.delete(:children)
|
data/lib/glia/version.rb
CHANGED
data/lib/glia.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glia
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dane Lowe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|