Merge lp:~jcsackett/launchpad/missing-results-count-in-chromium into lp:launchpad

Proposed by j.c.sackett
Status: Merged
Approved by: j.c.sackett
Approved revision: no longer in the source branch.
Merged at revision: 15951
Proposed branch: lp:~jcsackett/launchpad/missing-results-count-in-chromium
Merge into: lp:launchpad
Prerequisite: lp:~jcsackett/launchpad/clean-up-buglisting-classes
Diff against target: 137 lines (+37/-56)
1 file modified
lib/lp/bugs/javascript/buglisting.js (+37/-56)
To merge this branch: bzr merge lp:~jcsackett/launchpad/missing-results-count-in-chromium
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code Approve
Review via email: mp+124057@code.launchpad.net

Commit message

Fixes display of results count on bug listing in chromium.

Description of the change

Summary
=======
Per bug 984871, the bug listing javascript removed the display of the total
number of results when showing navigation links (i.e. NNNN -> MMMM of $total
results).

This was because while it was passing a total from the BugListingModel into
the template, the total was never explicitly set within the model once passed
in via config, and an undefined result was passed to mustache. I have no idea
how it is that firefox continued to display the results count.

Implementation
==============
Add "total" to the ListingModel's ATTRs. It's already passed in via config, so
the YUI Base initializer magic takes care of everything.

Tests
=====
bin/test -vvct buglisting --layer=YUI

QA
==
Ensure the proper results count is displayed on a buglisting in
chrome/chromium.

LoC
===
This branch is preceeded by one that is -20 LoC, to make space for this fix.

Lint
====

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/bugs/javascript/buglisting.js

To post a comment you must log in.
Revision history for this message
Curtis Hovey (sinzui) wrote :

Thank you.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/javascript/buglisting.js'
--- lib/lp/bugs/javascript/buglisting.js 2012-09-12 01:36:22 +0000
+++ lib/lp/bugs/javascript/buglisting.js 2012-09-13 19:57:19 +0000
@@ -30,22 +30,8 @@
30 * - batch_key: A string representing the position and ordering of the30 * - batch_key: A string representing the position and ordering of the
31 * current batch, as returned by listing_navigator.get_batch_key31 * current batch, as returned by listing_navigator.get_batch_key
32 */32 */
33 module.BugListingModel = function () {33 module.BugListingModel = Y.Base.create('buglisting-model', Y.Base, [],
34 module.BugListingModel.superclass.constructor.apply(this, arguments);34 {
35 };
36
37
38 module.BugListingModel.NAME = 'buglisting-model';
39
40
41 module.BugListingModel.ATTRS = {
42 field_visibility_defaults: {
43 value: null
44 }
45 };
46
47
48 Y.extend(module.BugListingModel, Y.Base, {
49 /**35 /**
50 * Initializer sets up the History object that stores most of the36 * Initializer sets up the History object that stores most of the
51 * model data.37 * model data.
@@ -100,9 +86,13 @@
100 var url = '?' + Y.QueryString.stringify(query);86 var url = '?' + Y.QueryString.stringify(query);
101 this.get('history').addValue('batch_key', batch_key, {url: url});87 this.get('history').addValue('batch_key', batch_key, {url: url});
102 }88 }
89 }, {
90 ATTRS: {
91 field_visibility_defaults: { value: null },
92 total: { value: null }
93 }
103 });94 });
10495
105
106 /**96 /**
107 * Constructor.97 * Constructor.
108 * current_url is used to determine search params.98 * current_url is used to determine search params.
@@ -114,45 +104,38 @@
114 * io_provider is something providing the Y.io interface, typically used104 * io_provider is something providing the Y.io interface, typically used
115 * for testing. Defaults to Y.io.105 * for testing. Defaults to Y.io.
116 */106 */
117 module.BugListingNavigator = function(config) {107 module.BugListingNavigator = Y.Base.create(
118 module.BugListingNavigator.superclass.constructor.apply(108 '', Y.lp.app.listing_navigator.ListingNavigator, [],
119 this, arguments);109 {
120 };110 _bindUI: function () {
121111 Y.lp.app.inlinehelp.init_help();
122 module.BugListingNavigator.ATTRS = {112 },
123 };113
124114 /**
125 Y.extend(115 * Return the model to use for rendering the batch. This will include
126 module.BugListingNavigator,116 * updates to field visibility.
127 Y.lp.app.listing_navigator.ListingNavigator, {117 */
128 _bindUI: function () {118 get_render_model: function(current_batch) {
129 Y.lp.app.inlinehelp.init_help();119 return Y.merge(
130 },120 current_batch.mustache_model,
131121 this.get('model').get_field_visibility());
132 /**122 },
133 * Return the model to use for rendering the batch. This will include123
134 * updates to field visibility.124 make_model: function(batch_key, cache) {
135 */125 return new module.BugListingModel({
136 get_render_model: function(current_batch) {126 batch_key: batch_key,
137 return Y.merge(127 total: cache.total,
138 current_batch.mustache_model,128 field_visibility: cache.field_visibility,
139 this.get('model').get_field_visibility());129 field_visibility_defaults: cache.field_visibility_defaults
140 },130 });
141131 },
142 make_model: function(batch_key, cache) {132
143 return new module.BugListingModel({133 },{});
144 batch_key: batch_key,
145 total: cache.total,
146 field_visibility: cache.field_visibility,
147 field_visibility_defaults: cache.field_visibility_defaults
148 });
149 }
150 });
151134
152 /**135 /**
153 * Factory to return a BugListingNavigator for the given page.136 * Factory to return a BugListingNavigator for the given page.
154 */137 */
155 module.BugListingNavigator.from_page = function() {138 module.BugListingNavigator.from_page = function () {
156 var target = Y.one('#client-listing');139 var target = Y.one('#client-listing');
157 if (Y.Lang.isNull(target)){140 if (Y.Lang.isNull(target)){
158 return null;141 return null;
@@ -180,8 +163,7 @@
180 navigator.clickAction('.last', navigator.last_batch);163 navigator.clickAction('.last', navigator.last_batch);
181 navigator.update_navigation_links();164 navigator.update_navigation_links();
182 return navigator;165 return navigator;
183 };166 }
184
185167
186 /**168 /**
187 * Helper view object for managing the buglisting code on the actual table169 * Helper view object for managing the buglisting code on the actual table
@@ -189,8 +171,7 @@
189 *171 *
190 * @class TableView172 * @class TableView
191 * @extends Y.Base173 * @extends Y.Base
192 * @namespace lp.bugs.buglisting174 * @namespace lp.bugs.buglisting *
193 *
194 */175 */
195 module.TableView = Y.Base.create('buglisting-tableview', Y.Base,176 module.TableView = Y.Base.create('buglisting-tableview', Y.Base,
196 [], {177 [], {