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();
|
var routeData = new RouteData();
|
||||||
routeData.Values.Add("Options.Order", options.Order);
|
routeData.Values.Add("Options.Order", options.Order);
|
||||||
routeData.Values.Add("Options.SearchText", options.SearchText);
|
routeData.Values.Add("Options.SearchText", options.SearchText);
|
||||||
|
routeData.Values.Add("Options.SourceId", options.SourceId);
|
||||||
pagerShape.RouteData(routeData);
|
pagerShape.RouteData(routeData);
|
||||||
|
|
||||||
return View(packageType == DefaultExtensionTypes.Theme ? "Themes" : "Modules", new PackagingExtensionsViewModel {
|
return View(packageType == DefaultExtensionTypes.Theme ? "Themes" : "Modules", new PackagingExtensionsViewModel {
|
||||||
Extensions = extensions,
|
Extensions = extensions,
|
||||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||||
SelectedSource = selectedSource,
|
|
||||||
Pager = pagerShape,
|
Pager = pagerShape,
|
||||||
Options = options
|
Options = options
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ namespace Orchard.Packaging.ViewModels {
|
|||||||
public class PackagingExtensionsViewModel {
|
public class PackagingExtensionsViewModel {
|
||||||
public IEnumerable<PackagingEntry> Extensions { get; set; }
|
public IEnumerable<PackagingEntry> Extensions { get; set; }
|
||||||
public IEnumerable<PackagingSource> Sources { get; set; }
|
public IEnumerable<PackagingSource> Sources { get; set; }
|
||||||
public PackagingSource SelectedSource { get; set; }
|
|
||||||
public PackagingExtensionsOptions Options { get; set; }
|
public PackagingExtensionsOptions Options { get; set; }
|
||||||
public dynamic Pager { get; set; }
|
public dynamic Pager { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery"))) {
|
@using (Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery"))) {
|
||||||
<fieldset class="bulk-actions">
|
<fieldset class="bulk-actions">
|
||||||
<label for="filterResults" class="bulk-filter">@T("Feed:")</label>
|
<label for="sourceId">@T("Feed:")</label>
|
||||||
<select id="sourceId" name="sourceId">
|
<select id="sourceId" name="@Html.NameOf(m => m.Options.SourceId)">
|
||||||
@Html.SelectOption("", Model.SelectedSource == null, T("All feeds").ToString())
|
@Html.SelectOption(Model.Options.SourceId, null, T("All feeds").ToString())
|
||||||
@foreach (var source in Model.Sources) {
|
@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>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
|
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button type="submit">@T("Apply")</button>
|
<button id="apply-bulk-actions" type="submit">@T("Apply")</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="search-actions">
|
<fieldset class="search-actions">
|
||||||
|
|||||||
@@ -10,11 +10,11 @@
|
|||||||
|
|
||||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Themes", "Gallery"))) {
|
@using (Html.BeginFormAntiForgeryPost(Url.Action("Themes", "Gallery"))) {
|
||||||
<fieldset class="bulk-actions">
|
<fieldset class="bulk-actions">
|
||||||
<label for="filterResults" class="bulk-filter">@T("Show")</label>
|
<label for="sourceId">@T("Show")</label>
|
||||||
<select id="sourceId" name="sourceId">
|
<select id="sourceId" name="@Html.NameOf(m => m.Options.SourceId)">
|
||||||
@Html.SelectOption("", Model.SelectedSource == null, T("All feeds").ToString())
|
@Html.SelectOption(Model.Options.SourceId, null, T("All feeds").ToString())
|
||||||
@foreach (var source in Model.Sources) {
|
@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>
|
</select>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
|
@Html.SelectOption(Model.Options.Order, PackagingExtensionsOrder.Alphanumeric, T("Alphanumeric").ToString())
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button type="submit">@T("Apply")</button>
|
<button id="apply-bulk-actions" type="submit">@T("Apply")</button>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset class="search-actions">
|
<fieldset class="search-actions">
|
||||||
|
|||||||
@@ -56,4 +56,16 @@
|
|||||||
return this;
|
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);
|
})(jQuery);
|
||||||
@@ -962,7 +962,7 @@ table.items th, table.items td {
|
|||||||
.page-size-options select {
|
.page-size-options select {
|
||||||
margin-top: 10px;
|
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 { list-style: none; padding: 0; margin: 12px 0 0 0;}
|
||||||
.pager li {
|
.pager li {
|
||||||
float: left;
|
float: left;
|
||||||
|
|||||||
@@ -34,8 +34,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="layout-content">
|
<div id="layout-content">
|
||||||
|
|
||||||
@if (Model.Header != null) {
|
@if (Model.Header != null) {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@
|
|||||||
}
|
}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<button id="submit_pager" type="submit">@T("Apply")</button>
|
<button id="submit-pager" type="submit">@T("Apply")</button>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user