mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Adding Horizontal Tab nagigation on Autoroute Patterns Localization settings.
Fixing Token Picker CSS (vertical position).
This commit is contained in:
parent
e508385dcb
commit
d2fc47eb2d
@ -71,6 +71,7 @@
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Scripts\autoroute-browser.js" />
|
||||
<Content Include="Styles\orchard-autoroute-settings.css" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Scripts\Web.config" />
|
||||
|
@ -5,6 +5,7 @@ namespace Orchard.Autoroute {
|
||||
public void BuildManifests(ResourceManifestBuilder builder) {
|
||||
var manifest = builder.Add();
|
||||
manifest.DefineStyle("AutorouteSettings").SetUrl("orchard-autoroute-settings.css");
|
||||
manifest.DefineScript("AutorouteBrowser").SetUrl("autoroute-browser.js").SetDependencies("jQuery");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,26 @@
|
||||
(function ($) {
|
||||
var AutorouteCultureBrowser = function (culture) {
|
||||
var self = this;
|
||||
this.culture = culture;
|
||||
|
||||
this.initialize = function () {
|
||||
self.culture.find(".autoroute-cultures").on("click", "a.culture", function (e) {
|
||||
var categoryLink = $(this);
|
||||
var href = categoryLink.attr("href");
|
||||
|
||||
self.culture.find(".autoroute-cultures li").removeClass("selected");
|
||||
categoryLink.closest("li").addClass("selected");
|
||||
self.culture.find(".items").hide();
|
||||
self.culture.find(href).show();
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
self.culture.find(".autoroute-cultures a").first().click();
|
||||
}
|
||||
};
|
||||
|
||||
$(function () {
|
||||
var browser = new AutorouteCultureBrowser($("#main"));
|
||||
browser.initialize();
|
||||
});
|
||||
})(jQuery);
|
@ -26,7 +26,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
public bool AllowCustomPattern { get; set; }
|
||||
public bool AutomaticAdjustmentOnEdit { get; set; }
|
||||
public bool? IsDefault { get; set; }
|
||||
public IEnumerable<string> SiteCultures { get; set; }
|
||||
public List<string> SiteCultures { get; set; }
|
||||
public string DefaultSiteCulture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
@ -29,7 +29,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
var settings = definition.Settings.GetModel<AutorouteSettings>();
|
||||
|
||||
//get cultures
|
||||
settings.SiteCultures = _cultureManager.ListCultures();
|
||||
settings.SiteCultures = _cultureManager.ListCultures().ToList();
|
||||
//get default site culture
|
||||
settings.DefaultSiteCulture = _cultureManager.GetSiteCulture();
|
||||
|
||||
@ -81,7 +81,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
};
|
||||
|
||||
//get cultures
|
||||
settings.SiteCultures = _cultureManager.ListCultures();
|
||||
settings.SiteCultures = _cultureManager.ListCultures().ToList();
|
||||
|
||||
if (updateModel.TryUpdateModel(settings, "AutorouteSettings", null, null)) {
|
||||
// remove empty patterns
|
||||
|
@ -18,6 +18,10 @@
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.autoroute-settings-patterns tr td input {
|
||||
.autoroute-settings-patterns, .autoroute-settings-patterns tr td input {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.autoroute-settings-patterns td, .autoroute-settings-patterns th {
|
||||
padding:10px;
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
@using Orchard.Utility.Extensions;
|
||||
|
||||
@{
|
||||
Script.Require("AutorouteBrowser");
|
||||
Style.Require("AutorouteSettings");
|
||||
int patternCount = 0;
|
||||
int patternCultureCount = 0;
|
||||
@ -21,31 +22,49 @@
|
||||
<span class="hint">@T("This option will cause the Url to automatically be regenerated when you edit existing content and publish it again, otherwise it will always keep the old route, or you have to perform bulk update in the Autoroute admin.")</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
@foreach (var culture in Model.SiteCultures) {
|
||||
<fieldset>
|
||||
<label>@T("Patterns") @culture :</label>
|
||||
<table class="items autoroute-settings-patterns">
|
||||
<tr>
|
||||
<th class="autoroute-settings-default">@T("Default")</th>
|
||||
<th class="autoroute-settings-name">@T("Name")<span class="hint">@T("Name of the pattern")</span></th>
|
||||
<th class="autoroute-settings-pat">@T("Pattern")<span class="hint">@T("The definition of the pattern")</span></th>
|
||||
<th class="autoroute-settings-desc">@T("Description")<span class="hint">@T("The description of the pattern, displayed in the editor")</span></th>
|
||||
<th class="autoroute-settings-actions"> </th>
|
||||
</tr>
|
||||
@for (int index = 0; index < Model.Patterns.Where(x => x.Culture == culture).Count(); index++) {
|
||||
<tr>
|
||||
<td>@Html.RadioButtonFor(m => m.DefaultPatterns[cultureCount].Culture, culture + "|" + patternCultureCount, patternCultureCount.ToString() == Model.DefaultPatterns[cultureCount].PatternIndex ? new { @checked = "checked" } : null)</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Name, new { @class = "text" })</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Pattern, new { @class = "tokenized text" })</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Description, new { @class = "text" })</td>
|
||||
<td>@Html.HiddenFor(m => m.Patterns[patternCount].Culture) </td>
|
||||
</tr>
|
||||
if (Model.Patterns[patternCount].Name != null) { patternCultureCount++; } else { patternCultureCount = 0; }
|
||||
patternCount++;
|
||||
<fieldset>
|
||||
<h4>@T("Patterns") :</h4>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div id="local-navigation">
|
||||
<ul class="autoroute-cultures localmenu group">
|
||||
@{
|
||||
int i = 0;
|
||||
}
|
||||
<tr></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
cultureCount++;
|
||||
}
|
||||
@Display.TokenHint()
|
||||
@foreach (var culture in Model.SiteCultures) {
|
||||
var cssClass = i == 0 ? "selected first" : i == Model.SiteCultures.Count - 1 ? "last" : "middle";
|
||||
<li class="@cssClass"><a class="culture" href="#cat-@culture">@culture</a></li>
|
||||
i++;
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
@foreach (var culture in Model.SiteCultures) {
|
||||
<fieldset id="cat-@culture" class="items" style="@(cultureCount == 0 ? "display:block;" : "display:none;" )">
|
||||
<table class="autoroute-settings-patterns">
|
||||
<tr>
|
||||
<th class="autoroute-settings-default">@T("Default")</th>
|
||||
<th class="autoroute-settings-name">@T("Name")<span class="hint">@T("Name of the pattern")</span></th>
|
||||
<th class="autoroute-settings-pat">@T("Pattern")<span class="hint">@T("The definition of the pattern")</span></th>
|
||||
<th class="autoroute-settings-desc">@T("Description")<span class="hint">@T("The description of the pattern, displayed in the editor")</span></th>
|
||||
<th class="autoroute-settings-actions"> </th>
|
||||
</tr>
|
||||
@for (int index = 0; index < Model.Patterns.Where(x => x.Culture == culture).Count(); index++) {
|
||||
<tr>
|
||||
<td>@Html.RadioButtonFor(m => m.DefaultPatterns[cultureCount].Culture, culture + "|" + patternCultureCount, patternCultureCount.ToString() == Model.DefaultPatterns[cultureCount].PatternIndex ? new { @checked = "checked" } : null)</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Name, new { @class = "text" })</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Pattern, new { @class = "tokenized text" })</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Description, new { @class = "text" })</td>
|
||||
<td>@Html.HiddenFor(m => m.Patterns[patternCount].Culture) </td>
|
||||
</tr>
|
||||
if (Model.Patterns[patternCount].Name != null) { patternCultureCount++; } else { patternCultureCount = 0; }
|
||||
patternCount++;
|
||||
}
|
||||
<tr></tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
cultureCount++;
|
||||
}
|
||||
</div>
|
||||
</fieldset>
|
||||
@Display.TokenHint()
|
||||
|
@ -8,7 +8,7 @@
|
||||
cursor: pointer;
|
||||
|
||||
padding-right:8px;
|
||||
margin-top:10px;
|
||||
margin-top:0.15em;
|
||||
right:100%;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user