From 1ae69fd67a6919f9deab84341629d10232ed6c25 Mon Sep 17 00:00:00 2001
From: Kathrin Osswald <kathrin.osswald@uni-ulm.de>
Date: Thu, 6 Feb 2020 13:28:31 +0100
Subject: [PATCH] Re-ordered in course course settings to be displayed within
 the course header.

---
 CHANGES.md                            |  1 +
 amd/build/incoursesettings.min.js     |  2 +-
 amd/src/incoursesettings.js           | 12 ++++++++++++
 scss/post.scss                        | 12 +++++++-----
 templates/settings_link_page.mustache |  2 --
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/CHANGES.md b/CHANGES.md
index 4c7652d..7d7734e 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -6,6 +6,7 @@ Changes
 
 ### Unreleased
 
+* 2020-02-11 - Re-ordered in course course settings to be displayed within the course header.
 * 2020-02-07 - Added missing information to README.md for the changes to the activity navigation links.
 * 2020-02-06 - Made changes to icons in course category overview undone as the alignment of them were improved in theme Boost (MDL-65357).
 * 2020-01-29 - Adjusted navbar.mustache template due to upstream changes in theme Boost.
diff --git a/amd/build/incoursesettings.min.js b/amd/build/incoursesettings.min.js
index 4aaf698..ac43aef 100644
--- a/amd/build/incoursesettings.min.js
+++ b/amd/build/incoursesettings.min.js
@@ -1 +1 @@
-define(["jquery"],function(a){"use strict";function b(){var b=a("#boost-campus-course-settings"),c=a("#boost-campus-activity-settings"),d=a("body").hasClass("pagelayout-frontpage");d||(a("#page-header .context-header-settings-menu").on("click",function(a){a.stopPropagation(),b.is(":visible")?b.hide(400):(b.show(400),c.is(":visible")&&c.hide(400))}),a("#region-main-settings-menu .action-menu .dropdown-toggle").on("click",function(a){a.stopPropagation(),c.is(":visible")?c.hide(400):(c.show(400),b.is(":visible")&&b.hide(400))}))}return{init:function(){b()}}});
\ No newline at end of file
+define(["jquery"],function(a){"use strict";function b(){var b=a("#boost-campus-course-settings"),c=a("#boost-campus-activity-settings"),d=a("body").hasClass("pagelayout-frontpage"),e=a("#page-header .card").css("border-bottom");d||(a("#page-header .context-header-settings-menu").on("click",function(d){d.stopPropagation(),b.is(":visible")?(b.hide(400),setTimeout(function(){a("#page-header .card").css("border-bottom",e),a("#page-header > div").addClass("pb-3")},300)):(b.show(400),a("#page-header div").removeClass("pb-3"),a("#page-header .card").css("border-bottom","none"),b.css("border-top","none"),c.is(":visible")&&c.hide(400))}),a("#region-main-settings-menu .action-menu .dropdown-toggle").on("click",function(d){d.stopPropagation(),c.is(":visible")?c.hide(400):(c.show(400),setTimeout(function(){a("#page-header .card").css("border-bottom",e),a("#page-header > div").addClass("pb-3")},300),b.is(":visible")&&b.hide(400))}))}return{init:function(){b()}}});
\ No newline at end of file
diff --git a/amd/src/incoursesettings.js b/amd/src/incoursesettings.js
index 962fa31..b3d4987 100644
--- a/amd/src/incoursesettings.js
+++ b/amd/src/incoursesettings.js
@@ -31,6 +31,7 @@ define(['jquery'], function($) {
         var courseSettings = $('#boost-campus-course-settings');
         var activitySettings = $('#boost-campus-activity-settings');
         var frontpage = $('body').hasClass('pagelayout-frontpage');
+        var headerCardBorderBottom = $('#page-header .card').css("border-bottom");
 
         // Only change the behaviour if the setting is enabled and we are not on the frontpage,
         // because we did not change the settings menu there. So we need the default propagation here.
@@ -39,8 +40,15 @@ define(['jquery'], function($) {
                 event.stopPropagation();
                 if (courseSettings.is(":visible")) {
                     courseSettings.hide(400);
+                    setTimeout(function() {
+                        $('#page-header .card').css('border-bottom', headerCardBorderBottom);
+                        $('#page-header > div').addClass('pb-3');
+                    }, 300);
                 } else {
                     courseSettings.show(400);
+                    $('#page-header div').removeClass('pb-3');
+                    $('#page-header .card').css('border-bottom', 'none');
+                    courseSettings.css('border-top', 'none');
                     // Additionally close activity settings if they are currently open.
                     if (activitySettings.is(":visible")) {
                         activitySettings.hide(400);
@@ -53,6 +61,10 @@ define(['jquery'], function($) {
                     activitySettings.hide(400);
                 } else {
                     activitySettings.show(400);
+                    setTimeout(function() {
+                        $('#page-header .card').css('border-bottom', headerCardBorderBottom);
+                        $('#page-header > div').addClass('pb-3');
+                    }, 300);
                     // Additionally close course settings if they are currently open.
                     if (courseSettings.is(":visible")) {
                         courseSettings.hide(400);
diff --git a/scss/post.scss b/scss/post.scss
index 3091d15..630201b 100644
--- a/scss/post.scss
+++ b/scss/post.scss
@@ -914,11 +914,8 @@ a[href^="mailto"]::before {
 #boost-campus-activity-settings {
     /* Initially do not display the settings. Visibility will be changed on click with incoursesettings.js. */
     display: none;
-    padding: 1rem;
-    padding-top: 0;
-    margin-bottom: 3rem;
-    margin-top: 1rem;
-    border: none;
+    margin-bottom: 1rem;
+    padding: 0 1rem 1.3rem 1rem;
 
     .nav-tabs {
         border: none;
@@ -934,6 +931,11 @@ a[href^="mailto"]::before {
     }
 }
 
+/* As this is already placed within the activity content card, the border around the settings card should be removed. */
+#boost-campus-activity-settings {
+    border: none;
+}
+
 /* Setting to move 'Switch role to...' menu item to the course settings - but only if
    setting showsettingsincourse is also enabled. */
 @if (variable-exists(incoursesettingsswitchtoroleposition) and variable-exists(showsettingsincourse)) {
diff --git a/templates/settings_link_page.mustache b/templates/settings_link_page.mustache
index 46123f9..ad3708d 100644
--- a/templates/settings_link_page.mustache
+++ b/templates/settings_link_page.mustache
@@ -39,12 +39,10 @@
 {{! MODIFICATION:
     * Added divs around the tab structure to be able to insert this on different sites.
     * Changed the grid definitions for improved displaying.
-    * Inserted heading for the general course settings.
     * Removed check for !is_short_branch to display all children of the course settings within an own tab.
 }}
 
 <div id="boost-campus-course-settings" class="card" >
-    <h2>{{incourse_node_heading}}</h2>
     <div class="mx-2 pt-2">
         <ul class="nav nav-tabs" role="tablist">
         <!-- First the top most node and immediate children -->
-- 
GitLab