Class: Demos::Forum::PostBlock

Inherits:
Hokusai::Block show all
Defined in:
ui/examples/forum/post.rb

Instance Attribute Summary collapse

Attributes inherited from Hokusai::Block

#node, #provides, #publisher

Instance Method Summary collapse

Methods inherited from Hokusai::Block

#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, #initialize, inject, inject!, #method_missing, mount, #on_resize, provide, provides, #render, style, styles_get, template, template_from_file, template_get, #update, use, uses

Constructor Details

This class inherits a constructor from Hokusai::Block

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Hokusai::Block

Instance Attribute Details

#app_heightObject (readonly)

Returns the value of attribute app_height.



120
121
122
# File 'ui/examples/forum/post.rb', line 120

def app_height
  @app_height
end

#post_heightObject (readonly)

Returns the value of attribute post_height.



120
121
122
# File 'ui/examples/forum/post.rb', line 120

def post_height
  @post_height
end

#post_title_heightObject (readonly)

Returns the value of attribute post_title_height.



120
121
122
# File 'ui/examples/forum/post.rb', line 120

def post_title_height
  @post_title_height
end

Instance Method Details

#after_updatedObject



138
139
140
141
142
# File 'ui/examples/forum/post.rb', line 138

def after_updated
  height = (@post_height || 100) + (@post_title_height || 90) + (@app_height || 0) + 50
  node.meta.set_prop(:height, height)
  emit("height_updated", height, index)
end

#app_height_updated(height) ⇒ Object



126
127
128
# File 'ui/examples/forum/post.rb', line 126

def app_height_updated(height)
  @app_height = height
end

#post_has_appObject



122
123
124
# File 'ui/examples/forum/post.rb', line 122

def post_has_app
  !post.app.nil?
end

#post_height_updated(height) ⇒ Object



134
135
136
# File 'ui/examples/forum/post.rb', line 134

def post_height_updated(height)
  @post_height = height + 50
end

#post_title_height_updated(height) ⇒ Object



130
131
132
# File 'ui/examples/forum/post.rb', line 130

def post_title_height_updated(height)
  @post_title_height = height
end