Commit bfba4bbe authored by Camille Tardy's avatar Camille Tardy
Browse files

Add "add block" buton to index page

parent 44ef0b42
...@@ -30,6 +30,9 @@ class core_renderer extends \theme_boost\output\core_renderer { ...@@ -30,6 +30,9 @@ class core_renderer extends \theme_boost\output\core_renderer {
$header = new stdClass(); $header = new stdClass();
$header->settingsmenu = $this->course_edit_mode_button(); $header->settingsmenu = $this->course_edit_mode_button();
if ($this->page->pagelayout == "frontpage"){
$header->settingsmenu .= $this->add_block_button_index_admin();
}
$header->settingsmenu .= $this->context_header_settings_menu(); $header->settingsmenu .= $this->context_header_settings_menu();
if ($this->page->pagelayout == "mydashboard") { if ($this->page->pagelayout == "mydashboard") {
$header->settingsmenu = $this->create_course_button(); $header->settingsmenu = $this->create_course_button();
...@@ -856,6 +859,32 @@ class core_renderer extends \theme_boost\output\core_renderer { ...@@ -856,6 +859,32 @@ class core_renderer extends \theme_boost\output\core_renderer {
return $html; return $html;
} }
/**
* Get the button "Add a block" for "index" page for admin users
*
* @return string
*/
public function add_block_button_index_admin() {
global $PAGE;
$html = "";
// If the page is "Index"
if ($this->page->pagetype == "site-index") {
// If the user is admin
if (is_siteadmin()) {
// If edit mode is enabled
if ($PAGE->user_is_editing()) {
$html .= html_writer::start_tag('a', array('href' => new moodle_url('/theme/index.php?bui_addblock', array('sesskey' => sesskey())), 'class' => 'singlebutton btn btn-secondary add-block-button-index', 'data-key' => 'addblock', 'data-isexpandable' => '0', 'data-indent' => '0', 'data-showdivider' => '1', 'data-type' => '60', 'data-nodetype' => '0', 'data-collapse' => '0', 'data-forceopen' => '0', 'data-isactive' => '0', 'data-hidden' => '0', 'data-preceedwithhr' => '0'));
$html .= " " . get_string('addblock', 'moodle');
$html .= html_writer::end_tag('a');
}
}
}
return $html;
}
/** /**
* Return the navbar content so that it can be echoed out by the layout * Return the navbar content so that it can be echoed out by the layout
* *
......
...@@ -15,7 +15,7 @@ $fac-societe: #F1AB00; ...@@ -15,7 +15,7 @@ $fac-societe: #F1AB00;
body { body {
//fix for Boost in Course creatin form page the targeted section was getting bad padding and margin. //fix for Boost in Course creation form page the targeted section was getting bad padding and margin.
:target { :target {
padding-top: 0px!important; padding-top: 0px!important;
margin-top: 0px!important; margin-top: 0px!important;
...@@ -90,13 +90,21 @@ body { ...@@ -90,13 +90,21 @@ body {
transition: background-color 0.2s; transition: background-color 0.2s;
} }
.add-block-button:hover { .add-block-button-index {
color: $primary;
border-color: $primary;
background-color: white;
transition: background-color 0.2s;
margin-right: 10px;
}
.add-block-button:hover, .add-block-button-index:hover {
color: $primary; color: $primary;
border-color: $primary; border-color: $primary;
background-color: #e9ecef; background-color: #e9ecef;
} }
.add-block-button:focus { .add-block-button:focus, .add-block-button-index:focus {
color: $primary !important; color: $primary !important;
border-color: $primary !important; border-color: $primary !important;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment