Plato on Github
Report Home
ampersand/template/shared/client/pages/person-view.js
Maintainability
81.97
Lines of code
40
Difficulty
7.27
Estimated Errors
0.30
Function weight
By Complexity
By SLOC
/*global alert*/ var app = require('ampersand-app'); var PageView = require('./base'); var templates = require('../templates'); var PersonForm = require('../forms/person'); module.exports = PageView.extend({ pageTitle: 'view person', template: templates.pages.personView, bindings: { 'model.fullName': { hook: 'name' }, 'model.avatar': { type: 'attribute', hook: 'avatar', name: 'src' }, 'model.editUrl': { type: 'attribute', hook: 'edit', name: 'href' } }, events: { 'click [data-hook~=delete]': 'handleDeleteClick' }, initialize: function (spec) { var self = this; app.people.getOrFetch(spec.id, {all: true}, function (err, model) { if (err) alert('couldnt find a model with id: ' + spec.id); self.model = model; }); }, handleDeleteClick: function () { this.model.destroy({success: function () { app.navigate('collections'); }}); } });