Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge branch 'wip-MDL-34798_M23-2' of git://github.com/gjb2048/moodle…

… into MOODLE_23_STABLE
  • Loading branch information...
commit 35f667d8501fd497752dbbffe751b8b0a25a1605 2 parents f81a08b + d26cc0a
Dan Poltawski danpoltawski authored
10 course/format/topics/format.js
@@ -40,7 +40,7 @@ M.course.format.swap_sections = function(Y, node1, node2) {
40 40 };
41 41
42 42 var sectionlist = Y.Node.all('.'+CSS.COURSECONTENT+' '+M.course.format.get_section_selector(Y));
43   - // Swap menus
  43 + // Swap menus.
44 44 sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.'+CSS.SECTIONADDMENUS));
45 45 }
46 46
@@ -59,7 +59,13 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
59 59 };
60 60
61 61 if (response.action == 'move') {
62   - // update titles in all affected sections
  62 + // If moving up swap around 'sectionfrom' and 'sectionto' so the that loop operates.
  63 + if (sectionfrom > sectionto) {
  64 + var temp = sectionto;
  65 + sectionto = sectionfrom;
  66 + sectionfrom = temp;
  67 + }
  68 + // Update titles in all affected sections.
63 69 for (var i = sectionfrom; i <= sectionto; i++) {
64 70 sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
65 71 }
10 course/format/weeks/format.js
@@ -40,7 +40,7 @@ M.course.format.swap_sections = function(Y, node1, node2) {
40 40 };
41 41
42 42 var sectionlist = Y.Node.all('.'+CSS.COURSECONTENT+' '+M.course.format.get_section_selector(Y));
43   - // Swap menus
  43 + // Swap menus.
44 44 sectionlist.item(node1).one('.'+CSS.SECTIONADDMENUS).swap(sectionlist.item(node2).one('.'+CSS.SECTIONADDMENUS));
45 45 }
46 46
@@ -59,7 +59,13 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
59 59 };
60 60
61 61 if (response.action == 'move') {
62   - // update titles in all affected sections
  62 + // If moving up swap around 'sectionfrom' and 'sectionto' so the that loop operates.
  63 + if (sectionfrom > sectionto) {
  64 + var temp = sectionto;
  65 + sectionto = sectionfrom;
  66 + sectionfrom = temp;
  67 + }
  68 + // Update titles in all affected sections.
63 69 for (var i = sectionfrom; i <= sectionto; i++) {
64 70 sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
65 71 }

0 comments on commit 35f667d

Please sign in to comment.
Something went wrong with that request. Please try again.