mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Moving the tag create from from its own page right up to the top-right of the tag management UI
--HG-- branch : dev
This commit is contained in:
@@ -93,7 +93,39 @@
|
|||||||
}
|
}
|
||||||
// otherwise, make the autofocus attribute work
|
// otherwise, make the autofocus attribute work
|
||||||
var autofocus = _this.find(":input[autofocus]").first();
|
var autofocus = _this.find(":input[autofocus]").first();
|
||||||
return autofocus.focus();
|
autofocus.focus();
|
||||||
|
|
||||||
|
return _this;
|
||||||
|
},
|
||||||
|
helpfullyPlacehold: function () {
|
||||||
|
var _this = $(this);
|
||||||
|
|
||||||
|
// give it up to the browser to handle placeholder text
|
||||||
|
if ('placeholder' in document.createElement('input')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// otherwise, make the placeholder attribute work
|
||||||
|
$(":input[placeholder]")
|
||||||
|
.each(function () {
|
||||||
|
var _this = $(this);
|
||||||
|
if (_this.val() === "") {
|
||||||
|
_this.val(_this.attr("placeholder")).addClass("placeholderd");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.live("focus", function () {
|
||||||
|
var _this = $(this);
|
||||||
|
if (_this.val() === _this.attr("placeholder")) {
|
||||||
|
_this.val("").removeClass("placeholderd");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.live("blur", function () {
|
||||||
|
var _this = $(this);
|
||||||
|
if (_this.val() === "") {
|
||||||
|
_this.val(_this.attr("placeholder")).addClass("placeholderd");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return _this;
|
||||||
},
|
},
|
||||||
toggleWhatYouControl: function () {
|
toggleWhatYouControl: function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
@@ -106,7 +138,7 @@
|
|||||||
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less...or when chrome behaves
|
//_controllees.slideUp(200); <- hook this back up when chrome behaves, or when I care less...or when chrome behaves
|
||||||
_controllees.hide()
|
_controllees.hide()
|
||||||
}
|
}
|
||||||
return this;
|
return _this;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
// collapsable areas - anything with a data-controllerid attribute has its visibility controlled by the id-ed radio/checkbox
|
||||||
@@ -131,7 +163,7 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
$("form.inline.link").each(function () {
|
$("form.inline.link").each(function () {
|
||||||
var _this = $(this);
|
var _this = $(this);
|
||||||
console.log(_this.html())
|
console.log(_this.html())
|
||||||
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
var link = $("<a class='wasFormInlineLink' href='.'/>");
|
||||||
var button = _this.children("button").first();
|
var button = _this.children("button").first();
|
||||||
link.text(button.text())
|
link.text(button.text())
|
||||||
@@ -143,9 +175,11 @@
|
|||||||
$("body").append(_this);
|
$("body").append(_this);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// (do) a little better autofocus
|
// some default value add behavior
|
||||||
$(function () {
|
$(function () {
|
||||||
$("body").helpfullyFocus();
|
$("body").helpfullyFocus() // (do) a little better autofocus
|
||||||
|
.helpfullyPlacehold(); // pick up on placeholders
|
||||||
|
|
||||||
});
|
});
|
||||||
// UnsafeUrl links -> form POST
|
// UnsafeUrl links -> form POST
|
||||||
//todo: need some real microdata support eventually (incl. revisiting usage of data-* attributes)
|
//todo: need some real microdata support eventually (incl. revisiting usage of data-* attributes)
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
@@ -31,7 +32,9 @@ namespace Orchard.Tags.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Index(FormCollection input) {
|
[FormValueRequired("submit.BulkEdit")]
|
||||||
|
public ActionResult Index(FormCollection input)
|
||||||
|
{
|
||||||
var viewModel = new TagsAdminIndexViewModel {Tags = new List<TagEntry>(), BulkAction = new TagAdminIndexBulkAction()};
|
var viewModel = new TagsAdminIndexViewModel {Tags = new List<TagEntry>(), BulkAction = new TagAdminIndexBulkAction()};
|
||||||
|
|
||||||
if ( !TryUpdateModel(viewModel) ) {
|
if ( !TryUpdateModel(viewModel) ) {
|
||||||
@@ -58,16 +61,14 @@ namespace Orchard.Tags.Controllers {
|
|||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Create() {
|
[HttpPost, ActionName("Index")]
|
||||||
return View(new TagsAdminCreateViewModel());
|
[FormValueRequired("submit.Create")]
|
||||||
}
|
public ActionResult IndexCreatePOST() {
|
||||||
|
|
||||||
[HttpPost]
|
|
||||||
public ActionResult Create(FormCollection input) {
|
|
||||||
var viewModel = new TagsAdminCreateViewModel();
|
var viewModel = new TagsAdminCreateViewModel();
|
||||||
|
|
||||||
if (!TryUpdateModel(viewModel)) {
|
if (!TryUpdateModel(viewModel)) {
|
||||||
return View(viewModel);
|
ViewData["CreateTag"] = viewModel;
|
||||||
|
return Index();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.CreateTag, T("Couldn't create tag")))
|
if (!Services.Authorizer.Authorize(Permissions.CreateTag, T("Couldn't create tag")))
|
||||||
@@ -147,5 +148,18 @@ namespace Orchard.Tags.Controllers {
|
|||||||
IsChecked = false,
|
IsChecked = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FormValueRequiredAttribute : ActionMethodSelectorAttribute {
|
||||||
|
private readonly string _submitButtonName;
|
||||||
|
|
||||||
|
public FormValueRequiredAttribute(string submitButtonName) {
|
||||||
|
_submitButtonName = submitButtonName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) {
|
||||||
|
var value = controllerContext.HttpContext.Request.Form[_submitButtonName];
|
||||||
|
return !string.IsNullOrEmpty(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -70,6 +70,7 @@
|
|||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
<Compile Include="Migrations.cs" />
|
<Compile Include="Migrations.cs" />
|
||||||
<Compile Include="Models\TagsContentItems.cs" />
|
<Compile Include="Models\TagsContentItems.cs" />
|
||||||
|
<Compile Include="ResourceManifest.cs" />
|
||||||
<Compile Include="Services\ITagService.cs" />
|
<Compile Include="Services\ITagService.cs" />
|
||||||
<Compile Include="ViewModels\EditTagsViewModel.cs" />
|
<Compile Include="ViewModels\EditTagsViewModel.cs" />
|
||||||
<Compile Include="Controllers\HomeController.cs" />
|
<Compile Include="Controllers\HomeController.cs" />
|
||||||
@@ -91,7 +92,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
<Content Include="Views\Admin\Create.cshtml" />
|
<Content Include="Styles\admin.css" />
|
||||||
<Content Include="Views\Web.config" />
|
<Content Include="Views\Web.config" />
|
||||||
<Content Include="Views\Admin\Edit.cshtml" />
|
<Content Include="Views\Admin\Edit.cshtml" />
|
||||||
<Content Include="Views\Admin\Index.cshtml" />
|
<Content Include="Views\Admin\Index.cshtml" />
|
||||||
@@ -116,6 +117,12 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Styles\Web.config">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Content>
|
||||||
|
<None Include="Views\EditorTemplates\Parts\CreateTag.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
9
src/Orchard.Web/Modules/Orchard.Tags/ResourceManifest.cs
Normal file
9
src/Orchard.Web/Modules/Orchard.Tags/ResourceManifest.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Orchard.UI.Resources;
|
||||||
|
|
||||||
|
namespace Orchard.Tags {
|
||||||
|
public class ResourceManifest : IResourceManifestProvider {
|
||||||
|
public void BuildManifests(ResourceManifestBuilder builder) {
|
||||||
|
builder.Add().DefineStyle("TagsAdmin").SetUrl("admin.css");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
src/Orchard.Web/Modules/Orchard.Tags/Styles/Web.config
Normal file
18
src/Orchard.Web/Modules/Orchard.Tags/Styles/Web.config
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<system.web>
|
||||||
|
<httpHandlers>
|
||||||
|
<!-- iis6 - for any request in this location, return via managed static file handler -->
|
||||||
|
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
|
||||||
|
</httpHandlers>
|
||||||
|
</system.web>
|
||||||
|
<system.webServer>
|
||||||
|
<handlers accessPolicy="Script,Read">
|
||||||
|
<!--
|
||||||
|
iis7 - for any request to a file exists on disk, return it via native http module.
|
||||||
|
accessPolicy 'Script' is to allow for a managed 404 page.
|
||||||
|
-->
|
||||||
|
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
|
||||||
|
</handlers>
|
||||||
|
</system.webServer>
|
||||||
|
</configuration>
|
11
src/Orchard.Web/Modules/Orchard.Tags/Styles/admin.css
Normal file
11
src/Orchard.Web/Modules/Orchard.Tags/Styles/admin.css
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.orchard-tags #main .manage form {
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
.orchard-tags .manage fieldset {
|
||||||
|
display:inline;
|
||||||
|
margin:0;
|
||||||
|
padding:0;
|
||||||
|
}
|
||||||
|
.orchard-tags .manage label[for=TagName] {
|
||||||
|
display:none;
|
||||||
|
}
|
@@ -1,15 +0,0 @@
|
|||||||
@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, T("Tag Name"))
|
|
||||||
@Html.TextBoxFor(m=>m.TagName, new { @class = "text" })
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<fieldset>
|
|
||||||
<button class="primaryAction" type="submit">@T("Save")</button>
|
|
||||||
</fieldset>
|
|
||||||
}
|
|
@@ -3,11 +3,15 @@
|
|||||||
@using Orchard.Utility.Extensions;
|
@using Orchard.Utility.Extensions;
|
||||||
@{
|
@{
|
||||||
Script.Require("ShapesBase");
|
Script.Require("ShapesBase");
|
||||||
|
Style.Require("TagsAdmin");
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>@Html.TitleForPage(T("Manage Tags").ToString()) </h1>
|
<h1>@Html.TitleForPage(T("Manage Tags").ToString()) </h1>
|
||||||
|
@Html.ValidationSummary()
|
||||||
|
<div class="manage">
|
||||||
|
@Display.EditorTemplate(TemplateName: "Parts/CreateTag", Model: View.CreateTag != null ? View.CreateTag : new TagsAdminCreateViewModel())
|
||||||
|
</div>
|
||||||
@using(Html.BeginFormAntiForgeryPost()) {
|
@using(Html.BeginFormAntiForgeryPost()) {
|
||||||
@Html.ValidationSummary()
|
|
||||||
<fieldset class="bulk-actions">
|
<fieldset class="bulk-actions">
|
||||||
<label for="publishActions">@T("Actions:")</label>
|
<label for="publishActions">@T("Actions:")</label>
|
||||||
<select id="publishActions" name="@Html.NameOf(m => m.BulkAction)">
|
<select id="publishActions" name="@Html.NameOf(m => m.BulkAction)">
|
||||||
@@ -16,7 +20,6 @@
|
|||||||
</select>
|
</select>
|
||||||
<button type="submit"name="submit.BulkEdit" value="@T("Apply")">@T("Apply")</button>
|
<button type="submit"name="submit.BulkEdit" value="@T("Apply")">@T("Apply")</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<div class="manage">@Html.ActionLink(T("Add a tag").ToString(), "Create", new { }, new { @class = "button primaryAction" })</div>
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<table class="items" summary="@T("This is a table of the tags in your application")" >
|
<table class="items" summary="@T("This is a table of the tags in your application")" >
|
||||||
<colgroup>
|
<colgroup>
|
||||||
|
@@ -0,0 +1,13 @@
|
|||||||
|
@model Orchard.Tags.ViewModels.TagsAdminCreateViewModel
|
||||||
|
@{
|
||||||
|
Style.Require("TagsAdmin");
|
||||||
|
}
|
||||||
|
@using (Html.BeginFormAntiForgeryPost()) {
|
||||||
|
<fieldset>
|
||||||
|
@Html.LabelFor(m => m.TagName, T("New Tag Name"))
|
||||||
|
@Html.TextBoxFor(m => m.TagName, new { @class = "text", placeholder = T("New Tag Name") })
|
||||||
|
</fieldset>
|
||||||
|
<fieldset>
|
||||||
|
<button class="primaryAction" type="submit" name="submit.Create" value="yes">@T("Add Tag")</button>
|
||||||
|
</fieldset>
|
||||||
|
}
|
@@ -915,3 +915,7 @@ fieldset.publish-later-datetime input {
|
|||||||
.clearBoth {
|
.clearBoth {
|
||||||
clear:both;
|
clear:both;
|
||||||
}
|
}
|
||||||
|
.placeholderd {
|
||||||
|
color:#ccc;
|
||||||
|
font-style:italic;
|
||||||
|
}
|
Reference in New Issue
Block a user