141
|
|
|
|
|
|
|
#pod |
142
|
|
|
|
|
|
|
#pod =item * C - Add a wrapper element with these classes |
143
|
|
|
|
|
|
|
#pod |
144
|
|
|
|
|
|
|
#pod =back |
145
|
|
|
|
|
|
|
#pod |
146
|
|
|
|
|
|
|
#pod =back |
147
|
|
|
|
|
|
|
#pod |
148
|
|
|
|
|
|
|
#pod =head2 moai/lib |
149
|
|
|
|
|
|
|
#pod |
150
|
|
|
|
|
|
|
#pod %= include 'moai/lib', version => '4.1.0'; |
151
|
|
|
|
|
|
|
#pod |
152
|
|
|
|
|
|
|
#pod Add the required stylesheet and JavaScript links for the current library |
153
|
|
|
|
|
|
|
#pod using a CDN. The stylesheets and JavaScript can be added separately |
154
|
|
|
|
|
|
|
#pod using C and C respectively. |
155
|
|
|
|
|
|
|
#pod |
156
|
|
|
|
|
|
|
#pod =head3 Stash |
157
|
|
|
|
|
|
|
#pod |
158
|
|
|
|
|
|
|
#pod =over |
159
|
|
|
|
|
|
|
#pod |
160
|
|
|
|
|
|
|
#pod =item version |
161
|
|
|
|
|
|
|
#pod |
162
|
|
|
|
|
|
|
#pod The specific version of the library to use. Required. |
163
|
|
|
|
|
|
|
#pod |
164
|
|
|
|
|
|
|
#pod =back |
165
|
|
|
|
|
|
|
#pod |
166
|
|
|
|
|
|
|
#pod =head1 TODO |
167
|
|
|
|
|
|
|
#pod |
168
|
|
|
|
|
|
|
#pod =over |
169
|
|
|
|
|
|
|
#pod |
170
|
|
|
|
|
|
|
#pod =item Security |
171
|
|
|
|
|
|
|
#pod |
172
|
|
|
|
|
|
|
#pod The CDN links should have full security hashes. |
173
|
|
|
|
|
|
|
#pod |
174
|
|
|
|
|
|
|
#pod =item Accessibility Testing |
175
|
|
|
|
|
|
|
#pod |
176
|
|
|
|
|
|
|
#pod Accessibility testing should be automated and applied to all supported |
177
|
|
|
|
|
|
|
#pod libraries. |
178
|
|
|
|
|
|
|
#pod |
179
|
|
|
|
|
|
|
#pod =item Internationalization |
180
|
|
|
|
|
|
|
#pod |
181
|
|
|
|
|
|
|
#pod This library should use Mojolicious's C feature to provide |
182
|
|
|
|
|
|
|
#pod translations for every widget in every library. |
183
|
|
|
|
|
|
|
#pod |
184
|
|
|
|
|
|
|
#pod =item Add more widgets |
185
|
|
|
|
|
|
|
#pod |
186
|
|
|
|
|
|
|
#pod There should be widgets for... |
187
|
|
|
|
|
|
|
#pod |
188
|
|
|
|
|
|
|
#pod =over |
189
|
|
|
|
|
|
|
#pod |
190
|
|
|
|
|
|
|
#pod =item * menus (vertical lists, horizontal navbars, dropdown buttons) |
191
|
|
|
|
|
|
|
#pod |
192
|
|
|
|
|
|
|
#pod =item * switched panels (tabs, accordion, slider) |
193
|
|
|
|
|
|
|
#pod |
194
|
|
|
|
|
|
|
#pod =item * alerts (error, warning, info) |
195
|
|
|
|
|
|
|
#pod |
196
|
|
|
|
|
|
|
#pod =item * menus (dropdown button, menu bar) |
197
|
|
|
|
|
|
|
#pod |
198
|
|
|
|
|
|
|
#pod =item * popups (modal dialogs, tooltips, notifications) |
199
|
|
|
|
|
|
|
#pod |
200
|
|
|
|
|
|
|
#pod =item * grid (maybe...) |
201
|
|
|
|
|
|
|
#pod |
202
|
|
|
|
|
|
|
#pod =back |
203
|
|
|
|
|
|
|
#pod |
204
|
|
|
|
|
|
|
#pod =item Add more libraries |
205
|
|
|
|
|
|
|
#pod |
206
|
|
|
|
|
|
|
#pod There should be support for... |
207
|
|
|
|
|
|
|
#pod |
208
|
|
|
|
|
|
|
#pod =over |
209
|
|
|
|
|
|
|
#pod |
210
|
|
|
|
|
|
|
#pod =item * Bootstrap 3 |
211
|
|
|
|
|
|
|
#pod |
212
|
|
|
|
|
|
|
#pod =item * Bulma |
213
|
|
|
|
|
|
|
#pod |
214
|
|
|
|
|
|
|
#pod =item * Material |
215
|
|
|
|
|
|
|
#pod |
216
|
|
|
|
|
|
|
#pod =back |
217
|
|
|
|
|
|
|
#pod |
218
|
|
|
|
|
|
|
#pod Moai should support the same features for each library, allowing easy |
219
|
|
|
|
|
|
|
#pod switching between them. |
220
|
|
|
|
|
|
|
#pod |
221
|
|
|
|
|
|
|
#pod =item Add progressive enhancement |
222
|
|
|
|
|
|
|
#pod |
223
|
|
|
|
|
|
|
#pod Some examples of progressive enhancement: |
224
|
|
|
|
|
|
|
#pod |
225
|
|
|
|
|
|
|
#pod =over |
226
|
|
|
|
|
|
|
#pod |
227
|
|
|
|
|
|
|
#pod =item * The table widget could have sortable columns |
228
|
|
|
|
|
|
|
#pod |
229
|
|
|
|
|
|
|
#pod =item * The table widget could use AJAX to to filter and paginate |
230
|
|
|
|
|
|
|
#pod |
231
|
|
|
|
|
|
|
#pod =item * The pager widget could use AJAX to update a linked element |
232
|
|
|
|
|
|
|
#pod |
233
|
|
|
|
|
|
|
#pod =item * The switched panel widgets could load their content lazily |
234
|
|
|
|
|
|
|
#pod |
235
|
|
|
|
|
|
|
#pod =back |
236
|
|
|
|
|
|
|
#pod |
237
|
|
|
|
|
|
|
#pod =item Themes |
238
|
|
|
|
|
|
|
#pod |
239
|
|
|
|
|
|
|
#pod Built-in selection of CDN-based themes for each library |
240
|
|
|
|
|
|
|
#pod |
241
|
|
|
|
|
|
|
#pod =item Layouts |
242
|
|
|
|
|
|
|
#pod |
243
|
|
|
|
|
|
|
#pod A customizable layout with good defaults. |
244
|
|
|
|
|
|
|
#pod |
245
|
|
|
|
|
|
|
#pod =item Extra Classes |
246
|
|
|
|
|
|
|
#pod |
247
|
|
|
|
|
|
|
#pod A standard way of adding extra classes to individual tags inside components. In addition |
248
|
|
|
|
|
|
|
#pod to a string, we should also support a subref so that loops can apply classes to certain |
249
|
|
|
|
|
|
|
#pod elements based on input criteria. |
250
|
|
|
|
|
|
|
#pod |
251
|
|
|
|
|
|
|
#pod =item Documentation Sheet |
252
|
|
|
|
|
|
|
#pod |
253
|
|
|
|
|
|
|
#pod Each supported library should come with a single page that demonstrates the various |
254
|
|
|
|
|
|
|
#pod widgets and provides copy/paste code snippets to achieve that widget. |
255
|
|
|
|
|
|
|
#pod |
256
|
|
|
|
|
|
|
#pod It would be amazing if there was a way to make one template apply to all |
257
|
|
|
|
|
|
|
#pod supported libraries. |
258
|
|
|
|
|
|
|
#pod |
259
|
|
|
|
|
|
|
#pod =item Content section overrides |
260
|
|
|
|
|
|
|
#pod |
261
|
|
|
|
|
|
|
#pod We cannot, should not, must not make every little thing customizable or |
262
|
|
|
|
|
|
|
#pod else our templates will be so complex as to be unmaintainable and |
263
|
|
|
|
|
|
|
#pod unusable. We should instead make content sections that can be extended, |
264
|
|
|
|
|
|
|
#pod like the C template could have a C section,
265
|
|
|
|
|
|
|
#pod a C | section, and a C section. |
266
|
|
|
|
|
|
|
#pod |
267
|
|
|
|
|
|
|
#pod A rule of thumb for adding a feature should be if it can be configured simply by a single |
268
|
|
|
|
|
|
|
#pod string. The more complex the configuration needs to be, the more likely it should be |
269
|
|
|
|
|
|
|
#pod customized using L|Mojolicious::Guides::Rendering/Template inheritance> |
270
|
|
|
|
|
|
|
#pod |
271
|
|
|
|
|
|
|
#pod =back |
272
|
|
|
|
|
|
|
#pod |
273
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
274
|
|
|
|
|
|
|
#pod |
275
|
|
|
|
|
|
|
#pod L |
276
|
|
|
|
|
|
|
#pod |
277
|
|
|
|
|
|
|
#pod =cut |
278
|
|
|
|
|
|
|
|
279
|
3
|
|
|
3
|
|
58685
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
14
|
|
280
|
3
|
|
|
3
|
|
383
|
use Mojo::File qw( path ); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
429
|
|
281
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
sub register { |
283
|
3
|
|
|
3
|
1
|
96
|
my ( $self, $app, $conf ) = @_; |
284
|
3
|
|
|
|
|
6
|
my $library = $conf->[0]; |
285
|
3
|
|
50
|
|
|
18
|
$conf = $conf->[1] || {}; |
286
|
3
|
|
|
|
|
12
|
my $libdir = path( __FILE__ )->sibling( 'Moai' )->child( 'resources', lc $library ); |
287
|
3
|
|
|
|
|
329
|
push @{$app->renderer->paths}, $libdir->child( 'templates' ); |
|
3
|
|
|
|
|
9
|
|
288
|
3
|
|
|
|
|
64
|
return; |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
1; |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
__END__ |