mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +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
|
@ -106,10 +106,30 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
|
|||
cssleft.appendChild(this.get_drag_handle(title, CSS.SECTIONHANDLE, 'icon', true));
|
||||
|
||||
if (moveup) {
|
||||
moveup.remove();
|
||||
if (moveup.previous('br')) {
|
||||
moveup.previous('br').remove();
|
||||
} else if (moveup.next('br')) {
|
||||
moveup.next('br').remove();
|
||||
}
|
||||
|
||||
if (moveup.ancestor('.section_action_menu')) {
|
||||
moveup.ancestor('li').remove();
|
||||
} else {
|
||||
moveup.remove();
|
||||
}
|
||||
}
|
||||
if (movedown) {
|
||||
movedown.remove();
|
||||
if (movedown.previous('br')) {
|
||||
movedown.previous('br').remove();
|
||||
} else if (movedown.next('br')) {
|
||||
movedown.next('br').remove();
|
||||
}
|
||||
|
||||
if (movedown.ancestor('.section_action_menu')) {
|
||||
movedown.ancestor('li').remove();
|
||||
} else {
|
||||
movedown.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// This section can be moved - add the class to indicate this to Y.DD.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -106,10 +106,30 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
|
|||
cssleft.appendChild(this.get_drag_handle(title, CSS.SECTIONHANDLE, 'icon', true));
|
||||
|
||||
if (moveup) {
|
||||
moveup.remove();
|
||||
if (moveup.previous('br')) {
|
||||
moveup.previous('br').remove();
|
||||
} else if (moveup.next('br')) {
|
||||
moveup.next('br').remove();
|
||||
}
|
||||
|
||||
if (moveup.ancestor('.section_action_menu')) {
|
||||
moveup.ancestor('li').remove();
|
||||
} else {
|
||||
moveup.remove();
|
||||
}
|
||||
}
|
||||
if (movedown) {
|
||||
movedown.remove();
|
||||
if (movedown.previous('br')) {
|
||||
movedown.previous('br').remove();
|
||||
} else if (movedown.next('br')) {
|
||||
movedown.next('br').remove();
|
||||
}
|
||||
|
||||
if (movedown.ancestor('.section_action_menu')) {
|
||||
movedown.ancestor('li').remove();
|
||||
} else {
|
||||
movedown.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// This section can be moved - add the class to indicate this to Y.DD.
|
||||
|
|
|
@ -981,6 +981,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
var section = e.target.ancestor(M.course.format.get_section_selector(Y)),
|
||||
button = e.target.ancestor('a', true),
|
||||
hideicon = button.one('img'),
|
||||
buttontext = button.one('span'),
|
||||
|
||||
// The value to submit
|
||||
value,
|
||||
|
@ -1007,8 +1008,11 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
'src' : M.util.image_url('i/' + nextaction)
|
||||
});
|
||||
button.set('title', newstring);
|
||||
if (buttontext) {
|
||||
buttontext.set('text', newstring);
|
||||
}
|
||||
|
||||
// Change the highlight status
|
||||
// Change the show/hide status
|
||||
var data = {
|
||||
'class' : 'section',
|
||||
'field' : 'visible',
|
||||
|
@ -1053,6 +1057,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
var section = e.target.ancestor(M.course.format.get_section_selector(Y));
|
||||
var button = e.target.ancestor('a', true);
|
||||
var buttonicon = button.one('img');
|
||||
var buttontext = button.one('span');
|
||||
|
||||
// Determine whether the marker is currently set.
|
||||
var togglestatus = section.hasClass('current');
|
||||
|
@ -1060,16 +1065,21 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
|
||||
// Set the current highlighted item text.
|
||||
var old_string = M.util.get_string('markthistopic', 'moodle');
|
||||
Y.one(SELECTOR.PAGECONTENT)
|
||||
|
||||
var selectedpage = Y.one(SELECTOR.PAGECONTENT);
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT)
|
||||
.set('title', old_string);
|
||||
Y.one(SELECTOR.PAGECONTENT)
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT + ' span')
|
||||
.set('text', M.util.get_string('highlight', 'moodle'));
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT + ' img')
|
||||
.set('alt', old_string)
|
||||
.set('src', M.util.image_url('i/marker'));
|
||||
|
||||
// Remove the highlighting from all sections.
|
||||
Y.one(SELECTOR.PAGECONTENT).all(M.course.format.get_section_selector(Y))
|
||||
selectedpage.all(M.course.format.get_section_selector(Y))
|
||||
.removeClass('current');
|
||||
|
||||
// Then add it if required to the selected section.
|
||||
|
@ -1082,6 +1092,10 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
buttonicon
|
||||
.set('alt', new_string)
|
||||
.set('src', M.util.image_url('i/marked'));
|
||||
if (buttontext) {
|
||||
buttontext
|
||||
.set('text', M.util.get_string('highlightoff', 'moodle'));
|
||||
}
|
||||
}
|
||||
|
||||
// Change the highlight status.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -981,6 +981,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
var section = e.target.ancestor(M.course.format.get_section_selector(Y)),
|
||||
button = e.target.ancestor('a', true),
|
||||
hideicon = button.one('img'),
|
||||
buttontext = button.one('span'),
|
||||
|
||||
// The value to submit
|
||||
value,
|
||||
|
@ -1007,8 +1008,11 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
'src' : M.util.image_url('i/' + nextaction)
|
||||
});
|
||||
button.set('title', newstring);
|
||||
if (buttontext) {
|
||||
buttontext.set('text', newstring);
|
||||
}
|
||||
|
||||
// Change the highlight status
|
||||
// Change the show/hide status
|
||||
var data = {
|
||||
'class' : 'section',
|
||||
'field' : 'visible',
|
||||
|
@ -1053,6 +1057,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
var section = e.target.ancestor(M.course.format.get_section_selector(Y));
|
||||
var button = e.target.ancestor('a', true);
|
||||
var buttonicon = button.one('img');
|
||||
var buttontext = button.one('span');
|
||||
|
||||
// Determine whether the marker is currently set.
|
||||
var togglestatus = section.hasClass('current');
|
||||
|
@ -1060,16 +1065,21 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
|
||||
// Set the current highlighted item text.
|
||||
var old_string = M.util.get_string('markthistopic', 'moodle');
|
||||
Y.one(SELECTOR.PAGECONTENT)
|
||||
|
||||
var selectedpage = Y.one(SELECTOR.PAGECONTENT);
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT)
|
||||
.set('title', old_string);
|
||||
Y.one(SELECTOR.PAGECONTENT)
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT + ' span')
|
||||
.set('text', M.util.get_string('highlight', 'moodle'));
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT + ' img')
|
||||
.set('alt', old_string)
|
||||
.set('src', M.util.image_url('i/marker'));
|
||||
|
||||
// Remove the highlighting from all sections.
|
||||
Y.one(SELECTOR.PAGECONTENT).all(M.course.format.get_section_selector(Y))
|
||||
selectedpage.all(M.course.format.get_section_selector(Y))
|
||||
.removeClass('current');
|
||||
|
||||
// Then add it if required to the selected section.
|
||||
|
@ -1082,6 +1092,10 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
buttonicon
|
||||
.set('alt', new_string)
|
||||
.set('src', M.util.image_url('i/marked'));
|
||||
if (buttontext) {
|
||||
buttontext
|
||||
.set('text', M.util.get_string('highlightoff', 'moodle'));
|
||||
}
|
||||
}
|
||||
|
||||
// Change the highlight status.
|
||||
|
|
24
course/yui/src/dragdrop/js/section.js
vendored
24
course/yui/src/dragdrop/js/section.js
vendored
|
@ -75,10 +75,30 @@ Y.extend(DRAGSECTION, M.core.dragdrop, {
|
|||
cssleft.appendChild(this.get_drag_handle(title, CSS.SECTIONHANDLE, 'icon', true));
|
||||
|
||||
if (moveup) {
|
||||
moveup.remove();
|
||||
if (moveup.previous('br')) {
|
||||
moveup.previous('br').remove();
|
||||
} else if (moveup.next('br')) {
|
||||
moveup.next('br').remove();
|
||||
}
|
||||
|
||||
if (moveup.ancestor('.section_action_menu')) {
|
||||
moveup.ancestor('li').remove();
|
||||
} else {
|
||||
moveup.remove();
|
||||
}
|
||||
}
|
||||
if (movedown) {
|
||||
movedown.remove();
|
||||
if (movedown.previous('br')) {
|
||||
movedown.previous('br').remove();
|
||||
} else if (movedown.next('br')) {
|
||||
movedown.next('br').remove();
|
||||
}
|
||||
|
||||
if (movedown.ancestor('.section_action_menu')) {
|
||||
movedown.ancestor('li').remove();
|
||||
} else {
|
||||
movedown.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// This section can be moved - add the class to indicate this to Y.DD.
|
||||
|
|
22
course/yui/src/toolboxes/js/section.js
vendored
22
course/yui/src/toolboxes/js/section.js
vendored
|
@ -49,6 +49,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
var section = e.target.ancestor(M.course.format.get_section_selector(Y)),
|
||||
button = e.target.ancestor('a', true),
|
||||
hideicon = button.one('img'),
|
||||
buttontext = button.one('span'),
|
||||
|
||||
// The value to submit
|
||||
value,
|
||||
|
@ -75,8 +76,11 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
'src' : M.util.image_url('i/' + nextaction)
|
||||
});
|
||||
button.set('title', newstring);
|
||||
if (buttontext) {
|
||||
buttontext.set('text', newstring);
|
||||
}
|
||||
|
||||
// Change the highlight status
|
||||
// Change the show/hide status
|
||||
var data = {
|
||||
'class' : 'section',
|
||||
'field' : 'visible',
|
||||
|
@ -121,6 +125,7 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
var section = e.target.ancestor(M.course.format.get_section_selector(Y));
|
||||
var button = e.target.ancestor('a', true);
|
||||
var buttonicon = button.one('img');
|
||||
var buttontext = button.one('span');
|
||||
|
||||
// Determine whether the marker is currently set.
|
||||
var togglestatus = section.hasClass('current');
|
||||
|
@ -128,16 +133,21 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
|
||||
// Set the current highlighted item text.
|
||||
var old_string = M.util.get_string('markthistopic', 'moodle');
|
||||
Y.one(SELECTOR.PAGECONTENT)
|
||||
|
||||
var selectedpage = Y.one(SELECTOR.PAGECONTENT);
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT)
|
||||
.set('title', old_string);
|
||||
Y.one(SELECTOR.PAGECONTENT)
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT + ' span')
|
||||
.set('text', M.util.get_string('highlight', 'moodle'));
|
||||
selectedpage
|
||||
.all(M.course.format.get_section_selector(Y) + '.current ' + SELECTOR.HIGHLIGHT + ' img')
|
||||
.set('alt', old_string)
|
||||
.set('src', M.util.image_url('i/marker'));
|
||||
|
||||
// Remove the highlighting from all sections.
|
||||
Y.one(SELECTOR.PAGECONTENT).all(M.course.format.get_section_selector(Y))
|
||||
selectedpage.all(M.course.format.get_section_selector(Y))
|
||||
.removeClass('current');
|
||||
|
||||
// Then add it if required to the selected section.
|
||||
|
@ -150,6 +160,10 @@ Y.extend(SECTIONTOOLBOX, TOOLBOX, {
|
|||
buttonicon
|
||||
.set('alt', new_string)
|
||||
.set('src', M.util.image_url('i/marked'));
|
||||
if (buttontext) {
|
||||
buttontext
|
||||
.set('text', M.util.get_string('highlightoff', 'moodle'));
|
||||
}
|
||||
}
|
||||
|
||||
// Change the highlight status.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue