mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-71771 core_calendar: Convert the calendar footer buttons to links
This commit is contained in:
parent
338b60f43b
commit
2140d3e55c
@ -67,26 +67,26 @@ class footer_options_exporter extends exporter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the export calendar button.
|
||||
* Get the export calendar link.
|
||||
*
|
||||
* @return \single_button The export calendar button html.
|
||||
* @return string The export calendar hyperlink.
|
||||
*/
|
||||
protected function get_export_calendar_button() {
|
||||
protected function get_export_calendar_link(): string {
|
||||
$exportcalendarurl = new moodle_url('/calendar/export.php', $this->get_link_params());
|
||||
return new \single_button($exportcalendarurl, get_string('exportcalendar', 'calendar'), 'get');
|
||||
return $exportcalendarurl->out(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get manage subscription button.
|
||||
* Get manage subscription link.
|
||||
*
|
||||
* @return string The manage subscription button html.
|
||||
* @return string|null The manage subscription hyperlink.
|
||||
*/
|
||||
protected function get_manage_subscriptions_button() {
|
||||
protected function get_manage_subscriptions_link(): ?string {
|
||||
if (calendar_user_can_add_event($this->calendar->course)) {
|
||||
$managesubscriptionurl = new moodle_url('/calendar/managesubscriptions.php', $this->get_link_params());
|
||||
return new \single_button($managesubscriptionurl,
|
||||
get_string('managesubscriptions', 'calendar'), 'get');
|
||||
return $managesubscriptionurl->out(true);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -117,11 +117,9 @@ class footer_options_exporter extends exporter {
|
||||
$values = new stdClass();
|
||||
|
||||
if (!empty($CFG->enablecalendarexport)) {
|
||||
if ($exportbutton = $this->get_export_calendar_button()) {
|
||||
$values->exportcalendarbutton = $exportbutton->export_for_template($output);
|
||||
}
|
||||
if ($managesubscriptionbutton = $this->get_manage_subscriptions_button()) {
|
||||
$values->managesubscriptionbutton = $managesubscriptionbutton->export_for_template($output);
|
||||
$values->exportcalendarlink = $this->get_export_calendar_link();
|
||||
if ($managesubscriptionlink = $this->get_manage_subscriptions_link()) {
|
||||
$values->managesubscriptionlink = $managesubscriptionlink;
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,12 +133,11 @@ class footer_options_exporter extends exporter {
|
||||
*/
|
||||
public static function define_other_properties() {
|
||||
return array(
|
||||
'exportcalendarbutton' => [
|
||||
'type' => PARAM_RAW,
|
||||
'default' => null,
|
||||
'exportcalendarlink' => [
|
||||
'type' => PARAM_URL
|
||||
],
|
||||
'managesubscriptionbutton' => [
|
||||
'type' => PARAM_RAW,
|
||||
'managesubscriptionlink' => [
|
||||
'type' => PARAM_URL,
|
||||
'default' => null,
|
||||
],
|
||||
);
|
||||
|
@ -21,15 +21,19 @@
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"exportcalendarbutton": "<button class='btn btn-secondary'>Export calendar</button>",
|
||||
"managesubscriptionbutton": "<button class='btn btn-secondary'>Manage subscriptions</button>"
|
||||
"exportcalendarlink": "http://abc.com/calendar/export.php?course=1",
|
||||
"managesubscriptionlink": "http://abc.com/calendar/managesubscriptions.php?course=1"
|
||||
}
|
||||
}}
|
||||
<div class="bottom">
|
||||
{{#exportcalendarbutton}}
|
||||
{{> core/single_button }}
|
||||
{{/exportcalendarbutton}}
|
||||
{{#managesubscriptionbutton}}
|
||||
{{> core/single_button }}
|
||||
{{/managesubscriptionbutton}}
|
||||
{{#exportcalendarlink}}
|
||||
<span class="export-link">
|
||||
<a href="{{.}}" title={{#quote}}{{#str}}exportcalendar, calendar{{/str}}{{/quote}}>{{#str}}exportcalendar, calendar{{/str}}</a>
|
||||
</span>
|
||||
{{/exportcalendarlink}}
|
||||
{{#managesubscriptionlink}}
|
||||
<span class="export-link">
|
||||
<a href="{{.}}" title={{#quote}}{{#str}}managesubscriptions, calendar{{/str}}{{/quote}}>{{#str}}managesubscriptions, calendar{{/str}}</a>
|
||||
</span>
|
||||
{{/managesubscriptionlink}}
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@ Feature: Import and edit calendar events
|
||||
Scenario: Import then edit a calendar event.
|
||||
Given I log in as "teacher1"
|
||||
And I view the calendar for "1" "2016"
|
||||
And I press "Manage subscriptions"
|
||||
And I click on "Manage subscriptions" "link"
|
||||
And I set the following fields to these values:
|
||||
| Calendar name | Test Import |
|
||||
| Import from | Calendar file (.ics) |
|
||||
@ -42,7 +42,7 @@ Feature: Import and edit calendar events
|
||||
Then I should see "Event on 2-20-2017"
|
||||
And I should see "Event on 2-25-2017"
|
||||
And I should not see "Event on 2-15-2017"
|
||||
And I press "Manage subscriptions"
|
||||
And I click on "Manage subscriptions" "link"
|
||||
And I press "Remove"
|
||||
And I view the calendar for "2" "2017"
|
||||
And I should not see "Event on 2-25-2017"
|
||||
@ -51,7 +51,7 @@ Feature: Import and edit calendar events
|
||||
Scenario: Import events using different event types.
|
||||
Given I log in as "admin"
|
||||
And I view the calendar for "1" "2016"
|
||||
And I press "Manage subscriptions"
|
||||
And I click on "Manage subscriptions" "link"
|
||||
And I set the following fields to these values:
|
||||
| Calendar name | Test Import |
|
||||
| Import from | Calendar file (.ics) |
|
||||
|
@ -18,7 +18,7 @@ Feature: Export calendar events
|
||||
|
||||
Scenario: Viewing calendar export options
|
||||
Given I follow "This month"
|
||||
When I click on "Export calendar" "button"
|
||||
When I click on "Export calendar" "link"
|
||||
Then I should see "All events"
|
||||
And I should see "Events related to courses"
|
||||
And I should see "Events related to groups"
|
||||
@ -26,7 +26,7 @@ Feature: Export calendar events
|
||||
|
||||
Scenario: Generating calendar URL for all events
|
||||
Given I follow "This month"
|
||||
And I click on "Export calendar" "button"
|
||||
And I click on "Export calendar" "link"
|
||||
And I set the field "All events" to "1"
|
||||
And I set the field "Recent and next 60 days" to "1"
|
||||
When I click on "Get calendar URL" "button"
|
||||
@ -34,7 +34,7 @@ Feature: Export calendar events
|
||||
|
||||
Scenario: Generating calendar URL for course events
|
||||
Given I follow "This month"
|
||||
And I click on "Export calendar" "button"
|
||||
And I click on "Export calendar" "link"
|
||||
And I set the field "Events related to courses" to "1"
|
||||
And I set the field "Recent and next 60 days" to "1"
|
||||
When I click on "Get calendar URL" "button"
|
||||
@ -42,7 +42,7 @@ Feature: Export calendar events
|
||||
|
||||
Scenario: Generating calendar URL for group events
|
||||
Given I follow "This month"
|
||||
And I click on "Export calendar" "button"
|
||||
And I click on "Export calendar" "link"
|
||||
And I set the field "Events related to groups" to "1"
|
||||
And I set the field "Recent and next 60 days" to "1"
|
||||
When I click on "Get calendar URL" "button"
|
||||
@ -50,7 +50,7 @@ Feature: Export calendar events
|
||||
|
||||
Scenario: Generating calendar URL for category events
|
||||
Given I follow "This month"
|
||||
And I click on "Export calendar" "button"
|
||||
And I click on "Export calendar" "link"
|
||||
And I set the field "Events related to categories" to "1"
|
||||
And I set the field "Recent and next 60 days" to "1"
|
||||
When I click on "Get calendar URL" "button"
|
||||
@ -58,7 +58,7 @@ Feature: Export calendar events
|
||||
|
||||
Scenario: Generating calendar URL for user events
|
||||
Given I follow "This month"
|
||||
And I click on "Export calendar" "button"
|
||||
And I click on "Export calendar" "link"
|
||||
And I set the field "My personal events" to "1"
|
||||
And I set the field "Recent and next 60 days" to "1"
|
||||
When I click on "Get calendar URL" "button"
|
||||
|
@ -119,8 +119,17 @@ $calendarEventColor: #0d5ca1 !default;
|
||||
padding: 0;
|
||||
|
||||
.bottom {
|
||||
text-align: center;
|
||||
padding: 5px 0 0 0;
|
||||
text-align: left;
|
||||
padding: 20px 0 0 20px;
|
||||
|
||||
span.export-link:after {
|
||||
content: "\2022";
|
||||
color: $blue;
|
||||
}
|
||||
|
||||
span.export-link:last-child:after {
|
||||
content: none;
|
||||
}
|
||||
}
|
||||
|
||||
.heightcontainer {
|
||||
|
@ -12894,8 +12894,13 @@ input[disabled] {
|
||||
vertical-align: top;
|
||||
padding: 0; }
|
||||
.path-calendar .maincalendar .bottom {
|
||||
text-align: center;
|
||||
padding: 5px 0 0 0; }
|
||||
text-align: left;
|
||||
padding: 20px 0 0 20px; }
|
||||
.path-calendar .maincalendar .bottom span.export-link:after {
|
||||
content: "\2022";
|
||||
color: #0f6fc5; }
|
||||
.path-calendar .maincalendar .bottom span.export-link:last-child:after {
|
||||
content: none; }
|
||||
.path-calendar .maincalendar .heightcontainer {
|
||||
height: 100%;
|
||||
position: relative; }
|
||||
|
@ -13116,8 +13116,13 @@ input[disabled] {
|
||||
vertical-align: top;
|
||||
padding: 0; }
|
||||
.path-calendar .maincalendar .bottom {
|
||||
text-align: center;
|
||||
padding: 5px 0 0 0; }
|
||||
text-align: left;
|
||||
padding: 20px 0 0 20px; }
|
||||
.path-calendar .maincalendar .bottom span.export-link:after {
|
||||
content: "\2022";
|
||||
color: #0f6fc5; }
|
||||
.path-calendar .maincalendar .bottom span.export-link:last-child:after {
|
||||
content: none; }
|
||||
.path-calendar .maincalendar .heightcontainer {
|
||||
height: 100%;
|
||||
position: relative; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user