From b64214cc3c26548bbfdf63a4e4560e3f74482f11 Mon Sep 17 00:00:00 2001 From: Clemens Frahnow Date: Tue, 10 Sep 2024 13:43:51 +0200 Subject: [PATCH] PM-46537 namespace styles, add view capability to index.php, fix missing lang string --- index.php | 3 ++- styles.css | 25 +------------------------ tests/classes/kialo_view_test.php | 8 ++++++++ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/index.php b/index.php index d1f8ca7..d53f749 100644 --- a/index.php +++ b/index.php @@ -32,6 +32,7 @@ require_course_login($course); $coursecontext = context_course::instance($course->id); +require_capability('mod/kialo:view', $coursecontext); $PAGE->set_url('/mod/kialo/index.php', ['id' => $id]); $PAGE->set_title(format_string($course->fullname)); @@ -46,7 +47,7 @@ $kialos = get_all_instances_in_course('kialo', $course); if (empty($kialos)) { - notice(get_string('no$kialoinstances', 'mod_kialo'), new moodle_url('/course/view.php', ['id' => $course->id])); + notice(new lang_string('noinstances', 'error', 'Kialo'), new moodle_url('/course/view.php', ['id' => $course->id])); } $table = new html_table(); diff --git a/styles.css b/styles.css index bb8d4cd..eb37319 100644 --- a/styles.css +++ b/styles.css @@ -11,32 +11,9 @@ format('woff2'); } -body, -div, -html, -iframe, -p, -span { - border: 0; - font: inherit; - font-size: 100%; - margin: 0; - padding: 0; - vertical-align: baseline; -} - -body, -html { - height: 100%; -} - -html { - -webkit-text-size-adjust: 100%; -} - .kialo-loading-text { display: flex; - height: 100%; + min-height: 100vh; align-items: center; flex-direction: column; justify-content: center; diff --git a/tests/classes/kialo_view_test.php b/tests/classes/kialo_view_test.php index 26265bc..cec8a2c 100644 --- a/tests/classes/kialo_view_test.php +++ b/tests/classes/kialo_view_test.php @@ -25,6 +25,8 @@ namespace mod_kialo; +use stdClass; + defined('MOODLE_INTERNAL') || die(); require_once(__DIR__ . '/../../vendor/autoload.php'); @@ -33,6 +35,12 @@ * Tests the view helpers. */ final class kialo_view_test extends \advanced_testcase { + /** + * The test user the tests are run as. + * + * @var stdClass + */ + private stdClass $user; protected function setUp(): void { parent::setUp();