Commit Graph

118 Commits

Author SHA1 Message Date
Timo Tijhof
c6d71015ff Various clean up
Files:
* Consistently have one (1) new line at EOF
  (.gitignore, *.css, *.sh)

JSHint:
* Separate the common (general Wikimedia code conventions) from
  the local more stricter rules (nice work!).

Maintenance:
* Use simplified $IP definition where getenv is only called once.
  Based on http://git.io/ve-mw-36fc3b59-makeStaticLoader

JavaScript:
* Use the same closure in all files:
  - No need for "undefined".
  - One linebreak between license header and start of closure
    (sometimes there were 1 or 2 empty lines).
  - ext.uls.ime.js: No need for "document" (redundant in general,
    but especially as it wasn't used anywhere in this file).
  - Use "$, mw" for all ext.* modules (one of them used "mw, $").

Change-Id: Iba5dab14bbc3fbfc9f8fe96dd2d95529587a69aa
2014-02-08 00:11:50 -08:00
Amir E. Aharoni
3dda6b5828 Comment and whitespace cleanup
Change-Id: I7ac44f4d371faa3c6941ccf8a4654a035e9b05a5
2013-11-22 10:18:20 +05:30
Santhosh Thottingal
277b0db94d Visual indication while saving the settings
* Button label change to "applying changes"
* Button become disabled
* Cursor changes to "progress"

Bug: 53772
Change-Id: I1de459590ea9b357965a73f274d566eba8c04482
2013-11-21 14:52:48 +05:30
Santhosh Thottingal
8d9f1e97cd Remove unused method: hide
Change-Id: Iba2ca843db8f0edd7fd1826b998a73279e7c06fe
2013-11-18 20:09:42 +00:00
Santhosh Thottingal
be99ff9a55 Fix bug: Cannot apply changes after switching panels back and forth
Bug: 57011
Change-Id: I0614d97dea99781f46bb80a496b12c95aef55c8c
2013-11-14 14:12:59 +00:00
jenkins-bot
fb2c99d30e Merge "Validate the dirty flag before saving preferences in each modules" 2013-11-13 12:40:48 +00:00
Santhosh Thottingal
8b3d27a505 Validate the dirty flag before saving preferences in each modules
Pressing apply button is applicable to all settings module, not only
for the one that is visible. Unless we do a validation before we save
preferences, other module can cause incorrect (old) preferences to be
saved.

Bug: 56885
Change-Id: I31df2ee0bf8b600a94e8fed1a784daf529186b16
2013-11-13 12:39:57 +00:00
Niklas Laxström
de4f78a6be Use data-i18n for system font l10n
This ensures that the translation is updated properly in the
language live preview.

Bug: 56888
Change-Id: I320c570f9272e8d191144f66a9cf0079c89d201d
2013-11-13 08:36:47 +00:00
Santhosh Thottingal
9dd4072d3d Avoid a js error when inputsettings are saved.
It happens when input settings are accessed directly while display
settings are not initialized. While saving the display settings
will not be rendered, causing a js error

Change-Id: I3ef1afe67a6bcdc3047b482d697bc03baab6ac47
2013-11-07 13:58:06 +00:00
Santhosh Thottingal
27f356d1f6 Add autonym class to the buttons displaying language
Change-Id: Iade66179acd46835099e015d73c01349526f80ec
2013-11-05 15:00:12 +05:30
Amir E. Aharoni
25a95bc760 Cleanup comments and whitespace
Change-Id: I7597c590a59ada855d759615fbb1675c3bcfe461
2013-11-01 15:53:20 +02:00
Siebrand Mazeland
315cf739bc Update formatting
Change-Id: Iaee2ab4f36d3a0dce143c62965ab29de504b31ea
2013-10-09 15:40:39 +02:00
Santhosh Thottingal
b4f794f9fe Reset language and font while preview
If not reset, the font-family will persist for languages
without font preferences

Steps to reproduce:
1. Open language settings->Display settings.
Switch language to English. Inspect the lang and font-family
of uls-display-settings element.

2. Switch language to hi. Inspect the lang and font-family
of uls-display-settings element. You can see Lohit Devanagari
as font.

3. Switch the language back to English. You can still see font
as Lohit Devanagari. With this patch, you should see font family
reset for English.

Change-Id: Ib3346d8b888c7dcfda16e8a10473c785a1ebd890
2013-09-30 10:59:55 +05:30
Santhosh Thottingal
32bb03045f Refactor all language, font change code to preview method
Avoids duplication of code and better organising language and font
change logic

Change-Id: I4e95cfc2de7b650a75e2bd550af547647d5b3eb3
2013-09-30 04:14:46 +00:00
Kartik Mistry
039c91d1d5 Integration tests for live preview of display language
Bug: 53255

Change-Id: I1506ddd0ef68217ac114bdf4c29c62cd071b1900
2013-09-26 22:51:37 -07:00
Santhosh Thottingal
2d8522d1ba Keep correct lang attribute when display settings closed
Bug: 54594
Change-Id: I15b12e17b5a922cce6717577bc0d56dfd80ccfee
2013-09-26 07:36:13 +00:00
Niklas Laxström
e36d9b1cc3 Regression: Using [...] to change language does not activate apply button
Bug: 53736
Change-Id: If52beb73f9f3f74cde63bd846974540682066ab6
2013-09-04 07:00:53 +00:00
Santhosh Thottingal
3af403fee5 Make the cancel and apply button applicable for all modules
If a user does changes in module A, does not save or cancel,
goes to module B, does some changes, moves to other modules,
and finally presses Apply, all changes should get saved.

Similarly, if a user cancels, all changes should get cancelled.

This required moving the cancel and apply button outside of modules
and managed by the language settings framework.

Modules get mw.uls.settings.apply or mw.uls.settings.cancel triggers
to do whatever they want to do on apply or save.

Includes some refactoring related to this.

Bug: 53256
Change-Id: I7d773d33a980a78604b36e39bf96a5686870124e
2013-09-02 17:03:13 +02:00
Niklas Laxström
34146ea023 (bug 49738) Use correct name for wiki content language
Happens when anonymous user cannot change language, and the
language of the translation differs from the content language.

Change-Id: Ie4f15f1813eec992cfe060baf9cd7dcb5f8a0d95
2013-08-30 12:45:02 +03:00
Nikerabbit
ef826e0e75 Simplify the cancel logic for input and display settings
Change-Id: I2afe78edad31b00a35d0589384e4091b61091275
2013-08-29 10:57:45 +00:00
Nikerabbit
537e6def5d Revert "Simplify the cancel logic for input and display settings"
This reverts commit a5d79594a3.

Causes new integration tests to fail.

Change-Id: I7e14d73d0d726a3253e8c6e6bdf5066230d8454c
2013-08-27 12:34:50 +00:00
Santhosh Thottingal
a5d79594a3 Simplify the cancel logic for input and display settings
Restore the language(ui, content), font values, input method values.

Rest of the UI resetting will be done by redrawing the settings
area whenever the language settings is accessed again.

Change-Id: Ia1488d1501f9c9f61726cea3637624f22a7ba135
2013-08-26 14:56:38 +00:00
Santhosh Thottingal
0d9bbd8113 Make the behavior of close button same as cancel button
Bug: 53255
Change-Id: If27a770c531d78538c70dd86199f1791b1171c2d
2013-08-26 14:31:09 +00:00
Santhosh Thottingal
4704cf5182 Use mw.hook for notifying cancel of settings window to modules
This avoids mandate of having 'cancel' method defined in settings module.
Also avoids looping of all modules while cancel is happening.

Change-Id: I87d0975f2ef1bdee61f71d66eabe3040b81876b8
2013-08-22 11:51:26 +05:30
Amir E. Aharoni
a3bca89a42 Implement language-selection-method event
Change-Id: If2d207f8a221c8f2a560b1399ad69a3032b2064b
2013-08-20 05:16:35 +00:00
Santhosh Thottingal
7649b47f5c Followup I59dfcfb25c, language change work with out event logging
In I59dfcfb25c, for logging events when page is navigating away, we
used callbacks with mw.hook. That is wrong approach. If event logging
is disabled those callbacks will never called: it broke language change
and all use cases which navigates away from current page.

Event logging should not interfere with any ULS functionality. If ULS
functionality depends on callbacks from event logging, it is wrong.

In this patch, we give a small time window to make sure event logging is
fired, but we won't wait for its success or failure.

If eventlogging is disabled, this time window does not exist.

Change-Id: I0b7d9d8b9d1d01b99422010596ebfa80b2589d04
2013-08-19 10:13:56 +00:00
Santhosh Thottingal
44bd73325a Log font-change event
Change-Id: I093e27d74d047a639082a5da6442944f590c67dc
2013-08-19 06:00:26 +00:00
Santhosh Thottingal
117cc5bf46 eventlogger module for ULS
Separating event logging out of ULS functionality. Event logging
is now loosely coupled with ULS. ULS core modules can emit an event
whenever EventLogging is required. The eventlogger module will act
on the event if configured.

Change-Id: I59dfcfb25c1acb85376b56239f2355ee7c4aff1e
2013-08-15 17:08:15 +03:00
Amir E. Aharoni
f2f006788c Add event logging for more languages in display settings
Change-Id: I5d358d4e4d2a526381cd06fdeba98e7254418a24
2013-08-04 08:51:37 +00:00
Niklas Laxström
8e1726e745 Log login-click event
Our logEvent wrapper now returns jQuery.Promise too.

Added timeout out parameter to our logEvent wrapper. Unlike
GettingStarted, I didn't create separate logUnlessTimeout
function.

Chrome apparently emulates enter on links as a click, so
this catches enters, left and middle clicks, but not if
the link is opened via right click menu. Might not catch
enter in all browsers.

Change-Id: I4b0eb56e7c7d6e56f8fd99d536f9b60b94a2e09e
2013-08-02 13:03:15 +00:00
Santhosh Thottingal
f11ef736a4 Fix the logic of apply and cancel actions
* Refactored the Cancel button handler code to cancel method in
display settings and input settings.
* When the user makes changes in multiple modules and clicks the Cancel
button or closes the language settings after that, cancel the changes in
all the modules. See bug 50564.
* The Apply button was always active in input methods module. Fixed the
logic for that.
* Renamed the enableApplyButton method to markDirty in both modules.
* Introduced isDirty attribute to the modules for optimizing the Cancel
method to avoid unnecessary restore actions.
* More minor cleanup and documentation.

Bug: 50564

Change-Id: I71f527bfb7dd7f6724e4365371ac3e4fc0723ed6
2013-07-23 14:09:27 +03:00
Santhosh Thottingal
2159822145 Update jquery.i18n from upstream, use its default message store
In Iddef0805ab a custom message store was introduced for ULS, but
there were updates in jquery.i18n that allows us to use default
message store again.

(see https://github.com/wikimedia/jquery.i18n/pull/40)

Change-Id: I86cb7a44efa83e5811824cd1104c6be11b1e2925
2013-07-23 15:32:45 +05:30
Santhosh Thottingal
944c74c958 Update the previous UI and content font whenever font value changes
Bug: 50562
Change-Id: I1e89af19149a02ad4ed7a4a6b7f096c258258cf4
2013-07-19 10:40:29 +05:30
Santhosh Thottingal
a3bf6f7e3d Naming convention fix.
Change-Id: If1661a9c35fafb048b2a30b9fefbace7668e98d7
2013-07-19 10:20:31 +05:30
Santhosh Thottingal
3d6e4a007f jquery.i18n message store for ULS
Bug: 49935
Change-Id: Iddef0805abbf9b4ff0e606fc311c57e9dfa7107d
2013-07-08 06:55:21 +00:00
Santhosh Thottingal
acbc10c494 After rendering input and display settings, refresh webfonts
Because those windows are rendered later. The settings window inherits
fonts. But button in those panels doesn't inherit. Make sure all panel
elements have current font applied.

Change-Id: Ibb8b12b3d973023c49ef89a04d534081bf8ee87f
2013-07-02 10:53:21 +00:00
Siebrand Mazeland
1f9bf6f82c Update indentation and newlines
Change-Id: Iac833df12a00949d32f2ce2fc26a657bab3d8229
2013-06-17 16:36:34 +02:00
jenkins-bot
f0eca06c1c Merge "Set the language for the settings panel for correct webfonts" 2013-06-13 09:51:16 +00:00
Santhosh Thottingal
d36f6c516e Set the language for the settings panel for correct webfonts
Change-Id: Ia404f5e0b50d5b9114255c2e1e7daca39c79d414
2013-06-13 11:22:32 +05:30
Santhosh Thottingal
f0b3e6524c Cleanup
Minor whitespace, coding convention cleanup

Change-Id: Ibb10ce64ad4c35bfd6f924665243961c80b81714
2013-06-11 10:24:13 +05:30
Santhosh Thottingal
e9ab300889 Fix: ULS popup moves to sidebar if opened from ime menu
Issues fixed:
Incorrect position of ULS when accessed from more languages button
of input/display settings, when language settings opened from ime
menu.

Arrow(callout) appearing for ULS when opened from more languages
button of input/display settings, when language settings opened from ime
menu.

Used a class 'callout' to mark whether windows need callout arrow or not.

Bug: 49060
Change-Id: Ic4c0a1e386918494a0d006a02dd0cf93ef269163
2013-06-07 14:26:46 +00:00
Santhosh Thottingal
c9aa1f1130 Correct the loop logic for language buttons
It is possible that the count reach more than  SUGGESTED_LANGUAGES_NUMBER
before it reach the

languagesForButtons.length === SUGGESTED_LANGUAGES_NUMBER

check. This will cause the loop to run for all languages.

Change-Id: Ie6190d1c80c2a7152af490db2bc115ecdfde4184
2013-06-06 06:36:36 +00:00
Santhosh Thottingal
73716f3f67 Remove lot of scroll to view related code
Just use javascript scrollIntoView to do that.
Also remove duplication of code related to this

Change-Id: Ied1235a85f4fe2d99afa127737979c24d3591118
2013-06-03 05:44:17 +00:00
Santhosh Thottingal
65711c312d Fix cancel behaviour of display settings
Font selection becomes persistent despite cancelling it
Bug: 47976

Change-Id: Iea4b65a8a13da3cb4a86f5b6521d62cb1372b42a
2013-05-27 18:24:14 +05:30
Santhosh Thottingal
f23666a15a Get the saved font using the fontSelector defined in mw.webfonts.setup
Also make sure that correct language is passed to the getFont
It was wrong in current version - UI language was passed always
(introduced in a refactoring to avoid code duplication for content
and ui language- commit: 98bb1c200c )

Change-Id: I62860f9d62538915628ad21e5d904e56bdcc9430
2013-05-27 14:43:30 +05:30
Amir E. Aharoni
2ef2376bfe Remove webfonts enabling checkbox and associated preference
Bug: 48535
Change-Id: If735a733717596fae03042c5e277bd538bd8501f
2013-05-27 07:59:45 +03:00
Santhosh Thottingal
bb3e72f5a0 Simplify the language settings display
Directly show language settings instead of showing ULS language selector
and then simulating click on language settings

Change-Id: Iafb15ac9a7140fcce9e71ed933be6c55be81dc7e
2013-05-20 10:21:38 +05:30
jenkins-bot
ee9fe23599 Merge "Scroll language settings on all changes" 2013-05-16 09:52:35 +00:00
jenkins-bot
394f4ab943 Merge "Set the position of display settings to match ULS" 2013-05-16 09:52:15 +00:00
Amir E. Aharoni
07465bf20c Set the position of display settings to match ULS
Bug: 47822
Change-Id: I7b04a831b2c5d7932564a3cdde94be0e233f7a7b
2013-05-16 09:48:44 +00:00