mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +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:
parent
9bc2d6dfd5
commit
b6b307fb80
src/Orchard.Web/Modules/Orchard.Workflows
@ -50,6 +50,8 @@ var updateActivities = function(localId) {
|
||||
activity.State = JSON.parse(updatedActivityState);
|
||||
}
|
||||
}
|
||||
|
||||
displaySaveMessage();
|
||||
}
|
||||
|
||||
sessionStorage.setItem(localId, JSON.stringify(workflow));
|
||||
@ -81,6 +83,7 @@ var loadActivities = function (localId) {
|
||||
});
|
||||
}
|
||||
|
||||
refreshStateMessage();
|
||||
return workflow;
|
||||
};
|
||||
|
||||
|
@ -77,6 +77,8 @@
|
||||
if (activityName && activityName.length) {
|
||||
createActivity(activityName, event.pageY, event.pageX);
|
||||
}
|
||||
|
||||
displaySaveMessage();
|
||||
}
|
||||
});
|
||||
|
||||
@ -209,6 +211,11 @@
|
||||
var checked = $(this).is(':checked');
|
||||
target.viewModel.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
|
||||
@ -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) {
|
||||
target = $(target);
|
||||
@ -243,6 +261,8 @@
|
||||
|
||||
jsPlumb.removeAllEndpoints(target.attr('id'));
|
||||
target.remove();
|
||||
|
||||
displaySaveMessage();
|
||||
});
|
||||
|
||||
};
|
||||
|
@ -96,3 +96,8 @@
|
||||
@Html.ActionLink(T("Close").Text, "Index", "Admin", new { area = "Orchard.Workflows" }, new { @class = "primaryAction button" })
|
||||
</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>
|
||||
}
|
Loading…
Reference in New Issue
Block a user