Skip to content

Instantly share code, notes, and snippets.

@bodokaiser
Last active December 19, 2015 05:49
Show Gist options
  • Save bodokaiser/5907059 to your computer and use it in GitHub Desktop.
Save bodokaiser/5907059 to your computer and use it in GitHub Desktop.
(function() {
var router = new Router().map(function() {
this.route('index', '/', indexRoute);
this.route('outputs', '/outputs', outputsRoute);
this.route('outputs:list', '/outputs/list', outputsListRoute);
this.route('outputs:create', '/outputs/create', outputsCreateRoute);
});
var outputs = new Repository('outputs');
function indexRoute() {
var body = document.body;
var rootTpl = document.querySelector('script#root');
while (body.hasChildNodes())
body.removeChildNode();
body.innerHTML = swig.compile(rootTpl.innerHTML);
}
function outputsRoute() {
// extend root layout
}
function outputsListRoute() {
outputs.find(function(err, outputs) {
var ctrl = new OutputsListController({ model: outputs });
});
}
function outputsCreateRoute() {
}
function OutputsListController() {
}
OutputsListController.prototype.checkInput = function() {};
router.start();
}).call(this);
var users = new Repository('users', {
resource: '/users'
});
users.find(function(err, models) {
});
users.findOne('4874203', function(err, user) {
});
users.findQuery({ search: 'babo' }, function(err, user) {
});
users.persist({ username: 'bodo', password: '1234' }, function(err, user) {
});
users.remove('4784232', function(err) {
});
var router = new Router();
router.map(function() {
this.route('help', '/help*', helpRoute);
this.route('user', '/user', userRoute);
});
function helpRoute() {
// setup some bindings
}
function userRoute() {
// setup some other stuff
}
router.route('index', '/*', function(fragment) {
});
router.route('outputs', '/outputs', function() {
});
router.navigate('outputs');
router.navigateBack();
router.navigateForward();
var linkView = View.create({ tagName: 'a', attributes: { href: '#/blabl' } });
linkView.updateHrefPostfix = function(postfix) {
this.element.href = this.attributes.href;
this.element.href += postfix;
};
var FormView = View.extend({
idName: 'my-form'
tagName: 'form',
classNames: ['form', 'form-horizontal'],
attribures: { data-id: 22 },
template: swig.compile('form'),
events: {
'submit': function() {
},
'focus input': function() {
}
}
});
var formView = new FormView({ model: { name: 'hallie'} , context: aController });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment