mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Posting bulk actions through Javascript
--HG-- branch : dev
This commit is contained in:
@@ -219,12 +219,12 @@ namespace Orchard.Packaging.Controllers {
|
||||
var routeData = new RouteData();
|
||||
routeData.Values.Add("Options.Order", options.Order);
|
||||
routeData.Values.Add("Options.SearchText", options.SearchText);
|
||||
routeData.Values.Add("Options.SourceId", options.SourceId);
|
||||
pagerShape.RouteData(routeData);
|
||||
|
||||
return View(packageType == DefaultExtensionTypes.Theme ? "Themes" : "Modules", new PackagingExtensionsViewModel {
|
||||
Extensions = extensions,
|
||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||
SelectedSource = selectedSource,
|
||||
Pager = pagerShape,
|
||||
Options = options
|
||||
});
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace Orchard.Packaging.ViewModels {
|
||||
public class PackagingExtensionsViewModel {
|
||||
public IEnumerable<PackagingEntry> Extensions { get; set; }
|
||||
public IEnumerable<PackagingSource> Sources { get; set; }
|
||||
public PackagingSource SelectedSource { get; set; }
|
||||
public PackagingExtensionsOptions Options { get; set; }
|
||||
public dynamic Pager { get; set; }
|
||||
}
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery"))) {
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="filterResults" class="bulk-filter">@T("Feed:")</label>
|
||||
<select id="sourceId" name="sourceId">
|
||||
@Html.SelectOption("", Model.SelectedSource == null, T("All feeds").ToString())
|
||||
<label for="sourceId">@T("Feed:")</label>
|
||||
<select id="sourceId" name="@Html.NameOf(m => m.Options.SourceId)">
|
||||
@Html.SelectOption(Model.Options.SourceId, null, T("All feeds").ToString())
|
||||
@foreach (var source in Model.Sources) {
|
||||
@Html.SelectOption(source.Id, Model.SelectedSource != null && Model.SelectedSource.Id == source.Id, source.FeedTitle)
|
||||
@Html.SelectOption(Model.Options.SourceId, source.Id, source.FeedTitle)
|
||||
}
|
||||
</select>
|
||||
</fieldset>
|
||||
@@ -27,7 +27,7 @@
|
||||
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
|
||||
</select>
|
||||
|
||||
<button type="submit">@T("Apply")</button>
|
||||
<button id="apply-bulk-actions" type="submit">@T("Apply")</button>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="search-actions">
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Themes", "Gallery"))) {
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="filterResults" class="bulk-filter">@T("Show")</label>
|
||||
<select id="sourceId" name="sourceId">
|
||||
@Html.SelectOption("", Model.SelectedSource == null, T("All feeds").ToString())
|
||||
<label for="sourceId">@T("Show")</label>
|
||||
<select id="sourceId" name="@Html.NameOf(m => m.Options.SourceId)">
|
||||
@Html.SelectOption(Model.Options.SourceId, null, T("All feeds").ToString())
|
||||
@foreach (var source in Model.Sources) {
|
||||
@Html.SelectOption(source.Id, Model.SelectedSource != null && Model.SelectedSource.Id == source.Id, source.FeedTitle)
|
||||
@Html.SelectOption(Model.Options.SourceId, source.Id, source.FeedTitle)
|
||||
}
|
||||
</select>
|
||||
</fieldset>
|
||||
@@ -27,7 +27,7 @@
|
||||
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
|
||||
</select>
|
||||
|
||||
<button type="submit">@T("Apply")</button>
|
||||
<button id="apply-bulk-actions" type="submit">@T("Apply")</button>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="search-actions">
|
||||
|
||||
@@ -56,4 +56,16 @@
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
$(".bulk-actions").each(function () {
|
||||
$("select").each(function () {
|
||||
$(this).change(function () {
|
||||
var self = $(this);
|
||||
var form = self.closest("form");
|
||||
|
||||
// Submit form
|
||||
form.submit();
|
||||
});
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
@@ -962,7 +962,7 @@ table.items th, table.items td {
|
||||
.page-size-options select {
|
||||
margin-top: 10px;
|
||||
}
|
||||
html.dyn #submit_pager { display:none; }
|
||||
html.dyn #submit-pager, html.dyn #apply-bulk-actions { display:none; }
|
||||
.pager { list-style: none; padding: 0; margin: 12px 0 0 0;}
|
||||
.pager li {
|
||||
float: left;
|
||||
|
||||
@@ -34,8 +34,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
<div id="layout-content">
|
||||
|
||||
@if (Model.Header != null) {
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
</select>
|
||||
|
||||
<button id="submit_pager" type="submit">@T("Apply")</button>
|
||||
<button id="submit-pager" type="submit">@T("Apply")</button>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user