marionette

Binding a Backbone Model to a Marionette ItemView - blocking .fetch()?

柔情痞子 提交于 2019-11-28 19:23:14
问题 This is a 2 part question. 1) Is there a better way to render a model to a view asynchronously? I'm currently making the ajax request using the fetch method in the model (though I'm calling it explicitly upon initilization), then rendering the templated view using an application event, vent , which gets published from inside the model after the parse method is called. Cool but wonky? 2) Would a blocking fetch method be of use, and is it possible? The application renders this to the page:

Backbone Marionette - Add a visual effect when switching view

烂漫一生 提交于 2019-11-28 17:14:41
问题 Is there a convenient way to add an effect when I leave a page (close a view/layout) and open a new one in the same region ? (something like a fade effect) 回答1: Marionette regions have a method called open that by default just replace the HTML of the old view with the new view. You can override this method to do any animation you like. From the region documentation: Set How View's el Is Attached If you need to change how the view is attached to the DOM when showing a view via a region,

Expected a spy, but got Function

不问归期 提交于 2019-11-28 13:15:58
I am trying to implement a test (1) for this module (2). My purpose is to check if the collection is fetched when a particular event is triggered. As you can see from my comment in (2) I get the message Error: Expected a spy, but got Function. The module works but the test fails. any ideas? (1) // jasmine test module describe('When onGivePoints is fired', function () { beforeEach(function () { spyOn(this.view.collection, 'restartPolling').andCallThrough(); app.vent.trigger('onGivePoints'); }); it('the board collection should be fetched', function () { expect(this.view.collection.restartPolling

How can Geckodriver/Firefox work without Marionette? (running python selenium 3 against FF 53)

倾然丶 夕夏残阳落幕 提交于 2019-11-28 09:15:05
问题 I'm seeing a bizarre "untrusted cert" error only on selenium-controlled firefox pop-ups. Very specific. To solve this problem, various google results suggested turning off marionette, like so: from selenium.webdriver.common.desired_capabilities import DesiredCapabilities firefox_capabilities = DesiredCapabilities.FIREFOX firefox_capabilities['marionette'] = False driver = webdriver.Firefox() And this works, but how?? How is geckodriver working at all with Marionette off? From this other Stack

Integrating iCanHaz and Marionette

和自甴很熟 提交于 2019-11-28 06:43:58
问题 I'm a big fan of ICanHaz, and I'm trying to directly intregrate it into a new Marionette application I'm building. However, going off this post, I have written this that reaches into the render method and changes it in Marionette: // Set up Initalizer APP.addInitializer(function() { //Reach into Marionette and switch out templating system to ICH Backbone.Marionette.Renderer.render = function(template, data){ return ich[template](data); } //Create Router new APP.Routers.GlobalRouter(); //Start

Bubbling events in nested Backbone (Marionette) Models / Collections

爱⌒轻易说出口 提交于 2019-11-28 02:19:59
We have a large Marionette App, that uses Backbone.trackit to monitor unsaved changes in our Models. We now have some nested models, in fact we have a Model, with a Collection of Models, that contain a Collection of Models. trackit doesn't support the top level model being marked as 'dirty' when the child models change - due to backbone not bubbling these change events. I know we could manually monitor these change events, but Im looking for a generic solution. Has anyone had any experience of the following libs or any other solutions for this? backbone-deep-model Backbone Associations events

Call a function in another Marionette.ItemView

蹲街弑〆低调 提交于 2019-11-28 02:16:50
问题 I have one ItemView, where I use clearSearch() function. I need to call the same function in another ItemView, so to keep it DRY I tried to call clearSearch(), but i didn't work. View.Panel = Marionette.ItemView.extend({ template: panelTpl, events: { 'click .search_clear': 'clearSearch', } clearSearch: function() { //some important actions } }); View.Pagination = Marionette.ItemView.extend({ template: paginationTpl, events: { 'click .page': 'changePage' }, changePage: function(e) { //others

Extra wrappers in Backbone and Marionette

拥有回忆 提交于 2019-11-27 20:34:25
Using Backbone and Marionette, I've created a new layout that goes into the main content div on my page. The layout looks like this: <div id='dash-sidebar'> <div id='dash-profile'></div> <div id='dash-nav'></div> </div> <div id='dash-content'></div> The issue is that when I render the layout, Backbone automatically wraps it in a div before putting it into the main content div like this: <div id='main-content'> <div> <div id='dash-sidebar'> <div id='dash-profile'></div> <div id='dash-nav'></div> </div> <div id='dash-content'></div> </div> </div> I know that I can change the element with tagName

Nesting Marionette regions, layouts and views

梦想的初衷 提交于 2019-11-27 18:17:52
问题 I'm trying to get my Marionette views working in combination with application regions and layouts, but I just can't seem to get the nested views in the layout to render. Edit: I expected both the OptionsView and BreadcrumbsView to be rendered in the NavigationLayout , which should be rendered in the navigation region. However, the navigation region isn't rendered at all. The console doesn't show any errors. My structure is as follows: - Navigation region - Navigation layout - Options region -

Nested collections with Backbone.Marionette

旧城冷巷雨未停 提交于 2019-11-27 12:33:11
问题 I want to create a calendar which is a day collection, and every day is a collection of appointments. The structure of day object is: day:{ date:'08-06-2012', appointment: { time_begin:'12:55', time_end: '16:40', customer: 'Jaime' } } At this moment i have this models and views: // CALENDAR COLLECTION App.Calendar.Collection = Backbone.Collection.extend({ // MODEL model: App.Day.Model } When calendar collection fetch data form the server, it gets complete day objects including appointments. /