mirror of
https://github.com/moodle/moodle.git
synced 2025-04-14 04:52:36 +02:00
MDL-80923 course: Replace custom element with placeholder
In the section settings page, replace the custom checkbox element used for renaming with a standard input text field featuring a placeholder. This adjustment aims to enhance user experience by simplifying the interaction and aligning with modern design standards.
This commit is contained in:
parent
39b8e198ff
commit
5e5f06ba68
@ -25,12 +25,19 @@ class editsection_form extends moodleform {
|
||||
|
||||
$mform->addElement('header', 'generalhdr', get_string('general'));
|
||||
|
||||
$mform->addElement('defaultcustom', 'name', get_string('sectionname'), [
|
||||
'defaultvalue' => $this->_customdata['defaultsectionname'],
|
||||
'customvalue' => $sectioninfo->name,
|
||||
], ['size' => 30, 'maxlength' => 255]);
|
||||
$mform->setDefault('name', false);
|
||||
$mform->addGroupRule('name', array('name' => array(array(get_string('maximumchars', '', 255), 'maxlength', 255))));
|
||||
$mform->addElement(
|
||||
'text',
|
||||
'name',
|
||||
get_string('sectionname'),
|
||||
[
|
||||
'placeholder' => $this->_customdata['defaultsectionname'],
|
||||
'size' => 30,
|
||||
'maxlength' => 255,
|
||||
],
|
||||
);
|
||||
$mform->setType('name', PARAM_RAW);
|
||||
$mform->setDefault('name', $sectioninfo->name);
|
||||
$mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
|
||||
|
||||
/// Prepare course and the editor
|
||||
|
||||
@ -98,9 +105,6 @@ class editsection_form extends moodleform {
|
||||
$editoroptions = $this->_customdata['editoroptions'];
|
||||
$default_values = file_prepare_standard_editor($default_values, 'summary', $editoroptions,
|
||||
$editoroptions['context'], 'course', 'section', $default_values->id);
|
||||
if (strval($default_values->name) === '') {
|
||||
$default_values->name = false;
|
||||
}
|
||||
parent::set_data($default_values);
|
||||
}
|
||||
|
||||
|
@ -27,22 +27,21 @@ Feature: Sections can be edited and deleted in custom sections format
|
||||
Scenario: View the default name of the general section in custom sections format
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
When I edit the section "0"
|
||||
Then the field "Custom" matches value "0"
|
||||
And the field "New value for Section name" matches value "General"
|
||||
Then the field "Section name" matches value ""
|
||||
And I should see "General"
|
||||
|
||||
Scenario: Edit the default name of the general section in custom sections format
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I should see "General" in the "General" "section"
|
||||
When I edit the section "0" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the general section |
|
||||
| Section name | This is the general section |
|
||||
Then I should see "This is the general section" in the "page" "region"
|
||||
|
||||
Scenario: View the default name of the second section in custom sections format
|
||||
Given I am on "Course 2" course homepage with editing mode on
|
||||
When I edit the section "1"
|
||||
Then the field "Custom" matches value "0"
|
||||
And the field "New value for Section name" matches value "New section"
|
||||
Then the field "Section name" matches value ""
|
||||
And I should see "New section"
|
||||
|
||||
Scenario: Edit section summary in custom sections format
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
@ -53,8 +52,7 @@ Feature: Sections can be edited and deleted in custom sections format
|
||||
Scenario: Edit section default name in custom sections format
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
When I edit the section "2" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the second section |
|
||||
| Section name | This is the second section |
|
||||
Then I should see "This is the second section" in the "page" "region"
|
||||
And I should not see "Section 2" in the "region-main" "region"
|
||||
|
||||
|
@ -25,19 +25,18 @@ Feature: Sections can be edited and deleted in weekly sections format
|
||||
|
||||
Scenario: View the default name of the general section in weeks format
|
||||
When I edit the section "0"
|
||||
Then the field "Custom" matches value "0"
|
||||
And the field "New value for Section name" matches value "General"
|
||||
Then the field "Section name" matches value ""
|
||||
And I should see "General"
|
||||
|
||||
Scenario: Edit the default name of the general section in weeks format
|
||||
When I edit the section "0" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the general section |
|
||||
| Section name | This is the general section |
|
||||
Then I should see "This is the general section" in the "page" "region"
|
||||
|
||||
Scenario: View the default name of the second section in weeks format
|
||||
When I edit the section "2"
|
||||
Then the field "Custom" matches value "0"
|
||||
And the field "New value for Section name" matches value "8 May - 14 May"
|
||||
Then the field "Section name" matches value ""
|
||||
And I should see "8 May - 14 May"
|
||||
|
||||
Scenario: Edit section summary in weeks format
|
||||
When I edit the section "2" and I fill the form with:
|
||||
@ -47,8 +46,7 @@ Feature: Sections can be edited and deleted in weekly sections format
|
||||
Scenario: Edit section default name in weeks format
|
||||
Given I should see "8 May - 14 May" in the "8 May - 14 May" "section"
|
||||
When I edit the section "2" and I fill the form with:
|
||||
| Custom | 1 |
|
||||
| New value for Section name | This is the second week |
|
||||
| Section name | This is the second week |
|
||||
Then I should see "This is the second week" in the "page" "region"
|
||||
And I should not see "8 May - 14 May"
|
||||
|
||||
|
@ -64,8 +64,7 @@ Feature: Collapse course sections
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I click on "Edit" "link" in the "region-main" "region"
|
||||
And I click on "Custom" "checkbox"
|
||||
And I set the field "New value for Section name" to "New section name"
|
||||
And I set the field "Section name" to "New section name"
|
||||
When I press "Save changes"
|
||||
Then "[data-toggle=collapse]" "css_element" should not exist in the "region-main" "region"
|
||||
|
||||
|
@ -25,8 +25,7 @@ Feature: Site home activities section
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I click on "Edit" "link" in the "region-main" "region"
|
||||
And I click on "Custom" "checkbox"
|
||||
And I set the field "New value for Section name" to "New section name"
|
||||
And I set the field "Section name" to "New section name"
|
||||
When I press "Save changes"
|
||||
And I should see "New section name" in the "region-main" "region"
|
||||
Then I turn editing mode off
|
||||
|
@ -36,7 +36,6 @@ Feature: Section 0 default/custom title
|
||||
And "New name for section" "field" should not exist
|
||||
And I set the field "Edit section name" in the "li#section-0" "css_element" to "Edited section 0"
|
||||
And I should see "Edited section 0" in the "page" "region"
|
||||
And I edit the section "0" and I fill the form with:
|
||||
| Custom | 0 |
|
||||
And I set the field "Edit section name" in the "li#section-0" "css_element" to ""
|
||||
And I should not see "Edited section 0" in the "page" "region"
|
||||
And I should see "General" in the "page" "region"
|
||||
|
Loading…
x
Reference in New Issue
Block a user