Skip to content

Commit

Permalink
MDL-37901 format_topics & format_weeks: Fix drag icon tooltip after m…
Browse files Browse the repository at this point in the history
…ove.
  • Loading branch information
gjb2048 committed Mar 2, 2013
1 parent 215c189 commit 92eeecd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
16 changes: 15 additions & 1 deletion course/format/topics/format.js
Expand Up @@ -56,6 +56,9 @@ M.course.format.swap_sections = function(Y, node1, node2) {
M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
var CSS = {
SECTIONNAME : 'sectionname'
},
SELECTORS = {
SECTIONLEFTSIDE : '.left .section-handle img'
};

if (response.action == 'move') {
Expand All @@ -65,9 +68,20 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
sectionto = sectionfrom;
sectionfrom = temp;
}
// Update titles in all affected sections.

// Update titles and move icons in all affected sections.
var ele, str, stridx, newstr;

for (var i = sectionfrom; i <= sectionto; i++) {
// Update section title.
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
// Update move icon.
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
str = ele.getAttribute('alt');
stridx = str.lastIndexOf(' ');
newstr = str.substr(0, stridx +1) + i;
ele.setAttribute('alt', newstr);
ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
}
}
}
16 changes: 15 additions & 1 deletion course/format/weeks/format.js
Expand Up @@ -56,6 +56,9 @@ M.course.format.swap_sections = function(Y, node1, node2) {
M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
var CSS = {
SECTIONNAME : 'sectionname'
},
SELECTORS = {
SECTIONLEFTSIDE : '.left .section-handle img'
};

if (response.action == 'move') {
Expand All @@ -65,9 +68,20 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
sectionto = sectionfrom;
sectionfrom = temp;
}
// Update titles in all affected sections.

// Update titles and move icons in all affected sections.
var ele, str, stridx, newstr;

for (var i = sectionfrom; i <= sectionto; i++) {
// Update section title.
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
// Update move icon.
ele = sectionlist.item(i).one(SELECTORS.SECTIONLEFTSIDE);
str = ele.getAttribute('alt');
stridx = str.lastIndexOf(' ');
newstr = str.substr(0, stridx +1) + i;
ele.setAttribute('alt', newstr);
ele.setAttribute('title', newstr); // For FireFox as 'alt' is not refreshed.
}
}
}

0 comments on commit 92eeecd

Please sign in to comment.