mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
@@ -1,11 +1,10 @@
|
||||
@using Orchard.Utility.Extensions
|
||||
|
||||
@using Orchard.Workflows.Helpers
|
||||
@{
|
||||
string name = Model.Name;
|
||||
string actions = Model.State.Actions;
|
||||
var outcomes = String.Join(",", actions == null ? new string[0] : actions.Split(new []{','}, StringSplitOptions.RemoveEmptyEntries).Select(x => "'" + x.Trim() + "'").ToArray());
|
||||
var name = (string)Model.Name;
|
||||
var outcomes = ((string)Model.State.Actions).FormatOutcomesJson();
|
||||
}
|
||||
|
||||
<div class="event activity-@name.HtmlClassify()" title="@Model.Description" data-outcomes="@outcomes">
|
||||
<div>@name.CamelFriendly()</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,13 +1,8 @@
|
||||
@using Orchard.Utility.Extensions
|
||||
|
||||
@using Orchard.Workflows.Helpers
|
||||
@{
|
||||
string name = Model.Name;
|
||||
string actions = Model.State.Outcomes;
|
||||
var outcomes = String.Join(",", actions == null ? new string[0] : actions.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => "'" + x.Trim() + "'").ToArray());
|
||||
var outcomes = ((string)Model.State.Outcomes).FormatOutcomesJson();
|
||||
}
|
||||
|
||||
<div data-outcomes="@outcomes">
|
||||
<div class="diamond"></div>
|
||||
@*@name.CamelFriendly()*@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Orchard.Workflows.Helpers {
|
||||
public static class OutcomeSerializerExtensions {
|
||||
/// <summary>
|
||||
/// Returns a JSON formatted string.
|
||||
/// </summary>
|
||||
/// <param name="outcomesText">A comma separated string containing outcomes.</param>
|
||||
public static string FormatOutcomesJson(this string outcomesText) {
|
||||
var items = outcomesText != null
|
||||
? outcomesText.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => x.Trim())
|
||||
: Enumerable.Empty<string>();
|
||||
|
||||
var query =
|
||||
from item in items
|
||||
let outcome = Encode(item)
|
||||
select "{label:'" + outcome + "', value:'" + outcome + "'}";
|
||||
|
||||
var outcomes = String.Join(",", query);
|
||||
return outcomes;
|
||||
}
|
||||
|
||||
private static string Encode(string value) {
|
||||
return HttpUtility.JavaScriptStringEncode(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -104,6 +104,7 @@
|
||||
<Content Include="Styles\Web.config" />
|
||||
<Compile Include="Activities\LoggingActivity.cs" />
|
||||
<Compile Include="Forms\LoggingActivityForms.cs" />
|
||||
<Compile Include="Helpers\OutcomeSerializerExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Content Include="Module.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var connectorPaintStyle = {
|
||||
var connectorPaintStyle = {
|
||||
lineWidth: 2,
|
||||
strokeStyle: "#999",
|
||||
joinstyle: "round",
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
@using Orchard.Utility.Extensions
|
||||
|
||||
@using Orchard.Workflows.Helpers
|
||||
@{
|
||||
string name = Model.Name;
|
||||
string branches = Model.State.Branches;
|
||||
var outcomes = String.Join(",", branches == null ? new string[0] : branches.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => "'" + x.Trim() + "'").ToArray());
|
||||
var outcomes = ((string)Model.State.Branches).FormatOutcomesJson();
|
||||
}
|
||||
|
||||
<div data-outcomes="@outcomes">
|
||||
<div class="branch" ></div>
|
||||
@*@name.CamelFriendly()*@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -1,13 +1,8 @@
|
||||
@using Orchard.Utility.Extensions
|
||||
|
||||
@using Orchard.Workflows.Helpers
|
||||
@{
|
||||
string name = Model.Name;
|
||||
string branches = Model.State.Branches;
|
||||
var outcomes = String.Join(",", branches == null ? new string[0] : branches.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(x => "'" + x.Trim() + "'").ToArray());
|
||||
var outcomes = ((string)Model.State.Branches).FormatOutcomesJson();
|
||||
}
|
||||
|
||||
<div data-outcomes="@outcomes" title="First of @outcomes">
|
||||
<div class="exclusive-branch" ></div>
|
||||
@*@name.CamelFriendly()*@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user