Skip to content

Commit

Permalink
Tidied up highlighting for currently opened module
Browse files Browse the repository at this point in the history
  • Loading branch information
0ip committed Apr 28, 2012
1 parent 8364848 commit 4b272fe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/static/css/pad.css
Original file line number Diff line number Diff line change
Expand Up @@ -1402,7 +1402,7 @@ input[type=checkbox] {
float: left;
width: 50%;
}
#settingsmenu,
#settings,
#importexport,
#embed {
position: absolute;
Expand Down
19 changes: 8 additions & 11 deletions src/static/js/pad_editbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ var padeditbar = (function()
}
else if (cmd == 'settings')
{
self.toogleDropDown("settingsmenu");
self.toogleDropDown("settings");
}
else if (cmd == 'embed')
{
Expand Down Expand Up @@ -177,12 +177,11 @@ var padeditbar = (function()
},
toogleDropDown: function(moduleName)
{
var modules = ["settingsmenu", "importexport", "embed", "users"];
var modules = ["settings", "importexport", "embed", "users"];

//hide all modules
// hide all modules and remove highlighting of all buttons
if(moduleName == "none")
{
$(".toolbar ul.menu_right li").removeClass("selected");
for(var i=0;i<modules.length;i++)
{
//skip the userlist
Expand All @@ -193,29 +192,27 @@ var padeditbar = (function()

if(module.css('display') != "none")
{
$("#" + modules[i] + "link").removeClass("selected");
module.slideUp("fast");
}
}
}
else
{
var nth_child = indexOf(modules, moduleName) + 1;
if (nth_child > 0 && nth_child <= (modules.length-1)) {
$(".toolbar ul.menu_right li:not(:nth-child(" + nth_child + "))").removeClass("selected");
$(".toolbar ul.menu_right li:nth-child(" + nth_child + ")").toggleClass("selected");
}
if(modules[modules.length-1] === moduleName) $(".toolbar ul.menu_right li").removeClass("selected");
//hide all modules that are not selected and show the selected one
// hide all modules that are not selected and remove highlighting
// respectively add highlighting to the corresponding button
for(var i=0;i<modules.length;i++)
{
var module = $("#" + modules[i]);

if(module.css('display') != "none")
{
$("#" + modules[i] + "link").removeClass("selected");
module.slideUp("fast");
}
else if(modules[i]==moduleName)
{
$("#" + modules[i] + "link").addClass("selected");
module.slideDown("fast");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/templates/pad.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<div id="editorloadingbox">Loading...</div>
</div>

<div id="settingsmenu" class="popup">
<div id="settings" class="popup">
<h1>Pad settings</h1>
<div class="column">
<h2>My view</h2>
Expand Down

0 comments on commit 4b272fe

Please sign in to comment.