Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(44)

Delta Between Two Patch Sets: app/subapps/browser/views/charmresults.js

Issue 9036049: Fixes #1174358 remove dupe code/driveby route fix
Left Patch Set: Fixes #1174358 remove dupe code/driveby route fix Created 11 years, 11 months ago
Right Patch Set: Fixes #1174358 remove dupe code/driveby route fix Created 11 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « app/subapps/browser/browser.js ('k') | app/subapps/browser/views/editorial.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 'use strict'; 1 'use strict';
2 2
3 3
4 /** 4 /**
5 * Charm Results View. 5 * Charm Results View.
6 * 6 *
7 * @module juju.browser 7 * @module juju.browser
8 * @submodule views 8 * @submodule views
9 * 9 *
10 */ 10 */
(...skipping 12 matching lines...) Expand all
23 Since this view is incomplete (has no render, template, etc.) it's not 23 Since this view is incomplete (has no render, template, etc.) it's not
24 tested directly, but through the SearchView and the EditorialView which 24 tested directly, but through the SearchView and the EditorialView which
25 verify both rendering and expected event behavior. 25 verify both rendering and expected event behavior.
26 26
27 @class CharmReults 27 @class CharmReults
28 @extends {juju.browser.views.CharmResults} 28 @extends {juju.browser.views.CharmResults}
29 29
30 */ 30 */
31 ns.CharmResults = Y.Base.create('browser-view-charmresults', Y.View, [ 31 ns.CharmResults = Y.Base.create('browser-view-charmresults', Y.View, [
32 views.utils.apiFailingView, 32 views.utils.apiFailingView,
33 widgets.browser.IndicatorManager 33 widgets.browser.IndicatorManager,
34 Y.Event.EventTracker
34 ], { 35 ], {
35 events: { 36 events: {
36 '.charm-token': { 37 '.charm-token': {
37 click: '_handleCharmSelection' 38 click: '_handleCharmSelection'
38 } 39 }
39 }, 40 },
40 41
41 /** 42 /**
42 Watch for selecting a charm in the results. 43 Watch for selecting a charm in the results.
43 44
44 @method _bindEvents 45 @method _bindEvents
45 46
46 */ 47 */
47 _bindEvents: function() { 48 _bindEvents: function() {
48 // Watch for changse to the activeID so that we can mark/unmark active 49 // Watch for changse to the activeID so that we can mark/unmark active
49 // as required. 50 // as required.
50 this.on('activeIDChange', function(ev) { 51 this.addEvent(
j.c.sackett 2013/05/13 18:34:05 We should probaby catch this and detach it on dest
rharding 2013/05/14 10:54:08 Definitely, thanks.
51 var id = ev.newVal; 52 this.on('activeIDChange', function(ev) {
52 if (id) { 53 var id = ev.newVal;
53 id = this.get('container').one( 54 if (id) {
54 '.charm-token[data-charmid="' + id + '"]'); 55 id = this.get('container').one(
55 } 56 '.charm-token[data-charmid="' + id + '"]');
56 this._updateActive(id); 57 }
57 }); 58 this._updateActive(id);
59 })
60 );
58 }, 61 },
59 62
60 /** 63 /**
61 When selecting a charm from the list make sure we re-route the app to 64 When selecting a charm from the list make sure we re-route the app to
62 the details view with that charm selected. 65 the details view with that charm selected.
63 66
64 @method _handleCharmSelection 67 @method _handleCharmSelection
65 @param {Event} ev the click event handler for the charm selected. 68 @param {Event} ev the click event handler for the charm selected.
66 69
67 */ 70 */
(...skipping 24 matching lines...) Expand all
92 _updateActive: function(clickTarget) { 95 _updateActive: function(clickTarget) {
93 // Remove the active class from any nodes that have it. 96 // Remove the active class from any nodes that have it.
94 Y.all('.yui3-charmtoken.active').removeClass('active'); 97 Y.all('.yui3-charmtoken.active').removeClass('active');
95 98
96 // Add it to the current node. 99 // Add it to the current node.
97 if (clickTarget) { 100 if (clickTarget) {
98 clickTarget.ancestor('.yui3-charmtoken').addClass('active'); 101 clickTarget.ancestor('.yui3-charmtoken').addClass('active');
99 } 102 }
100 }, 103 },
101 104
102 /** 105
103 * Generates a message to the user based on a bad api call.
104 * @method apiFailure
105 * @param {Object} data the json decoded response text.
106 * @param {Object} request the original io_request object for debugging.
107 */
108 apiFailure: function(data, request) {
109 this._apiFailure(data, request, 'Failed to load editorial content.');
j.c.sackett 2013/05/13 18:34:05 This is the wrong place for this; leave it in the
rharding 2013/05/14 10:54:08 Yep, thanks. I'll keep this on its own between the
110 },
111 106
112 /** 107 /**
113 * General YUI initializer. 108 * General YUI initializer.
114 * 109 *
115 * @method initializer 110 * @method initializer
116 * @param {Object} cfg configuration object. 111 * @param {Object} cfg configuration object.
117 * 112 *
118 */ 113 */
119 initializer: function(cfg) { 114 initializer: function(cfg) {
120 // Hold onto charm data so we can pass model instances to other views when 115 // Hold onto charm data so we can pass model instances to other views when
(...skipping 14 matching lines...) Expand all
135 }, { 130 }, {
136 ATTRS: { 131 ATTRS: {
137 /** 132 /**
138 * The charm id to start out selected as active. 133 * The charm id to start out selected as active.
139 * 134 *
140 * @attribute setActive 135 * @attribute setActive
141 * @default undefined 136 * @default undefined
142 * @type {String} 137 * @type {String}
143 * 138 *
144 */ 139 */
145 activeID: { 140 activeID: {},
gary.poster 2013/05/13 18:20:33 trivial, but might as well collapse as you do else
rharding 2013/05/14 10:54:08 Sure thing.
146
147 },
148 141
149 /** 142 /**
150 * Is this rendering of the editorial view for fullscreen or sidebar 143 * Is this rendering of the editorial view for fullscreen or sidebar
151 * purposes? 144 * purposes?
152 * 145 *
153 * @attribute isFullscreen 146 * @attribute isFullscreen
154 * @default false 147 * @default false
155 * @type {Boolean} 148 * @type {Boolean}
156 */ 149 */
157 isFullscreen: { 150 isFullscreen: {
(...skipping 21 matching lines...) Expand all
179 }); 172 });
180 173
181 }, '0.1.0', { 174 }, '0.1.0', {
182 requires: [ 175 requires: [
183 'juju-models', 176 'juju-models',
184 'browser-overlay-indicator', 177 'browser-overlay-indicator',
185 'juju-view-utils', 178 'juju-view-utils',
186 'view' 179 'view'
187 ] 180 ]
188 }); 181 });
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b