1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-25 10:26:17 +02:00

Merge branch 'MDL-63794-master-2' of git://github.com/mihailges/moodle

This commit is contained in:
Adrian Greeve 2018-12-18 12:13:35 +01:00
commit 1ccaa71b04
7 changed files with 78 additions and 24 deletions

@ -28,7 +28,8 @@
"courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
"fullname": "course 3",
"hasprogress": true,
"progress": 10
"progress": 10,
"coursecategory": "Miscellaneous"
}
]
}
@ -50,4 +51,13 @@
{{#shortentext}}50, {{{fullname}}} {{/shortentext}}
</span>
{{/coursename}}
{{$coursecategory}}
<span class="sr-only">
{{#str}}aria:coursecategory, core_course{{/str}}
</span>
<div>{{{coursecategory}}}</div>
{{/coursecategory}}
{{$divider}}
<div class="pl-1 pr-1">|</div>
{{/divider}}
{{/ core_course/coursecards }}

@ -28,7 +28,8 @@
"courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
"fullname": "course 3",
"hasprogress": true,
"progress": 10
"progress": 10,
"coursecategory": "Miscellaneous"
}
]
}
@ -42,14 +43,19 @@
<div class="row-fluid">
<div class="{{#hasprogress}}col-md-6 span6{{/hasprogress}}{{^hasprogress}}col-md-11 span11{{/hasprogress}} d-flex align-items-center">
<a href="{{viewurl}}" class="coursename">
{{#showshortname}}
<div class="text-muted muted d-flex" style="flex-flow:wrap;">
<span class="sr-only">
{{#str}}aria:coursecategory, core_course{{/str}}
</span>
<div>{{{coursecategory}}}</div>
{{#showshortname}}
<div class="pl-1 pr-1">|</div>
<span class="sr-only">
{{#str}}aria:courseshortname, core_course{{/str}}
</span>
<div class="text-muted muted">
{{{shortname}}}
</div>
{{/showshortname}}
<div>{{{shortname}}}</div>
{{/showshortname}}
</div>
{{> core_course/favouriteicon }}
<span class="sr-only">
{{#str}}aria:coursename, core_course{{/str}}

@ -29,7 +29,8 @@
"fullname": "course 3",
"summary": "This course is about assignments",
"hasprogress": true,
"progress": 10
"progress": 10,
"coursecategory": "Miscellaneous"
}
]
}
@ -49,19 +50,24 @@
<div class="align-self-stretch d-flex flex-column w-100">
<div class="d-flex mb-1">
<a href="{{viewurl}}" class="coursename">
{{#showshortname}}
<div class="text-muted muted mb-1 d-flex" style="flex-flow:wrap;">
<span class="sr-only">
{{#str}}aria:coursecategory, core_course{{/str}}
</span>
<div>{{{coursecategory}}}</div>
{{#showshortname}}
<div class="pl-1 pr-1">|</div>
<span class="sr-only">
{{#str}}aria:courseshortname, core_course{{/str}}
</span>
<div class="text-muted muted mb-1">
{{{shortname}}}
</div>
{{/showshortname}}
<div>{{{shortname}}}</div>
{{/showshortname}}
</div>
{{> core_course/favouriteicon }}
<span class="sr-only">
{{#str}}aria:coursename, core_course{{/str}}
</span>
<h6 class="d-inline h5">{{{fullname}}}</h4>
<h6 class="d-inline h5">{{{fullname}}}</h6>
</a>
{{> block_myoverview/course-action-menu }}
</div>

@ -8,12 +8,15 @@ Feature: The my overview block allows users to easily access their courses
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | X | student1@example.com | S1 |
And the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
And the following "courses" exist:
| fullname | shortname | category | startdate | enddate |
| Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## |
| Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## |
| Course 3 | C3 | 0 | ##yesterday## | ##tomorrow## |
| Course 4 | C4 | 0 | ##yesterday## | ##tomorrow## |
| Course 4 | C4 | CAT1 | ##yesterday## | ##tomorrow## |
| Course 5 | C5 | 0 | ##first day of next month## | ##last day of next month## |
And the following "course enrolments" exist:
| user | course | role |
@ -200,3 +203,21 @@ Feature: The my overview block allows users to easily access their courses
And I should not see "Course 3" in the "Course overview" "block"
And I should not see "Course 4" in the "Course overview" "block"
And I log out
Scenario: Show course category in cards display
Given I log in as "student1"
And I click on "Display dropdown" "button" in the "Course overview" "block"
When I click on "Card" "link" in the "Course overview" "block"
Then I should see "Category 1" in the "Course overview" "block"
Scenario: Show course category in list display
Given I log in as "student1"
And I click on "Display dropdown" "button" in the "Course overview" "block"
When I click on "List" "link" in the "Course overview" "block"
Then I should see "Category 1" in the "Course overview" "block"
Scenario: Show course category in summary display
Given I log in as "student1"
And I click on "Display dropdown" "button" in the "Course overview" "block"
When I click on "Summary" "link" in the "Course overview" "block"
Then I should see "Category 1" in the "Course overview" "block"

@ -65,6 +65,7 @@ class course_summary_exporter extends \core\external\exporter {
$hasprogress = true;
}
$progress = floor($progress);
$coursecategory = \core_course_category::get($this->data->category, MUST_EXIST, true);
return array(
'fullnamedisplay' => get_course_display_name_for_list($this->data),
'viewurl' => (new moodle_url('/course/view.php', array('id' => $this->data->id)))->out(false),
@ -73,7 +74,8 @@ class course_summary_exporter extends \core\external\exporter {
'hasprogress' => $hasprogress,
'isfavourite' => $this->related['isfavourite'],
'hidden' => boolval(get_user_preferences('block_myoverview_hidden_course_' . $this->data->id, 0)),
'showshortname' => $CFG->courselistshortnames ? true : false
'showshortname' => $CFG->courselistshortnames ? true : false,
'coursecategory' => $coursecategory->name
);
}
@ -149,6 +151,9 @@ class course_summary_exporter extends \core\external\exporter {
),
'showshortname' => array(
'type' => PARAM_BOOL
),
'coursecategory' => array(
'type' => PARAM_TEXT
)
);
}

@ -28,7 +28,8 @@
"courseimage": "https://moodlesite/pluginfile/123/course/overviewfiles/123.jpg",
"fullname": "course 3",
"hasprogress": true,
"progress": 10
"progress": 10,
"coursecategory": "Miscellaneous"
}
]
}
@ -47,14 +48,18 @@
<div class="card-body pr-1 course-info-container" id="course-info-container-{{id}}-{{uniqid}}">
<div class="d-flex align-items-start">
<a href="{{viewurl}}" class="coursename mr-2 text-truncate">
<span class="sr-only">
{{#str}}aria:courseshortname, core_course{{/str}}
</span>
{{#showshortname}}
<div class="text-muted muted w-100 mb-1 text-truncate">
{{{shortname}}}
<div class="text-muted muted d-flex w-100 mb-1 text-truncate" style="flex-flow:wrap;">
{{$coursecategory}}{{/coursecategory}}
{{#showshortname}}
{{$divider}}{{/divider}}
<span class="sr-only">
{{#str}}aria:courseshortname, core_course{{/str}}
</span>
<div>
{{{shortname}}}
</div>
{{/showshortname}}
</div>
{{/showshortname}}
{{> core_course/favouriteicon }}
<span class="sr-only">
{{#str}}aria:coursename, core_course{{/str}}

@ -22,6 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['aria:coursecategory'] = 'Course category';
$string['aria:courseimage'] = 'Course image';
$string['aria:courseshortname'] = 'Course short name';
$string['aria:coursename'] = 'Course name';