- added links to relation items in relatin view

This commit is contained in:
prjseal
2018-11-08 16:12:13 +00:00
committed by Sebastiaan Janssen
parent ea1a25eb84
commit 75fdee6d6d
2 changed files with 27 additions and 4 deletions

View File

@@ -10,6 +10,8 @@
table.relations th.directionIcon { width:16px; height:16px; }
table.relations td { background: transparent none no-repeat scroll center center }
table.relations td a { text-decoration: underline; }
/* objectType icons */
table.relations td.ContentItemType {}
@@ -124,10 +126,10 @@
<ItemTemplate>
<tr>
<td class="<%= this.ParentObjectType %>">&nbsp;</td>
<td><%# DataBinder.Eval(Container.DataItem, "ParentText") %></td>
<td><a href="<%# GetEditUrl(this.ParentObjectType, (int)DataBinder.Eval(Container.DataItem, "ParentId")) %>" target="_blank"><%# DataBinder.Eval(Container.DataItem, "ParentText") %></a></td>
<td class="<%= this.RelationTypeDirection %>">&nbsp;</td>
<td class="<%= this.ChildObjectType %>">&nbsp;</td>
<td><%# DataBinder.Eval(Container.DataItem, "ChildText") %></td>
<td><a href="<%# GetEditUrl(this.ChildObjectType, (int)DataBinder.Eval(Container.DataItem, "ChildId")) %>" target="_blank"><%# DataBinder.Eval(Container.DataItem, "ChildText") %></a></td>
<td><%# DataBinder.Eval(Container.DataItem, "DateTime") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "Comment") %></td>
</tr>
@@ -144,4 +146,4 @@
</umb:Pane>
</asp:Content>
</asp:Content>

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using System.Web.UI.WebControls;
using umbraco.BasePages;
@@ -127,7 +128,7 @@ namespace umbraco.cms.presentation.developer.RelationTypes
/// <param name="e">EventArgs (expect empty)</param>
protected void Page_Load(object sender, EventArgs e)
{
int id;
int id;
if (int.TryParse(Request.QueryString["id"], out id))
{
var relationService = Services.RelationService;
@@ -281,5 +282,25 @@ namespace umbraco.cms.presentation.developer.RelationTypes
}
}
}
public string GetEditUrl(string objectTypeName, int id)
{
var path = new StringBuilder();
path.Append(UmbracoPath.Replace("~", string.Empty));
if (objectTypeName == UmbracoObjectTypes.Document.GetFriendlyName())
path.Append("#/content/content/");
else if (objectTypeName == UmbracoObjectTypes.Media.GetFriendlyName())
path.Append("#/media/media/");
else if (objectTypeName == UmbracoObjectTypes.Member.GetFriendlyName())
path.Append("#/member/member/");
else
return string.Empty;
path.Append("edit/");
path.Append(id);
return path.ToString();
}
}
}