Hide close cross in slots if need be.

Better cross  (unicode as icon).
CSS settings are better applied.
This commit is contained in:
Gabriel Devillers
2016-08-05 11:51:49 +02:00
parent 1dfd40961f
commit 37076ebcd9
3 changed files with 42 additions and 20 deletions
+17 -8
View File
@@ -1041,6 +1041,11 @@ function Compiler(domRoot, origFilters, windowLocalPrefix,
setSetting('leaderSlot', leaderSlot.id);
}
// hide the close-slot icon if there will remain 1 slot
if (slots.length <= 2) {
domRoot.find('.slot .closeButton').hide()
}
// now safely delete:
removeSetting('compiler'+slot.id);
removeSetting('compilerOptions'+slot.id);
@@ -1103,14 +1108,18 @@ function Compiler(domRoot, origFilters, windowLocalPrefix,
slot.node.show();
slot.node.find('.closeButton').on('click', function(e) {
console.log("[UI] User clicked on closeButton in slot "+slot.id);
if (slots.length > 1) {
var slotToDelete = getSlotById(slot.id);
deleteAndUnplaceSlot(slotToDelete);
} else {
console.log("[UI] It is useless to close the last compiler!");
}
var slotToDelete = getSlotById(slot.id);
deleteAndUnplaceSlot(slotToDelete);
});
// show the close-slot icons if there will be more than 1 slot
if (slots.length == 1) {
domRoot.find('.slot .closeButton').hide()
}
if (slots.length == 2) {
domRoot.find('.slot .closeButton').show()
}
setPanelListSortable();
}
@@ -1188,7 +1197,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix,
function updateDiffButton(diff, className) {
var slot = diff[className+'Slot'];
var diffSlotMenuNode = diff.node.find('.'+className+' .slot');
var diffSlotMenuNode = diff.node.find('.'+className+' .slotName');
diffSlotMenuNode.text(slot.description());
}
@@ -1227,7 +1236,7 @@ function Compiler(domRoot, origFilters, windowLocalPrefix,
diff.node.find('.'+className+' li').remove();
for (var i = 0; i < slots.length; i++) {
var elem = $('<li><a href="#">' + slots[i].description() + '</a></li>');
diff.node.find('.'+className+' .slots').append(elem);
diff.node.find('.'+className+' .slotNameList').append(elem);
(function (i) {
elem.click(function () {
// TODO: check if modifying diff with [] will survive to
+15 -2
View File
@@ -232,7 +232,7 @@ li.social {
display: inline-block;
}
.characterIcon {
.unselectable{
/* disable text selection on character icons
* source : http://stackoverflow.com/a/9314458/4669135 */
-webkit-touch-callout: none;
@@ -243,6 +243,11 @@ li.social {
user-select: none;
}
.characterIcon {
/* Show classical cursor when hovering */
cursor: pointer;
}
.selectedCharacterIcon {
color: #01DF01;
font-size: 25px;
@@ -259,9 +264,17 @@ li.social {
.unicode-arrow {
font-size: 25px;
padding: 10px;
}
.unicodeCross {
overflow: visible;
font-weight: bold;
color: #B90000;
font-size: 20px; /* problem : it makes the panel header (title zone) bigger*/
float: right;
}
.diff-before-button {
background-color: rgba(251,175,175,.7);
}
+10 -10
View File
@@ -195,15 +195,15 @@
</div>
<li class="panel panel-primary col-md-3" id="slotTemplate">
<div class="panel-heading"><span class="title">Slot template (should *not* be visible)</span><span class="closeButton">[X]</span></div>
<div class="panel-body">
<div class="panel-heading slot"><span class="title">Slot template (should *not* be visible)</span><span class="closeButton unicodeCross unselectable characterIcon">&#10006;</span></div>
<div class="panel-body slot">
<div class="params">
<form class="well well-sm form-inline">
<table>
<tbody>
<tr>
<td>
<p class="leaderSlotIcon characterIcon unselectedCharacterIcon">&#9734;</p>
<p class="leaderSlotIcon unselectable characterIcon unselectedCharacterIcon">&#9734;</p>
<td class="dropdown compilers-container">
<!-- the accesskey is set in static/compiler.js -->
<button accesskey="" type="button" title="Compiler to use (alt-C)" class="btn btn-default dropdown-toggle compiler-selection" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
@@ -245,7 +245,7 @@
</div>
</div>
<li class="panel panel-primary col-md-3" id="diffTemplate">
<div class="panel-heading"><span class="title">Diff template (should *not* be visible)</span><span class="closeButton">[X]</span></div>
<div class="panel-heading"><span class="title">Diff template (should *not* be visible)</span><span class="closeButton unicodeCross unselectable characterIcon">&#10006;</span></div>
<div class="panel-body">
<div class="params">
<form class="well well-sm form-inline">
@@ -255,23 +255,23 @@
<td class="dropdown compilers-container before">
<button type="button"
title="Slot before" class="btn btn-default dropdown-toggle diff-before-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="slot">before</span>
<span class="slotName">before</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu slots">
<ul class="dropdown-menu slotNameList">
</ul>
</td>
<td <span class="compilers-container unicode-arrow" >&#8658;</span> </td>
<td <span class="compilers-container unicode-arrow unselectable" >&#8658;</span> </td>
<td class="dropdown compilers-container after">
<button type="button"
title="Slot after" class="btn btn-default dropdown-toggle diff-after-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<span class="slot">after</span>
<span class="slotName">after</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu slots">
<ul class="dropdown-menu slotNameList">
</ul>
</td>
<td <span class="compilers-container unicode-arrow reverse-diff">&#8646;</span> </td>
<td <span class="compilers-container unicode-arrow reverse-diff unselectable characterIcon">&#8646;</span> </td>
</tr>
</tbody>
</table>