mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 12:53:33 +08:00
- Manage Roles Index action,view,model for Roles
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4039480
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
<span class="filterActions">
|
||||
<%=Html.ActionLink("Add a new folder", "Create") %>
|
||||
</span>
|
||||
<table id="Table1" cellspacing="0" class="roundCorners clearLayout" summary="This is a table of the pages currently available for use in your application.">
|
||||
<table id="Table1" cellspacing="0" class="roundCorners clearLayout" summary="This is a table of the media folders currently available for use in your application.">
|
||||
<colgroup>
|
||||
<col id="Col1" />
|
||||
<col id="Col2" />
|
||||
|
@@ -1,18 +1,31 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Data;
|
||||
using Orchard.Notify;
|
||||
using Orchard.Roles.Models;
|
||||
using Orchard.Roles.ViewModels;
|
||||
|
||||
namespace Orchard.Roles.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class AdminController : Controller {
|
||||
private readonly IRepository<RoleRecord> _roleRepository;
|
||||
private readonly INotifier _notifier;
|
||||
|
||||
public AdminController(INotifier notifier) {
|
||||
public AdminController(IRepository<RoleRecord> roleRepository, INotifier notifier) {
|
||||
_roleRepository = roleRepository;
|
||||
_notifier = notifier;
|
||||
}
|
||||
|
||||
|
||||
public ActionResult Index() {
|
||||
return View();
|
||||
var model = new RolesIndexViewModel {
|
||||
Rows = _roleRepository.Fetch(x => x.Name != null)
|
||||
.Select(x => new RolesIndexViewModel.Row {
|
||||
Role = x
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -66,9 +66,11 @@
|
||||
<Compile Include="Models\RoleRecord.cs" />
|
||||
<Compile Include="Models\RolesPermissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\RolesIndexViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Package.txt" />
|
||||
<Content Include="Views\Admin\Index.aspx" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Content\Site.css" />
|
||||
<Content Include="Views\Web.config" />
|
||||
@@ -81,7 +83,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Views\Admin\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Roles.Models;
|
||||
|
||||
namespace Orchard.Roles.ViewModels {
|
||||
public class RolesIndexViewModel : AdminViewModel {
|
||||
public class Row {
|
||||
public RoleRecord Role { get; set; }
|
||||
}
|
||||
|
||||
public IList<Row> Rows { get; set; }
|
||||
}
|
||||
}
|
@@ -0,0 +1,52 @@
|
||||
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Orchard.Roles.ViewModels.RolesIndexViewModel>" %>
|
||||
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head id="Head1" runat="server">
|
||||
<title>Manage Roles</title>
|
||||
<% Html.Include("Head"); %>
|
||||
</head>
|
||||
<body>
|
||||
<% Html.Include("Header"); %>
|
||||
<% Html.BeginForm(); %>
|
||||
<div class="yui-g">
|
||||
<h2 class="separator">Manage Roles</h2>
|
||||
<ol class="horizontal actions floatLeft">
|
||||
<li><label class="floatLeft" for="bulkActions">Actions:</label>
|
||||
<select id="Select1" name="roleActions">
|
||||
<option value="1">Delete</option>
|
||||
</select> </li>
|
||||
<li>
|
||||
<input class="button roundCorners" type="submit" value="Apply" />
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
<%=Html.ValidationSummary() %>
|
||||
<%=Html.ActionLink("Add a new role", "Create", new {}, new {@class="floatRight topSpacer"}) %>
|
||||
<table id="Table1" cellspacing="0" class="roundCorners clearLayout" summary="This is a table of the roles currently available for use in your application.">
|
||||
<colgroup>
|
||||
<col id="Col1" />
|
||||
<col id="Col2" />
|
||||
<col id="Col3" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><%--<input type="checkbox" value="" />--%></th>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<%foreach (var row in Model.Rows) { %>
|
||||
<tr>
|
||||
<td><input type="checkbox" value="true" name="<%= "Checkbox." + row.Role.Name %>"/></td>
|
||||
<td><%=Html.Encode(row.Role.Name) %></td>
|
||||
<td><%=Html.ActionLink("Edit", "Edit", new { row.Role.Id })%></td>
|
||||
</tr>
|
||||
<%}%>
|
||||
</table>
|
||||
</div>
|
||||
<% Html.EndForm(); %>
|
||||
<% Html.Include("Footer"); %>
|
||||
</body>
|
||||
</html>
|
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Users.Models;
|
||||
|
||||
|
Reference in New Issue
Block a user