Class: Demos::Forum::App
Instance Attribute Summary
#node, #provides, #publisher
Instance Method Summary
collapse
#children, #children?, compile, computed, computed!, #draw, #draw_with, #dump, #emit, #initialize, inject, inject!, #method_missing, mount, 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 Method Details
#files ⇒ Object
138
139
140
141
142
143
144
145
|
# File 'ui/examples/forum.rb', line 138
def files
@files ||= (1..10).to_a.map do |i|
file = OpenStruct.new
file.type = [:video, :audio, :app, nil, :image].sample
file.name = ["hello.mp3", "thing.png", "what.mp4", "yeah"].sample
file
end
end
|
#forum_height ⇒ Object
116
117
118
|
# File 'ui/examples/forum.rb', line 116
def forum_height
@indicies&.values&.sum || 0.0
end
|
#margin_width ⇒ Object
130
131
132
|
# File 'ui/examples/forum.rb', line 130
def margin_width
@margin_width || 0.0
end
|
#on_resize(canvas) ⇒ Object
120
121
122
123
124
125
126
127
128
|
# File 'ui/examples/forum.rb', line 120
def on_resize(canvas)
if canvas.width <= 800
@panel_width = canvas.width - 50
@margin_width = 25.0
else
@panel_width = 900
@margin_width = (canvas.width - 800) / 2
end
end
|
#panel_width ⇒ Object
134
135
136
|
# File 'ui/examples/forum.rb', line 134
def panel_width
@panel_width || 800
end
|
#posts ⇒ Object
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
# File 'ui/examples/forum.rb', line 147
def posts
@posts ||= (1..10).to_a.map do |i|
post = OpenStruct.new
post.author_image = ["#{__dir__}/assets/baby_sean.png", "#{__dir__}/assets/addy.png"].sample
post.author_name = "Baby Sean"
post.title = ["Hello World", "My neon jeans", "How to eat a sandwich without killing yourself"].sample
post.date = "January 4th @ 10.00 am"
post.body = <<~EOF
Lorem markdownum vigor concutiens iter frondes, [non spes
parente](http://www.et.com/mirantiesse) isque, in defunctum concrescere ultima!
Corpus nepotis tristique isti forsitan respicit o invenit, cur ope in sit
[eat](http://stringebat.io/). At equus *ullam sua efflant* ludat, silvas
Achilles, nata aere, modo [Amazone pectore](http://minustantum.com/).
Mea tolerare [iussi plumbo](http://perpetiarcorpora.net/pertimuit): ad otia,
requiris procis, ne illa rore glaebam, velis. Vero creatum Perseus dextrum at
sterilem telum amensque aliis sermone et pyram meruisse Titania furiosior
laterum fuit, fata. Qua exstitit aberat sunt dea nequeam concentu raptae Phrygia
relictis ferebat hoc fuit videtur reddita spectare ignotissima *amorem fugit
crines*. Oscula Tectaphon.
EOF
post
end
end
|
#update_forum_height(height, index) ⇒ Object
111
112
113
114
|
# File 'ui/examples/forum.rb', line 111
def update_forum_height(height, index)
@indicies ||= {}
@indicies[index] = height
end
|