Left: | ||
Right: |
OLD | NEW |
---|---|
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 | 3 |
4 /** | 4 /** |
5 * Browser Editorial View. | 5 * Browser Editorial View. |
6 * | 6 * |
7 * @module juju.browser | 7 * @module juju.browser |
8 * @submodule views | 8 * @submodule views |
9 * | 9 * |
10 */ | 10 */ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 var charmID = charm.getData('charmid'); | 44 var charmID = charm.getData('charmid'); |
45 | 45 |
46 this.fire('viewNavigate', { | 46 this.fire('viewNavigate', { |
47 change: { | 47 change: { |
48 charmID: charmID | 48 charmID: charmID |
49 } | 49 } |
50 }); | 50 }); |
51 }, | 51 }, |
52 | 52 |
53 /** | 53 /** |
54 * Generates a message to the user based on a bad api call. | |
55 * | |
56 * @method apiFailure | |
57 * @param {Object} data the json decoded response text. | |
58 * @param {Object} request the original io_request object for debugging. | |
59 * | |
60 */ | |
61 apiFailure: function(data, request) { | |
62 Y.juju.browser.views.utils.apiFailure(data, request, this); | |
63 }, | |
64 /** | |
54 * General YUI initializer. | 65 * General YUI initializer. |
55 * | 66 * |
56 * @method initializer | 67 * @method initializer |
57 * @param {Object} cfg configuration object. | 68 * @param {Object} cfg configuration object. |
58 * | 69 * |
59 */ | 70 */ |
60 initializer: function(cfg) { | 71 initializer: function(cfg) { |
61 // Hold onto charm data so we can pass model instances to other views when | 72 // Hold onto charm data so we can pass model instances to other views when |
62 // charms are selected. | 73 // charms are selected. |
63 this._cacheCharms = new models.BrowserCharmList(); | 74 this._cacheCharms = new models.BrowserCharmList(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 this._cacheCharms.reset(newCharms); | 135 this._cacheCharms.reset(newCharms); |
125 this._cacheCharms.add(popularCharms); | 136 this._cacheCharms.add(popularCharms); |
126 this._cacheCharms.add(featuredCharms); | 137 this._cacheCharms.add(featuredCharms); |
127 this.charmContainers = [ | 138 this.charmContainers = [ |
128 featuredCharmContainer, | 139 featuredCharmContainer, |
129 newCharmContainer, | 140 newCharmContainer, |
130 popularCharmContainer | 141 popularCharmContainer |
131 ]; | 142 ]; |
132 }, | 143 }, |
133 | 144 |
134 'failure': function(data, request) { | 145 'failure': this.apiFailure |
135 var message; | |
136 if (data && data.type) { | |
137 message = 'Charm API error of type: ' + data.type; | |
138 } else { | |
139 message = 'Charm API server did not respond'; | |
140 } | |
141 this.get('db').notifications.add( | |
142 new models.Notification({ | |
143 title: 'Failed to load landing page content.', | |
144 message: message, | |
145 level: 'error' | |
146 }) | |
147 ); | |
148 } | |
149 }, this); | 146 }, this); |
150 }, | 147 }, |
151 | 148 |
149 /* | |
rharding
2013/04/22 14:08:15
typo?
j.c.sackett
2013/04/22 20:54:45
Fixed.
| |
152 /** | 150 /** |
153 * Destroy this view and clear from the dom world. | 151 * Destroy this view and clear from the dom world. |
154 * | 152 * |
155 * @method destructor | 153 * @method destructor |
156 * | 154 * |
157 */ | 155 */ |
158 destructor: function() { | 156 destructor: function() { |
159 if (this.charmContainers) { | 157 if (this.charmContainers) { |
160 Y.Array.each(this.charmContainers, function(container) { | 158 Y.Array.each(this.charmContainers, function(container) { |
161 container.destroy(); | 159 container.destroy(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 }); | 201 }); |
204 | 202 |
205 }, '0.1.0', { | 203 }, '0.1.0', { |
206 requires: [ | 204 requires: [ |
207 'browser-charm-container', | 205 'browser-charm-container', |
208 'browser-charm-token', | 206 'browser-charm-token', |
209 'browser-search-widget', | 207 'browser-search-widget', |
210 'juju-charm-store', | 208 'juju-charm-store', |
211 'juju-models', | 209 'juju-models', |
212 'juju-templates', | 210 'juju-templates', |
211 'subapp-browser-view-utils', | |
213 'view' | 212 'view' |
214 ] | 213 ] |
215 }); | 214 }); |
OLD | NEW |