diff --git a/mod/forum/amd/build/discussion_list.min.js b/mod/forum/amd/build/discussion_list.min.js index ed06505dc5b..730af0537b9 100644 --- a/mod/forum/amd/build/discussion_list.min.js +++ b/mod/forum/amd/build/discussion_list.min.js @@ -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(a){var b=a.discussionId,c=a.subscriptionState,d=e.find(f.discussion.item+"[data-discussionid= "+b+"] "+f.discussion.subscribedLabel);if(c){d.removeAttr("hidden")}else{d.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,!1,function(a,b){var d=a.attr("id"),e=b.userstate.subscribed?0:1;a.data("targetstate",e);var f=b.userstate.subscribed?"unsubscribediscussion":"subscribediscussion";return c.get_string(f,"mod_forum").then(function(b){a.closest("td").find("label[for=\""+d+"\"]").text(b);return b})});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(a){var b=a.discussionId,c=a.subscriptionState,d=e.find(f.discussion.item+"[data-discussionid= "+b+"]"),g=d.find(f.discussion.subscribedLabel);if(c){d.addClass("subscribed");g.removeAttr("hidden")}else{d.removeClass("subscribed");g.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,!1,function(a,b){var d=a.attr("id"),e=b.userstate.subscribed?0:1;a.data("targetstate",e);var f=b.userstate.subscribed?"unsubscribediscussion":"subscribediscussion";return c.get_string(f,"mod_forum").then(function(b){a.closest("td").find("label[for=\""+d+"\"]").text(b);return b})});j(a)}}}); //# sourceMappingURL=discussion_list.min.js.map diff --git a/mod/forum/amd/build/discussion_list.min.js.map b/mod/forum/amd/build/discussion_list.min.js.map index a2d9f13bc60..8da1ac03eaa 100644 --- a/mod/forum/amd/build/discussion_list.min.js.map +++ b/mod/forum/amd/build/discussion_list.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/discussion_list.js"],"names":["define","$","Templates","Str","Notification","SubscriptionToggle","Selectors","Repository","PubSub","ForumEvents","registerEventListeners","root","subscribe","SUBSCRIPTION_TOGGLED","data","discussionId","subscribed","subscriptionState","subscribedLabel","find","discussion","item","removeAttr","attr","on","favourite","toggle","toggleElement","forumId","setFavouriteDiscussionState","then","location","reload","catch","exception","pin","e","preventDefault","state","setPinDiscussionState","lock","setDiscussionLockState","context","icon","parents","summary","actions","lockedLabel","locked","removeClass","addClass","forumid","render","html","js","replaceNode","get_string","done","s","addNotification","message","type","init","toggleId","newTargetState","userstate","stringKey","string","closest","text"],"mappings":"AAuBAA,OAAM,6BAAC,CACH,QADG,CAEH,gBAFG,CAGH,UAHG,CAIH,mBAJG,CAKH,+BALG,CAMH,qBANG,CAOH,sBAPG,CAQH,aARG,CASH,wBATG,CAAD,CAUH,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQCC,CARD,CASCC,CATD,CAUD,CACE,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCH,CAAM,CAACI,SAAP,CAAiBH,CAAW,CAACI,oBAA7B,CAAmD,SAASC,CAAT,CAAe,IAC1DC,CAAAA,CAAY,CAAGD,CAAI,CAACC,YADsC,CAE1DC,CAAU,CAAGF,CAAI,CAACG,iBAFwC,CAG1DC,CAAe,CAAGP,CAAI,CAACQ,IAAL,CAAUb,CAAS,CAACc,UAAV,CAAqBC,IAArB,CAA4B,sBAA5B,CAAqDN,CAArD,CAAoE,IAApE,CAC1BT,CAAS,CAACc,UAAV,CAAqBF,eADL,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AA,CACV,CAJE,CAKV,CAXD,EAYAzD,CAAsB,CAACC,CAAD,CACzB,CAfE,CAiBV,CArHK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Module for the list of discussions on when viewing a forum.\n *\n * @module mod_forum/discussion_list\n * @package mod_forum\n * @copyright 2019 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/str',\n 'core/notification',\n 'mod_forum/subscription_toggle',\n 'mod_forum/selectors',\n 'mod_forum/repository',\n 'core/pubsub',\n 'mod_forum/forum_events',\n], function(\n $,\n Templates,\n Str,\n Notification,\n SubscriptionToggle,\n Selectors,\n Repository,\n PubSub,\n ForumEvents\n) {\n var registerEventListeners = function(root) {\n PubSub.subscribe(ForumEvents.SUBSCRIPTION_TOGGLED, function(data) {\n var discussionId = data.discussionId;\n var subscribed = data.subscriptionState;\n var subscribedLabel = root.find(Selectors.discussion.item + '[data-discussionid= ' + discussionId + '] '\n + Selectors.discussion.subscribedLabel);\n if (subscribed) {\n subscribedLabel.removeAttr('hidden');\n } else {\n subscribedLabel.attr('hidden', true);\n }\n });\n\n root.on('click', Selectors.favourite.toggle, function() {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var subscriptionState = toggleElement.data('targetstate');\n Repository.setFavouriteDiscussionState(forumId, discussionId, subscriptionState)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n });\n\n root.on('click', Selectors.pin.toggle, function(e) {\n e.preventDefault();\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('targetstate');\n Repository.setPinDiscussionState(forumId, discussionId, state)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n });\n\n root.on('click', Selectors.lock.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('state');\n\n Repository.setDiscussionLockState(forumId, discussionId, state)\n .then(function(context) {\n var icon = toggleElement.parents(Selectors.summary.actions).find(Selectors.lock.icon);\n var lockedLabel = toggleElement.parents(Selectors.discussion.item).find(Selectors.discussion.lockedLabel);\n if (context.locked) {\n icon.removeClass('hidden');\n lockedLabel.removeAttr('hidden');\n } else {\n icon.addClass('hidden');\n lockedLabel.attr('hidden', true);\n }\n return context;\n })\n .then(function(context) {\n context.forumid = forumId;\n return Templates.render('mod_forum/discussion_lock_toggle', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(toggleElement, html, js);\n })\n .then(function() {\n return Str.get_string('lockupdated', 'forum')\n .done(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n });\n })\n .catch(Notification.exception);\n\n e.preventDefault();\n });\n };\n\n return {\n init: function(root) {\n SubscriptionToggle.init(root, false, function(toggleElement, context) {\n var toggleId = toggleElement.attr('id');\n var newTargetState = context.userstate.subscribed ? 0 : 1;\n toggleElement.data('targetstate', newTargetState);\n\n var stringKey = context.userstate.subscribed ? 'unsubscribediscussion' : 'subscribediscussion';\n return Str.get_string(stringKey, 'mod_forum')\n .then(function(string) {\n toggleElement.closest('td').find('label[for=\"' + toggleId + '\"]').text(string);\n return string;\n });\n });\n registerEventListeners(root);\n }\n };\n});\n"],"file":"discussion_list.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/discussion_list.js"],"names":["define","$","Templates","Str","Notification","SubscriptionToggle","Selectors","Repository","PubSub","ForumEvents","registerEventListeners","root","subscribe","SUBSCRIPTION_TOGGLED","data","discussionId","subscribed","subscriptionState","discussionListItem","find","discussion","item","subscribedLabel","addClass","removeAttr","removeClass","attr","on","favourite","toggle","toggleElement","forumId","setFavouriteDiscussionState","then","location","reload","catch","exception","pin","e","preventDefault","state","setPinDiscussionState","lock","setDiscussionLockState","context","icon","parents","summary","actions","lockedLabel","locked","forumid","render","html","js","replaceNode","get_string","done","s","addNotification","message","type","init","toggleId","newTargetState","userstate","stringKey","string","closest","text"],"mappings":"AAuBAA,OAAM,6BAAC,CACH,QADG,CAEH,gBAFG,CAGH,UAHG,CAIH,mBAJG,CAKH,+BALG,CAMH,qBANG,CAOH,sBAPG,CAQH,aARG,CASH,wBATG,CAAD,CAUH,SACCC,CADD,CAECC,CAFD,CAGCC,CAHD,CAICC,CAJD,CAKCC,CALD,CAMCC,CAND,CAOCC,CAPD,CAQCC,CARD,CASCC,CATD,CAUD,CACE,GAAIC,CAAAA,CAAsB,CAAG,SAASC,CAAT,CAAe,CACxCH,CAAM,CAACI,SAAP,CAAiBH,CAAW,CAACI,oBAA7B,CAAmD,SAASC,CAAT,CAAe,IAC1DC,CAAAA,CAAY,CAAGD,CAAI,CAACC,YADsC,CAE1DC,CAAU,CAAGF,CAAI,CAACG,iBAFwC,CAG1DC,CAAkB,CAAGP,CAAI,CAACQ,IAAL,CAAUb,CAAS,CAACc,UAAV,CAAqBC,IAArB,CAA4B,sBAA5B,CAAqDN,CAArD,CAAoE,GAA9E,CAHqC,CAI1DO,CAAe,CAAGJ,CAAkB,CAACC,IAAnB,CAAwBb,CAAS,CAACc,UAAV,CAAqBE,eAA7C,CAJwC,CAK9D,GAAIN,CAAJ,CAAgB,CACZE,CAAkB,CAACK,QAAnB,CAA4B,YAA5B,EACAD,CAAe,CAACE,UAAhB,CAA2B,QAA3B,CACH,CAHD,IAGO,CACHN,CAAkB,CAACO,WAAnB,CAA+B,YAA/B,EACAH,CAAe,CAACI,IAAhB,CAAqB,QAArB,IACH,CAC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\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see .\n\n/**\n * Module for the list of discussions on when viewing a forum.\n *\n * @module mod_forum/discussion_list\n * @package mod_forum\n * @copyright 2019 Andrew Nicols \n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([\n 'jquery',\n 'core/templates',\n 'core/str',\n 'core/notification',\n 'mod_forum/subscription_toggle',\n 'mod_forum/selectors',\n 'mod_forum/repository',\n 'core/pubsub',\n 'mod_forum/forum_events',\n], function(\n $,\n Templates,\n Str,\n Notification,\n SubscriptionToggle,\n Selectors,\n Repository,\n PubSub,\n ForumEvents\n) {\n var registerEventListeners = function(root) {\n PubSub.subscribe(ForumEvents.SUBSCRIPTION_TOGGLED, function(data) {\n var discussionId = data.discussionId;\n var subscribed = data.subscriptionState;\n var discussionListItem = root.find(Selectors.discussion.item + '[data-discussionid= ' + discussionId + ']');\n var subscribedLabel = discussionListItem.find(Selectors.discussion.subscribedLabel);\n if (subscribed) {\n discussionListItem.addClass('subscribed');\n subscribedLabel.removeAttr('hidden');\n } else {\n discussionListItem.removeClass('subscribed');\n subscribedLabel.attr('hidden', true);\n }\n });\n\n root.on('click', Selectors.favourite.toggle, function() {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var subscriptionState = toggleElement.data('targetstate');\n Repository.setFavouriteDiscussionState(forumId, discussionId, subscriptionState)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n });\n\n root.on('click', Selectors.pin.toggle, function(e) {\n e.preventDefault();\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('targetstate');\n Repository.setPinDiscussionState(forumId, discussionId, state)\n .then(function() {\n return location.reload();\n })\n .catch(Notification.exception);\n });\n\n root.on('click', Selectors.lock.toggle, function(e) {\n var toggleElement = $(this);\n var forumId = toggleElement.data('forumid');\n var discussionId = toggleElement.data('discussionid');\n var state = toggleElement.data('state');\n\n Repository.setDiscussionLockState(forumId, discussionId, state)\n .then(function(context) {\n var icon = toggleElement.parents(Selectors.summary.actions).find(Selectors.lock.icon);\n var lockedLabel = toggleElement.parents(Selectors.discussion.item).find(Selectors.discussion.lockedLabel);\n if (context.locked) {\n icon.removeClass('hidden');\n lockedLabel.removeAttr('hidden');\n } else {\n icon.addClass('hidden');\n lockedLabel.attr('hidden', true);\n }\n return context;\n })\n .then(function(context) {\n context.forumid = forumId;\n return Templates.render('mod_forum/discussion_lock_toggle', context);\n })\n .then(function(html, js) {\n return Templates.replaceNode(toggleElement, html, js);\n })\n .then(function() {\n return Str.get_string('lockupdated', 'forum')\n .done(function(s) {\n return Notification.addNotification({\n message: s,\n type: \"info\"\n });\n });\n })\n .catch(Notification.exception);\n\n e.preventDefault();\n });\n };\n\n return {\n init: function(root) {\n SubscriptionToggle.init(root, false, function(toggleElement, context) {\n var toggleId = toggleElement.attr('id');\n var newTargetState = context.userstate.subscribed ? 0 : 1;\n toggleElement.data('targetstate', newTargetState);\n\n var stringKey = context.userstate.subscribed ? 'unsubscribediscussion' : 'subscribediscussion';\n return Str.get_string(stringKey, 'mod_forum')\n .then(function(string) {\n toggleElement.closest('td').find('label[for=\"' + toggleId + '\"]').text(string);\n return string;\n });\n });\n registerEventListeners(root);\n }\n };\n});\n"],"file":"discussion_list.min.js"} \ No newline at end of file diff --git a/mod/forum/amd/src/discussion_list.js b/mod/forum/amd/src/discussion_list.js index 57dd2d9ae5b..1fb1bcdb681 100644 --- a/mod/forum/amd/src/discussion_list.js +++ b/mod/forum/amd/src/discussion_list.js @@ -46,11 +46,13 @@ define([ PubSub.subscribe(ForumEvents.SUBSCRIPTION_TOGGLED, function(data) { var discussionId = data.discussionId; var subscribed = data.subscriptionState; - var subscribedLabel = root.find(Selectors.discussion.item + '[data-discussionid= ' + discussionId + '] ' - + Selectors.discussion.subscribedLabel); + var discussionListItem = root.find(Selectors.discussion.item + '[data-discussionid= ' + discussionId + ']'); + var subscribedLabel = discussionListItem.find(Selectors.discussion.subscribedLabel); if (subscribed) { + discussionListItem.addClass('subscribed'); subscribedLabel.removeAttr('hidden'); } else { + discussionListItem.removeClass('subscribed'); subscribedLabel.attr('hidden', true); } }); diff --git a/mod/forum/templates/discussion_list.mustache b/mod/forum/templates/discussion_list.mustache index 2aa67614852..74dc110228e 100644 --- a/mod/forum/templates/discussion_list.mustache +++ b/mod/forum/templates/discussion_list.mustache @@ -189,12 +189,17 @@ {{$discussion_list_body}} {{#summaries}} - - - + {{#discussion.pinned}} {{#pix}}i/pinned, mod_forum, {{#str}}discussionpinned, mod_forum{{/str}}{{/pix}} {{/discussion.pinned}} diff --git a/mod/forum/templates/forum_discussion_nested_v2_first_post.mustache b/mod/forum/templates/forum_discussion_nested_v2_first_post.mustache index 59edc382f99..ff599a956fd 100644 --- a/mod/forum/templates/forum_discussion_nested_v2_first_post.mustache +++ b/mod/forum/templates/forum_discussion_nested_v2_first_post.mustache @@ -39,7 +39,7 @@ aria-labelledby="post-header-{{id}}" aria-describedby="post-content-{{id}}" > - + {{! The firstpost and starter classes below aren't used for anything other than to identify the first post in behat. }}
- + {{! The firstpost and starter classes below aren't used for anything other than to identify the first post in behat. }}
+ {{! The forumthread class is only added for behat. }}
{{#replies}} {{> mod_forum/forum_discussion_threaded_post }} diff --git a/theme/boost/scss/moodle/modules.scss b/theme/boost/scss/moodle/modules.scss index ae0d3a40070..d8677bc2c8b 100644 --- a/theme/boost/scss/moodle/modules.scss +++ b/theme/boost/scss/moodle/modules.scss @@ -97,6 +97,13 @@ select { } } + .discussion-list { + .topic { + // Do not use the default bold style for the table headings. + font-weight: inherit; + } + } + // Style for the forum subscription mode node. .subscriptionmode { color: $body-color; diff --git a/theme/boost/style/moodle.css b/theme/boost/style/moodle.css index 1f6778271a3..98be0ffaf48 100644 --- a/theme/boost/style/moodle.css +++ b/theme/boost/style/moodle.css @@ -16265,6 +16265,9 @@ select { .path-mod-forum .forumheaderlist .discussion .lastpost { vertical-align: top; } +.path-mod-forum .discussion-list .topic { + font-weight: inherit; } + .path-mod-forum .subscriptionmode { color: #373a3c; } diff --git a/theme/classic/style/moodle.css b/theme/classic/style/moodle.css index 2b347c5403b..18e3946f45d 100644 --- a/theme/classic/style/moodle.css +++ b/theme/classic/style/moodle.css @@ -16534,6 +16534,9 @@ select { .path-mod-forum .forumheaderlist .discussion .lastpost { vertical-align: top; } +.path-mod-forum .discussion-list .topic { + font-weight: inherit; } + .path-mod-forum .subscriptionmode { color: #373a3c; }