Skip to content

Instantly share code, notes, and snippets.

@blikblum
Last active September 22, 2017 12:31
Show Gist options
  • Save blikblum/f66d5ae093645600d26684e988716fee to your computer and use it in GitHub Desktop.
Save blikblum/f66d5ae093645600d26684e988716fee to your computer and use it in GitHub Desktop.
Marionette F7 Demo - Home page
<div class="page-content">
<div class="content-block-title">Welcome</div>
<div class="content-block">
<p>Enjoy using Backbone/Marionette with the awesome Framework7!</p>
</div>
<div class="content-block-title">Examples</div>
<div class="list-block">
<ul>
<li class="item-content">
<div class="item-inner">
<div class="item-title">Item with no link</div>
</div>
</li>
<li>
<a href="#" class="item-link item-content single-link">
<div class="item-inner">
<div class="item-title">Open page in this view</div>
</div>
</a>
</li>
<li>
<a href="#" class="item-link item-content popup-link">
<div class="item-inner">
<div class="item-title">Open single popup</div>
</div>
</a>
</li>
<li>
<a href="#" class="item-link item-content login-link">
<div class="item-inner">
<div class="item-title">Open login/register popup</div>
</div>
</a>
</li>
</ul>
</div>
</div>
import {View} from 'backbone.marionette'
import {pushPage, showPopup} from 'marionette.f7'
import template from './home-template.html'
import SingleView from '../single/view'
import PopupView from '../popup/view'
import LoginView from '../login/view'
export default View.extend({
template: Template7.compile(template),
events: {
'click .popup-link': 'onPopupLinkClick',
'click .login-link': 'onLoginLinkClick',
'click .single-link': 'onSingleLinkClick'
},
onLoginLinkClick (e) {
e.preventDefault()
pushPage(new LoginView(), 'login')
},
onSingleLinkClick (e) {
e.preventDefault()
pushPage(new SingleView())
},
onPopupLinkClick (e) {
e.preventDefault()
showPopup(new PopupView())
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment