1 | 'use strict'
|
2 |
|
3 | var Base = require('ribcage-view')
|
4 | , _ = require('lodash')
|
5 | , rt = require('../../../lib/rt.js')
|
6 | , cache = require('../../../app/cache/')
|
7 | , Button = require('../../pieces/button')
|
8 | , {{PascalName}}Step = require('./step')
|
9 | , State = require('ampersand-state').extend({
|
10 |
|
11 |
|
12 | extraProperties: 'reject'
|
13 |
|
14 | , toJSON: function toJSON(){
|
15 | return _.extend(this.serialize(), this.getAttributes({derived: true}))
|
16 | }
|
17 | })
|
18 | , {{PascalName}}Pane
|
19 |
|
20 | {{PascalName}}Pane = Base.extend({
|
21 |
|
22 | className: '{{camelName}}Pane'
|
23 |
|
24 | , stackBranchStart: false
|
25 |
|
26 | , navBarTitle: '{{titleName}}'
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 | , navBarRightButton: new Button({label: 'Next'})
|
35 |
|
36 | , State: State.extend({
|
37 | props: {
|
38 |
|
39 | }
|
40 | })
|
41 |
|
42 |
|
43 | , bindEvents: function bindEvents(){
|
44 |
|
45 | if (this.state){
|
46 | this.stopListening(this.state)
|
47 |
|
48 |
|
49 | }
|
50 | }
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 | , create{{PascalName}}Step: function create{{PascalName}}Step(){
|
75 | return new {{PascalName}}Step({})
|
76 | }
|
77 |
|
78 |
|
79 | , beforeInit: function beforeInit(options){
|
80 |
|
81 | var requiredProps = this.State.prototype._definition
|
82 |
|
83 | _.each(requiredProps, function eachRequiredProp(setting, prop){
|
84 | if (setting.required && _.isUndefined(options[prop]))
|
85 | throw new Error(this.className + ' requires ' + prop)
|
86 | }, this)
|
87 |
|
88 | this.state = new this.State(options)
|
89 | }
|
90 |
|
91 | , afterInit: function afterInit(){
|
92 | this.{{camelName}}Step = this.create{{PascalName}}Step()
|
93 | }
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | , loadData: function loadData(done){
|
101 | done()
|
102 | }
|
103 |
|
104 |
|
105 |
|
106 |
|
107 | , afterRender: function afterRender(){
|
108 | this.appendSubview(this.{{camelName}}Step)
|
109 | }
|
110 |
|
111 | })
|
112 |
|
113 | module.exports = {{PascalName}}Pane
|