Merge lp:~adiroiban/launchpad/bug-359180 into lp:launchpad
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Aaron Bentley on 2009-12-22 | ||||
| Approved revision: | not available | ||||
| Merged at revision: | not available | ||||
| Proposed branch: | lp:~adiroiban/launchpad/bug-359180 | ||||
| Merge into: | lp:launchpad | ||||
| Diff against target: |
576 lines (+278/-61) 11 files modified
lib/canonical/launchpad/javascript/translations/pofile.js (+194/-2) lib/canonical/launchpad/templates/batchnavigator-navigation-links.pt (+4/-0) lib/lp/app/templates/base-layout-macros.pt (+2/-0) lib/lp/translations/browser/pofile.py (+22/-2) lib/lp/translations/browser/translationmessage.py (+22/-0) lib/lp/translations/stories/standalone/xx-pofile-translate-newlines-check.txt (+2/-2) lib/lp/translations/stories/standalone/xx-pofile-translate.txt (+2/-1) lib/lp/translations/templates/currenttranslationmessage-translate-one.pt (+1/-6) lib/lp/translations/templates/pofile-translate.pt (+12/-46) lib/lp/translations/templates/translationmessage-translate.pt (+8/-2) lib/lp/translations/templates/translations-macros.pt (+9/-0) |
||||
| To merge this branch: | bzr merge lp:~adiroiban/launchpad/bug-359180 | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2009-12-21 | Approve on 2009-12-22 | |
|
Review via email:
|
|||
| Adi Roiban (adiroiban) wrote : | # |
| Aaron Bentley (abentley) wrote : | # |
This looks mostly good. Please rename tabindex_chain to something else (we discussed "translations_
The current interaction of autofocus_html_id and Y.lp.pofile.
| Adi Roiban (adiroiban) wrote : | # |
Thanks for the review!
Here is the latest diff.
=== modified file 'lib/canonical/
--- lib/canonical/
+++ lib/canonical/
@@ -86,7 +86,7 @@
};
-var setFocus = function(e, field) {
+self.setFocus = function(field) {
//Y.log(e.type + ":" + e.keyCode + ': ' + field);
// if there is nofield, do nothing
if (Y.one('#' + field)) {
@@ -96,7 +96,7 @@
var setNextFocus = function(e, field) {
- setFocus(e,field);
+ self.setFocus(
// stopPropagation() and preventDefault()
e.halt();
};
@@ -106,8 +106,8 @@
// Original singular test is focused first to make sure
// it is visible when scrolling up
- setFocus(e, original);
- setFocus(e, field);
+ self.setFocus(
+ self.setFocus(
// stopPropagation() and preventDefault()
e.halt();
};
@@ -116,7 +116,6 @@
var copyOriginalTextOne = function(from_id, to_id, select_id) {
var from = Y.one('#' + from_id);
var to = Y.one('#' + to_id);
-
// The replacement regex strips all tags from the html.
to.
@@ -182,7 +181,13 @@
*/
self.initializ
- var fields = tabindex_
+ if (translations_
+ // If no translations fiels are displayed on the page
+ // don't initialize the translations order
+ return;
+ }
+
+ var fields = translations_
// The last field is Save & Continue button
fields.
@@ -192,7 +197,7 @@
var html_parts = fields[
var original_stem = html_parts[0] + '_' + html_parts[1];
- var translation_stem = original_stem + '_' + html_parts[2];
+ var translation_stem = fields[
var select_widget = (
=== modified file 'lib/lp/
--- lib/lp/
+++ lib/lp/
@@ -935,17 +935,17 @@
return first_field[
except IndexError:
- return False
+ return ""
@property
- def tabindex_
+ def translations_
try:
- tabindex = []
+ order = []
for message in self.translatio
- tabindex.append(
+ order.append(
- return ' '.join(tabindex)
+ return ' '.join(order)
except IndexError:
return ""
=== modified file 'lib/lp/

= Bug 359180 =
Would be useful if the First - Previous - Next - Last link in the translation interface had a keyboard shortcut for fast accessing them. Don't need to be visible, but at least documented somewhere.
Maybe even the Save & Continue button.
== Pre-implementation notes ==
Talking with Danilo we agreed not to use tabindex as it may disturb screen readers.
HTML Accesskeys were used for links, while YUI3 key-event here used for navigation between input fields and copying the original text.
== Implementation details ==
Shift+Alt+a - First (using accesskey)
Shift+Alt+n - Next (using accesskey)
Shift+Alt+p - Previous (using accesskey)
Shift+Alt+l - Last (using accesskey)
Shift+Alt+S - Save and continue (using accesskey)
Shift+Alt+Down - Next field (using YUI3 key-event)
Shift+Alt+Up - Previous field (using YUI3 key-event)
Shift+Alt+C - Copy original text (both singular and plural) (using YUI3 key-event)
First field is autofocused.
I went for Shift+Alt as they are used for Acceskey, and I assume browsers will try to reserve them.
Once keybindings are agreed they should be documented on help.launchpad.net
Accesskeys were tested on Epiphany and Chromium. en.wikipedia. org/wiki/ Access_ key
Wikipedia says that Accesskeys in Firefox are enabled with Shift+Alt but I was not able to activate them on my Firefox.
http://
-----
The legacy JS code from canonical/ launchpad/ icing/build/ lp/lp.js and from pofile-tranlate.pt was moved to javascript/ translations/ pofile. js.
Those functions from lp.js was rewritten using YUI3. Maybe we can no delete them from lp.js.
== Tests ==
I was not able to produce a reasonable windmill test since it is not trivial to find the current focused node or to see if a node is focused.
This requires adding onFocus and onBlur trigger for all DOM nodes.
== Demo and Q/A ==
Log in as admin or as a person with rights on adding translations to a pofile.
Go to a pofile translate page: /translations. launchpad. dev/ubuntu/ hoary/+ source/ evolution/ +pots/evolution -2.2/es/ +translate? start=0
https:/
The first field should have focus and you can start translating right away.
Adding a new translation should automatically select the radio button in front of it.
Pressing Alt + Shift + C will copy the original text. Current text will be discarded.
Pressing Alt + Shift + Down will set the focus to the next input field. Last field is Save and Continue button.
Pressing Alt + Shift + Up will set the focus to the previous input field. Nothing will happen when pressing on the first field.
Pressing Alt + Shift + A from anywhere in the page will point the browser to the fist page in the batch navigation.
Pressing Alt + Shift + L from anywhere in the page will point the browser to the last page in the batch navigation.
Pressing Alt + Shift + N from anywhere in the page will point the browser to the next page in the batch navigation.
Pressing Alt + Shift + P from anywhere in the page will point the browser to the previous page in the batch navigation.
= Launchpad lint =
Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.
Linting changed files:
lib/canon...