In pageIssues.js:
- Consistently use the KEYWORD_ALL_SECTIONS symbol instead of hardcoding
the string, "all".
- Improve typing for allIssues.
- Wrap a long line.
Bug: T212371
Change-Id: I429fe37f88311c787e91946bb1438c6961eeeb5b
- Move page issue view components that do not modify the DOM during
during construction to PageIssueLearnMoreLink.js and PageIssueLink.js.
PascalCase is used optimistically for filenaming in the hopes that
these functions can become something like a JSX component. A "new"
function prefix is used in the meantime.
- Move page issue view logic that munges the existing DOM to
pageIssueFormatter.js. Substitute "create" prefixes for insert so that
clients won't forget that calling the function is a modify operation.
Alternative naming welcome but it shouldn't be confused with more
idealistic components that do not depend on DOM state for
construction.
- Consolidate createPageIssueBanner() and
createPageIssueBannerMultiple() into insertPageIssueBanner() as the
code was quite similar and were it a true component, it would probably
be a single component.
All new files appear under page/ to keep their distinction from the
overlay code clear.
Some view logic remains in pageIssues.js but it shall be difficult to
isolate.
Bug: T212376
Change-Id: Iccce709c34fa8de5a28a5a00098add5775e3dc9a
Replace all occurrences of `M.require( 'mobile.startup/pathToModule' )`
with `M.require( 'mobile.startup' ).pathToModule`. Where multiple
requires existed, add an intermediate variable,
`var mobile = M.require( 'mobile.startup' )`, and dot off that.
This changes improves the consistency of MinervaNeue which currently
contains a mix of require styles and eliminates any deprecated requires.
Bug: T208915
Change-Id: If14f280672d914d07275197100b12421bb217b67
* Add inline exceptions for global selectors
* Exception for $.animate in scrolling code
* Fix $ prefixing in search.js
* Fix repeated selectors in search.js & toc.js
* Disable no-parse-html-literal in tests
Change-Id: Id58fe11d1e09714501a378e4ca7ed9588f02f32d
This experiments with making PageIssuesOverlay an Overlay with
various options.
The appending of children is a little messy and points at a need
to standardise this some way
(see https://phabricator.wikimedia.org/T209647)
TODO:
* Remove the iconString property on PageIssueSummary which is no longer
needed
Bug: T209647
Change-Id: Iadd798a820dca6bbb31edc9a8570b6db7aac237a
Instead of having one large `createBanner` function, breaks down
that responsibility into three smaller functions:
- createPageIssueBanner
- createPageIssueBannerMultiple
- createPageIssueNotice
These functions represent issues in the new treatment, the
multiple-issues template, and the old treatment.
createBanner now delegates the creation of these banner types to these
new functions.
A new property to PageSummary, $el, has also been added. This allows us
to manipulate the issues DOM via the PageSummary object, instead of using
the `$metadata` variable in createBanner.
This approach to the page-issues DOM also solves the problem of
wrong or missing icons in T202349.
Bug: T211257, T202349
Change-Id: I50a2d8e3ae94913dc060ceedaaf1fa7e1756617f
* New feature/skin option is added and value is read inside
the pageIssues setup code
* issues-group-a class is added to page on server side to remove
the flash of unstyled content
* issues-group-A class is dropped (it's not doing anything!)
* The minerva-issues flag will now accept any value to avoid confusion.
It is used to override the default setting of wgMinervaPageIssuesNewTreatment
A note has been added that this can be removed in future.
Bug: T206179
Change-Id: I3d98fd8f8e1adc818ea03589d2c8f68fe991e861
Account for the fact that many wikis use `mbox-text-div` rather
than `mbox-text-span` and that the element might not be display
block/inline block
Bug: T206887
Change-Id: I6b3cee4339fc7ddb035a99fb4929b1ab67f22333
Note, since the page issues code is not feature flagged,
the new treatment will only be accessible via query
string until T206179 is taken care of.
Bug: T206178
Change-Id: I5ab2f3396e642f7b973263e2bb3963e0e82721b3
The extractMessage function has a lot to do with parsing - so this
and its tests are moved into the pageIssuesParser.
Change-Id: I62d79fbba166eff2c3ca573ef94ff86a269a7f9a
We have two type defs - IssueSummary and PageIssue.
I'd like to consolidate these two types by making
IssueSummary a combination of the two
Change-Id: Ic831b463fa66b0cacdd0b9b79aff741e55c0ec24
Separate the page issue grouping concern so that changes to parsing
don't concern everything else and vice-versa.
Bug: T203449, T202349
Change-Id: I7bddb0c53310805ece71b8f7821b1d6ce05cfae9
The page-issues reducer function that retrieves the severityLevels
for issues was incorrectly comparing two values in the multiple-issues
scenario.
Instead of comparing the severity of the current issue with the previous
value in the accumulator, it was comparing the current issue with the
previous issue in the original array, thus ignoring the
previous `maxSeverity` value in the accumulator.
Tests added and function refactored with more explicit variable names.
Bug: T203725
Change-Id: Ia4c15cbf0c2457d68a7381e8ed04c1a6b3ae65d1
Erroneously in I6fd55c35b9e2ce35894259f36d1a50fb5dca5e43 for the old treatment
we sent sectionNumbers for all issues in the page.
This is inconsistent with the issuesSeverity field above it
Add a clarifying inline comment.
Bug: T203050
Change-Id: Ib1fcda0c49a162cd7aca8ee8b3221236f724e1d7
createBanner was incorrectly always assigning the 'all' keyword
to the old page issues banner. Instead it should use the section
number in the function signature - as this decision of which issues
to show is made inside initPageIssues
For the old treatment, in the main namespace, we only show issues
in the lead section. When we use the 'all' keyword the visual is
the same, but it breaks the instrumentation requirement that
sectionNumbers and issuesSeverity should be the correct length
Note, for the talk and category pages treatment, we do not
log any events so the instrumentation doesn't matter here
and the 'all' keyword correctly targets all issues in the page
as before.
Bug: T203050
Change-Id: I63e45da05ca033fe282633f7fd59038a8e5d8c8d
When handling special cases that are logically distinct from
the function's main branch, it improves code quality (through
readability and maintainability) to place those first and with
an early return.
The has the benefit of the main return statement being easy to
find at the end of the function. (Not early and/or in a block).
It also means when working on the code, there is generally a
less complexity and fewer nesting levels, given that most code
is in the main branch. This makes is easier and quicker to verify
that code does what it should, as well as making it easy to
extend in the future. When considering to add code to end of a
function's main scope, it should relate to the function's main
branch by default, not a special case. For example, a getName()
method should not end with a top-level statement 'return false'
(unless it is a stub). Rather, one would expect it to end with
`return name`.
Change-Id: I1f3088f2409c82dd3bf757fc8fa27dc97ae2767b
"multiple issues" templates as one issue.
When logging the `issuesSeverity` and `sectionNumbers` field,
any issues that are part of a "multiple issues" template only send
one value.
Adds an `isMultiple` property to IssueSummary to determine which
issues are part of a multiple-issues template.
Bug: T203050
Change-Id: I7d55dfead72439df4accadcdc8623a080e1321c2
The value of `sectionNumbers` should be the section number of each issue
Not the number of the sections that have issues.
Bug: T203050
Change-Id: I6fd55c35b9e2ce35894259f36d1a50fb5dca5e43
Adds logging for the sectionNumbers field in the PageIssues schema.
Additional changes:
* createBanner now requires section number to be a string - this ensures
consistency with how these are used.
* fix a bug which meant createBanner was being called with undefined
section number (due to table of contents)
* Fix some indents in some JSDoc blocks
* Change parameter in function signature from mixed type (int or string)
to explicit string
* update schema number
Depends-On: Ia2696b86c6855d7b46a3f668585377d106d7af23
Bug: T202098
Change-Id: I20511a77258ea245f3d6fe93ade238e5df397a71
An event only needs to send this field when overriding the
default. This line is thus unnecessary.
Change-Id: Ia1dfcac5dd25f36f5f4169daf6535fd66aedf754
Move page issue overlay specific code out of cleanuptemplates and into
PageIssueOverlay to clarify what code is specific to the page issues
modal screen and what's specific to the page itself.
Bug: T191528
Change-Id: I95821ccda84306ddd5d22b57ffbae8d13ca44408
Rather than inventing its own page token the PageIssues
schema will rely on the standard page token.
In future when I9bb18d47e36d2d99d812e5b47ea9516d3dff3a16 is
merged this will mean that PageIssues and ReadingDepth have
consistent page tokens.
Bug: T201124
Change-Id: I19fea41e04cd792423ea9d41a673563418b69726
The CleanupOverlay is moved to Minerva and renamed the
IssuesOverlay to be consistent with current terminology
The new IssuesOverlay is defined inside the module
skins.minerva.scripts to which it now belongs.
Additional changes:
* various file renames
* overlay-cleanup renames overlay-issues
* cleanuptemplates renamed issues.js
* Add a test stub file to avoid the need to load templates inside
the test environment
After this change, I75f47622d94e504688e04dfb2892540473817053
should be merged to avoid confusion.
Change-Id: I08945a324a6b878abe56efed1e988466085b3018
2018-08-16 14:06:12 -07:00
Renamed from resources/skins.minerva.scripts/cleanuptemplates.js (Browse further)