glia 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbf015ba736749fad81608cd56993e52235f4e3c
4
- data.tar.gz: 74bb89d646e2c577fed3379d1affa0c69185c410
3
+ metadata.gz: a7c365840fb404b696b34559a20de1fb19e0ade6
4
+ data.tar.gz: a8538ba3f88281dd85ccf16e7ea7264b1abd50ae
5
5
  SHA512:
6
- metadata.gz: 10d970881a992c4a71ed02dd1970373e77aed1c46ca9fa8877db0c727f3d68af388092ba250180f7bafe2c878bcb89f7ed0f515a5454c8acdc8412c3f40178c9
7
- data.tar.gz: 3456730ca644a468fd710ef65a526769d10bb3bb184c5c8d53e615da75b8c433c8a76257899489f3f937ed176358b516501a5ba7262016e0a5fb70ed1653a3a7
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 withing the block will create a child 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. Anything parameter will overwrite the
147
- same parameter defined in a previous handle. Any contents of the block will operate on the previously defined cell.
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 a `:backend` area.
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
- RequestStore.store[:action_exposures] = action.exposures
268
- layout = Glia.layout(:frontend, action.handles)
269
- layout.view_factory = ViewFactory.new
270
- layout.cell(:root, action.exposures).render
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
@@ -1,3 +1,3 @@
1
1
  module Glia
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/glia.rb CHANGED
@@ -12,7 +12,7 @@ module Glia
12
12
  UpdateRegistry.area(code, &blk)
13
13
  end
14
14
 
15
- def self.layout(area, handles)
16
- Layout.new(area, handles)
15
+ def self.layout(area, handles, options = {})
16
+ Layout.new(area, handles, options)
17
17
  end
18
18
  end
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.2
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-04 00:00:00.000000000 Z
11
+ date: 2015-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler