mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-66481 mod_forum: Move timed discussion indicator
* Move it under the discussion column. * Change it to look like a label * Plus limit the group name to 15 characters * Plus some accessibility fixes: - Add labels to column headings. - Set discussion name as a row heading.
This commit is contained in:
parent
1a9e5cb230
commit
a78070aa1b
2
mod/forum/amd/build/discussion_list.min.js
vendored
2
mod/forum/amd/build/discussion_list.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("mod_forum/discussion_list",["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository","core/pubsub","mod_forum/forum_events"],function(a,b,c,d,e,f,g,h,i){var j=function(e){h.subscribe(i.SUBSCRIPTION_TOGGLED,function(b){var c=b.discussionId,d=b.subscriptionState,e=a(f.discussion.item+"[data-discussionid= "+c+"] "+f.discussion.subscribedLabel);if(d){e.removeAttr("hidden")}else{e.attr("hidden",!0)}});e.on("click",f.favourite.toggle,function(){var b=a(this),c=b.data("forumid"),e=b.data("discussionid"),f=b.data("targetstate");g.setFavouriteDiscussionState(c,e,f).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.pin.toggle,function(b){b.preventDefault();var c=a(this),e=c.data("forumid"),f=c.data("discussionid"),h=c.data("targetstate");g.setPinDiscussionState(e,f,h).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.lock.toggle,function(h){var e=a(this),i=e.data("forumid"),j=e.data("discussionid"),k=e.data("state");g.setDiscussionLockState(i,j,k).then(function(a){var b=e.parents(f.summary.actions).find(f.lock.icon),c=e.parents(f.discussion.item).find(f.discussion.lockedLabel);if(a.locked){b.removeClass("hidden");c.removeAttr("hidden")}else{b.addClass("hidden");c.attr("hidden",!0)}return a}).then(function(a){a.forumid=i;return b.render("mod_forum/discussion_lock_toggle",a)}).then(function(a,c){return b.replaceNode(e,a,c)}).then(function(){return c.get_string("lockupdated","forum").done(function(a){return d.addNotification({message:a,type:"info"})})}).catch(d.exception);h.preventDefault()})};return{init:function init(a){e.init(a);j(a)}}});
|
||||
define ("mod_forum/discussion_list",["jquery","core/templates","core/str","core/notification","mod_forum/subscription_toggle","mod_forum/selectors","mod_forum/repository","core/pubsub","mod_forum/forum_events"],function(a,b,c,d,e,f,g,h,i){var j=function(e){h.subscribe(i.SUBSCRIPTION_TOGGLED,function(b){var c=b.discussionId,d=b.subscriptionState,e=a(f.discussion.item+"[data-discussionid= "+c+"] "+f.discussion.subscribedLabel);if(d){e.removeAttr("hidden")}else{e.attr("hidden",!0)}});e.on("click",f.favourite.toggle,function(){var b=a(this),c=b.data("forumid"),e=b.data("discussionid"),f=b.data("targetstate");g.setFavouriteDiscussionState(c,e,f).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.pin.toggle,function(b){b.preventDefault();var c=a(this),e=c.data("forumid"),f=c.data("discussionid"),h=c.data("targetstate");g.setPinDiscussionState(e,f,h).then(function(){return location.reload()}).catch(d.exception)});e.on("click",f.lock.toggle,function(h){var e=a(this),i=e.data("forumid"),j=e.data("discussionid"),k=e.data("state");g.setDiscussionLockState(i,j,k).then(function(a){var b=e.parents(f.summary.actions).find(f.lock.icon),c=e.parents(f.discussion.item).find(f.discussion.lockedLabel);if(a.locked){b.removeClass("hidden");c.removeAttr("hidden")}else{b.addClass("hidden");c.attr("hidden",!0)}return a}).then(function(a){a.forumid=i;return b.render("mod_forum/discussion_lock_toggle",a)}).then(function(a,c){return b.replaceNode(e,a,c)}).then(function(){return c.get_string("lockupdated","forum").done(function(a){return d.addNotification({message:a,type:"info"})})}).catch(d.exception);h.preventDefault()});e.on("click",f.discussion.timedLabel,function(a){a.preventDefault()})};return{init:function init(a){e.init(a);j(a)}}});
|
||||
//# sourceMappingURL=discussion_list.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
2
mod/forum/amd/build/selectors.min.js
vendored
2
mod/forum/amd/build/selectors.min.js
vendored
@ -1,2 +1,2 @@
|
||||
define ("mod_forum/selectors",[],function(){return{subscription:{toggle:"[data-type='subscription-toggle'][data-action='toggle']"},summary:{actions:"[data-container='discussion-summary-actions']"},post:{post:"[data-region=\"post\"]",action:"[data-region=\"post-action\"]",actionsContainer:"[data-region=\"post-actions-container\"]",authorName:"[data-region=\"author-name\"]",forumCoreContent:"[data-region-content='forum-post-core']",forumContent:"[data-content='forum-post']",forumSubject:"[data-region-content='forum-post-core-subject']",inpageReplyButton:"button",inpageReplyLink:"[data-action='collapsible-link']",inpageReplyCancelButton:"[data-action='cancel-inpage-reply']",inpageReplyCreateButton:"[data-action='create-inpage-reply']",inpageReplyContainer:"[data-region=\"inpage-reply-container\"]",inpageReplyContent:"[data-content='inpage-reply-content']",inpageReplyForm:"form[data-content='inpage-reply-form']",inpageSubmitBtn:"[data-action='forum-inpage-submit']",inpageSubmitBtnText:"[data-region='submit-text']",loadingIconContainer:"[data-region='loading-icon-container']",repliesContainer:"[data-region='replies-container']",replyCount:"[data-region=\"reply-count\"]",modeSelect:"select[name='mode']",showReplies:"[data-action=\"show-replies\"]",hideReplies:"[data-action=\"hide-replies\"]",repliesVisibilityToggleContainer:"[data-region=\"replies-visibility-toggle-container\"]"},lock:{toggle:"[data-action='toggle'][data-type='lock-toggle']",icon:"[data-region='locked-icon']"},favourite:{toggle:"[data-type='favorite-toggle'][data-action='toggle']"},pin:{toggle:"[data-type='pin-toggle'][data-action='toggle']"},discussion:{tools:"[data-container=\"discussion-tools\"]",item:"[data-region=\"discussion-list-item\"]",lockedLabel:"[data-region='locked-label']",subscribedLabel:"[data-region='subscribed-label']"}}});
|
||||
define ("mod_forum/selectors",[],function(){return{subscription:{toggle:"[data-type='subscription-toggle'][data-action='toggle']"},summary:{actions:"[data-container='discussion-summary-actions']"},post:{post:"[data-region=\"post\"]",action:"[data-region=\"post-action\"]",actionsContainer:"[data-region=\"post-actions-container\"]",authorName:"[data-region=\"author-name\"]",forumCoreContent:"[data-region-content='forum-post-core']",forumContent:"[data-content='forum-post']",forumSubject:"[data-region-content='forum-post-core-subject']",inpageReplyButton:"button",inpageReplyLink:"[data-action='collapsible-link']",inpageReplyCancelButton:"[data-action='cancel-inpage-reply']",inpageReplyCreateButton:"[data-action='create-inpage-reply']",inpageReplyContainer:"[data-region=\"inpage-reply-container\"]",inpageReplyContent:"[data-content='inpage-reply-content']",inpageReplyForm:"form[data-content='inpage-reply-form']",inpageSubmitBtn:"[data-action='forum-inpage-submit']",inpageSubmitBtnText:"[data-region='submit-text']",loadingIconContainer:"[data-region='loading-icon-container']",repliesContainer:"[data-region='replies-container']",replyCount:"[data-region=\"reply-count\"]",modeSelect:"select[name='mode']",showReplies:"[data-action=\"show-replies\"]",hideReplies:"[data-action=\"hide-replies\"]",repliesVisibilityToggleContainer:"[data-region=\"replies-visibility-toggle-container\"]"},lock:{toggle:"[data-action='toggle'][data-type='lock-toggle']",icon:"[data-region='locked-icon']"},favourite:{toggle:"[data-type='favorite-toggle'][data-action='toggle']"},pin:{toggle:"[data-type='pin-toggle'][data-action='toggle']"},discussion:{tools:"[data-container=\"discussion-tools\"]",item:"[data-region=\"discussion-list-item\"]",lockedLabel:"[data-region='locked-label']",subscribedLabel:"[data-region='subscribed-label']",timedLabel:"[data-region='timed-label']"}}});
|
||||
//# sourceMappingURL=selectors.min.js.map
|
||||
|
File diff suppressed because one or more lines are too long
@ -119,6 +119,11 @@ define([
|
||||
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
root.on('click', Selectors.discussion.timedLabel, function(e) {
|
||||
// Prevent clicking on the timed discussion label from causing the page to jump.
|
||||
e.preventDefault();
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
|
@ -69,6 +69,7 @@ define([], function() {
|
||||
item: '[data-region="discussion-list-item"]',
|
||||
lockedLabel: "[data-region='locked-label']",
|
||||
subscribedLabel: "[data-region='subscribed-label']",
|
||||
timedLabel: "[data-region='timed-label']",
|
||||
},
|
||||
};
|
||||
});
|
||||
|
@ -191,10 +191,12 @@ $string['discussionunpin'] = 'Unpin';
|
||||
$string['discussthistopic'] = 'Discuss this topic';
|
||||
$string['displayend'] = 'Display end';
|
||||
$string['displayend_help'] = 'This setting specifies whether a forum post should be hidden after a certain date. Note that administrators can always view forum posts.';
|
||||
$string['displayenddate'] = 'Display end: {$a}.';
|
||||
$string['displaymode'] = 'Display mode';
|
||||
$string['displayperiod'] = 'Display period';
|
||||
$string['displaystart'] = 'Display start';
|
||||
$string['displaystart_help'] = 'This setting specifies whether a forum post should be displayed from a certain date. Note that administrators can always view forum posts.';
|
||||
$string['displaystartdate'] = 'Display start: {$a}.';
|
||||
$string['displaywordcount'] = 'Display word count';
|
||||
$string['displaywordcount_help'] = 'This setting specifies whether the word count of each post should be displayed or not.';
|
||||
$string['duedate'] = 'Due date';
|
||||
@ -637,6 +639,8 @@ $string['tagsdeleted'] = 'Forum tags have been deleted';
|
||||
$string['thisforumisthrottled'] = 'This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at {$a->blockafter} posting(s) in {$a->blockperiod}';
|
||||
$string['thisforumisdue'] = 'The due date for posting to this forum was {$a}.';
|
||||
$string['thisforumhasduedate'] = 'The due date for posting to this forum is {$a}.';
|
||||
$string['timed'] = 'Timed';
|
||||
$string['timeddiscussion'] = 'Timed discussion';
|
||||
$string['timedhidden'] = 'Timed status: Hidden from students';
|
||||
$string['timedposts'] = 'Timed posts';
|
||||
$string['timedvisible'] = 'Timed status: Visible to all users';
|
||||
|
@ -80,14 +80,16 @@
|
||||
{{$discussion_list_header}}
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"> </th>
|
||||
<th scope="col" class="p-l-0">{{#str}}discussion, mod_forum{{/str}}</th>
|
||||
<th scope="col" class="author">
|
||||
{{#str}}startedby, mod_forum{{/str}}
|
||||
<th scope="col">
|
||||
<span class="accesshide">{{#str}}status{{/str}}</span>
|
||||
</th>
|
||||
<th scope="col" class="p-l-0">{{#str}}discussion, mod_forum{{/str}}</th>
|
||||
{{#forum.state.groupmode}}
|
||||
<th scope="col" class="group">{{#str}}group{{/str}}</th>
|
||||
{{/forum.state.groupmode}}
|
||||
<th scope="col" class="author">
|
||||
{{#str}}startedby, mod_forum{{/str}}
|
||||
</th>
|
||||
<th scope="col" class="lastpost">
|
||||
{{#state.sortorder.islastpostdesc}}
|
||||
<a href="{{{forum.urls.sortlastpostasc}}}" aria-label="{{#str}}discussionlistsortbylastpostasc, mod_forum{{/str}}">{{#str}}lastpost, mod_forum{{/str}}</a> <span class="text-primary">{{#pix}}t/downlong, core, {{#str}}desc, core{{/str}}{{/pix}}</span>
|
||||
@ -119,8 +121,9 @@
|
||||
{{/forum.userstate.tracked}}
|
||||
</th>
|
||||
{{/forum.capabilities.viewdiscussions}}
|
||||
<th scope="col"> </th>
|
||||
<th scope="col" class="discussionsubscription"></th>
|
||||
<th scope="col" class="discussionsubscription">
|
||||
<span class="accesshide">{{#str}}actions{{/str}}</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{{/discussion_list_header}}
|
||||
@ -142,17 +145,47 @@
|
||||
{{/discussion}}
|
||||
{{/discussion.pinned}}
|
||||
</td>
|
||||
<td class="topic p-0 align-middle">
|
||||
<th scope="row" class="topic p-0 align-middle">
|
||||
<div class="p-3 p-l-0">
|
||||
<a class="w-100 h-100 d-block" href="{{discussion.urls.view}}" title="{{discussion.name}}" aria-label="{{discussion.name}}">
|
||||
<strong>{{#shortentext}}72, {{{discussion.name}}}{{/shortentext}}</strong>
|
||||
{{#shortentext}}72, {{{discussion.name}}}{{/shortentext}}
|
||||
</a>
|
||||
<div>
|
||||
<span class="badge badge-danger rounded" data-region="locked-label" {{^discussion.locked}}hidden{{/discussion.locked}}>{{#str}}locked, forum{{/str}}</span>
|
||||
<span class="badge badge-light rounded" data-region="subscribed-label" {{^discussion.userstate.subscribed}}hidden{{/discussion.userstate.subscribed}}>{{#str}}subscribed, forum{{/str}}</span>
|
||||
<span class="badge badge-danger rounded" data-region="locked-label" {{^discussion.locked}}hidden{{/discussion.locked}}>
|
||||
{{#str}}locked, forum{{/str}}
|
||||
</span>
|
||||
<span class="badge badge-light rounded" data-region="subscribed-label" {{^discussion.userstate.subscribed}}hidden{{/discussion.userstate.subscribed}}>
|
||||
{{#str}}subscribed, forum{{/str}}
|
||||
</span>
|
||||
{{#discussion.timed.istimed}}
|
||||
<a href="#" role="button" class="badge badge-primary rounded" data-region="timed-label"
|
||||
data-toggle="popover" data-container="body" data-placement="right" data-html="true"
|
||||
data-content='{{#discussion.timed}}{{#discussion.times}}{{> mod_forum/discussion_times}}{{/discussion.times}}{{/discussion.timed}}'
|
||||
data-trigger="click" aria-label="{{#str}}timeddiscussion, forum{{/str}}" title="{{#str}}timeddiscussion, forum{{/str}}">
|
||||
{{#str}}timed, forum{{/str}}
|
||||
</a>
|
||||
{{/discussion.timed.istimed}}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</th>
|
||||
{{#forum.state.groupmode}}
|
||||
<td class="group align-middle">
|
||||
{{#discussion.group}}
|
||||
<img alt="{{#str}} pictureof, core, {{name}} {{/str}}"
|
||||
class="border rounded h-auto rounded-circle grouppicture"
|
||||
src="{{{urls.picture}}}"
|
||||
title="{{#str}} pictureof, core, {{name}} {{/str}}">
|
||||
{{#urls.userlist}}
|
||||
<a href="{{{urls.userlist}}}" role="button" aria-label='{{#str}} memberofgroup, group, {{name}}{{/str}}'>
|
||||
{{#shortentext}}15, {{name}}{{/shortentext}}
|
||||
</a>
|
||||
{{/urls.userlist}}
|
||||
{{^urls.userlist}}
|
||||
<span>{{name}}</span>
|
||||
{{/urls.userlist}}
|
||||
{{/discussion.group}}
|
||||
</td>
|
||||
{{/forum.state.groupmode}}
|
||||
<td class="author align-middle">
|
||||
{{#firstpostauthor}}
|
||||
<div class="d-flex flex-row">
|
||||
@ -170,24 +203,6 @@
|
||||
</div>
|
||||
{{/firstpostauthor}}
|
||||
</td>
|
||||
{{#forum.state.groupmode}}
|
||||
<td class="group align-middle">
|
||||
{{#discussion.group}}
|
||||
<img alt="{{#str}} pictureof, core, {{name}} {{/str}}"
|
||||
class="border rounded h-auto rounded-circle grouppicture"
|
||||
src="{{{urls.picture}}}"
|
||||
title="{{#str}} pictureof, core, {{name}} {{/str}}">
|
||||
{{#urls.userlist}}
|
||||
<a href="{{{urls.userlist}}}" role="button" aria-label='{{#str}} memberofgroup, group, {{name}}{{/str}}'>
|
||||
{{name}}
|
||||
</a>
|
||||
{{/urls.userlist}}
|
||||
{{^urls.userlist}}
|
||||
<span>{{name}}</span>
|
||||
{{/urls.userlist}}
|
||||
{{/discussion.group}}
|
||||
</td>
|
||||
{{/forum.state.groupmode}}
|
||||
<td class="text-left align-middle">
|
||||
{{! TODO Check q&a, eachuser }}
|
||||
{{#latestpostid}}
|
||||
@ -214,27 +229,6 @@
|
||||
{{/forum.userstate.tracked}}
|
||||
</td>
|
||||
{{/forum.capabilities.viewdiscussions}}
|
||||
<td class="timed p-0 text-center align-middle">
|
||||
{{#discussion.timed.istimed}}
|
||||
<div class="timedpost">
|
||||
{{#pix}}
|
||||
i/calendar, moodle,
|
||||
{{#discussion.times.start}}{{!
|
||||
}}{{#str}} displaystart, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}}strftimerecentfull {{/str}}{{/userdate}}
|
||||
{{/discussion.times.start}}
|
||||
{{#discussion.times.end}}{{!
|
||||
}}{{#str}} displayend, mod_forum {{/str}}: {{#userdate}}{{.}}, {{#str}} strftimerecentfull {{/str}}{{/userdate}}
|
||||
{{/discussion.times.end}}
|
||||
{{#discussion.timed.visible}}{{!
|
||||
}}{{#str}} timedvisible, mod_forum {{/str}}
|
||||
{{/discussion.timed.visible}}
|
||||
{{^discussion.timed.visible}}{{!
|
||||
}}{{#str}} timedhidden, mod_forum {{/str}}
|
||||
{{/discussion.timed.visible}}
|
||||
{{/pix}}
|
||||
</div>
|
||||
{{/discussion.timed.istimed}}
|
||||
</td>
|
||||
<td class="p-0 align-middle" data-container="discussion-summary-actions">
|
||||
{{#discussion}}
|
||||
<div class="d-flex flex-wrap justify-content-end pr-4">
|
||||
|
59
mod/forum/templates/discussion_times.mustache
Normal file
59
mod/forum/templates/discussion_times.mustache
Normal file
@ -0,0 +1,59 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template mod_forum/discussion_times
|
||||
|
||||
Template to display the discussion times.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* start int - The discussion start timestamp
|
||||
* end int - The discussion end timestamp
|
||||
* visible boolean - Whether the discussion is visible to students or not.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"start": 1,
|
||||
"end": 1,
|
||||
"visible": true
|
||||
}
|
||||
}}
|
||||
<ul>
|
||||
{{#start}}
|
||||
<li>
|
||||
{{#str}} displaystartdate, mod_forum, {{#userdate}}{{.}}, {{#str}}strftimerecentfull {{/str}}{{/userdate}} {{/str}}
|
||||
</li>
|
||||
{{/start}}
|
||||
{{#end}}
|
||||
<li>
|
||||
{{#str}} displayenddate, mod_forum, {{#userdate}}{{.}}, {{#str}}strftimerecentfull {{/str}}{{/userdate}} {{/str}}
|
||||
</li>
|
||||
{{/end}}
|
||||
<li>
|
||||
{{#visible}}
|
||||
{{#str}} timedvisible, mod_forum {{/str}}
|
||||
{{/visible}}
|
||||
{{^visible}}
|
||||
{{#str}} timedhidden, mod_forum {{/str}}
|
||||
{{/visible}}
|
||||
</li>
|
||||
</ul>
|
@ -37,12 +37,12 @@ Feature: Users can choose to set start and end time for display of their discuss
|
||||
And I follow "Test forum name"
|
||||
And I should see "Discussion 2 timed"
|
||||
And I should see "Discussion 3 timed"
|
||||
And ".timedpost" "css_element" should exist
|
||||
And "[data-region=timed-label]" "css_element" should exist
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
When I am on "Course 1" course homepage
|
||||
And I follow "Test forum name"
|
||||
Then I should see "Discussion 1"
|
||||
And I should not see "Discussion 2 timed"
|
||||
And ".timedpost" "css_element" should not exist
|
||||
And "[data-region=timed-label]" "css_element" should not exist
|
||||
And I should see "Discussion 3 timed"
|
||||
|
Loading…
x
Reference in New Issue
Block a user