Added links to localized content of an item on the front

--HG--
branch : dev
This commit is contained in:
Nathan Heskew
2010-07-12 23:35:43 -07:00
parent ac7a4ace9a
commit 1ff677d24d
6 changed files with 52 additions and 17 deletions

View File

@@ -23,13 +23,8 @@ namespace Orchard.Core.Localization.Drivers {
public IOrchardServices Services { get; set; }
protected override DriverResult Display(Localized part, string displayType) {
// for viewing or adding translation
if (!Services.Authorizer.Authorize(Permissions.ChangeOwner)) {
return null;
}
var model = new ContentLocalizationsViewModel(part) {
CanLocalize = _cultureManager.ListCultures()
CanLocalize = Services.Authorizer.Authorize(Permissions.ChangeOwner) && _cultureManager.ListCultures()
.Where(s => s != _cultureManager.GetCurrentCulture(new HttpContextWrapper(HttpContext.Current)) && s != _localizationService.GetContentCulture(part.ContentItem))
.Count() > 0,
Localizations = _localizationService.GetLocalizations(part.ContentItem)
@@ -38,12 +33,6 @@ namespace Orchard.Core.Localization.Drivers {
}
protected override DriverResult Editor(Localized part) {
// ContentTranslations: for when there are drafts of translations
// CultureSelection: for a new translation
//var model = new SelectTranslationsViewModel(part);
//if (part.ContentItem.Is<Localized>())
return ContentPartTemplate(new SelectLocalizationsViewModel(part), "Parts/Localization.ContentTranslations").Location("secondary", "5");
}
}

View File

@@ -1,10 +1,12 @@
.content-localization .content-localizations li,
.content-localization {
margin:1.44em 0 .44em;
}
.content-localization .content-localizations li,
.content-localization .add-localization {
font-size:1.4em;
}
.content-localization .content-localizations {
font-size:.9em;
margin:1.44em 0 .44em;
}
.content-localization .content-localizations>* {
display:inline;

View File

@@ -0,0 +1,30 @@
.content-localization {
overflow:auto;
}
.content-localization .content-localizations,
.content-localization .add-localization {
clear:right;
float:right;
}
.content-localization .content-localizations li,
.content-localization .add-localization {
font-size:1.2em;
}
.content-localization .content-localizations {
font-size:.9em;
}
.content-localization .content-localizations>* {
display:inline;
}
.content-localization .content-localizations li {
border-bottom:0;
display:inline;
margin-left:.5em;
padding:0;
}
.content-localization .content-localizations li::after {
content:", ";
}
.content-localization .content-localizations li:last-child::after {
content:"";
}

View File

@@ -1 +1,16 @@
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Localization.ViewModels.ContentLocalizationsViewModel>" %>
<%@ Import Namespace="Orchard.Core.Localization.Models" %>
<%@ Import Namespace="Orchard.ContentManagement" %>
<%
Html.RegisterStyle("base.css"); %>
<% if (Model.Localizations.Count() > 0 || Model.CanLocalize) { %>
<div class="content-localization"><%
if (Model.Localizations.Count() > 0) { %>
<%--//todo: need this info in the view model--%>
<div class="content-localizations"><%:Html.UnorderedList(Model.Localizations, (c, i) => Html.ItemDisplayLink(c.ContentItem.As<Localized>().Culture != null ? c.ContentItem.As<Localized>().Culture.Culture : "[site's default culture]", c), "localizations") %></div><%
}
if (Model.CanLocalize) { %>
<div class="add-localization"><%:Html.ActionLink(T("+ New translation").Text, "translate", "admin", new { area = "Localization", id = Model.Id }, null)%></div><%
} %>
</div><%
} %>

View File

@@ -244,6 +244,7 @@
<Content Include="Contents\Views\Item\Preview.aspx" />
<Content Include="Contents\Views\Item\Display.aspx" />
<Content Include="Localization\Styles\admin.css" />
<Content Include="Localization\Styles\base.css" />
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.Summary.ascx" />
<Content Include="Localization\Views\DisplayTemplates\Parts\Localization.ContentTranslations.ascx" />
<Content Include="Localization\Views\EditorTemplates\Parts\Localization.ContentTranslations.ascx" />

View File

@@ -120,9 +120,7 @@
</Content>
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>