mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 02:46:40 +02:00
MDL-48947 course: Section button cleanup
Creates a new method of handling all the section related icons. Including a new method that places these actions in a menu for topic and weeks course formats. (This version replaces "Edit" with "Topic/Week/or Section menu")
This commit is contained in:
parent
cd3a6a78b6
commit
60cf074239
29 changed files with 512 additions and 126 deletions
|
@ -74,7 +74,7 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
|
|||
|
||||
for (var i = sectionfrom; i <= sectionto; i++) {
|
||||
// Update section title.
|
||||
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
|
||||
sectionlist.item(i).all('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
|
||||
// Update move icon.
|
||||
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
|
||||
str = ele.getAttribute('alt');
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
*/
|
||||
|
||||
$string['currentsection'] = 'This topic';
|
||||
$string['editsection'] = 'Edit topic';
|
||||
$string['deletesection'] = 'Delete topic';
|
||||
$string['sectionname'] = 'Topic';
|
||||
$string['pluginname'] = 'Topics format';
|
||||
$string['sectionmenu'] = 'Topic menu';
|
||||
$string['section0name'] = 'General';
|
||||
$string['page-course-view-topics'] = 'Any course main page in topics format';
|
||||
$string['page-course-view-topics-x'] = 'Any course page in topics format';
|
||||
|
|
|
@ -74,14 +74,14 @@ class format_topics_renderer extends format_section_renderer_base {
|
|||
}
|
||||
|
||||
/**
|
||||
* Generate the edit controls of a section
|
||||
* Generate the edit control items of a section
|
||||
*
|
||||
* @param stdClass $course The course entry from DB
|
||||
* @param stdClass $section The course_section entry from DB
|
||||
* @param bool $onsectionpage true if being printed on a section page
|
||||
* @return array of links with edit controls
|
||||
* @return array of edit control items
|
||||
*/
|
||||
protected function section_edit_controls($course, $section, $onsectionpage = false) {
|
||||
protected function section_edit_control_items($course, $section, $onsectionpage = false) {
|
||||
global $PAGE;
|
||||
|
||||
if (!$PAGE->user_is_editing()) {
|
||||
|
@ -99,22 +99,26 @@ class format_topics_renderer extends format_section_renderer_base {
|
|||
|
||||
$isstealth = $section->section > $course->numsections;
|
||||
$controls = array();
|
||||
if (!$isstealth && has_capability('moodle/course:setcurrentsection', $coursecontext)) {
|
||||
if (!$isstealth && $section->section && has_capability('moodle/course:setcurrentsection', $coursecontext)) {
|
||||
if ($course->marker == $section->section) { // Show the "light globe" on/off.
|
||||
$url->param('marker', 0);
|
||||
$controls[] = html_writer::link($url,
|
||||
html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marked'),
|
||||
'class' => 'icon ', 'alt' => get_string('markedthistopic'))),
|
||||
array('title' => get_string('markedthistopic'), 'class' => 'editing_highlight'));
|
||||
$markedthistopic = get_string('markedthistopic');
|
||||
$highlightoff = get_string('highlightoff');
|
||||
$controls[] = array("url" => $url, "icon" => 'i/marked',
|
||||
"name" => $highlightoff,
|
||||
'pixattr' => array('class' => '', 'alt' => $markedthistopic),
|
||||
"attr" => array('class' => 'editing_highlight', 'title' => $markedthistopic));
|
||||
} else {
|
||||
$url->param('marker', $section->section);
|
||||
$controls[] = html_writer::link($url,
|
||||
html_writer::empty_tag('img', array('src' => $this->output->pix_url('i/marker'),
|
||||
'class' => 'icon', 'alt' => get_string('markthistopic'))),
|
||||
array('title' => get_string('markthistopic'), 'class' => 'editing_highlight'));
|
||||
$markthistopic = get_string('markthistopic');
|
||||
$highlight = get_string('highlight');
|
||||
$controls[] = array("url" => $url, "icon" => 'i/marker',
|
||||
"name" => $highlight,
|
||||
'pixattr' => array('class' => '', 'alt' => $markthistopic),
|
||||
"attr" => array('class' => 'editing_highlight', 'title' => $markthistopic));
|
||||
}
|
||||
}
|
||||
|
||||
return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage));
|
||||
return array_merge($controls, parent::section_edit_control_items($course, $section, $onsectionpage));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
.course-content ul.topics {margin:0;}
|
||||
.course-content ul.topics li.section {list-style: none;margin:0 0 5px 0;padding:0;}
|
||||
.course-content ul.topics li.section .content {margin:0 40px;}
|
||||
.course-content ul.topics li.section .left {float:left;}
|
||||
.course-content ul.topics li.section .right {float:right;}
|
||||
.course-content ul.topics li.section .left,
|
||||
.course-content ul.topics li.section .right {width:40px;text-align:center;padding: 6px 0;}
|
||||
.course-content ul.topics li.section .right {width:40px;padding: 0 6px;}
|
||||
.course-content ul.topics li.section .right img.icon { padding: 0 0 4px 0;}
|
||||
.course-content ul.topics li.section .left {padding-top:22px;text-align: right;}
|
||||
.jsenabled .course-content ul.topics li.section .left,
|
||||
.jsenabled .course-content ul.topics li.section .right {width:auto;}
|
||||
.course-content ul.topics li.section .left .section-handle img.icon { padding:0; vertical-align: baseline; }
|
||||
.course-content ul.topics li.section .section_action_menu .textmenu,
|
||||
.course-content ul.topics li.section .section_action_menu .menu-action-text { white-space: nowrap; }
|
|
@ -25,14 +25,14 @@ Feature: Sections can be edited and deleted in topics format
|
|||
And I turn editing mode on
|
||||
|
||||
Scenario: Edit section summary in topics format
|
||||
When I click on "Edit summary" "link" in the "li#section-2" "css_element"
|
||||
When I edit the section "2"
|
||||
And I set the following fields to these values:
|
||||
| Summary | Welcome to section 2 |
|
||||
And I press "Save changes"
|
||||
Then I should see "Welcome to section 2" in the "li#section-2" "css_element"
|
||||
|
||||
Scenario: Edit section default name in topics format
|
||||
When I click on "Edit summary" "link" in the "li#section-2" "css_element"
|
||||
When I edit the section "2"
|
||||
And I set the following fields to these values:
|
||||
| Use default section name | 0 |
|
||||
| name | This is the second topic |
|
||||
|
@ -41,7 +41,7 @@ Feature: Sections can be edited and deleted in topics format
|
|||
And I should not see "Topic 2" in the "li#section-2" "css_element"
|
||||
|
||||
Scenario: Deleting the last section in topics format
|
||||
When I click on "Delete topic" "link" in the "li#section-5" "css_element"
|
||||
When I delete section "5"
|
||||
Then I should see "Are you absolutely sure you want to completely delete \"Topic 5\" and all the activities it contains?"
|
||||
And I press "Continue"
|
||||
And I should not see "Topic 5"
|
||||
|
@ -50,7 +50,7 @@ Feature: Sections can be edited and deleted in topics format
|
|||
And the field "Number of sections" matches value "4"
|
||||
|
||||
Scenario: Deleting the middle section in topics format
|
||||
When I click on "Delete topic" "link" in the "li#section-4" "css_element"
|
||||
When I delete section "4"
|
||||
And I press "Continue"
|
||||
Then I should not see "Topic 5"
|
||||
And I should not see "Test chat name"
|
||||
|
@ -62,7 +62,7 @@ Feature: Sections can be edited and deleted in topics format
|
|||
Scenario: Deleting the orphaned section in topics format
|
||||
When I follow "Reduce the number of sections"
|
||||
Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element"
|
||||
And I click on "Delete topic" "link" in the "li#section-5" "css_element"
|
||||
And I delete section "5"
|
||||
And I press "Continue"
|
||||
And I should not see "Topic 5"
|
||||
And I should not see "Orphaned activities"
|
||||
|
@ -76,7 +76,7 @@ Feature: Sections can be edited and deleted in topics format
|
|||
Then I should see "Orphaned activities (section 5)" in the "li#section-5" "css_element"
|
||||
And "li#section-5.orphaned" "css_element" should exist
|
||||
And "li#section-4.orphaned" "css_element" should not exist
|
||||
And I click on "Delete topic" "link" in the "li#section-1" "css_element"
|
||||
And I delete section "1"
|
||||
And I press "Continue"
|
||||
And I should not see "Test book name"
|
||||
And I should see "Orphaned activities (section 4)" in the "li#section-4" "css_element"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue