javascript - Backbone Marionette : Reusable UI Elements -
i'm building first backbone marionette application, i'm confused how add reusable ui view templates, ui elements have javascript interaction.
i have built number of ui elements input element shown below. input element can interacted via javascript, example clicking up/down arrows change input's value.
these ui elements should reused again , again in multiple views, , there can many instances of these ui elements contained within given view. mockup 1 such view, containing several ui elements, shown below.
a model view might this, , have javascript interaction of ui elements interacting view's model. in other words, javascript interaction on ui element have able pass event model of view inside ui element shown.
var fontstyles = backbone.model.extend({ defaults: { fontfamily: "helvetica neue", fontweight: "regular", color: "rbg(1,197,255)" ... } });
my question
for structured backbone marionette application, define these reusable ui elements , javascript interaction methods, in such way can reuse them throughout of views/modules?
as concern, possible write html these ui elements once, in template file, , reuse single ui template file again , again in underscore templates of views? or have repeat html ui elements in template of every view?
thank help, , if question unclear please let me know.
you should create elements marionette.itemview's extensions
each item view should created , placed region inside layout want use them
, of course, since itemview contains template:some_template, or marionette.layout extensions if contain regions
so, pictures small picture itemview big picture layout, contains number of regions, each region contain widget, itemview.
layout receives model:some_model on initialization (layout extension of itemview)
Comments
Post a Comment