Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCI task pull request #474

Merged
merged 8 commits into from
Nov 18, 2018
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions examples/demo.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,17 @@ h1 {
opacity:0.5;
color:#BABABA;
}

#stepRemovedNotification{
background-color: #808b96;
padding:4px;
color:white;
border-radius:3px;
font-size:2rem;
position:fixed;
bottom:8px;
left:45%;
min-width:14rem;
text-align:center;
display:none;
}
35 changes: 23 additions & 12 deletions examples/lib/defaultHtmlStepUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@
// The variable 'step' stores useful data like input and
// output values, step information.
// See documetation for more details.
function DefaultHtmlStepUi(_sequencer, options) {
function stepRemovedNotify() {
if ($('#stepRemovedNotification').length == 0) {
var notification = document.createElement('span');
notification.innerHTML = ' <i class="fa fa-info-circle" aria-hidden="true"></i> Step Removed ';
notification.id = 'stepRemovedNotification';

$('body').append(notification);
}

$('#stepRemovedNotification').DOMNotification.fadeIn(500).delay(200).fadeOut(500);
}

function DefaultHtmlStepUi(_sequencer, options) {
options = options || {};
var stepsEl = options.stepsEl || document.querySelector("#steps");
var selectStepSel = options.selectStepSel = options.selectStepSel || "#selectStep";
Expand Down Expand Up @@ -37,7 +48,7 @@ function DefaultHtmlStepUi(_sequencer, options) {

var tools =
'<div class="tools btn-group">\
<button confirm="Are you sure?" class="remove btn btn btn-default">\
<button confirm="Are you sure?" onclick="stepRemovedNotify()" class="stepRemoveButton remove btn btn btn-default">\
<i class="fa fa-trash"></i>\
</button>\
</div>';
Expand Down Expand Up @@ -66,7 +77,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
}
html += "</select>";
} else {
let paramVal = step.options[paramName] || inputDesc.default;
let paramVal = step.options[paramName] || inputDesc.default;
html =
'<input class="form-control target" type="' +
inputDesc.type +
Expand All @@ -76,19 +87,19 @@ function DefaultHtmlStepUi(_sequencer, options) {
paramVal +
'" placeholder ="' +
(inputDesc.placeholder || "");
if(inputDesc.type.toLowerCase() == "range")
{
html+=

if (inputDesc.type.toLowerCase() == "range")
{
html +=
'"min="'+
inputDesc.min +
'"max="'+
inputDesc.max +
'"step="' +
inputDesc.step + '">'+'<span>'+paramVal+'</span>';

}
else html+= '">';
}
else html += '">';
}

var div = document.createElement("div");
Expand Down Expand Up @@ -125,7 +136,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
.each(function(i, input) {
step.options[$(input).attr("name")] = input.value;
});
_sequencer.run({ index: step.index - 1 });
_sequencer.run({index: step.index - 1});

// modify the url hash
setUrlHashParameter("steps", _sequencer.toString());
Expand All @@ -145,7 +156,7 @@ function DefaultHtmlStepUi(_sequencer, options) {
);

stepsEl.appendChild(step.ui);

var inputs = document.querySelectorAll('input[type="range"]')
for(i in inputs)
inputs[i].oninput = function(e) {
Expand Down Expand Up @@ -216,4 +227,4 @@ function DefaultHtmlStepUi(_sequencer, options) {
onRemove: onRemove,
onDraw: onDraw
}
}
}