marionette

Best Practice to add UI enhancements to multiple Backbone Marionette views

霸气de小男生 提交于 2019-12-09 23:18:01
问题 So I was what the best way for all views in an application to have actions performed on an element. In a non single page application you would run say: $(document).ready(function() { $('.autosize').autosize(); }); to apply autosize function to all elements with the autosize class on every page. Now in a Backbone Marionette app to do this you could perform that in each view with onDomRefresh or similar but for things that affect 90% of views you'd want this to run automatically somehow. I don

Circular Dependencies for a web app using backbone.marionette and requireJs

浪子不回头ぞ 提交于 2019-12-09 10:43:52
问题 I am in the following situation. I am using requireJs to loads module and I don't want to use global variables. The main.js is responsible to load the router. Then the router loads the app and the app loads several subApps. After everything has been initialised, the subApps needs the router for making router.navigate . Here the schema: main.js -> router -> app -> subApp -> router Then I have a problem of Circular Dependencies and for that reason the router in subApp will be undefined. What is

How to synchronise/organise modules using requirejs and Backbone.Marionette

回眸只為那壹抹淺笑 提交于 2019-12-09 07:04:53
问题 I organised the file structure of my web app, which is using RequireJs and Backbone.Marionette,in this way: |- main.js |- app.js |- /subapp1 |- subapp1.js |- subapp1.router.js |- /subapp2 |- subapp2.js |- subapp2.router.js |- /colections |- /views To loads the modules I use requireJs. Here's my code, for each module I put some questions. // main.js define([ 'app', 'subapp1/subapp1.router', 'subapp2/subapp2.router' ], function (app) { "use strict"; app.start(); }); Questions: 1) Is right to

Extra divs in itemviews and layouts in Backbone.Marionette

一个人想着一个人 提交于 2019-12-09 02:58:26
问题 I am trying out Backbone.Marionette and I am confused as to why my Layouts and ItemViews keep generating extra divs. example is in Coffee btw. AppLayout = Backbone.Marionette.Layout.extend template: "#my-layout", regions: menu: "#menu", content: "#content" MyMenuView = Backbone.Marionette.ItemView.extend template: '#project_wiz_nav_template' MyContentView = Backbone.Marionette.ItemView.extend template: '#project_setup_template' MyApp = new Backbone.Marionette.Application() MyApp.addRegions

Backbone.Marionette CollectionView/CompositeView rendering

*爱你&永不变心* 提交于 2019-12-08 09:58:29
问题 This question is an extension of this Related question. Taking Derick's advice, I now have my data in the correct shape. i.e. I have a collection of Department objects, each of which have a collection of Users . Again following Derick's advice I'm trying to render a CollectionView of CompositeView 's My collection view looks like this class UserListView extends Backbone.Marionette.CollectionView itemView: UserCompositeView id: "user-list" appendHtml: (collectionView, itemView, index) =>

Dynamically add/remove regions to a layout

回眸只為那壹抹淺笑 提交于 2019-12-08 09:43:19
问题 Is it possible to dynamically add and remove regions to a layout with Marionette? My app needs to be able to push and pop regions from a layout. This is similar to how GitHub pushes and pops views when you drill down in the source code of a project. They have the slide over animation when presenting the next view and then it slides back when you're backing out. The idea is that I need to keep the previous views around. Another analogy would be how UINavigationControllers work on iOS. Or maybe

how correctly change url hash with bootstrap tabs(pills) using marionetteJS?

可紊 提交于 2019-12-08 05:57:59
问题 I have bootstrap nav-pills on my page. This is part of code: <ul class="nav nav-pills offset3"> <li class="active"> <a href="#alphabetical" class="alphabetical_tab" data-toggle="pill"> Поиск по алфавиту </a> </li> <li> <a href="#name_search" class="name_search_tab" data-toggle="pill"> Поиск по имени </a> </li> <li> <a href="#new_characteristic" data-toggle="pill" class="new_category_characteristic"> Создать характеристику </a> </li> </ul> <div class="tab-content"> <div id="alphabetical" class

how to write marionettejs module using typescript?

久未见 提交于 2019-12-08 02:34:32
问题 I'm trying to write MarionetteJS module using Typescript. Compiled module should be added to plain javascript application using RequireJS and initialized as normal Marionette module i.e.: define( ['marionette', 'modules/sample/sample'], function (Marionette, Sample) { var sampleApp = new Backbone.Marionette.Application(); sampleApp.SampleModule = sampleApp.module("SampleModule", Sample.Sample); } My module is created, but initializer and start functions are not being called by Marionette

Uncaught TypeError: Cannot read property 'app' of undefined

徘徊边缘 提交于 2019-12-07 12:58:33
I have a composite view: var resultView = Marionette.CompositeView.extend({ template : ResultPanel, itemView : ResultItemView, initialize : function() { ... }, itemViewOptions : { app : this.options.app }, I just want to assign this view's app property to itemView's app property. So i can use this view's app from other view. But I'm getting this error: Uncaught TypeError: Cannot read property 'app' of undefined. What am i doing wrong? Is there another way in order to do this? possiblity #1: this.option is not yet set when your code executes. possibility #2: maybe 'this' is not what you expect

Rendering a closed Marionette view

落爺英雄遲暮 提交于 2019-12-07 06:45:02
问题 Shouldn't a closed Marionette view re-delegate the defined events (events, modelEvents, CollectionEvents) when rendering again? It seems as if I have to manually call delegateEvents after closing and re-rendering a view. Otherwise the view won't work as expected. http://jsfiddle.net/4DCeY/ var app = new Marionette.Application(); app.addRegions({ main: '.main' }); var MyView = Marionette.ItemView.extend({ template: _.template('Hi, I\'m a view! Foo is: <%= foo %>'), modelEvents: { 'change':