Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call it 1.4 #57

Merged
merged 6 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,17 @@ jobs:
matrix:
include:
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
database: 'mariadb'
- php: '8.2'
moodle-branch: 'MOODLE_403_STABLE'
moodle-branch: 'MOODLE_405_STABLE'
database: 'pgsql'
- php: '8.1'
moodle-branch: 'MOODLE_403_STABLE'
moodle-branch: 'MOODLE_404_STABLE'
database: 'mariadb'
- php: '8.1'
- php: '8.0'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
database: 'pgsql'

steps:
- name: Check out repository code
Expand Down
1 change: 1 addition & 0 deletions lang/en/format_kickstart.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
$string['migratefromcourses'] = 'Migrate content from other courses';
$string['notemplates'] = 'No templates are available yet.';
$string['pluginname'] = 'Kickstart format';
$string['plugin_description'] = 'Create courses faster and make them more consistent across your organization using course templates.';
$string['previewurl'] = 'Preview URL';
$string['previewurl_help'] = 'If provided a button will display on the template that will open this URL in a new tab';
$string['privacy:metadata'] = 'The Kickstart format plugin does not store any personal data.';
Expand Down
3 changes: 3 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@

require_once($CFG->dirroot. '/course/format/lib.php');


use format_kickstart\output\course_template_list;

/**
* Main class for the Kickstart course format
*
Expand Down
65 changes: 54 additions & 11 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ body.format-kickstart .form-control .fa-search {

#page-course-view-kickstart.kickstart-icon:before {
content: '\f1ce';
font-family: fontawesome;
font-family: var(--fa-style-family, "Font Awesome 6 Free", "Font Awesome 6 Brands", fontawesome);
font-weight: 700;
font-size: 40px;
position: fixed;
top: 50%;
Expand Down Expand Up @@ -123,23 +124,39 @@ body.format-kickstart .form-control .fa-search {
flex: 1 1 auto;
padding: 1.25rem;
}
.format-kickstart .card-body .card-title {
margin-top: 10px;
.format-kickstart .card-body .card-title,
.format-kickstart .card-body .card-text,
.format-kickstart .card-body p {
margin-bottom: 0;
}
.format-kickstart .card-body .text-muted {
margin-top: 5px;
}
.format-kickstart .card-body .card-text:empty,
.format-kickstart .card-body .text-muted:empty {
display: none;
}
.format-kickstart .course-content > .card .card-body {
text-align: right;
padding: 0;
display: flex;
align-items: center;
}
.format-kickstart .course-content > .card .card-body > .img-responsive + .card-title {
text-align: center;
float: none;
margin: 1rem 0;
}
.format-kickstart .course-content > .card .card-body .card-title {
width: 50%;
text-align: left;
margin-top: 5px;
margin-bottom: 9px;
margin-right: 5px;
margin: 5px 5px 5px 0;
}
.format-kickstart .course-content > .card .card-body a.btn {
margin: 5px 5px 5px 0;
}
.format-kickstart .course-content > .card .card-body a.btn:not(.btn-outline-dark) {
margin-left: auto;
}
.format-kickstart .card-footer {
padding: .75rem 1.25rem;
Expand All @@ -155,9 +172,6 @@ body.format-kickstart .form-control .fa-search {
.format-kickstart .mform > .form-group {
margin-left: 1.5rem;
}
.format-kickstart .course-content > .card .card-body .card-title {
float: left;
}
}

body#page-course-format-kickstart-template.template-designer-format #fitem_id_coursetype {
Expand All @@ -172,8 +186,10 @@ body#page-course-format-kickstart-template.template-designer-format #fitem_id_co
margin-bottom: 20px;
flex-direction: row;
align-items: center;
padding: 1.25rem;
}
.format-kickstart .course-content .kickstart-list-view .templates-block .card .card-body {
padding: 0;
display: flex;
align-items: center;
}
Expand Down Expand Up @@ -216,9 +232,10 @@ body#page-course-format-kickstart-template.template-designer-format #fitem_id_co
text-align: right;
border: 0;
background: none;
padding: 0 0 0 1.25rem;
}
.format-kickstart .course-content .kickstart-list-view .templates-block .card .card-footer a {
margin-bottom: 10px;
margin: 5px 0;
}
.format-kickstart .course-content .kickstart-list-view .templates-block .card .card-footer a.btn-outline-primary {
margin-left: 10px;
Expand All @@ -228,4 +245,30 @@ body#page-course-format-kickstart-template.template-designer-format #fitem_id_co
}
#page-admin-course-format-kickstart-templates .generaltable tbody tr td .singlebutton + .singlebutton {
margin: 10px 0;
}
}

/* Tile view */
.format-kickstart .course-content .kickstart-tile-view .templates-block .card {
padding: 0;
}

/* Content Migration from course block */
.format-kickstart.path-course-view .course-content .card {
padding: 1.25rem;
}
/* Teacher profile block */
.format-kickstart.path-course-view .course-content .card .card-header,
.format-kickstart.path-course-view .course-content .card .card-header img {
border-radius: 50%;
}
/* End of Teacher profile block */
.format-kickstart.path-course-view .course-content .card .card-block a.btn {
margin-right: 10px;
}
.format-kickstart.path-course-view .input-group-append {
border: 0;
}
.format-kickstart.path-course-view .input-group-append button i.icon {
margin: 0;
}
/* End of Content Migration from course block */
118 changes: 118 additions & 0 deletions tests/behat/behat_format_kickstart.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,109 @@
*/
class behat_format_kickstart extends behat_base {

/**
* Click the disable link for single activity course format.
* @Given /^I click on disable link single activity$/
*/
public function i_click_on_disable_link_single_activity() {
global $CFG;
if ($CFG->branch <= '403') {
$this->execute('behat_general::i_click_on_in_the', ["Disable", "link", "Single activity format", "table_row"]);
} else {
$this->execute('behat_general::i_click_on_in_the', ["Disable", "link", "Single activity", "table_row"]);
}
}

/**
* Click the ecit link for custom sections course format.
* @Given /^I click on enable link custom sections$/
*/
public function i_click_on_edit_link_custom_sections() {
global $CFG;
if ($CFG->branch <= '403') {
$this->execute('behat_general::i_click_on_in_the', ["Edit", "button", "Topics format", "table_row"]);
} else {
$this->execute('behat_general::i_click_on_in_the', ["Edit", "button", "Custom sections", "table_row"]);
}
}

/**
* Click the edit link for single activity course format.
* @Given /^I click on enable link single activity$/
*/
public function i_click_on_edit_link_single_activity() {
global $CFG;
if ($CFG->branch <= '403') {
$this->execute('behat_general::i_click_on_in_the', ["Edit", "button", "Single activity format", "table_row"]);
} else {
$this->execute('behat_general::i_click_on_in_the', ["Edit", "button", "Single activity", "table_row"]);
}
}

/**
* Check the single activity condition.
* @Given /^I check single activity condition kickstart:$/
* @param TableNode $table The course data
*/
public function i_check_single_activity_condition_kickstart(TableNode $table) {
$this->execute('behat_forms::i_set_the_following_fields_to_these_values', $table);
$this->execute('behat_forms::press_button', "Save and display");
$this->execute('behat_general::assert_page_contains_text', "There are no discussion topics yet in this forum");
}

/**
* I should see the course format.
* @Given /^I should see course format "(?P<element_string>(?:[^"]|\\")*)"$/
* @param string $format The course data
*/
public function i_should_see_define_course_format($format) {
global $CFG;
if ($CFG->branch <= '403') {
switch($format) {
case 'Single activity':
$format = 'Single activity format';
break;
case 'Social':
$format = 'Social format';
break;
case 'Custom sections':
$format = 'Topics format';
break;
case 'Weekly sections':
$format = 'Weekly format';
break;
}
}
$this->execute('behat_general::assert_page_contains_text', [$format]);
}


/**
* I should not see the course format.
* @Given /^I should not see course format "(?P<element_string>(?:[^"]|\\")*)"$/
* @param string $format The course data
*/
public function i_should_not_see_define_course_format($format) {
global $CFG;
if ($CFG->branch <= '403') {
switch($format) {
case 'Single activity':
$format = 'Single activity format';
break;
case 'Social':
$format = 'Social format';
break;
case 'Custom sections':
$format = 'Topics format';
break;
case 'Weekly sections':
$format = 'Weekly format';
break;
}
}
$this->execute('behat_general::assert_page_not_contains_text', [$format]);
}

/**
* Creates a new template with the provided table data matching template settings names with the desired values.
*
Expand Down Expand Up @@ -84,4 +187,19 @@ public function i_click_kickstart_template($selector) {
throw new ExpectationException("Doesn't working correct", $this->getSession());
}
}


/**
* Set the kickstart course format plugins settings.
*
* @Given /^I click kickstart single activity format template$/
*/
public function i_click_kickstart_single_activity_format_template() {
global $CFG;
if ($CFG->branch <= '403') {
$this->i_click_kickstart_template(".use-template[data-templatename=\"Single activity format\"]");
} else {
$this->i_click_kickstart_template(".use-template[data-templatename=\"Single activity\"]");
}
}
}
54 changes: 19 additions & 35 deletions tests/behat/format_kickstart_visibility.feature
Original file line number Diff line number Diff line change
Expand Up @@ -121,63 +121,47 @@ Feature: Check the kickstart course format features.
Scenario: Check the format plugin template access.
Given I log in as "admin"
Then I navigate to "Plugins > Course formats > Manage templates" in site administration
And I should see "Kickstart format"
And I should see "Single activity format"
And I should see "Social format"
And I should see "Topics format"
And I should see "Weekly format"
And I should see course format "Kickstart format"
And I should see course format "Single activity"
And I should see course format "Social"
And I should see course format "Custom sections"
And I should see course format "Weekly sections"
And I navigate to "Plugins > Course formats > Manage course formats" in site administration
And I click on "Disable" "link" in the "Single activity format" "table_row"
Then I click on disable link single activity
Then I navigate to "Plugins > Course formats > Manage templates" in site administration
And I should not see "Single activity format"
And I should not see course format "Single activity"
Then I am on "Course 1" course homepage
Then I should see "Course templates"
And I should not see "Single activity format"
Then I should see "Topics format"
And I click kickstart template ".use-template[data-templatename=\"Topics format\"]"
And I should not see course format "Single activity"
Then I should see course format "Custom sections"
Then I click on ".template-list .card-deck .card:nth-child(2) .card-footer a" "css_element"
And I click on "Import" "button" in the ".modal" "css_element"
And I start watching to see if a new page loads
Then I should see "Course 1"
Then ".course-content .topics" "css_element" should exist
Then ".course-content" "css_element" should exist
And I navigate to "Plugins > Course formats > Manage templates" in site administration
Then I click on "Edit" "button" in the "Topics format" "table_row"
Then I click on enable link custom sections
And I should see "Edit template"
And I set the following fields to these values:
| Course layout | Show one section per page |
Then I press "Save changes"
Then I am on "Course 2" course homepage
And I click kickstart template ".use-template[data-templatename=\"Topics format\"]"
And I click on "Import" "button" in the ".modal" "css_element"
#And I start watching to see if a new page loads
Then I should see "Course 2"
Then ".course-content .topics" "css_element" should exist
And I follow "Topic 1"
Then ".single-section" "css_element" should exist
Then I click on ".template-list .card-deck .card:nth-child(2) .card-footer a" "css_element"

Scenario: Check the visible course templates in different roles
Given I log in as "user1"
Then I am on "Course 1" course homepage
Then I should see "Course templates"
And I click kickstart template ".use-template[data-templatename=\"Topics format\"]"
And I click on "Import" "button" in the ".modal" "css_element"
And I start watching to see if a new page loads
Then I should see "Course 1"
Then ".course-content .topics" "css_element" should exist
Then I should see "Course 2"
Then ".course-content" "css_element" should exist

Scenario: Check the single activity format template
Given I log in as "admin"
And I am on "Course 3" course homepage with editing mode on
Then I should see "Course templates"
And I should see "Single activity format"
And I click kickstart template ".use-template[data-templatename=\"Single activity format\"]"
And I should see course format "Single activity"
And I click kickstart single activity format template
And I click on "Import" "button" in the ".modal" "css_element"
And I start watching to see if a new page loads
And I set the following fields to these values:
And I check single activity condition kickstart:
| Forum name | Test Forum |
Then I press "Save and display"
Then I should see "There are no discussion topics yet in this forum"
And I navigate to "Plugins > Course formats > Manage templates" in site administration
Then I click on "Edit" "button" in the "Single activity format" "table_row"
Then I click on enable link single activity
And I should see "Edit template"
And I set the following fields to these values:
| Type of activity | Page |
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024101700; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024111600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022041900; // Requires this Moodle version.
$plugin->release = 'Version 1.3';
$plugin->release = 'Version 1.4';
$plugin->component = 'format_kickstart'; // Full name of the plugin (used for diagnostics).
$plugin->supported = [400, 403];
$plugin->supported = [400, 405];
$plugin->maturity = MATURITY_STABLE;
Loading