Skip to content
Snippets Groups Projects
Commit 3c02504d authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Extended the behaviour of the setting showsettingsincourse to respect...

Extended the behaviour of the setting showsettingsincourse to respect activities and resources menus, too.
parent 9d5de236
No related branches found
No related tags found
No related merge requests found
......@@ -6,6 +6,7 @@ Changes
### Unreleased
* 2017-11-17 - Extended the behaviour of the setting "showsettingsincourse" to respect activities and resources menus, too. Please check this setting due to the new scope.
* 2017-11-09 - Replaced the settings icon with a edit profile button on the profile page.
* 2017-11-07 - Updated travis.yml to use newer node version for fixing TravisCI error.
* 2017-10-17 - Minor change in SCSS to fit the borders of the current section in the periods format into the section.
......
......@@ -125,7 +125,8 @@ With this setting you can choose the place where the information to which role a
##### In course settings menu
With this setting you can change the displaying of the course context menu. In Boost, there is a popup context menu right next to the cog icon and clicking on the "More..." menu item will lead the user to another page with all course settings. By enabling this setting the settings will occur directly beneath the course header.
With this setting you can change the displaying of the context menus. In Boost, there is a popup context menu right next to the cog icon. By enabling this setting the settings will occur directly beneath the course header. The settings are arranged in tabs, so it is easier for the user to get to the desired setting instead of scanning a long list of menu items. With this setting we also hide the settings icon on the participants page as the entries on this page are duplicated with the in-course course menu and therefore not necessary.
Please note that this change does not affect users who have switched off javascript in their browsers - they will still get the behaviour from Moodle core with a popup course context menu.
##### Move "Switch role to..." to the course settings
......
define(["jquery"],function(a){"use strict";function b(){a("#page-header .context-header-settings-menu").on("click",function(b){b.stopPropagation(),a("#boost-campus-course-settings").is(":visible")?a("#boost-campus-course-settings").hide(400):a("#boost-campus-course-settings").show(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");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
......@@ -28,12 +28,31 @@ define(['jquery'], function($) {
* Initialising.
*/
function initInCourseSettings() {
var courseSettings = $('#boost-campus-course-settings');
var activitySettings = $('#boost-campus-activity-settings');
$('#page-header .context-header-settings-menu').on('click', function(event) {
event.stopPropagation();
if ($('#boost-campus-course-settings').is(":visible")) {
$('#boost-campus-course-settings').hide(400);
if (courseSettings.is(":visible")) {
courseSettings.hide(400);
} else {
$('#boost-campus-course-settings').show(400);
courseSettings.show(400);
// Additionally close activity settings if they are currently open.
if (activitySettings.is(":visible")) {
activitySettings.hide(400);
}
}
});
$('#region-main-settings-menu .action-menu .dropdown-toggle').on('click', function(event) {
event.stopPropagation();
if (activitySettings.is(":visible")) {
activitySettings.hide(400);
} else {
activitySettings.show(400);
// Additionally close course settings if they are currently open.
if (courseSettings.is(":visible")) {
courseSettings.hide(400);
}
}
});
}
......
......@@ -390,7 +390,6 @@ class core_renderer extends \theme_boost\output\core_renderer {
ORIGINAL END. */
}
// TODO Remove the copied function build_action_menu_from_navigation in version 3.4 of the theme.
// This will be the first Moodle major version having MDL-58174 integrated from version x.0 on.
......
......@@ -76,7 +76,7 @@ $string['switchedroleto'] = 'You are viewing this course currently with the role
$string['coursesettingsheadingsetting'] = 'Course settings';
// ...Show course settings within the course.
$string['showsettingsincoursesetting'] = 'In course settings menu';
$string['showsettingsincoursesetting_desc'] = 'With this setting you can change the displaying of the course context menu. In Boost, there is a popup context menu right next to the cog icon and clicking on the "More..." menu item will lead the user to another page with all course settings. By enabling this setting the settings will occur directly beneath the course header.<br/>
$string['showsettingsincoursesetting_desc'] = 'With this setting you can change the displaying of the context menus. In Boost, there is a popup context menu right next to the cog icon. By enabling this setting the settings will occur directly beneath the course header. The settings are arranged in tabs, so it is easier for the user to get to the desired setting instead of scanning a long list of menu items. With this setting we also hide the settings icon on the participants page as the entries on this page are duplicated with the in-course course menu and therefore not necessary.<br/>
Please note that this change does not affect users who have switched off javascript in their browsers - they will still get the behaviour from Moodle core with a popup course context menu.';
// ...Show switch role to link within the in-course course settings.
$string['incoursesettingsswitchtorolesetting'] = 'Move "Switch role to..." to the course settings';
......
......@@ -81,8 +81,15 @@ $templatecontext = [
// MODIDFICATION START.
// Use the returned value from theme_boost_campus_get_modified_flatnav_defaulthomepageontop as the template context.
$templatecontext['flatnavigation'] = theme_boost_campus_process_flatnav($PAGE->flatnav);
// If setting showsettingsincourse is enabled.
if (get_config('theme_boost_campus', 'showsettingsincourse') == 'yes') {
// Context value for requiring incoursesettings.js.
$templatecontext['incoursesettings'] = true;
// Add the returned value from theme_boost_campus_get_incourse_settings to the template context.
$templatecontext['node'] = theme_boost_campus_get_incourse_settings();
// Add the returned value from theme_boost_campus_get_incourse_activity_settings to the template context.
$templatecontext['activitynode'] = theme_boost_campus_get_incourse_activity_settings();
}
// Render colums2.mustache from boost_campus.
echo $OUTPUT->render_from_template('theme_boost_campus/columns2', $templatecontext);
......
......@@ -240,7 +240,7 @@ function theme_boost_campus_set_node_on_top(flat_navigation $flatnav, $nodename,
/**
* Provides the node for the in-course course settings.
* Provides the node for the in-course course or activity settings.
*
* @return navigation_node.
*/
......@@ -286,6 +286,32 @@ function theme_boost_campus_get_incourse_settings() {
}
}
}
return $node;
}
}
/**
* Provides the node for the in-course settings for other contexts.
*
* @return navigation_node.
*/
function theme_boost_campus_get_incourse_activity_settings() {
global $PAGE;
$context = $PAGE->context;
$node = false;
// If setting showsettingsincourse is enabled.
if (get_config('theme_boost_campus', 'showsettingsincourse') == 'yes') {
// Settings belonging to activity or resources.
if ($context->contextlevel == CONTEXT_MODULE) {
$node = $PAGE->settingsnav->find('modulesettings', navigation_node::TYPE_SETTING);
} else if ($context->contextlevel == CONTEXT_COURSECAT) {
// For course category context, show category settings menu, if we're on the course category page.
if ($PAGE->pagetype === 'course-index-category') {
$node = $PAGE->settingsnav->find('categorysettings', navigation_node::TYPE_CONTAINER);
}
} else {
$node = false;
}
}
return $node;
}
......@@ -495,6 +495,21 @@ body.loginbackgroundimage {
display: none;
}
/* If showsettingsincourse is enabled */
@if variable-exists(showsettingsincourse) {
@if $showsettingsincourse == 'yes' {
/* We do not show the cog icon on the participants page as the settings on this page are
* duplicated with the in-course course menu. */
.path-user #region-main-settings-menu {
display: none;
}
/* Hide the triangle down icon. */
#region-main-settings-menu .dropdown-toggle::after {
display: none;
}
}
}
/*
* Misc
* /
......@@ -821,10 +836,13 @@ a[href^="mailto"]::before {
vertical-align: 0.3rem;
}
/* In-course course settings. */
#boost-campus-course-settings {
/* In-course settings. */
#boost-campus-course-settings,
#boost-campus-activity-settings {
/* Initially do not display the settings. Visibility will be changed on click with incoursesettings.js. */
display: none;
border-bottom: 2px solid $brand-primary;
margin-bottom: 3rem;
/* Improve color of tab content so it looks more like a real tab. */
.tab-content .card {
background-color: #f4f4f4;
......
{{!
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 theme_boost_campus/activity_settings_incourse
Displays the admin tree as a list of grouped links.
Example context (json):
{
"activitynode": {
"text": "Root of menu",
"key": "test0",
"display": true,
"children": [
{
"text": "Child of menu",
"key": "test1",
"display": true,
"children": []
}
]
}
}
}}
{{! 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-activity-settings" class="card" >
<h2>{{incourse_activitynode_heading}}</h2>
<div class="p-t-2">
<ul class="nav nav-tabs" role="tablist">
<!-- First the top most activitynode and immediate children -->
<li class="nav-item">
<a class="nav-link active" href="#activity-settings-{{key}}" data-toggle="tab" role="tab">{{activitynode.text}}</a>
</li>
<!-- Now the first level children with sub activitynodes -->
{{#activitynode.children}}
{{#children.count}}
{{#display}}
<li class="nav-item">
<a class="nav-link" href="#activity-settings-{{key}}" data-toggle="tab" role="tab">{{text}}</a>
</li>
{{/display}}
{{/children.count}}
{{/activitynode.children}}
</ul>
<div class="tab-content">
<div class="tab-pane active" id="activity-settings-{{key}}" role="tabpanel">
<div class="card">
<div class="card-block">
<div class="container">
<div class="row">
<div class="col-sm-4">
{{#action}}<h4><a href="{{action}}">{{text}}</a></h4>{{/action}}
{{^action}}<h4>{{text}}</h4>{{/action}}
</div>
<div class="col-sm-8">
<ul class="list-unstyled">
{{#activitynode.children}}
{{^children.count}}
{{#display}}
<li><a href="{{{action}}}">{{text}}</a></li>
{{/display}}
{{/children.count}}
{{/activitynode.children}}
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
{{#activitynode.children}}
{{#children.count}}
<div class="tab-pane" id="activity-settings-{{key}}" role="tabpanel">
<div class="card">
<div class="card-block">
<div class="container">
<div class="row">
<div class="col-sm-4">
{{#action}}<h4><a href="{{action}}">{{text}}</a></h4>{{/action}}
{{^action}}<h4>{{text}}</h4>{{/action}}
</div>
<div class="col-sm-8">
<ul class="list-unstyled">
{{#children}}
{{#display}}
{{^children.count}}
<li><a href="{{{action}}}">{{text}}</a></li>
{{/children.count}}
{{/display}}
{{/children}}
</ul>
</div>
</div>
{{#children}}
{{#display}}
{{#children.count}}
<hr>
<div class="row">
<div class="col-sm-4">
{{#action}}<h4><a href="{{action}}">{{text}}</a></h4>{{/action}}
{{^action}}<h4>{{text}}</h4>{{/action}}
</div>
<div class="col-sm-8">
<ul class="list-unstyled">
{{#children}}
{{> core/settings_link_page_single }}
{{/children}}
</ul>
</div>
</div>
{{/children.count}}
{{/display}}
{{/children}}
</div>
</div>
</div>
</div>
{{/children.count}}
{{/activitynode.children}}
</div>
</div>
</div>
......@@ -91,6 +91,9 @@
<div class="region_main_settings_menu_proxy"></div>
{{/hasregionmainsettingsmenu}}
{{{ output.course_content_header }}}
{{#activitynode}}
{{> theme_boost_campus/activity_settings_incourse }}
{{/activitynode}}
{{{ output.main_content }}}
{{{ output.course_content_footer }}}
</div>
......@@ -119,9 +122,9 @@ require(['theme_boost_campus/backtotop'], function(mod) {
require(['theme_boost_campus/catchshortcuts'], function(mod) {
mod.init({{{catchshortcuts}}});
});
{{#node}}
{{#incoursesettings}}
require(['theme_boost_campus/incoursesettings'], function(mod) {
mod.init();
});
{{/node}}
{{/incoursesettings}}
{{/js}}
......@@ -44,18 +44,19 @@
}}
<div id="boost-campus-course-settings" class="card" >
<h2>{{incourse_node_heading}}</h2>
<div class="m-x-2 p-t-2">
<ul class="nav nav-tabs" role="tablist">
<!-- First the top most node and immediate children -->
<li class="nav-item">
<a class="nav-link active" href="#link{{node.key}}" data-toggle="tab" role="tab">{{node.text}}</a>
<a class="nav-link active" href="#course-settings-{{node.key}}" data-toggle="tab" role="tab">{{node.text}}</a>
</li>
<!-- Now the first level children with sub nodes -->
{{#node.children}}
{{#children.count}}
{{#display}}
<li class="nav-item">
<a class="nav-link" href="#link{{key}}" data-toggle="tab" role="tab">{{text}}</a>
<a class="nav-link" href="#course-settings-{{key}}" data-toggle="tab" role="tab">{{text}}</a>
</li>
{{/display}}
{{/children.count}}
......@@ -63,7 +64,7 @@
</ul>
<div class="tab-content">
<div class="tab-pane active" id="link{{node.key}}" role="tabpanel">
<div class="tab-pane active" id="course-settings-{{node.key}}" role="tabpanel">
<div class="card">
<div class="card-block">
<div class="container">
......@@ -90,7 +91,7 @@
</div>
{{#node.children}}
{{#children.count}}
<div class="tab-pane" id="link{{key}}" role="tabpanel">
<div class="tab-pane" id="course-settings-{{key}}" role="tabpanel">
<div class="card">
<div class="card-block">
<div class="container">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment