#19783: Handling the case when there's no Url state for a newly created Redirect activity.

Work Item: 19783

--HG--
branch : 1.x
extra : amend_source : 4434580d74e0b1c231009df5790b56a465352c95
This commit is contained in:
Sipke Schoorstra
2013-06-19 00:21:49 +02:00
parent ab6df9fa6b
commit f7bffac6db
2 changed files with 10 additions and 5 deletions

View File

@@ -16,7 +16,8 @@ namespace Orchard.Workflows.Activities {
public Localizer T { get; set; }
public override bool CanExecute(WorkflowContext workflowContext, ActivityContext activityContext) {
return true;
var url = activityContext.GetState<string>("Url");
return !string.IsNullOrWhiteSpace(url);
}
public override IEnumerable<LocalizedString> GetPossibleOutcomes(WorkflowContext workflowContext, ActivityContext activityContext) {
@@ -38,7 +39,7 @@ namespace Orchard.Workflows.Activities {
}
public override LocalizedString Description {
get { return T("Redirect to the specified URL."); }
get { return T("Redirects to the specified URL."); }
}
public override string Form {

View File

@@ -1,4 +1,8 @@
<div>
<div>@T("Redirect to {0}", Model.State.Url.Value)</div>
</div>
@if (Model.State.Url != null && !String.IsNullOrWhiteSpace(Model.State.Url.Value)) {
<div>@T("Redirect to {0}", Model.State.Url.Value)</div>
}
else {
<div>@T("Redirect")</div>
}
</div>