- Bringing Orchard.Tags back

--HG--
branch : dev
This commit is contained in:
Suha Can
2010-09-14 14:49:34 -07:00
parent 3ef83d903d
commit 6a55a20a31
26 changed files with 157 additions and 151 deletions

View File

@@ -88,7 +88,7 @@ namespace Orchard.Setup.Services {
"Orchard.Themes",
//"Orchard.Blogs",
//"Orchard.Comments",
//"Orchard.Tags",
"Orchard.Tags",
//"Orchard.Media",
//"Futures.Widgets"

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using JetBrains.Annotations;
@@ -45,7 +46,7 @@ namespace Orchard.Tags.Controllers {
var viewModel = new TagsSearchViewModel {
TagName = tag.TagName,
Items = items.ToList()
Items = (IList<IContent>) items.ToList<object>()
};
return View(viewModel);

View File

@@ -90,16 +90,16 @@
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Views\Admin\Create.aspx" />
<Content Include="Views\Admin\Edit.aspx" />
<Content Include="Views\Admin\Index.aspx" />
<Content Include="Views\Admin\Search.aspx" />
<Content Include="Views\Home\Index.ascx" />
<Content Include="Views\Home\Search.ascx" />
<Content Include="Views\DisplayTemplates\Parts\Tags.ShowTags.ascx" />
<Content Include="Views\EditorTemplates\Parts\Tags.EditTags.ascx" />
<None Include="Views\Admin\Create.cshtml" />
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
<None Include="Views\Admin\Edit.cshtml" />
<None Include="Views\Admin\Index.cshtml" />
<None Include="Views\Admin\Search.cshtml" />
<None Include="Views\DisplayTemplates\Parts\Tags.ShowTags.cshtml" />
<None Include="Views\EditorTemplates\Parts\Tags.EditTags.cshtml" />
<None Include="Views\Home\Index.cshtml" />
<None Include="Views\Home\Search.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">

View File

@@ -1,9 +1,8 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Orchard.Mvc.ViewModels;
namespace Orchard.Tags.ViewModels {
public class TagsAdminCreateViewModel : BaseViewModel {
public class TagsAdminCreateViewModel {
[Required, DisplayName("Name")]
public string TagName { get; set; }
}

View File

@@ -1,9 +1,8 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Orchard.Mvc.ViewModels;
namespace Orchard.Tags.ViewModels {
public class TagsAdminEditViewModel : BaseViewModel {
public class TagsAdminEditViewModel {
public int Id { get; set; }
[Required, DisplayName("Name")]
public string TagName { get; set; }

View File

@@ -1,9 +1,8 @@
using System.Collections.Generic;
using Orchard.Mvc.ViewModels;
using Orchard.Tags.Models;
namespace Orchard.Tags.ViewModels {
public class TagsAdminIndexViewModel : BaseViewModel {
public class TagsAdminIndexViewModel {
public IList<TagEntry> Tags { get; set; }
public TagAdminIndexBulkAction BulkAction { get; set; }
}

View File

@@ -1,9 +1,8 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.Mvc.ViewModels;
namespace Orchard.Tags.ViewModels {
public class TagsAdminSearchViewModel : BaseViewModel {
public class TagsAdminSearchViewModel {
public string TagName { get; set; }
public IEnumerable<IContent> Contents { get; set; }
}

View File

@@ -1,9 +1,8 @@
using System.Collections.Generic;
using Orchard.Mvc.ViewModels;
using Orchard.Tags.Models;
namespace Orchard.Tags.ViewModels {
public class TagsIndexViewModel : BaseViewModel {
public class TagsIndexViewModel {
public IList<Tag> Tags { get; set; }
}
}

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.Mvc.ViewModels;
namespace Orchard.Tags.ViewModels {
public class TagsSearchViewModel : BaseViewModel {
public class TagsSearchViewModel {
public string TagName { get; set; }
public IEnumerable<ContentItemViewModel<IContent>> Items { get; set; }
public IEnumerable<IContent> Items { get; set; }
}
}

View File

@@ -1,13 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<TagsAdminCreateViewModel>" %>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<h1><%: Html.TitleForPage(T("Add a Tag").ToString()) %></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset>
<%: Html.LabelFor(m => m.TagName) %>
<%: Html.TextBoxFor(m => m.TagName, new { @class = "text" })%>
</fieldset>
<fieldset>
<input class="button primaryAction" type="submit" value="<%:T("Save") %>" />
</fieldset>
<% } %>

View File

@@ -0,0 +1,15 @@
@model Orchard.Tags.ViewModels.TagsAdminCreateViewModel
<h1>@Html.TitleForPage(T("Add a Tag").ToString()) </h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset>
@Html.LabelFor(m=>m.TagName)
@Html.TextBoxFor(m=>m.TagName, new { @class = "text" })
</fieldset>
<fieldset>
<input class="button primaryAction" type="submit" value="@T("Save")" />
</fieldset>
}

View File

@@ -1,14 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<TagsAdminEditViewModel>" %>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<h1><%: Html.TitleForPage(T("Edit a Tag").ToString()) %></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset>
<%: Html.HiddenFor(m => m.Id) %>
<%: Html.LabelFor(m => m.TagName) %>
<%: Html.TextBoxFor(m => m.TagName, new { @class = "text" })%>
</fieldset>
<fieldset>
<input class="button primaryAction" type="submit" value="<%:T("Save") %>" />
</fieldset>
<% } %>

View File

@@ -0,0 +1,15 @@
@model Orchard.Tags.ViewModels.TagsAdminEditViewModel
<h1>@Html.TitleForPage(T("Edit a Tag").ToString()) </h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset>
@Html.HiddenFor(m=>m.Id)
@Html.LabelFor(m=>m.TagName)
@Html.TextBoxFor(m=>m.TagName, new { @class = "text" })
</fieldset>
<fieldset>
<input class="button primaryAction" type="submit" value="@T("Save") " />
</fieldset>
}

View File

@@ -1,49 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<TagsAdminIndexViewModel>" %>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<h1><%: Html.TitleForPage(T("Manage Tags").ToString())%></h1>
<% using(Html.BeginFormAntiForgeryPost()) { %>
<%: Html.ValidationSummary() %>
<fieldset class="bulk-actions">
<label for="publishActions"><%: T("Actions:") %></label>
<select id="publishActions" name="<%: Html.NameOf(m => m.BulkAction)%>">
<%: Html.SelectOption(Model.BulkAction, TagAdminIndexBulkAction.None, T("Choose action...").ToString())%>
<%: Html.SelectOption(Model.BulkAction, TagAdminIndexBulkAction.Delete, T("Remove").ToString())%>
</select>
<input class="button" type="submit" name="submit.BulkEdit" value="<%: T("Apply") %>" />
</fieldset>
<div class="manage"><%: Html.ActionLink(T("Add a tag").ToString(), "Create", new { }, new { @class = "button primaryAction" })%></div>
<fieldset>
<table class="items" summary="<%: T("This is a table of the tags in your application") %>">
<colgroup>
<col id="Col1" />
<col id="Col2" />
<col id="Col3" />
</colgroup>
<thead>
<tr>
<th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th>
<th scope="col"><%: T("Name")%></th>
<th scope="col"></th>
</tr>
</thead>
<%
int tagIndex = 0;
foreach (var tagEntry in Model.Tags) {
var ti = tagIndex;
%>
<tr>
<td>
<input type="hidden" value="<%=Model.Tags[tagIndex].Tag.Id%>" name="<%: Html.NameOf(m => m.Tags[ti].Tag.Id)%>"/>
<input type="checkbox" value="true" name="<%: Html.NameOf(m => m.Tags[ti].IsChecked)%>"/>
</td>
<td>
<%: Html.ActionLink(Html.Encode(tagEntry.Tag.TagName), "Search", new {id = tagEntry.Tag.Id}) %>
</td>
<td>
<%: Html.ActionLink(T("Edit").ToString(), "Edit", new {id = tagEntry.Tag.Id}) %>
</td>
</tr>
<% tagIndex++; } %>
</table>
</fieldset>
<% } %>

View File

@@ -0,0 +1,45 @@
@model Orchard.Tags.ViewModels.TagsAdminIndexViewModel
<h1>@Html.TitleForPage(T("Manage Tags").ToString()) </h1>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.ValidationSummary()
<fieldset class="bulk-actions">
<label for="publishActions">@T("Actions:")</label>
<select id="publishActions" name="@Html.NameOf(m => m.BulkAction)">
@Html.SelectOption(Model.BulkAction, TagAdminIndexBulkAction.None, T("Choose action...").ToString())
@Html.SelectOption(Model.BulkAction, TagAdminIndexBulkAction.Delete, T("Remove").ToString())
</select>
<input class="button" type="submit" name="submit.BulkEdit" value="@T("Apply")" />
</fieldset>
<div class="manage">@Html.ActionLink(T("Add a tag").ToString(), "Create", new { }, new { @class = "button primaryAction" })</div>
<fieldset>
<table class="items" summary="@T("This is a table of the tags in your application")" >
<colgroup>
<col id="Name" />
<col id="Email" />
<col id="Edit" />
</colgroup>
<thead>
<th scope="col">&nbsp;&darr;<%-- todo: (heskew) something more appropriate for "this applies to the bulk actions --%></th>
<th scope="col">@T("Name")</th>
<th scope="col"></th>
</thead>
@foreach (var tagEntry in Model.Tags) {
<tr>
<td>
<input type="hidden" value="<%=Model.Tags[tagIndex].Tag.Id%>" name="@Html.NameOf(m => m.Tags[ti].Tag.Id)"/>
<input type="checkbox" value="true" name="@Html.NameOf(m => m.Tags[ti].IsChecked)"/>
</td>
<td>
@Html.ActionLink(Html.Encode(tagEntry.Tag.TagName), "Search", new {id = tagEntry.Tag.Id})
</td>
<td>
@Html.ActionLink(T("Edit").ToString(), "Edit", new {id = tagEntry.Tag.Id})
</td>
</tr>
}
</table>
</fieldset>
}

View File

@@ -1,22 +0,0 @@
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<TagsAdminSearchViewModel>" %>
<%@ Import Namespace="Orchard.ContentManagement"%>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<h1><%: Html.TitleForPage(T("List of contents tagged with {0}", Model.TagName).ToString()) %></h1>
<table class="items">
<colgroup>
<col id="Col1" />
<col id="Col2" />
</colgroup>
<thead>
<tr>
<th scope="col"><%: T("Name")%></th>
<th scope="col"><%: T("Link to the content item")%></th>
</tr>
</thead>
<% foreach (var contentItem in Model.Contents) { %>
<tr>
<td><%: Html.ItemDisplayText(contentItem) %></td>
<td><%: Html.ItemDisplayLink(contentItem) %></td>
</tr>
<% } %>
</table>

View File

@@ -0,0 +1,22 @@
@model Orchard.Tags.ViewModels.TagsAdminSearchViewModel
@using Orchard.ContentManagement
<h1>@Html.TitleForPage(T("List of contents tagged with {0}", Model.TagName).ToString())</h1>
<table class="items">
<colgroup>
<col id="Col1" />
<col id="Col2" />
</colgroup>
<thead>
<tr>
<th scope="col">@T("Name")</th>
<th scope="col">@T("Link to the content item")</th>
</tr>
</thead>
@foreach (var contentItem in Model.Contents) {
<tr>
<td>@Html.ItemDisplayText(contentItem)</td>
<td>@Html.ItemDisplayLink(contentItem)</td>
</tr>
}
</table>

View File

@@ -1,8 +1,8 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TagsPart>" %>
<%@ Import Namespace="Orchard.Tags.Models" %>
<% if (Model.CurrentTags.Count > 0) { %>
@model Orchard.Tags.Models.TagsPart
@if (Model.CurrentTags.Count > 0) {
<p class="tags">
<span><%: T("Tags:") %></span>
<span>@T("Tags:")</span>
<%=string.Join(", ", Model.CurrentTags.Select(t => Html.ActionLink(Html.Encode(t.TagName), "Search", "Home", new { area = "Orchard.Tags", tagName = t.TagName }, new { }).ToHtmlString()).ToArray())%>
</p><%
} %>
</p>
}

View File

@@ -1,6 +0,0 @@
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<EditTagsViewModel>" %>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<fieldset>
<%: Html.LabelFor(m => m.Tags) %>
<%: Html.TextBoxFor(m => m.Tags, new { @class = "large text" })%>
</fieldset>

View File

@@ -0,0 +1,6 @@
@model Orchard.Tags.ViewModels.EditTagsViewModel
<fieldset>
@Html.LabelFor(m => m.Tags)
@Html.TextBoxFor(m => m.Tags, new { @class = "large text" })
</fieldset>

View File

@@ -1,13 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TagsIndexViewModel>" %>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<h1 class="page-title"><%: Html.TitleForPage(T("Tags").ToString())%></h1>
<%: Html.UnorderedList(
Model.Tags,
(t, i) => Html.ActionLink(
Html.Encode(t.TagName),
"Search",
new { tagName = t.TagName },
new { @class = "" /* todo: (heskew) classify according to tag use */ }
),
"tagCloud")
%>

View File

@@ -0,0 +1,12 @@
@model Orchard.Tags.ViewModels.TagsIndexViewModel
<h1 class="page-title">@Html.TitleForPage(T("Tags").ToString())</h1>
@Html.UnorderedList(
Model.Tags,
(t, i) => Html.ActionLink(
Html.Encode(t.TagName),
"Search",
new { tagName = t.TagName },
new { @class = "" /* todo: (heskew) classify according to tag use */ }
),
"tagCloud")

View File

@@ -1,5 +0,0 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<TagsSearchViewModel>" %>
<%@ Import Namespace="Orchard.Tags.ViewModels"%>
<% Html.AddTitleParts(T("Tags").ToString(), T("Contents tagged with {0}", Model.TagName).ToString()); %>
<h1 class="page-title"><%: T("Contents tagged with <span>{0}</span>", Html.Encode(Model.TagName)) %></h1>
<%: Html.UnorderedList(Model.Items, (c, i) => Html.DisplayForItem(c), "taggedPosts contentItems") %>

View File

@@ -0,0 +1,5 @@
@model Orchard.Tags.ViewModels.TagsSearchViewModel
@Html.AddTitleParts(T("Tags").ToString(), T("Contents tagged with {0}", Model.TagName).ToString());
<h1 class="page-title">@T("Contents tagged with <span>{0}</span>", Html.Encode(Model.TagName))</h1>
@Html.UnorderedList(Model.Items, (c, i) => Html.DisplayForItem(c), "taggedPosts contentItems")

View File

@@ -64,6 +64,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Packaging", "Orchar
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ContentTypes", "Orchard.Web\Modules\Orchard.ContentTypes\Orchard.ContentTypes.csproj", "{0E7646E8-FE8F-43C1-8799-D97860925EC4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Tags", "Orchard.Web\Modules\Orchard.Tags\Orchard.Tags.csproj", "{5D0F00F0-26C9-4785-AD61-B85710C60EB0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinyMce", "Orchard.Web\Modules\TinyMce\TinyMce.csproj", "{954CA994-D204-468B-9D69-51F6AD3E1C29}"
EndProject
Global
@@ -315,6 +317,16 @@ Global
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.FxCop|Any CPU.Build.0 = Release|Any CPU
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Release|Any CPU.Build.0 = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Coverage|Any CPU.Build.0 = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.FxCop|Any CPU.Build.0 = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Release|Any CPU.Build.0 = Release|Any CPU
{954CA994-D204-468B-9D69-51F6AD3E1C29}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
{954CA994-D204-468B-9D69-51F6AD3E1C29}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
{954CA994-D204-468B-9D69-51F6AD3E1C29}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
@@ -338,6 +350,7 @@ Global
{17F86780-9A1F-4AA1-86F1-875EEC2730C7} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{0E7646E8-FE8F-43C1-8799-D97860925EC4} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{5D0F00F0-26C9-4785-AD61-B85710C60EB0} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{954CA994-D204-468B-9D69-51F6AD3E1C29} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}