Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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 */ |
11 YUI.add('subapp-browser-editorial', function(Y) { | 11 YUI.add('subapp-browser-editorial', function(Y) { |
12 var ns = Y.namespace('juju.browser.views'), | 12 var ns = Y.namespace('juju.browser.views'), |
13 models = Y.namespace('juju.models'), | 13 models = Y.namespace('juju.models'), |
14 views = Y.namespace('juju.views'), | 14 views = Y.namespace('juju.views'), |
15 widgets = Y.namespace('juju.widgets'); | 15 widgets = Y.namespace('juju.widgets'); |
16 | 16 |
17 | 17 |
18 /** | 18 /** |
19 * Editorial view for landing pages. | 19 * Editorial view for landing pages. |
20 * | 20 * |
21 * @class Editorial | 21 * @class Editorial |
22 * @extends {juju.browser.views.Editorial} | 22 * @extends {juju.browser.views.Editorial} |
23 * | 23 * |
24 */ | 24 */ |
25 ns.EditorialView = Y.Base.create('browser-view-sidebar', Y.View, [], { | 25 ns.EditorialView = Y.Base.create('browser-view-sidebar', Y.View, [ |
26 views.utils.apiFailingView | |
27 ], { | |
26 template: views.Templates.editorial, | 28 template: views.Templates.editorial, |
27 | 29 |
28 events: { | 30 events: { |
29 '.charm-token': { | 31 '.charm-token': { |
30 click: '_handleCharmSelection' | 32 click: '_handleCharmSelection' |
31 } | 33 } |
32 }, | 34 }, |
33 | 35 |
34 /** | 36 /** |
35 When selecting a charm from the list make sure we re-route the app to | 37 When selecting a charm from the list make sure we re-route the app to |
(...skipping 16 matching lines...) Expand all Loading... | |
52 | 54 |
53 /** | 55 /** |
54 * Generates a message to the user based on a bad api call. | 56 * Generates a message to the user based on a bad api call. |
55 * | 57 * |
56 * @method apiFailure | 58 * @method apiFailure |
57 * @param {Object} data the json decoded response text. | 59 * @param {Object} data the json decoded response text. |
58 * @param {Object} request the original io_request object for debugging. | 60 * @param {Object} request the original io_request object for debugging. |
59 * | 61 * |
60 */ | 62 */ |
61 apiFailure: function(data, request) { | 63 apiFailure: function(data, request) { |
62 Y.juju.browser.views.utils.apiFailure(data, request, this); | 64 this._apiFailure(data, request, 'Failed to load sidebar content.'); |
63 }, | 65 }, |
66 | |
64 /** | 67 /** |
65 * General YUI initializer. | 68 * General YUI initializer. |
66 * | 69 * |
67 * @method initializer | 70 * @method initializer |
68 * @param {Object} cfg configuration object. | 71 * @param {Object} cfg configuration object. |
69 * | 72 * |
70 */ | 73 */ |
71 initializer: function(cfg) { | 74 initializer: function(cfg) { |
72 // Hold onto charm data so we can pass model instances to other views when | 75 // Hold onto charm data so we can pass model instances to other views when |
73 // charms are selected. | 76 // charms are selected. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 featuredCharmContainer, | 142 featuredCharmContainer, |
140 newCharmContainer, | 143 newCharmContainer, |
141 popularCharmContainer | 144 popularCharmContainer |
142 ]; | 145 ]; |
143 }, | 146 }, |
144 | 147 |
145 'failure': this.apiFailure | 148 'failure': this.apiFailure |
146 }, this); | 149 }, this); |
147 }, | 150 }, |
148 | 151 |
149 /* | |
rharding
2013/04/22 14:08:15
typo?
j.c.sackett
2013/04/22 20:54:45
Fixed.
| |
150 /** | 152 /** |
151 * Destroy this view and clear from the dom world. | 153 * Destroy this view and clear from the dom world. |
152 * | 154 * |
153 * @method destructor | 155 * @method destructor |
154 * | 156 * |
155 */ | 157 */ |
156 destructor: function() { | 158 destructor: function() { |
157 if (this.charmContainers) { | 159 if (this.charmContainers) { |
158 Y.Array.each(this.charmContainers, function(container) { | 160 Y.Array.each(this.charmContainers, function(container) { |
159 container.destroy(); | 161 container.destroy(); |
160 }); | 162 }); |
161 } | 163 } |
162 this._cacheCharms.destroy(); | 164 this._cacheCharms.destroy(); |
163 } | 165 } |
164 }, { | 166 }, { |
165 ATTRS: { | 167 ATTRS: { |
166 /** | 168 /** |
167 * Is this rendering of the editorial view for fullscreen or sidebar | 169 * Is this rendering of the editorial view for fullscreen or sidebar |
168 * purposes? | 170 * purposes? |
169 * | 171 * |
170 * @attribute isFullscreen | 172 * @attribute isFullscreen |
171 * @default false | 173 * @default false |
172 * @type {Boolean} | 174 * @type {Boolean} |
173 * | |
174 */ | 175 */ |
175 isFullscreen: { | 176 isFullscreen: { |
176 value: false | 177 value: false |
177 }, | 178 }, |
179 | |
178 /** | 180 /** |
179 * What is the container node we should render our container into? | 181 * What is the container node we should render our container into? |
180 * | 182 * |
181 * @attribute renderTo | 183 * @attribute renderTo |
182 * @default undefined | 184 * @default undefined |
183 * @type {Node} | 185 * @type {Node} |
184 * | |
185 */ | 186 */ |
186 renderTo: { | 187 renderTo: {}, |
187 | 188 |
188 }, | |
189 /** | 189 /** |
190 * The Charmworld0 Api store instance for loading content. | 190 * The Charmworld0 Api store instance for loading content. |
191 * | 191 * |
192 * @attribute store | 192 * @attribute store |
193 * @default undefined | 193 * @default undefined |
194 * @type {Charmworld0} | 194 * @type {Charmworld0} |
195 * | |
196 */ | 195 */ |
197 store: { | 196 store: {} |
198 | |
199 } | |
200 } | 197 } |
201 }); | 198 }); |
202 | 199 |
203 }, '0.1.0', { | 200 }, '0.1.0', { |
204 requires: [ | 201 requires: [ |
205 'browser-charm-container', | 202 'browser-charm-container', |
206 'browser-charm-token', | 203 'browser-charm-token', |
207 'browser-search-widget', | 204 'browser-search-widget', |
208 'juju-charm-store', | 205 'juju-charm-store', |
209 'juju-models', | 206 'juju-models', |
210 'juju-templates', | 207 'juju-templates', |
211 'subapp-browser-view-utils', | 208 'juju-view-utils', |
212 'view' | 209 'view' |
213 ] | 210 ] |
214 }); | 211 }); |
LEFT | RIGHT |