mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 20:06:46 +02:00
Merge branch 'MDL-80621-main' of https://github.com/roland04/moodle
This commit is contained in:
commit
803af22d60
18 changed files with 668 additions and 604 deletions
|
@ -203,9 +203,11 @@
|
|||
</div>
|
||||
{{/hasnavigation}}
|
||||
{{#numsections}}
|
||||
{{$ core_courseformat/local/content/addsection}}
|
||||
{{> core_courseformat/local/content/addsection}}
|
||||
{{/ core_courseformat/local/content/addsection}}
|
||||
{{^singlesection}}
|
||||
{{$ core_courseformat/local/content/addsection}}
|
||||
{{> core_courseformat/local/content/addsection}}
|
||||
{{/ core_courseformat/local/content/addsection}}
|
||||
{{/singlesection}}
|
||||
{{/numsections}}
|
||||
{{#bulkedittools}}
|
||||
{{$ core_courseformat/local/content/bulkedittools}}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
}
|
||||
}}
|
||||
{{#showaddsection}}
|
||||
<div class="mdl-left changenumsections bulk-hidden mt-3">
|
||||
<div id="course-addsection" class="changenumsections bulk-hidden mt-5">
|
||||
{{#increase}}
|
||||
<a href="{{{url}}}" class="increase-sections">
|
||||
{{#pix}}t/switch_plus, moodle, {{#str}} increasesections, moodle {{/str}}{{/pix}}
|
||||
|
@ -51,16 +51,18 @@
|
|||
</a>
|
||||
{{/decrease}}
|
||||
{{#addsections}}
|
||||
<a
|
||||
href="{{{url}}}"
|
||||
class="add-sections btn btn-link px-0"
|
||||
|
||||
<a href="{{{url}}}"
|
||||
class="btn add-section d-flex justify-content-center align-items-center p-3"
|
||||
data-add-sections="{{title}}"
|
||||
data-new-sections="{{newsection}}"
|
||||
data-action="addSection"
|
||||
{{#insertafter}} data-id="{{id}}" {{/insertafter}}
|
||||
>
|
||||
{{#pix}}t/switch_plus, moodle{{/pix}}{{title}}
|
||||
{{#pix}} t/add, core {{/pix}}
|
||||
{{title}}
|
||||
</a>
|
||||
|
||||
{{/addsections}}
|
||||
</div>
|
||||
{{/showaddsection}}
|
||||
|
|
|
@ -58,13 +58,10 @@
|
|||
}
|
||||
}}
|
||||
{{#editing}}
|
||||
<div class="divider divider-plus bulk-hidden" data-action="insert-before-{{activityname}}">
|
||||
{{> core_course/activitychooserbuttonactivity}}
|
||||
</div>
|
||||
{{< core_courseformat/local/content/divider}}
|
||||
{{$content}}{{> core_course/activitychooserbuttonactivity}}{{/content}}
|
||||
{{/ core_courseformat/local/content/divider}}
|
||||
{{/editing}}
|
||||
|
||||
<hr class="my-2">
|
||||
|
||||
<div class="activity-item focus-control {{#modstealth}}hiddenactivity{{/modstealth}}{{!
|
||||
}}{{#modhiddenfromstudents}}hiddenactivity{{/modhiddenfromstudents}}{{!
|
||||
}}{{#modinline}}activityinline{{/modinline}}" data-activityname="{{activityname}}" data-region="activity-card">
|
||||
|
|
34
course/format/templates/local/content/divider.mustache
Normal file
34
course/format/templates/local/content/divider.mustache
Normal file
|
@ -0,0 +1,34 @@
|
|||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_courseformat/local/content/divider
|
||||
|
||||
Displays a dashed divider.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"extraclasses": "mt-3",
|
||||
"content": "<button class=\"btn btn-primary\">Add section</button>"
|
||||
}
|
||||
}}
|
||||
|
||||
<div class="divider bulk-hidden d-flex justify-content-center align-items-center {{$extraclasses}}{{extraclasses}}{{/extraclasses}}">
|
||||
<hr>
|
||||
<div class="divider-content px-3">
|
||||
{{$content}}{{content}}{{/content}}
|
||||
</div>
|
||||
</div>
|
|
@ -96,13 +96,23 @@
|
|||
data-id="{{id}}"
|
||||
data-number="{{num}}"
|
||||
>
|
||||
<div class="course-section-header d-flex"
|
||||
data-for="section_title"
|
||||
data-id="{{id}}"
|
||||
data-number="{{num}}"
|
||||
>
|
||||
{{$ core_courseformat/local/content/section/content }}
|
||||
{{> core_courseformat/local/content/section/content }}
|
||||
{{/ core_courseformat/local/content/section/content }}
|
||||
<div class="section-item">
|
||||
<div class="course-section-header d-flex"
|
||||
data-for="section_title"
|
||||
data-id="{{id}}"
|
||||
data-number="{{num}}"
|
||||
>
|
||||
{{$ core_courseformat/local/content/section/content }}
|
||||
{{> core_courseformat/local/content/section/content }}
|
||||
{{/ core_courseformat/local/content/section/content }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#insertafter}}
|
||||
{{#numsections}}
|
||||
{{$ core_courseformat/local/content/addsection}}
|
||||
{{> core_courseformat/local/content/section/addsectiondivider }}
|
||||
{{/ core_courseformat/local/content/addsection}}
|
||||
{{/numsections}}
|
||||
{{/insertafter}}
|
||||
</li>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
{{!
|
||||
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/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_courseformat/local/content/section/addsectiondivider
|
||||
|
||||
Displays the add section divider inside a section.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"showaddsection": true,
|
||||
"id": 42,
|
||||
"insertafter": true,
|
||||
"num": 0,
|
||||
"addsections": {
|
||||
"url": "#",
|
||||
"title": "Add section",
|
||||
"newsection": 3
|
||||
}
|
||||
}
|
||||
}}
|
||||
{{#showaddsection}}
|
||||
<div class="changenumsections bulk-hidden" data-region="section-addsection">
|
||||
{{#addsections}}
|
||||
{{< core_courseformat/local/content/divider}}
|
||||
{{$extraclasses}}always-hidden mt-2{{/extraclasses}}
|
||||
{{$content}}
|
||||
<a href="{{{url}}}"
|
||||
class="btn add-content section-modchooser section-modchooser-link activitychooser-button d-flex justify-content-center align-items-center p-1 icon-no-margin"
|
||||
data-add-sections="{{title}}"
|
||||
data-new-sections="{{newsection}}"
|
||||
data-action="addSection"
|
||||
{{#insertafter}} data-id="{{id}}" {{/insertafter}}
|
||||
>
|
||||
{{#pix}} t/add, core {{/pix}}
|
||||
<span class="sr-only">{{title}}</span>
|
||||
</a>
|
||||
{{/content}}
|
||||
{{/ core_courseformat/local/content/divider}}
|
||||
{{/addsections}}
|
||||
</div>
|
||||
{{/showaddsection}}
|
|
@ -178,10 +178,3 @@
|
|||
{{/ core_courseformat/local/content/section/cmlist }}
|
||||
{{/cmlist}}
|
||||
{{{cmcontrols}}}
|
||||
{{#insertafter}}
|
||||
{{#numsections}}
|
||||
{{$ core_courseformat/local/content/addsection}}
|
||||
{{> core_courseformat/local/content/addsection}}
|
||||
{{/ core_courseformat/local/content/addsection}}
|
||||
{{/numsections}}
|
||||
{{/insertafter}}
|
||||
|
|
|
@ -257,7 +257,7 @@ Feature: Course index depending on role
|
|||
Scenario: Adding section should alter the course index
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
When I click on "Add section" "link" in the "Topic 4" "section"
|
||||
When I click on "Add section" "link" in the "course-addsection" "region"
|
||||
Then I should see "Topic 5" in the "courseindex-content" "region"
|
||||
|
||||
@javascript
|
||||
|
|
|
@ -84,3 +84,8 @@ Feature: Single section course page
|
|||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Reports > Live logs" in current page administration
|
||||
And I should see "Section viewed"
|
||||
|
||||
Scenario: The add section button is not displayed in the single section page
|
||||
Given I turn editing mode on
|
||||
When I click on "View" "link" in the "Topic 1" "section"
|
||||
Then "Add section" "link" should not exist in the "region-main" "region"
|
||||
|
|
|
@ -37,11 +37,9 @@ use renderer_base;
|
|||
class content extends content_base {
|
||||
|
||||
/**
|
||||
* @var bool Topic format has add section after each topic.
|
||||
*
|
||||
* The responsible for the buttons is core_courseformat\output\local\content\section.
|
||||
* @var bool Topic format has also add section after each topic.
|
||||
*/
|
||||
protected $hasaddsection = false;
|
||||
protected $hasaddsection = true;
|
||||
|
||||
/**
|
||||
* Export this data so it can be used as the context for a mustache template (core/inplace_editable).
|
||||
|
|
|
@ -79,12 +79,13 @@ Feature: Sections can be edited and deleted in custom sections format
|
|||
|
||||
@javascript
|
||||
Scenario: Adding sections at the end of a custom sections format
|
||||
When I click on "Add section" "link" in the "Topic 5" "section"
|
||||
When I click on "Add section" "link" in the "course-addsection" "region"
|
||||
Then I should see "Topic 6" in the "Topic 6" "section"
|
||||
And I should see "Test choice name" in the "Topic 5" "section"
|
||||
|
||||
@javascript
|
||||
Scenario: Adding sections between topics in custom sections format
|
||||
Given I hover over the "Add section" "link" in the "Topic 4" "section"
|
||||
When I click on "Add section" "link" in the "Topic 4" "section"
|
||||
Then I should see "Topic 6" in the "Topic 6" "section"
|
||||
And I should not see "Test choice name" in the "Topic 5" "section"
|
||||
|
@ -92,7 +93,7 @@ Feature: Sections can be edited and deleted in custom sections format
|
|||
|
||||
@javascript
|
||||
Scenario: Add a topic and then add an activity in it
|
||||
When I click on "Add section" "link" in the "Topic 5" "section"
|
||||
When I click on "Add section" "link" in the "course-addsection" "region"
|
||||
And I add an assign activity to course "Course 1" section "6" and I fill the form with:
|
||||
| Assignment name | Very new activity |
|
||||
| Description | Test |
|
||||
|
|
|
@ -29,12 +29,16 @@
|
|||
"sectionreturn": 0
|
||||
}
|
||||
}}
|
||||
<button class="btn btn-link text-decoration-none section-modchooser section-modchooser-link activity-add bulk-hidden d-flex align-items-center p-3 mt-3"
|
||||
data-action="open-chooser"
|
||||
data-sectionid="{{sectionid}}"
|
||||
{{#sectionreturn}}data-sectionreturnid="{{.}}"{{/sectionreturn}}>
|
||||
<span class="pluscontainer icon-no-margin icon-size-3 d-flex p-2 mr-2">
|
||||
{{#pix}} t/add, core {{/pix}}
|
||||
</span>
|
||||
<span class="activity-add-text">{{#str}}addresourceoractivity, core{{/str}}</span>
|
||||
</button>
|
||||
{{< core_courseformat/local/content/divider}}
|
||||
{{$extraclasses}}always-visible my-3{{/extraclasses}}
|
||||
{{$content}}
|
||||
<button class="btn add-content section-modchooser section-modchooser-link d-flex justify-content-center align-items-center py-1 px-2"
|
||||
data-action="open-chooser"
|
||||
data-sectionid="{{sectionid}}"
|
||||
{{#sectionreturn}}data-sectionreturnid="{{.}}"{{/sectionreturn}}
|
||||
>
|
||||
{{#pix}} t/add, core {{/pix}}
|
||||
<span class="activity-add-text pr-1">{{#str}}addresourceoractivity, core{{/str}}</span>
|
||||
</button>
|
||||
{{/content}}
|
||||
{{/ core_courseformat/local/content/divider}}
|
||||
|
|
|
@ -31,12 +31,13 @@
|
|||
"sectionreturn": 5
|
||||
}
|
||||
}}
|
||||
<button class="btn btn-link text-decoration-none section-modchooser section-modchooser-link activity-add d-flex align-items-center activitychooser-button"
|
||||
data-action="open-chooser"
|
||||
data-sectionid="{{num}}"
|
||||
{{#sectionreturn}}data-sectionreturnid="{{.}}"{{/sectionreturn}}
|
||||
data-beforemod="{{id}}"
|
||||
aria-label="{{#str}}insertresourceoractivitybefore, core, { "activityname": {{#quote}} {{activityname}} {{/quote}} } {{/str}}"
|
||||
tabindex="0">
|
||||
<button class="btn add-content section-modchooser section-modchooser-link activitychooser-button d-flex justify-content-center align-items-center p-1 icon-no-margin"
|
||||
data-action="open-chooser"
|
||||
data-sectionid="{{num}}"
|
||||
{{#sectionreturn}}data-sectionreturnid="{{.}}"{{/sectionreturn}}
|
||||
data-beforemod="{{id}}"
|
||||
aria-label="{{#str}}insertresourceoractivitybefore, core, { "activityname": {{#quote}} {{activityname}} {{/quote}} } {{/str}}"
|
||||
tabindex="0"
|
||||
>
|
||||
{{#pix}} t/add, core {{/pix}}
|
||||
</button>
|
||||
|
|
|
@ -24,9 +24,9 @@ Feature: Use the activity chooser to insert activities anywhere in a section
|
|||
|
||||
Scenario: The activity chooser icon is hidden by default and be made visible on hover
|
||||
Given I hover ".navbar-brand" "css_element"
|
||||
And "[data-action='insert-before-Test Forum'] button" "css_element" should not be visible
|
||||
And "Insert an activity or resource before 'Test Forum'" "button" should not be visible
|
||||
When I hover "Insert an activity or resource before 'Test Forum'" "button"
|
||||
Then "[data-action='insert-before-Test Forum'] button" "css_element" should be visible
|
||||
Then "Insert an activity or resource before 'Test Forum'" "button" should be visible
|
||||
|
||||
Scenario: The activity chooser can be used to insert modules before existing modules
|
||||
Given I hover "Insert an activity or resource before 'Test Forum'" "button"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue