mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'MDL-75412-master' of https://github.com/sarjona/moodle
This commit is contained in:
commit
f2aafd12c0
10
mod/data/preset/journal/addtemplate.html
Normal file
10
mod/data/preset/journal/addtemplate.html
Normal file
@ -0,0 +1,10 @@
|
||||
<div class="journal-addentry">
|
||||
<div class="form-group">
|
||||
<label for="[[Title#id]]">Title</label><br/>
|
||||
[[Title]]
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="[[Content#id]]">Content</label><br/>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
12
mod/data/preset/journal/asearchtemplate.html
Normal file
12
mod/data/preset/journal/asearchtemplate.html
Normal file
@ -0,0 +1,12 @@
|
||||
<div class="journal-asearch container">
|
||||
<div class="row row-cols-3">
|
||||
<div class="form-group col">
|
||||
<label for="[[title#id]]">Title</label><br/>
|
||||
[[title]]
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="[[content#id]]">Content</label><br/>
|
||||
[[content]]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
37
mod/data/preset/journal/classes/privacy/provider.php
Normal file
37
mod/data/preset/journal/classes/privacy/provider.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace datapreset_journal\privacy;
|
||||
|
||||
/**
|
||||
* Privacy provider implementation for datapreset_journal.
|
||||
*
|
||||
* @package datapreset_journal
|
||||
* @copyright 2022 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class provider implements \core_privacy\local\metadata\null_provider {
|
||||
|
||||
/**
|
||||
* Get the language string identifier with the component's language
|
||||
* file to explain why this plugin stores no data.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function get_reason() : string {
|
||||
return 'privacy:metadata';
|
||||
}
|
||||
}
|
16
mod/data/preset/journal/csstemplate.css
Normal file
16
mod/data/preset/journal/csstemplate.css
Normal file
@ -0,0 +1,16 @@
|
||||
/****** List View CSS ******/
|
||||
|
||||
.truncate-overflow {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/***** Add entry CSS *****/
|
||||
|
||||
.journal-addentry .form-group label,
|
||||
.journal-asearch .form-group label {
|
||||
font-weight: bold;
|
||||
padding-top: 20px;
|
||||
}
|
0
mod/data/preset/journal/jstemplate.js
Normal file
0
mod/data/preset/journal/jstemplate.js
Normal file
28
mod/data/preset/journal/lang/en/datapreset_journal.php
Normal file
28
mod/data/preset/journal/lang/en/datapreset_journal.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Strings for component 'datapreset_journal', language 'en'.
|
||||
*
|
||||
* @package datapreset_journal
|
||||
* @copyright 2022 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['modulename'] = 'Journal';
|
||||
$string['modulename_help'] = 'Use this preset for a journal, diary, reflections tool or research log.';
|
||||
$string['pluginname'] = 'Journal';
|
||||
$string['privacy:metadata'] = 'The Reflections plugin does not store any personal data.';
|
11
mod/data/preset/journal/listtemplate.html
Normal file
11
mod/data/preset/journal/listtemplate.html
Normal file
@ -0,0 +1,11 @@
|
||||
<div class="card my-3">
|
||||
<div class="card-body">
|
||||
<div class="d-flex">
|
||||
<h3 class="card-title">[[Title]]</h3>
|
||||
<div class="ml-auto">##actionsmenu##</div>
|
||||
</div>
|
||||
<div class="card-text truncate-overflow mb-4">[[Content]]</div>
|
||||
<p class="card-text">##userpicture## ##user##</p>
|
||||
<p class="card-text">##timeadded##</p>
|
||||
</div>
|
||||
</div>
|
1
mod/data/preset/journal/listtemplatefooter.html
Normal file
1
mod/data/preset/journal/listtemplatefooter.html
Normal file
@ -0,0 +1 @@
|
||||
</div>
|
1
mod/data/preset/journal/listtemplateheader.html
Normal file
1
mod/data/preset/journal/listtemplateheader.html
Normal file
@ -0,0 +1 @@
|
||||
<div id="journal-list">
|
32
mod/data/preset/journal/preset.xml
Normal file
32
mod/data/preset/journal/preset.xml
Normal file
@ -0,0 +1,32 @@
|
||||
<preset>
|
||||
|
||||
<settings>
|
||||
<intro></intro>
|
||||
<comments>0</comments>
|
||||
<requiredentries>0</requiredentries>
|
||||
<requiredentriestoview>0</requiredentriestoview>
|
||||
<maxentries>0</maxentries>
|
||||
<rssarticles>0</rssarticles>
|
||||
<approval>0</approval>
|
||||
<manageapproved>1</manageapproved>
|
||||
<defaultsortdir>0</defaultsortdir>
|
||||
<defaultsort>0</defaultsort>
|
||||
</settings>
|
||||
|
||||
<field>
|
||||
<type>text</type>
|
||||
<name>Title</name>
|
||||
<required>0</required>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<type>textarea</type>
|
||||
<name>Content</name>
|
||||
<required>0</required>
|
||||
<param2>60</param2>
|
||||
<param3>10</param3>
|
||||
<param4>1</param4>
|
||||
<param5>0</param5>
|
||||
</field>
|
||||
|
||||
</preset>
|
21
mod/data/preset/journal/rsstemplate.html
Normal file
21
mod/data/preset/journal/rsstemplate.html
Normal file
@ -0,0 +1,21 @@
|
||||
<div class="journal-single">
|
||||
<div class="d-flex">
|
||||
<h3 class="card-title">[[Title]]</h3>
|
||||
</div>
|
||||
<div class="journal-single-body">
|
||||
<div class="row">
|
||||
<div class="col col-3 col-md-1"><strong>Author</strong></div>
|
||||
<div class="col">##userpicture## ##user##</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col col-3 col-md-1"><strong>Status</strong></div>
|
||||
<div class="col">[[Content status]]</div>
|
||||
</div>
|
||||
<div class="row singleentry-content">
|
||||
<div class="col">
|
||||
<h4>Description</h4>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
1
mod/data/preset/journal/rsstitletemplate.html
Normal file
1
mod/data/preset/journal/rsstitletemplate.html
Normal file
@ -0,0 +1 @@
|
||||
[[Title]]
|
22
mod/data/preset/journal/singletemplate.html
Normal file
22
mod/data/preset/journal/singletemplate.html
Normal file
@ -0,0 +1,22 @@
|
||||
<div class="journal-single my-5">
|
||||
<div class="d-flex">
|
||||
<h3 class="card-title">[[Title]]</h3>
|
||||
<div class="ml-auto">##actionsmenu##</div>
|
||||
</div>
|
||||
<div class="journal-single-body my-5">
|
||||
<div class="row">
|
||||
<div class="col-3 col-md-1"><strong>Author</strong></div>
|
||||
<div class="col">##userpicture## ##user##</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-3 col-md-1"><strong>Date</strong></div>
|
||||
<div class="col">##timeadded##</div>
|
||||
</div>
|
||||
<div class="row singleentry-content">
|
||||
<div class="col">
|
||||
<h4 class="my-5">Reflections</h4>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
78
mod/data/preset/journal/tests/behat/journal_preset.feature
Normal file
78
mod/data/preset/journal/tests/behat/journal_preset.feature
Normal file
@ -0,0 +1,78 @@
|
||||
@mod @mod_data @datapreset @datapreset_journal
|
||||
Feature: Users can use the Journal preset
|
||||
In order to create a Journal database
|
||||
As a user
|
||||
I need to apply and use the Journal preset
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Alice | Student | student1@example.com |
|
||||
| teacher1 | Pau | Teacher | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| data | Student reflections | Database intro | C1 | data1 |
|
||||
And I am on the "Student reflections" "data activity" page logged in as teacher1
|
||||
And I follow "Presets"
|
||||
And I click on "fullname" "radio" in the "Journal" "table_row"
|
||||
And I click on "Use preset" "button"
|
||||
And I click on "Continue" "button"
|
||||
And I click on "Continue" "button"
|
||||
And the following "mod_data > entries" exist:
|
||||
| database | user | Title | Content |
|
||||
| data1 | student1 | Reflection created by student | This is the content for the entry 1 |
|
||||
| data1 | teacher1 | Reflection created by teacher | And this is the content for the entry 2 |
|
||||
|
||||
@javascript
|
||||
Scenario: Journal. Users view entries
|
||||
When I am on the "Student reflections" "data activity" page logged in as student1
|
||||
Then I should see "Reflection created by student"
|
||||
And I should see "This is the content for the entry 1"
|
||||
And "Actions" "icon" should exist in the "#journal-list" "css_element"
|
||||
And I should see "Reflection created by teacher"
|
||||
And I should see "And this is the content for the entry 2"
|
||||
# Single view.
|
||||
And I select "Single view" from the "jump" singleselect
|
||||
And I should see "Reflection created by student"
|
||||
And I should see "This is the content for the entry 1"
|
||||
And "Actions" "icon" should exist in the ".journal-single" "css_element"
|
||||
And I should not see "Reflection created by teacher"
|
||||
And I should not see "And this is the content for the entry 2"
|
||||
And I follow "Next"
|
||||
And I should see "Reflection created by teacher"
|
||||
And I should see "And this is the content for the entry 2"
|
||||
# This student can't edit or delete this entry, so the Actions menu shouldn't be displayed.
|
||||
And "Actions" "icon" should not exist in the ".journal-single" "css_element"
|
||||
And I should not see "Reflection created by student"
|
||||
And I should not see "This is the content for the entry 1"
|
||||
|
||||
@javascript
|
||||
Scenario: Journal. Users can search entries
|
||||
Given I am on the "Student reflections" "data activity" page logged in as student1
|
||||
And "Reflection created by student" "text" should appear before "Reflection created by teacher" "text"
|
||||
When I click on "Advanced search" "checkbox"
|
||||
And I set the field "Title" to "student"
|
||||
And I press "Save settings"
|
||||
Then I should see "Reflection created by student"
|
||||
And I should not see "Reflection created by teacher"
|
||||
But I set the field "Title" to "Reflection"
|
||||
And I set the field "Order" to "Descending"
|
||||
And I press "Save settings"
|
||||
And "Reflection created by teacher" "text" should appear before "Reflection created by student" "text"
|
||||
|
||||
@javascript
|
||||
Scenario: Journal. Users can add entries
|
||||
Given I am on the "Student reflections" "data activity" page logged in as student1
|
||||
When I press "Add entry"
|
||||
And I set the field "Title" to "This is the title"
|
||||
And I set the field "Content" to "This is the content for the new entry."
|
||||
And I press "Save"
|
||||
Then I should see "This is the title"
|
||||
And I should see "This is the content for the new entry."
|
29
mod/data/preset/journal/version.php
Normal file
29
mod/data/preset/journal/version.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Data Journal preset version information.
|
||||
*
|
||||
* @package datapreset_journal
|
||||
* @copyright 2022 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2022041900; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2022041200; // Requires this Moodle version.
|
||||
$plugin->component = 'datapreset_journal'; // Full name of the plugin (used for diagnostics).
|
@ -141,10 +141,6 @@
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
#page-mod-data-edit .mod-data-input {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#page-mod-data-edit .datatagcontrol {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user