Skip to content

Commit

Permalink
Merge pull request #91 from dpalou/ionic7
Browse files Browse the repository at this point in the history
Mobile app: Use module-info instead of module-description
  • Loading branch information
danmarsden authored Jul 24, 2024
2 parents 2a7a191 + d7f200b commit d9ba6d2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 119 deletions.
4 changes: 2 additions & 2 deletions classes/output/mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public static function main_view($args) {
global $OUTPUT, $USER, $DB;

$args = (object) $args;
$versionname = $args->appversioncode >= 3950 ? 'latest' : 'ionic3';
$cm = get_coursemodule_from_id('subcourse', $args->cmid);
$context = \context_module::instance($cm->id);

Expand Down Expand Up @@ -92,13 +91,14 @@ public static function main_view($args) {
'currentgrade' => $currentgrade,
'hasgrade' => isset($currentgrade),
'warning' => $warning,
'canusemoduleinfo' => $args->appversioncode >= 44000,
];

return [
'templates' => [
[
'id' => 'main',
'html' => $OUTPUT->render_from_template("mod_subcourse/mobile_view_$versionname", $data),
'html' => $OUTPUT->render_from_template('mod_subcourse/mobile_view_latest', $data),
],
],
'javascript' => '',
Expand Down
102 changes: 0 additions & 102 deletions templates/mobile_view_ionic3.mustache

This file was deleted.

21 changes: 16 additions & 5 deletions templates/mobile_view_latest.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,22 @@

{{=<% %>=}}
<div>
<core-course-module-description
description="<% subcourse.intro %>"
component="mod_subcourse"
componentId="<% cmid %>">
</core-course-module-description>
<%#canusemoduleinfo%>
<core-course-module-info
[module]="module"
description="<% subcourse.intro %>"
component="mod_subcourse"
componentId="<% cmid %>"
[courseId]="courseId">
</core-course-module-info>
<%/canusemoduleinfo%>
<%^canusemoduleinfo%>
<core-course-module-description
description="<% subcourse.intro %>"
component="mod_subcourse"
componentId="<% cmid %>">
</core-course-module-description>
<%/canusemoduleinfo%>

<%# warning %>
<ion-card class="ion-text-wrap core-warning-card">
Expand Down
10 changes: 0 additions & 10 deletions tests/output_mobile_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,5 @@ public function test_main_view() {

$this->assertEquals('main', $mainview3950['templates'][0]['id']);
$this->assertStringContainsString('plugin.mod_subcourse.currentgrade', $mainview3950['templates'][0]['html']);

// Ionic3 compatible view for the app version 3.9.4.
$mainview3940 = \mod_subcourse\output\mobile::main_view([
'cmid' => $subcourse->cmid,
'courseid' => $metacourse->id,
'appversioncode' => 3940,
]);

$this->assertEquals('main', $mainview3940['templates'][0]['id']);
$this->assertStringContainsString('plugin.mod_subcourse.currentgrade', $mainview3940['templates'][0]['html']);
}
}

0 comments on commit d9ba6d2

Please sign in to comment.