mirror of
https://git.rwth-aachen.de/acs/public/villas/web/
synced 2025-03-09 00:00:01 +01:00
widgets are now resizable
This commit is contained in:
parent
10bb5c263f
commit
0bfeb325cb
2 changed files with 14 additions and 7 deletions
|
@ -162,6 +162,7 @@ class Dashboard extends Component {
|
|||
editModal: false,
|
||||
modalData: null,
|
||||
modalIndex: null,
|
||||
widgetChangeData: [],
|
||||
|
||||
maxWidgetHeight: maxHeight || null,
|
||||
dropZoneHeight: maxHeight +80 || null,
|
||||
|
@ -323,12 +324,10 @@ class Dashboard extends Component {
|
|||
|
||||
widgetChange(widget, index, callback = null){
|
||||
|
||||
let tempChanges = this.state.widgetChangeData;
|
||||
tempChanges.push(widget);
|
||||
|
||||
AppDispatcher.dispatch({
|
||||
type: 'widgets/start-edit',
|
||||
token: this.state.sessionToken,
|
||||
data: widget
|
||||
});
|
||||
this.setState({ widgetChangeData: tempChanges})
|
||||
|
||||
}
|
||||
|
||||
|
@ -397,6 +396,13 @@ class Dashboard extends Component {
|
|||
saveEditing() {
|
||||
// Provide the callback so it can be called when state change is applied
|
||||
// TODO: Check if callback is needed
|
||||
this.state.widgetChangeData.forEach( widget => {
|
||||
AppDispatcher.dispatch({
|
||||
type: 'widgets/start-edit',
|
||||
token: this.state.sessionToken,
|
||||
data: widget
|
||||
});
|
||||
});
|
||||
this.setState({ editing: false });
|
||||
};
|
||||
|
||||
|
@ -414,7 +420,7 @@ class Dashboard extends Component {
|
|||
}
|
||||
|
||||
cancelEditing() {
|
||||
this.setState({ editing: false });
|
||||
this.setState({ editing: false, widgetChangeData: [] });
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ class EditableWidgetContainer extends React.Component {
|
|||
}
|
||||
};
|
||||
|
||||
resizeStop = (direction, delta, ref, event) => {
|
||||
resizeStop = (event, direction, ref,delta, position) => {
|
||||
|
||||
const widget = this.props.widget;
|
||||
|
||||
// resize depends on direction
|
||||
|
|
Loading…
Add table
Reference in a new issue