Skip to content

Commit

Permalink
Edit mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Sep 12, 2023
1 parent 2664e71 commit 40e350e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layout/popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<?php echo $OUTPUT->custom_menu(); ?>
<ul class="nav pull-right">
<li><?php echo $OUTPUT->page_heading_menu(); ?></li>
<li><?php echo $OUTPUT->edit_switch(); ?></li>
<li class="navbar-text"><?php echo $OUTPUT->login_info() ?></li>
</ul>
</div>
Expand All @@ -77,7 +78,6 @@
<header id="page-header" class="clearfix">
<div id="page-navbar" class="clearfix">
<div class="breadcrumb-nav"><?php echo $OUTPUT->navbar(); ?></div>
<nav class="breadcrumb-button"><?php echo $OUTPUT->page_heading_button(); ?></nav>
</div>
<?php echo $OUTPUT->page_heading(); ?>
<div id="course-header">
Expand Down
1 change: 0 additions & 1 deletion layout/tiles/page-header.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
<header id="page-header" class="row-fluid">
<div id="page-navbar" class="d-flex flex-wrap col-12">
<nav class="breadcrumb-nav"><?php echo $OUTPUT->navbar(); ?></nav>
<div class="breadcrumb-button ml-auto d-flex"><?php echo $OUTPUT->page_heading_button(); ?></div>
</div>
<?php
if ($OUTPUT->using_frontpage_header_on_another_page()) {
Expand Down
2 changes: 1 addition & 1 deletion scss/bootstrapchanges.scss
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ textarea, .uneditable-input {
.navbar .nav > li > a,
.navbar .nav-item a.nav-link,
.navbar .nav-item.campussettingsmenu a.dropdown-toggle,
.navbar .editmode-switch-form label {
.navbar .campuseditmodelabel {
color: $navbarLinkColor;
// Hover/focus state
&:hover,
Expand Down
65 changes: 65 additions & 0 deletions templates/core/editswitch.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{!
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/editswitch
This template renders the top navbar.
Example context (json):
{
"url": "http://localhost/",
"sesskey": "sesskey",
"edit": 1,
"adminedit": true,
"checked": "",
"string": "Edit on",
"legacyseturl": "/editmode.php"
}
}}
<div class="divider border-left h-75 align-self-center ml-1 mr-3"></div>
<form action="{{{legacyseturl}}}" method="post" class="d-flex align-items-center editmode-switch-form">
<div class="input-group">
<label class="campuseditmodelabel mr-2 mb-0" for="{{uniqid}}-editingswitch">
{{#str}} editmode {{/str}}
</label>
<div class="custom-control custom-switch">
<input type="checkbox"{{!
}} name="setmode"{{!
}}{{#checked}}{{!
}} checked{{!
}}{{/checked}}{{!
}} class="custom-control-input"{{!
}} id="{{uniqid}}-editingswitch"{{!
}} data-context="{{{pagecontextid}}}"{{!
}} data-pageurl="{{{pageurl}}}"{{!
}}>
<span class="custom-control-label">&nbsp;</span>
</div>
</div>
<input type="hidden" name="sesskey" value="{{{sesskey}}}">
<input type="hidden" name="pageurl" value="{{{pageurl}}}">
<input type="hidden" name="context" value="{{{pagecontextid}}}">
<noscript>
<input type="submit" value="{{#str}}setmode, core{{/str}}">
</noscript>
</form>
{{#js}}
require(['core/edit_switch'], function(editSwitch) {
editSwitch.init('{{uniqid}}-editingswitch');
});
{{/js}}

0 comments on commit 40e350e

Please sign in to comment.