MDL-66770 mod_forum: move permalink into menu in modern display
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
||||
define ("mod_forum/inpage_reply",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors"],function(a,b,c,d,f){var g={MODERN:4,THREADED:2,NESTED:3,FLAT_OLDEST_FIRST:1,FLAT_NEWEST_FIRST:-1},h={POST_CREATED:"mod_forum-post-created"},i={MOODLE:0},j=function(a){var b=a.find(f.post.inpageSubmitBtnText),c=a.find(f.post.loadingIconContainer),d=a.outerWidth();a.css("width",d);b.addClass("hidden");c.removeClass("hidden")},k=function(a){var b=a.find(f.post.inpageSubmitBtnText),c=a.find(f.post.loadingIconContainer);a.css("width","");b.removeClass("hidden");c.addClass("hidden")},l=function(l){l.on("click",f.post.inpageSubmitBtn,function(m){m.preventDefault();var e=a(m.currentTarget),n=e.parent().find(f.post.inpageReplyButton),o=e.parents(f.post.inpageReplyForm).get(0),p=o.elements.post.value.trim(),q=i.MOODLE,r=o.elements.reply.value,s=o.elements.subject.value,t=e.closest(f.post.post),u=o.elements.privatereply!=void 0?o.elements.privatereply.checked:!1,v=l.find(f.post.modeSelect),w=v.length?parseInt(v.get(0).value):null,x;if(p.length){j(e);n.prop("disabled",!0);d.addDiscussionPost(r,s,p,q,u,!0).then(function(a){var b=a.messages.reduce(function(a,b){if("success"==b.type){a+="<p>"+b.message+"</p>"}return a},"");c.addNotification({message:b,type:"success"});return a}).then(function(a){o.reset();var c=a.post;x=c.id;switch(w){case g.MODERN:var d=c.capabilities;c.showactionmenu=d.controlreadstatus||d.edit||d.split||d.delete||d.export||c.urls.viewparent;return b.render("mod_forum/forum_discussion_modern_post_reply",c);case g.THREADED:return b.render("mod_forum/forum_discussion_threaded_post",c);case g.NESTED:return b.render("mod_forum/forum_discussion_nested_post",c);default:return b.render("mod_forum/forum_discussion_post",c);}}).then(function(a,c){var d=t.find(f.post.repliesContainer).first();if(w==g.FLAT_NEWEST_FIRST){return b.prependNodeContents(d,a,c)}else{return b.appendNodeContents(d,a,c)}}).then(function(){e.trigger(h.POST_CREATED,x);k(e);n.prop("disabled",!1);return t.find(f.post.inpageReplyContent).hide()}).then(function(){location.href="#p"+x}).catch(function(a){k(e);n.prop("disabled",!1);return c.exception(a)})}})};return{init:function init(a){l(a)},CONTENT_FORMATS:i,EVENTS:h}});
|
||||
define ("mod_forum/inpage_reply",["jquery","core/templates","core/notification","mod_forum/repository","mod_forum/selectors"],function(a,b,c,d,f){var g={MODERN:4,THREADED:2,NESTED:3,FLAT_OLDEST_FIRST:1,FLAT_NEWEST_FIRST:-1},h={POST_CREATED:"mod_forum-post-created"},i={MOODLE:0},j=function(a){var b=a.find(f.post.inpageSubmitBtnText),c=a.find(f.post.loadingIconContainer),d=a.outerWidth();a.css("width",d);b.addClass("hidden");c.removeClass("hidden")},k=function(a){var b=a.find(f.post.inpageSubmitBtnText),c=a.find(f.post.loadingIconContainer);a.css("width","");b.removeClass("hidden");c.addClass("hidden")},l=function(l){l.on("click",f.post.inpageSubmitBtn,function(m){m.preventDefault();var e=a(m.currentTarget),n=e.parent().find(f.post.inpageReplyButton),o=e.parents(f.post.inpageReplyForm).get(0),p=o.elements.post.value.trim(),q=i.MOODLE,r=o.elements.reply.value,s=o.elements.subject.value,t=e.closest(f.post.post),u=o.elements.privatereply!=void 0?o.elements.privatereply.checked:!1,v=l.find(f.post.modeSelect),w=v.length?parseInt(v.get(0).value):null,x;if(p.length){j(e);n.prop("disabled",!0);d.addDiscussionPost(r,s,p,q,u,!0).then(function(a){var b=a.messages.reduce(function(a,b){if("success"==b.type){a+="<p>"+b.message+"</p>"}return a},"");c.addNotification({message:b,type:"success"});return a}).then(function(a){o.reset();var c=a.post;x=c.id;switch(w){case g.MODERN:var d=c.capabilities,e=t.children().not(f.post.repliesContainer).find(f.post.authorName).text();c.parentauthorname=e;c.showactionmenu=d.view||d.controlreadstatus||d.edit||d.split||d.delete||d.export||c.urls.viewparent;return b.render("mod_forum/forum_discussion_modern_post_reply",c);case g.THREADED:return b.render("mod_forum/forum_discussion_threaded_post",c);case g.NESTED:return b.render("mod_forum/forum_discussion_nested_post",c);default:return b.render("mod_forum/forum_discussion_post",c);}}).then(function(a,c){var d=t.find(f.post.repliesContainer).first();if(w==g.FLAT_NEWEST_FIRST){return b.prependNodeContents(d,a,c)}else{return b.appendNodeContents(d,a,c)}}).then(function(){e.trigger(h.POST_CREATED,x);k(e);n.prop("disabled",!1);return t.find(f.post.inpageReplyContent).hide()}).then(function(){location.href="#p"+x}).catch(function(a){k(e);n.prop("disabled",!1);return c.exception(a)})}})};return{init:function init(a){l(a)},CONTENT_FORMATS:i,EVENTS:h}});
|
||||
//# sourceMappingURL=inpage_reply.min.js.map
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -135,7 +135,13 @@ define([
|
||||
switch (mode) {
|
||||
case DISPLAYCONSTANTS.MODERN:
|
||||
var capabilities = post.capabilities;
|
||||
post.showactionmenu = capabilities.controlreadstatus ||
|
||||
var currentAuthorName = currentRoot.children()
|
||||
.not(Selectors.post.repliesContainer)
|
||||
.find(Selectors.post.authorName)
|
||||
.text();
|
||||
post.parentauthorname = currentAuthorName;
|
||||
post.showactionmenu = capabilities.view ||
|
||||
capabilities.controlreadstatus ||
|
||||
capabilities.edit ||
|
||||
capabilities.split ||
|
||||
capabilities.delete ||
|
||||
|
||||
@@ -229,7 +229,8 @@ class renderer {
|
||||
}
|
||||
|
||||
if ($displaymode === FORUM_MODE_MODERN) {
|
||||
$exportedpost->showactionmenu = $exportedpost->capabilities['controlreadstatus'] ||
|
||||
$exportedpost->showactionmenu = $exportedpost->capabilities['view'] ||
|
||||
$exportedpost->capabilities['controlreadstatus'] ||
|
||||
$exportedpost->capabilities['edit'] ||
|
||||
$exportedpost->capabilities['split'] ||
|
||||
$exportedpost->capabilities['delete'] ||
|
||||
|
||||
@@ -137,16 +137,6 @@
|
||||
{{/author.groups}}
|
||||
|
||||
{{^readonly}}
|
||||
{{#capabilities.view}}
|
||||
<a
|
||||
href="{{{urls.view}}}"
|
||||
class="d-inline-block mr-1 icon-no-margin"
|
||||
title="{{#str}} permanentlinktopost, mod_forum {{/str}}"
|
||||
>
|
||||
{{#pix}} e/insert_edit_link, core {{/pix}}
|
||||
</a>
|
||||
{{/capabilities.view}}
|
||||
|
||||
{{#showactionmenu}}
|
||||
<div class="dropdown">
|
||||
<button
|
||||
@@ -163,6 +153,15 @@
|
||||
<!-- inline style to fix RTL placement bug -->
|
||||
<div class="dropdown-menu dropdown-menu-right rounded-lg shadow border-0" aria-labelledby="post-actions-menu-{{uniqid}}" style="right: auto">
|
||||
{{#capabilities}}
|
||||
{{#view}}
|
||||
<a
|
||||
href="{{{urls.view}}}"
|
||||
class="dropdown-item"
|
||||
role="menuitem"
|
||||
>
|
||||
{{#str}} permalink, mod_forum {{/str}}
|
||||
</a>
|
||||
{{/view}}
|
||||
{{#controlreadstatus}}
|
||||
{{#unread}}
|
||||
<a
|
||||
|
||||
Reference in New Issue
Block a user