mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
MDL-75411 mod_data: Add proposals preset
Co-author: Laurent David <laurent.david@moodle.com>
This commit is contained in:
parent
a7514f231d
commit
63bdc84719
@ -1850,7 +1850,8 @@ class core_plugin_manager {
|
||||
),
|
||||
|
||||
'datapreset' => array(
|
||||
'imagegallery'
|
||||
'imagegallery',
|
||||
'proposals',
|
||||
),
|
||||
|
||||
'fileconverter' => array(
|
||||
|
18
mod/data/preset/proposals/addtemplate.html
Normal file
18
mod/data/preset/proposals/addtemplate.html
Normal file
@ -0,0 +1,18 @@
|
||||
<div class="proposals-addentry">
|
||||
<div class="form-group">
|
||||
<label for="[[Title#id]]">Title</label><br/>
|
||||
[[Title]]
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="[[Status#id]]">Status</label><br/>
|
||||
[[Status]]
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="[[Summary#id]]">Summary</label><br/>
|
||||
[[Summary]]
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="[[Content#id]]">Content</label><br/>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
20
mod/data/preset/proposals/asearchtemplate.html
Normal file
20
mod/data/preset/proposals/asearchtemplate.html
Normal file
@ -0,0 +1,20 @@
|
||||
<div class="proposals-asearch container">
|
||||
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3">
|
||||
<div class="form-group col">
|
||||
<label for="[[Title#id]]">Title</label><br/>
|
||||
[[Title]]
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="[[Status#id]]">Status</label><br/>
|
||||
[[Status]]
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="[[Summary#id]]">Summary</label><br/>
|
||||
[[Summary]]
|
||||
</div>
|
||||
<div class="form-group col">
|
||||
<label for="[[Content#id]]">Content</label><br/>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
37
mod/data/preset/proposals/classes/privacy/provider.php
Normal file
37
mod/data/preset/proposals/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_proposals\privacy;
|
||||
|
||||
/**
|
||||
* Privacy provider implementation for datapreset_proposals.
|
||||
*
|
||||
* @package datapreset_proposals
|
||||
* @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';
|
||||
}
|
||||
}
|
18
mod/data/preset/proposals/csstemplate.css
Normal file
18
mod/data/preset/proposals/csstemplate.css
Normal file
@ -0,0 +1,18 @@
|
||||
/****** List View CSS ******/
|
||||
|
||||
#proposals-list .card-header a.d-block {
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#proposals-list .card {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/***** Add entry CSS *****/
|
||||
|
||||
.proposals-addentry .form-group label,
|
||||
.proposals-asearch .form-group label {
|
||||
font-weight: bold;
|
||||
padding-top: 20px;
|
||||
}
|
0
mod/data/preset/proposals/jstemplate.js
Normal file
0
mod/data/preset/proposals/jstemplate.js
Normal file
28
mod/data/preset/proposals/lang/en/datapreset_proposals.php
Normal file
28
mod/data/preset/proposals/lang/en/datapreset_proposals.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_proposals', language 'en'.
|
||||
*
|
||||
* @package datapreset_proposals
|
||||
* @copyright 2022 Sara Arjona <sara@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['modulename'] = 'Proposals';
|
||||
$string['modulename_help'] = 'Use this preset to collect proposals for topics, research, projects, etc. Fields include status such as approved, declined, revise or pending.';
|
||||
$string['pluginname'] = 'Proposals';
|
||||
$string['privacy:metadata'] = 'The Proposals plugin does not store any personal data.';
|
23
mod/data/preset/proposals/listtemplate.html
Normal file
23
mod/data/preset/proposals/listtemplate.html
Normal file
@ -0,0 +1,23 @@
|
||||
<div class="card">
|
||||
<div class="card-header" role="tab" id="entry-##id##">
|
||||
<div>
|
||||
<div class="row align-middle">
|
||||
<div class="col-4 col-sm-7 my-auto">
|
||||
<a data-toggle="collapse" data-parent="#proposals-list" href="#collapseentry-##id##" aria-expanded="true" aria-controls="collapseentry-##id##" class="d-block">
|
||||
<i class="fa fa-chevron-down"></i> [[Title]]
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-3 col-sm-2 push my-auto">[[Status]]</div>
|
||||
<div class="col-4 col-sm-2 my-auto">##userpicture## ##user##</div>
|
||||
<div class="ml-auto">##actionsmenu##</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="collapseentry-##id##" class="collapse" role="tabpanel" aria-labelledby="entry-##id##">
|
||||
<div class="card-body">
|
||||
[[Summary]]
|
||||
<p class="mt-3"><a href="##moreurl##">View the full proposal</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
1
mod/data/preset/proposals/listtemplatefooter.html
Normal file
1
mod/data/preset/proposals/listtemplatefooter.html
Normal file
@ -0,0 +1 @@
|
||||
</div>
|
1
mod/data/preset/proposals/listtemplateheader.html
Normal file
1
mod/data/preset/proposals/listtemplateheader.html
Normal file
@ -0,0 +1 @@
|
||||
<div id="proposals-list" class="accordion mb-4" role="tablist" aria-multiselectable="true">
|
48
mod/data/preset/proposals/preset.xml
Normal file
48
mod/data/preset/proposals/preset.xml
Normal file
@ -0,0 +1,48 @@
|
||||
<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>menu</type>
|
||||
<name>Status</name>
|
||||
<required>0</required>
|
||||
<param1>Approved
|
||||
In review
|
||||
Rejected
|
||||
Pending</param1>
|
||||
</field>
|
||||
|
||||
<field>
|
||||
<type>text</type>
|
||||
<name>Summary</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>
|
26
mod/data/preset/proposals/rsstemplate.html
Normal file
26
mod/data/preset/proposals/rsstemplate.html
Normal file
@ -0,0 +1,26 @@
|
||||
<div class="proposals-single">
|
||||
<div class="d-flex">
|
||||
<h3 class="card-title">[[Title]]</h3>
|
||||
</div>
|
||||
<div class="proposals-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">[[Status]]</div>
|
||||
</div>
|
||||
<div class="row singleentry-summary">
|
||||
<div class="col">
|
||||
<h4>Summary</h4>
|
||||
[[Summary]]
|
||||
</div>
|
||||
</div> <div class="row singleentry-content">
|
||||
<div class="col">
|
||||
<h4>Description</h4>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
1
mod/data/preset/proposals/rsstitletemplate.html
Normal file
1
mod/data/preset/proposals/rsstitletemplate.html
Normal file
@ -0,0 +1 @@
|
||||
[[Title]]
|
36
mod/data/preset/proposals/singletemplate.html
Normal file
36
mod/data/preset/proposals/singletemplate.html
Normal file
@ -0,0 +1,36 @@
|
||||
<div class="proposals-single my-5">
|
||||
<div class="d-flex">
|
||||
<h3 class="card-title">[[Title]]</h3>
|
||||
<div class="ml-auto">##actionsmenu##</div>
|
||||
</div>
|
||||
<div class="proposals-single-body">
|
||||
<div class="row my-3">
|
||||
<div class="col-3 col-md-1"><strong>Author</strong></div>
|
||||
<div class="col">##userpicture## ##user##</div>
|
||||
</div>
|
||||
<div class="row my-3">
|
||||
<div class="col-3 col-md-1"><strong>Status</strong></div>
|
||||
<div class="col">[[Status]]</div>
|
||||
</div>
|
||||
<div class="row my-3">
|
||||
<div class="col-3 col-md-1"><strong>Date added</strong></div>
|
||||
<div class="col">##timeadded##</div>
|
||||
</div>
|
||||
<div class="row my-3">
|
||||
<div class="col-3 col-md-1"><strong>Date modified</strong></div>
|
||||
<div class="col">##timemodified##</div>
|
||||
</div>
|
||||
<div class="row singleentry-summary">
|
||||
<div class="col">
|
||||
<h4 class="my-5">Summary</h4>
|
||||
[[Summary]]
|
||||
</div>
|
||||
</div>
|
||||
<div class="row singleentry-content">
|
||||
<div class="col">
|
||||
<h4 class="my-5">Content</h4>
|
||||
[[Content]]
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,98 @@
|
||||
@mod @mod_data @datapreset @datapreset_proposals
|
||||
Feature: Users can use the Proposals preset
|
||||
In order to create a Proposals database
|
||||
As a user
|
||||
I need to apply and use the Proposals 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 projects | Database intro | C1 | data1 |
|
||||
And I am on the "Student projects" "data activity" page logged in as teacher1
|
||||
And I follow "Presets"
|
||||
And I click on "fullname" "radio" in the "Proposals" "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 | Summary | Content | Status |
|
||||
| data1 | student1 | Project created by student | Summary 1 | Content for entry 1 | Pending |
|
||||
| data1 | teacher1 | Project created by teacher | Summary 2 | And content for entry 2 | Rejected |
|
||||
|
||||
@javascript
|
||||
Scenario: Proposals. Users view entries
|
||||
When I am on the "Student projects" "data activity" page logged in as student1
|
||||
Then I should see "Project created by student"
|
||||
And I should see "Pending"
|
||||
And "Summary 1" "text" should exist
|
||||
And "Actions" "icon" should exist in the "#proposals-list" "css_element"
|
||||
And I should see "Project created by teacher"
|
||||
And I should see "Rejected"
|
||||
And "Summary 2" "text" should exist
|
||||
And I click on "Project created by student" "link"
|
||||
And I click on "Project created by teacher" "link"
|
||||
And I should see "Summary 1"
|
||||
And I should not see "Content for entry 1"
|
||||
And I should see "Summary 2"
|
||||
And I should not see "And content for entry 2"
|
||||
# Single view.
|
||||
And I select "Single view" from the "jump" singleselect
|
||||
And I should see "Project created by student"
|
||||
And I should see "Summary 1"
|
||||
And I should see "Content for entry 1"
|
||||
And I should see "Pending"
|
||||
And "Actions" "icon" should exist in the ".proposals-single" "css_element"
|
||||
And I should not see "Project created by teacher"
|
||||
And I should not see "Summary 2"
|
||||
And I should not see "And content for entry 2"
|
||||
And I should not see "Rejected"
|
||||
And I follow "Next"
|
||||
And I should see "Project created by teacher"
|
||||
And I should see "Summary 2"
|
||||
And I should see "And content for entry 2"
|
||||
And I should see "Rejected"
|
||||
# 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 ".proposals-single" "css_element"
|
||||
And I should not see "Project created by student"
|
||||
And I should not see "Summary 1"
|
||||
And I should not see "Content for entry 1"
|
||||
And I should not see "Pending"
|
||||
|
||||
@javascript
|
||||
Scenario: Proposals. Users can search entries
|
||||
Given I am on the "Student projects" "data activity" page logged in as student1
|
||||
And "Project created by student" "text" should appear before "Project 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 "Project created by student"
|
||||
And I should not see "Project created by teacher"
|
||||
But I set the field "Title" to "Project"
|
||||
And I set the field "Order" to "Descending"
|
||||
And I press "Save settings"
|
||||
And "Project created by teacher" "text" should appear before "Project created by student" "text"
|
||||
|
||||
@javascript
|
||||
Scenario: Proposals. Users can add entries
|
||||
Given I am on the "Student projects" "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 "Summary" to "This is the summary for the new entry."
|
||||
And I set the field "Content" to "This is the content for the new entry."
|
||||
And I set the field "Status" to "Approved"
|
||||
And I press "Save"
|
||||
Then I should see "This is the title"
|
||||
And I should see "Approved"
|
||||
And I should see "This is the summary for the new entry."
|
||||
And I should see "This is the content for the new entry."
|
29
mod/data/preset/proposals/version.php
Normal file
29
mod/data/preset/proposals/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 Proposals preset version information.
|
||||
*
|
||||
* @package datapreset_proposals
|
||||
* @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_proposals'; // Full name of the plugin (used for diagnostics).
|
Loading…
x
Reference in New Issue
Block a user