[MediaWiki-commits] [Gerrit] mediawiki...EducationProgram[master]: ViewCourseAction: Responsive design
Mollgear has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/371628 ) Change subject: ViewCourseAction: Responsive design .. ViewCourseAction: Responsive design This is a work-in-progress commit. It breaks the "Add student" input text field and changes the EN locales only. The goal is to have most elements at the same width and shrink with to a (mobile) minimum. The summary and student sections don't really need the toggle feature because they are at the end the page with no content below. The help text was slightly missleading about adding a list of students; the list has to be comma (not space) separated. Ideally new students could be directly added at the student list rather than having a whole dedicated section. This is not implemente in the current version of this patch. Change-Id: Id826ebc6130b5d2499ef1e6753f86d0c1172be0f --- M i18n/en.json M includes/actions/ViewCourseAction.php M resources/ep.addstudents.css M resources/ep.addstudents.js 4 files changed, 13 insertions(+), 96 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/EducationProgram refs/changes/28/371628/1 diff --git a/i18n/en.json b/i18n/en.json index 3732853..b5b78d3 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -348,7 +348,7 @@ "ep-editcourse": "You are editing an existing course.", "ep-editcourse-exists-already": "This course already exists. You are editing it.", "ep-addstudents-section": "Add students to this course", - "ep-addstudents-instructions": "Type the usernames of the students you want to add. Press Enter after each one, or click on the menu that appears. You can also paste a list of usernames.\n\nClick \"{{int:ep-addstudents-btn}}\" when you're done.", + "ep-addstudents-instructions": "Type the usernames of the students you want to add. Press Enter after each one, or click on the menu that appears. You can also paste a list of comma separated usernames.\n\nClick \"{{int:ep-addstudents-btn}}\" when you're done.", "ep-addstudents-url-instructions": "Note that students may also add themselves by opening this link in their web browsers:", "ep-addstudents-invalid-users": "{{PLURAL:$1|This {{GENDER:$2|user}} doesn't|These users don't}} exist: $2.", "ep-addstudents-btn": "Add", @@ -387,7 +387,7 @@ "ep-vieworg-deleted": "This institution has been deleted. The deletion log for the institution is provided below for reference.", "ep-course-title": "Course: $1", "ep-course-students": "Students", - "ep-course-summary-students": "Summary and students", + "ep-course-summary": "Summary", "ep-course-articles": "Articles", "viewcourseaction-none": "There is no course with name \"$1\". See the [[Special:Courses|list of courses]].", "ep-course-create": "There is no course with name \"$1\", but you can create a new one.", diff --git a/includes/actions/ViewCourseAction.php b/includes/actions/ViewCourseAction.php index 89b2b1b..b95a606 100644 --- a/includes/actions/ViewCourseAction.php +++ b/includes/actions/ViewCourseAction.php @@ -122,9 +122,7 @@ $studentIds = $course->getField( 'students' ); - if ( !empty( $studentIds ) ) { - $wikiText .= "\n" . '==' . $this->msg( 'ep-course-summary-students' )->text() . '=='; - } + $wikiText .= "\n" . '==' . $this->msg( 'ep-course-summary' )->text() . '=='; $html .= $this->getOutput()->parse( $wikiText ); @@ -310,28 +308,13 @@ // add the required client-side module $this->getOutput()->addModules( 'ep.addstudents' ); - // Are we here following a page reload due to adding students? - // Check by looking at URl params. If so, controls start out - // expanded. Otherwise, they start out collapsed. - $queryVals = $this->getContext()->getRequest()->getQueryValues(); - - if ( isset( $queryVals['studentsadded'] ) - || isset( $queryVals['alreadyenrolled'] ) - ) { - $collapsedClassStr = ''; - $expandMsg = $this->msg( 'collapsible-collapse' )->text(); - } else { - $collapsedClassStr = ' mw-collapsed'; - $expandMsg = $this->msg( 'collapsible-expand' )->text(); - } - // open outer div $html = Html::openElement( 'div', [ 'class' => 'ep-addstudents-area' ] ); - // open div for headline and expand/collapse link + // open div for headline $html .= Html::openElement( 'div', [ 'class' => 'ep-addstudents-headline-area' ]
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Making the default toggle look clickable again
Mollgear has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/355874 ) Change subject: Making the default toggle look clickable again .. Making the default toggle look clickable again The toggle should now look same same prior to the premade toggle changes. The brackets are not part of the link, but the text inbetween. The link has no href property, so the toggle action is still triggered. Bug: T166359 Change-Id: I38698cd66d380626728eae9b8a9da1e465b207a6 --- M resources/src/jquery/jquery.makeCollapsible.js 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/74/355874/1 diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index ac4a392..5ce9b1f 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -262,7 +262,7 @@ // Default toggle link. Only build it when needed to avoid jQuery memory leaks (event data). buildDefaultToggleLink = function () { - return $( '' ) + return $( '' ) .text( collapseText ) .wrap( '' ).parent() .attr( { -- To view, visit https://gerrit.wikimedia.org/r/355874 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I38698cd66d380626728eae9b8a9da1e465b207a6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: master Gerrit-Owner: Mollgear___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Allow more customization on the default toggle system
Mollgear has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/346747 ) Change subject: Allow more customization on the default toggle system .. Allow more customization on the default toggle system The naming convention remained unchanged (default = mw-collapsible-toggle / premade = mw-customtoggle). Despite this mw-collapsible-toggle elements can now also be used in wiki code. - The default toggle, that is created if no toggle is present, is less rigid - Allows more than one default toggle element at a time (e.g. header + button) - Use the MW expand/collapse messages on any default toggle (via mw-collapsible-text) - Does not break/deprecate premade toggles (mw-customtoggle) - Removed the linksPassthru option in order to merge premadeToggleHandler into actionHandler and because the behaviour is not suited as default (better done with HMTL/CSS) - Removed mw-collapsible-bracket because it was not used and is deprecated by mw-collapsible-text Change-Id: Ic8627c4c185e8e4175e6fef1c8e1c2190e54edaa Disclaimer: Premade toggles still cannot be mixed/combined with default toggles. --- M resources/src/jquery/jquery.makeCollapsible.js 1 file changed, 11 insertions(+), 38 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core refs/changes/47/346747/1 diff --git a/resources/src/jquery/jquery.makeCollapsible.js b/resources/src/jquery/jquery.makeCollapsible.js index 7296811..c32677e 100644 --- a/resources/src/jquery/jquery.makeCollapsible.js +++ b/resources/src/jquery/jquery.makeCollapsible.js @@ -35,12 +35,6 @@ if ( $defaultToggle === undefined ) { $defaultToggle = null; } - if ( $defaultToggle !== null && !$defaultToggle.jquery ) { - // is optional (may be undefined), but if defined it must be an instance of jQuery. - // If it's not, abort right away. - // After this $defaultToggle is either null or a valid jQuery instance. - return; - } // Trigger a custom event to allow callers to hook to the collapsing/expanding, // allowing the module to be testable, and making it possible to @@ -156,16 +150,7 @@ options = options || {}; if ( e ) { - if ( - e.type === 'click' && - options.linksPassthru && - e.target.nodeName.toLowerCase() === 'a' && - $( e.target ).attr( 'href' ) && - $( e.target ).attr( 'href' ) !== '#' - ) { - // Don't fire if a link with href !== '#' was clicked, if requested (for premade togglers by default) - return; - } else if ( e.type === 'keypress' && e.which !== 13 && e.which !== 32 ) { + if ( e.type === 'keypress' && e.which !== 13 && e.which !== 32 ) { // Only handle keypresses on the "Enter" or "Space" keys return; } else { @@ -191,16 +176,15 @@ .toggleClass( 'mw-collapsible-toggle-expanded', wasCollapsed ); } - // Toggle the text ("Show"/"Hide"), if requested (for default togglers by default) + // Toggle the text ("Show"/"Hide") within elements tagged with mw-collapsible-text if ( options.toggleText ) { collapseText = options.toggleText.collapseText; expandText = options.toggleText.expandText; - $textContainer = $toggle.find( '> a' ); - if ( !$textContainer.length ) { - $textContainer = $toggle; + $textContainer = $collapsible.find( '.mw-collapsible-text' ); + if ( $textContainer.length ) { + $textContainer.text( wasCollapsed ? collapseText : expandText ); } - $textContainer.text( wasCollapsed ? collapseText : expandText ); } // And finally toggle the element state itself @@ -242,7 +226,7 @@ this.each( function () { var $collapsible, collapseText, expandText, $caption, $toggle, actionHandler, buildDefaultToggleLink, - premadeToggleHandler, $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval; + $toggleLink, $firstItem, collapsibleId, $customTogglers, firstval; // Ensure class "mw-collapsible" is present in case .makeCollapsible()