mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
#19771: Displaying a warning when no start activity is chosen
Also a message if any change needs to be saved
This commit is contained in:
@@ -50,6 +50,8 @@ var updateActivities = function(localId) {
|
|||||||
activity.State = JSON.parse(updatedActivityState);
|
activity.State = JSON.parse(updatedActivityState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displaySaveMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionStorage.setItem(localId, JSON.stringify(workflow));
|
sessionStorage.setItem(localId, JSON.stringify(workflow));
|
||||||
@@ -81,6 +83,7 @@ var loadActivities = function (localId) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshStateMessage();
|
||||||
return workflow;
|
return workflow;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,8 @@
|
|||||||
if (activityName && activityName.length) {
|
if (activityName && activityName.length) {
|
||||||
createActivity(activityName, event.pageY, event.pageX);
|
createActivity(activityName, event.pageY, event.pageX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displaySaveMessage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -209,6 +211,11 @@
|
|||||||
var checked = $(this).is(':checked');
|
var checked = $(this).is(':checked');
|
||||||
target.viewModel.start = checked;
|
target.viewModel.start = checked;
|
||||||
$(target).toggleClass('start', checked);
|
$(target).toggleClass('start', checked);
|
||||||
|
|
||||||
|
// display a warning if there are no activities with a start state
|
||||||
|
refreshStateMessage();
|
||||||
|
|
||||||
|
displaySaveMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
// prevent the editor from getting clicked when the label is clicked
|
// prevent the editor from getting clicked when the label is clicked
|
||||||
@@ -217,6 +224,17 @@
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function refreshStateMessage() {
|
||||||
|
if ($("#activity-editor div").hasClass('start')) {
|
||||||
|
$("#start-message").hide();
|
||||||
|
} else {
|
||||||
|
$("#start-message").show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function displaySaveMessage() {
|
||||||
|
$("#save-message").show();
|
||||||
|
}
|
||||||
|
|
||||||
var refreshToolbar = function(target) {
|
var refreshToolbar = function(target) {
|
||||||
target = $(target);
|
target = $(target);
|
||||||
@@ -243,6 +261,8 @@
|
|||||||
|
|
||||||
jsPlumb.removeAllEndpoints(target.attr('id'));
|
jsPlumb.removeAllEndpoints(target.attr('id'));
|
||||||
target.remove();
|
target.remove();
|
||||||
|
|
||||||
|
displaySaveMessage();
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -96,3 +96,8 @@
|
|||||||
@Html.ActionLink(T("Close").Text, "Index", "Admin", new { area = "Orchard.Workflows" }, new { @class = "primaryAction button" })
|
@Html.ActionLink(T("Close").Text, "Index", "Admin", new { area = "Orchard.Workflows" }, new { @class = "primaryAction button" })
|
||||||
</fieldset>
|
</fieldset>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@using (Capture(Layout.Messages)) {
|
||||||
|
<div id="save-message" class="message message-Warning" style="display:none">@T("You need to hit \"Save\" in order to save your changes.")</div>
|
||||||
|
<div id="start-message" class="message message-Warning" style="display:none">@T("The workflow needs at least one activity to be set as a starting state.")</div>
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user