Merge lp:~gesha/linaro-android-frontend/remove-mandatory-tabs into lp:linaro-android-frontend

Proposed by Georgy Redkozubov
Status: Merged
Merged at revision: 286
Proposed branch: lp:~gesha/linaro-android-frontend/remove-mandatory-tabs
Merge into: lp:linaro-android-frontend
Diff against target: 77 lines (+5/-30)
1 file modified
static/buildDetails.js (+5/-30)
To merge this branch: bzr merge lp:~gesha/linaro-android-frontend/remove-mandatory-tabs
Reviewer Review Type Date Requested Status
Данило Шеган (community) Approve
Review via email: mp+131151@code.launchpad.net

Description of the change

This branch removes mandatory tabs and fallback support for HOWTOs and adds searching of HOWTOs only in current dir.

To post a comment you must log in.
Revision history for this message
Данило Шеган (danilo) wrote :

In the loop over howto_paths (line 41 of the diff), I'd say a loop variable is more likely an "index" rather than "count" (count is the total count of something; perhaps we could call it a "counter", but that suggests something else as well). It's even better if it actually indicates what's it an index for, eg. "howto_index".

review: Needs Fixing
287. By Georgy Redkozubov

Fix based on review comments

Revision history for this message
Georgy Redkozubov (gesha) wrote :

> In the loop over howto_paths (line 41 of the diff), I'd say a loop variable is
> more likely an "index" rather than "count" (count is the total count of
> something; perhaps we could call it a "counter", but that suggests something
> else as well). It's even better if it actually indicates what's it an index
> for, eg. "howto_index".

Fixed.

Revision history for this message
Данило Шеган (danilo) wrote :

Thanks, looks good now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'static/buildDetails.js'
--- static/buildDetails.js 2012-10-19 14:07:39 +0000
+++ static/buildDetails.js 2012-10-24 12:01:21 +0000
@@ -22,7 +22,6 @@
22 var buildNumber = history.get('build');22 var buildNumber = history.get('build');
23 var fetchLatest = (buildNumber === undefined);23 var fetchLatest = (buildNumber === undefined);
2424
25 var howto_dir = "/howto/";
26 var howto_paths = [25 var howto_paths = [
27 "HOWTO_releasenotes.txt",26 "HOWTO_releasenotes.txt",
28 "HOWTO_install.txt",27 "HOWTO_install.txt",
@@ -30,12 +29,6 @@
30 "HOWTO_flashfirmware.txt",29 "HOWTO_flashfirmware.txt",
31 "HOWTO_rtsm.txt"]30 "HOWTO_rtsm.txt"]
3231
33 // For these files we use the fallback pages found in static/.
34 var howto_mandatory = [
35 "HOWTO_install.txt",
36 "HOWTO_getsourceandbuild.txt",
37 "HOWTO_flashfirmware.txt"]
38
39 // Mapping for howto_paths tab titles32 // Mapping for howto_paths tab titles
40 var howto_titles = [33 var howto_titles = [
41 "Release Notes",34 "Release Notes",
@@ -44,14 +37,6 @@
44 "Firmware Update",37 "Firmware Update",
45 "RTSM"]38 "RTSM"]
4639
47 // First and the last howto's don't have fallbacks, but this can change
48 // later.
49 var howto_fallbacks = [
50 '',
51 'Please read "Image Installation Wiki page":https://wiki.linaro.org/Platform/Android/ImageInstallation <br><br>For more info, check out this "page":https://wiki.linaro.org/Platform/Android',
52 'Please read these two pages: "Get Source page":https://wiki.linaro.org/Platform/Android/GetSource and "Build Source page":https://wiki.linaro.org/Platform/Android/BuildSource <br><br>For more info, check out this "page":https://wiki.linaro.org/Platform/Android',
53 'Please read "Flash Firmware Wiki page":https://wiki.linaro.org/Platform/Android/FlashFirmware <br><br>For more info, check out this "page":https://wiki.linaro.org/Platform/Android',
54 '']
5540
5641
5742
@@ -440,33 +425,23 @@
440 function handleRenderedFiles(downloadUrl) {425 function handleRenderedFiles(downloadUrl) {
441426
442 var rendered_files = new Object();427 var rendered_files = new Object();
443 var count = 0;428 var howto_index = 0;
444429
445 for (var count in howto_paths) {430 for (var howto_index in howto_paths) {
446 $.ajax({431 $.ajax({
447 url: '/api/proxy-remote-file?url=' + downloadUrl +432 url: '/api/proxy-remote-file?url=' + downloadUrl +
448 howto_dir + howto_paths[count],433 howto_paths[howto_index],
449 success: function(data) {434 success: function(data) {
450 if (data != 'Invalid argument') {435 if (data != 'Invalid argument') {
451 rendered_files[howto_titles[count]] =436 rendered_files[howto_titles[howto_index]] =
452 convert_textile(data);437 convert_textile(data);
453 }438 }
454 count++;439 howto_index++;
455 },440 },
456 async: false,441 async: false,
457 });442 });
458 }443 }
459444
460 for (var count in howto_paths) {
461 if ($.inArray(howto_paths[count], howto_mandatory) != -1) {
462 if (rendered_files[howto_titles[count]] == undefined) {
463 // No file found, get fallback.
464 rendered_files[howto_titles[count]] =
465 convert_textile(howto_fallbacks[count]);
466 }
467 }
468 }
469
470 refresh_tabs(rendered_files);445 refresh_tabs(rendered_files);
471 }446 }
472447

Subscribers

People subscribed via source and target branches