mirror of
https://github.com/Doodle3D/doodle3d-client.git
synced 2024-11-22 01:07:56 +01:00
Made gcodePanel collapsible using coolfieldset
This commit is contained in:
parent
965119de33
commit
ff397700b7
@ -23,6 +23,9 @@ function PrinterPanel() {
|
||||
formElements.each( function(index,element) {
|
||||
self.printerSettingsNames.push(element.name);
|
||||
});
|
||||
|
||||
var gcodePanel = element.find("#gcodePanel");
|
||||
gcodePanel.coolfieldset({collapsed:true});
|
||||
}
|
||||
this.printerSelectorChanged = function(e) {
|
||||
console.log("PrinterPanel:printerSelectorChanged");
|
||||
|
57
js_src/libs/jquery-coolfieldset.js
vendored
Normal file
57
js_src/libs/jquery-coolfieldset.js
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* jQuery Plugin for creating collapsible fieldset
|
||||
* @requires jQuery 1.2 or later
|
||||
*
|
||||
* Copyright (c) 2010 Lucky <bogeyman2007@gmail.com>
|
||||
* Licensed under the GPL license:
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*
|
||||
* "animation" and "speed" options are added by Mitch Kuppinger <dpneumo@gmail.com>
|
||||
*/
|
||||
|
||||
(function($) {
|
||||
function hideFieldsetContent(obj, options){
|
||||
if(options.animation==true)
|
||||
obj.find('div').slideUp(options.speed);
|
||||
else
|
||||
obj.find('div').hide();
|
||||
|
||||
obj.removeClass("expanded");
|
||||
obj.addClass("collapsed");
|
||||
}
|
||||
|
||||
function showFieldsetContent(obj, options){
|
||||
if(options.animation==true)
|
||||
obj.find('div').slideDown(options.speed);
|
||||
else
|
||||
obj.find('div').show();
|
||||
|
||||
obj.removeClass("collapsed");
|
||||
obj.addClass("expanded");
|
||||
}
|
||||
|
||||
$.fn.coolfieldset = function(options){
|
||||
var setting={collapsed:false, animation:true, speed:'medium'};
|
||||
$.extend(setting, options);
|
||||
|
||||
this.each(function(){
|
||||
var fieldset=$(this);
|
||||
fieldset.addClass("collapsible");
|
||||
var legend=fieldset.children('legend');
|
||||
|
||||
if(setting.collapsed==true){
|
||||
hideFieldsetContent(fieldset, setting);
|
||||
} else {
|
||||
showFieldsetContent(fieldset, setting);
|
||||
}
|
||||
|
||||
legend.bind('touchstart mousedown', function() {
|
||||
if(fieldset.hasClass("collapsed")) {
|
||||
showFieldsetContent(fieldset, setting);
|
||||
} else {
|
||||
hideFieldsetContent(fieldset, setting);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
})(jQuery);
|
@ -35,10 +35,34 @@ form fieldset fieldset{
|
||||
clear: left;
|
||||
float: left;
|
||||
}
|
||||
form fieldset.collapsed {
|
||||
border-radius: 0;
|
||||
-webkit-border-radius: 0;
|
||||
-moz-border-radius: 0;
|
||||
border-width: 1px 0 0 0;
|
||||
float:none;
|
||||
}
|
||||
form fieldset.collapsible {
|
||||
padding: 0;
|
||||
}
|
||||
form fieldset.collapsible div{
|
||||
margin: 8px;
|
||||
}
|
||||
form fieldset legend {
|
||||
margin-left: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
form fieldset.collapsible legend {
|
||||
padding-left: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
form fieldset.expanded legend {
|
||||
background: transparent url(../img/buttons/expanded.gif) no-repeat center left;
|
||||
}
|
||||
form fieldset.collapsed legend {
|
||||
background: transparent url(../img/buttons/collapsed.gif) no-repeat center left;
|
||||
}
|
||||
|
||||
form label {
|
||||
min-width: 150px;
|
||||
display: block;
|
||||
|
BIN
www/img/buttons/collapsed.gif
Normal file
BIN
www/img/buttons/collapsed.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 B |
BIN
www/img/buttons/expanded.gif
Normal file
BIN
www/img/buttons/expanded.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 107 B |
@ -134,6 +134,7 @@
|
||||
<!--<script src="js/libs/imagesloaded-pkgd.min.js"></script>-->
|
||||
<!--<script src="../js_src/libs/jquery-joyride-2-1.js"></script>-->
|
||||
<script src="js/libs/jquery-joyride-2-1.min.js"></script>
|
||||
<script src="js/libs/jquery-coolfieldset.min.js"></script>
|
||||
<!--<script src="js/doodle3d-client.js"></script>-->
|
||||
<script src="js/doodle3d-client.min.js"></script>
|
||||
|
||||
|
@ -54,6 +54,7 @@
|
||||
<label for="printerBedHeight">Bed height:</label><input id="printerBedHeight" type="number" class="small" name="printer.bed.height">mm<br>
|
||||
<fieldset id="gcodePanel">
|
||||
<legend>GCODE settings</legend>
|
||||
<div>
|
||||
<div class="startgcode_left">
|
||||
<label for="startgcode">Start:</label><br/>
|
||||
<textarea id="startgcode" class="gcode" name="printer.startcode"></textarea>
|
||||
@ -72,6 +73,7 @@
|
||||
<dt>{printerType}</dt><dd>Printer type</dd>
|
||||
</dl>
|
||||
</small>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user