Skip to content

Commit

Permalink
Merge 3c7f65d into 957bce7
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed Apr 25, 2018
2 parents 957bce7 + 3c7f65d commit 481f6cc
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ define([
});
}

// TODO: wrap this in a new type of field control --
// TODO: wrap this in a new type of field control --
// specialized to be very lightweight for the sequence control.
function makeSingleViewControl(control, events) {
return resolver.loadViewControl(itemSpec)
Expand All @@ -130,7 +130,8 @@ define([
initialValue: control.value,
parameterSpec: itemSpec,
referenceType: 'ref',
paramsChannelName: config.paramsChannelName
paramsChannelName: config.paramsChannelName,
workspaceId: config.workspaceId
});

// set up listeners for the input
Expand Down Expand Up @@ -229,7 +230,7 @@ define([
inputControl: null,
// the actual dome node (used?) to which the input control is attached
node: null,
// the current index - note: used by the inputControl
// the current index - note: used by the inputControl
index: null
};
var index = viewModel.pushItem(['items'], control);
Expand Down Expand Up @@ -352,4 +353,4 @@ define([
return factory(config);
}
};
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ define([
}

/*
* The single input control wraps a field widget, which provides the
* The single input control wraps a field widget, which provides the
* wrapper around the input widget itself.
*/
function makeSingleInputControl(value, fieldSpec, events) {
Expand All @@ -155,7 +155,7 @@ define([
initialValue: value,
// appSpec: appSpec,
parameterSpec: fieldSpec,
// workspaceId: workspaceInfo.id,
workspaceId: config.workspaceId,
referenceType: 'ref'
});

Expand Down Expand Up @@ -221,9 +221,10 @@ define([
});
} else {
return Promise.all(
Object.keys(structFields).map(function(fieldName) {
return structFields[fieldName].instance.stop();
}))
Object.keys(structFields).map(function(fieldName) {
return structFields[fieldName].instance.stop();
})
)
.then(function() {
ui.setContent('input-container.subcontrols', '');
structFields = {};
Expand Down Expand Up @@ -257,7 +258,7 @@ define([

// LIFECYCLE API

// Okay, we need to
// Okay, we need to

function start(arg) {
var events;
Expand All @@ -268,10 +269,6 @@ define([
events = Events.make({ node: container });

viewModel.data = lang.copy(config.initialValue);

// return bus.request({}, {
// key: 'get-param-state'
// });
})
.then(function() {
return render(events);
Expand Down Expand Up @@ -311,7 +308,7 @@ define([
});

// bus.on('')
// The controller of this widget will be smart enough to
// The controller of this widget will be smart enough to
// know...
// bus.emit('sync');
})
Expand Down Expand Up @@ -347,4 +344,4 @@ define([
return factory(config);
}
};
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -147,82 +147,82 @@ define([
content = div({ style: { textAlign: 'center' } }, 'no available values');
} else {
content = itemsToShow.map(function(item, index) {
var isSelected = selected.some(function(id) {
return (item.id === id);
}),
disabled = isSelected;
return div({ class: 'row', style: { border: '1px #CCC solid' } }, [
div({
class: 'col-md-2',
style: {
verticalAlign: 'middle',
borderRadius: '3px',
padding: '2px',
backgroundColor: '#EEE',
color: '#444',
textAlign: 'right',
paddingRight: '6px',
fontFamily: 'monospace'
}
}, String(from + index + 1)),
div({
class: 'col-md-8',
style: {
padding: '2px'
}
}, item.text),
div({
class: 'col-md-2',
style: {
padding: '2px',
textAlign: 'right',
verticalAlign: 'top'
}
}, [
(function() {
if (disabled) {
return span({
class: 'kb-btn-icon',
type: 'button',
dataToggle: 'tooltip',
title: 'Remove from selected'
}, [
span({
class: 'fa fa-minus-circle',
style: {
color: 'red',
fontSize: '200%'
}
})
]);
}
if (allowSelection) {
return span({
class: 'kb-btn-icon',
type: 'button',
dataToggle: 'tooltip',
title: 'Add to selected',
dataItemId: item.id,
}, [span({
class: 'fa fa-plus-circle',
var isSelected = selected.some(function(id) {
return (item.id === id);
}),
disabled = isSelected;
return div({ class: 'row', style: { border: '1px #CCC solid' } }, [
div({
class: 'col-md-2',
style: {
verticalAlign: 'middle',
borderRadius: '3px',
padding: '2px',
backgroundColor: '#EEE',
color: '#444',
textAlign: 'right',
paddingRight: '6px',
fontFamily: 'monospace'
}
}, String(from + index + 1)),
div({
class: 'col-md-8',
style: {
padding: '2px'
}
}, item.text),
div({
class: 'col-md-2',
style: {
padding: '2px',
textAlign: 'right',
verticalAlign: 'top'
}
}, [
(function() {
if (disabled) {
return span({
class: 'kb-btn-icon',
type: 'button',
dataToggle: 'tooltip',
title: 'Remove from selected'
}, [
span({
class: 'fa fa-minus-circle',
style: {
color: 'green',
color: 'red',
fontSize: '200%'
}
})]);
}
})
]);
}
if (allowSelection) {
return span({
class: 'kb-btn-icon',
type: 'button',
dataToggle: 'tooltip',
title: 'Can\'t add - remove one first',
dataItemId: item.id
}, span({ class: 'fa fa-ban', style: { color: 'silver', fontSize: '200%' } }));
}())
title: 'Add to selected',
dataItemId: item.id,
}, [span({
class: 'fa fa-plus-circle',
style: {
color: 'green',
fontSize: '200%'
}
})]);
}
return span({
class: 'kb-btn-icon',
type: 'button',
dataToggle: 'tooltip',
title: 'Can\'t add - remove one first',
dataItemId: item.id
}, span({ class: 'fa fa-ban', style: { color: 'silver', fontSize: '200%' } }));
}())

])
]);
})
])
]);
})
.join('\n');
}

Expand Down Expand Up @@ -252,8 +252,6 @@ define([
div({
class: 'col-md-2',
style: {
xdisplay: 'inline-block',
xwidth: '20%',
verticalAlign: 'middle',
borderRadius: '3px',
padding: '2px',
Expand All @@ -267,16 +265,12 @@ define([
div({
class: 'col-md-8',
style: {
xdisplay: 'inline-block',
xwidth: '90%',
padding: '2px'
}
}, item.text),
div({
class: 'col-md-2',
style: {
xdisplay: 'inline-block',
xwidth: '10%',
padding: '2px',
textAlign: 'right',
verticalAlign: 'top'
Expand Down Expand Up @@ -377,7 +371,6 @@ define([
button({
type: 'button',
class: 'btn btn-default',
style: { xwidth: '100%' },
id: events.addEvent({
type: 'click',
handler: function() {
Expand All @@ -388,7 +381,6 @@ define([
button({
class: 'btn btn-default',
type: 'button',
style: { xwidth: '50%' },
id: events.addEvent({
type: 'click',
handler: function() {
Expand All @@ -399,7 +391,6 @@ define([
button({
class: 'btn btn-default',
type: 'button',
style: { xwidth: '100%' },
id: events.addEvent({
type: 'click',
handler: function() {
Expand All @@ -410,7 +401,6 @@ define([
button({
type: 'button',
class: 'btn btn-default',
style: { xwidth: '100%' },
id: events.addEvent({
type: 'click',
handler: function() {
Expand Down Expand Up @@ -869,7 +859,8 @@ define([

// Get initial data.
// Weird, but will make it look nicer.
Promise.all([
Promise
.all([
bus.request({
parameterName: spec.id
}, {
Expand Down Expand Up @@ -957,4 +948,4 @@ define([
return factory(config);
}
};
});
});

0 comments on commit 481f6cc

Please sign in to comment.