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
1=== modified file 'lib/lp/bugs/javascript/buglisting.js'
2--- lib/lp/bugs/javascript/buglisting.js 2012-09-12 01:36:22 +0000
3+++ lib/lp/bugs/javascript/buglisting.js 2012-09-13 19:57:19 +0000
4@@ -30,22 +30,8 @@
5 * - batch_key: A string representing the position and ordering of the
6 * current batch, as returned by listing_navigator.get_batch_key
7 */
8- module.BugListingModel = function () {
9- module.BugListingModel.superclass.constructor.apply(this, arguments);
10- };
11-
12-
13- module.BugListingModel.NAME = 'buglisting-model';
14-
15-
16- module.BugListingModel.ATTRS = {
17- field_visibility_defaults: {
18- value: null
19- }
20- };
21-
22-
23- Y.extend(module.BugListingModel, Y.Base, {
24+ module.BugListingModel = Y.Base.create('buglisting-model', Y.Base, [],
25+ {
26 /**
27 * Initializer sets up the History object that stores most of the
28 * model data.
29@@ -100,9 +86,13 @@
30 var url = '?' + Y.QueryString.stringify(query);
31 this.get('history').addValue('batch_key', batch_key, {url: url});
32 }
33+ }, {
34+ ATTRS: {
35+ field_visibility_defaults: { value: null },
36+ total: { value: null }
37+ }
38 });
39
40-
41 /**
42 * Constructor.
43 * current_url is used to determine search params.
44@@ -114,45 +104,38 @@
45 * io_provider is something providing the Y.io interface, typically used
46 * for testing. Defaults to Y.io.
47 */
48- module.BugListingNavigator = function(config) {
49- module.BugListingNavigator.superclass.constructor.apply(
50- this, arguments);
51- };
52-
53- module.BugListingNavigator.ATTRS = {
54- };
55-
56- Y.extend(
57- module.BugListingNavigator,
58- Y.lp.app.listing_navigator.ListingNavigator, {
59- _bindUI: function () {
60- Y.lp.app.inlinehelp.init_help();
61- },
62-
63- /**
64- * Return the model to use for rendering the batch. This will include
65- * updates to field visibility.
66- */
67- get_render_model: function(current_batch) {
68- return Y.merge(
69- current_batch.mustache_model,
70- this.get('model').get_field_visibility());
71- },
72-
73- make_model: function(batch_key, cache) {
74- return new module.BugListingModel({
75- batch_key: batch_key,
76- total: cache.total,
77- field_visibility: cache.field_visibility,
78- field_visibility_defaults: cache.field_visibility_defaults
79- });
80- }
81- });
82+ module.BugListingNavigator = Y.Base.create(
83+ '', Y.lp.app.listing_navigator.ListingNavigator, [],
84+ {
85+ _bindUI: function () {
86+ Y.lp.app.inlinehelp.init_help();
87+ },
88+
89+ /**
90+ * Return the model to use for rendering the batch. This will include
91+ * updates to field visibility.
92+ */
93+ get_render_model: function(current_batch) {
94+ return Y.merge(
95+ current_batch.mustache_model,
96+ this.get('model').get_field_visibility());
97+ },
98+
99+ make_model: function(batch_key, cache) {
100+ return new module.BugListingModel({
101+ batch_key: batch_key,
102+ total: cache.total,
103+ field_visibility: cache.field_visibility,
104+ field_visibility_defaults: cache.field_visibility_defaults
105+ });
106+ },
107+
108+ },{});
109
110 /**
111 * Factory to return a BugListingNavigator for the given page.
112 */
113- module.BugListingNavigator.from_page = function() {
114+ module.BugListingNavigator.from_page = function () {
115 var target = Y.one('#client-listing');
116 if (Y.Lang.isNull(target)){
117 return null;
118@@ -180,8 +163,7 @@
119 navigator.clickAction('.last', navigator.last_batch);
120 navigator.update_navigation_links();
121 return navigator;
122- };
123-
124+ }
125
126 /**
127 * Helper view object for managing the buglisting code on the actual table
128@@ -189,8 +171,7 @@
129 *
130 * @class TableView
131 * @extends Y.Base
132- * @namespace lp.bugs.buglisting
133- *
134+ * @namespace lp.bugs.buglisting *
135 */
136 module.TableView = Y.Base.create('buglisting-tableview', Y.Base,
137 [], {