mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Correcting RolesPart display in User views
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
@model UserRolesViewModel
|
||||
@using Orchard.Roles.ViewModels
|
||||
|
||||
<fieldset>
|
||||
<legend>@T("Roles")</legend>
|
||||
@if (Model.Roles.Count > 0) {
|
||||
@@ -8,14 +9,18 @@
|
||||
if (string.Equals(entry.Name, "Authenticated", StringComparison.OrdinalIgnoreCase) || string.Equals(entry.Name, "Anonymous", StringComparison.OrdinalIgnoreCase)) {
|
||||
continue;
|
||||
}
|
||||
Html.Hidden("Roles[" + index + "].RoleId", entry.RoleId);
|
||||
Html.Hidden("Roles[" + index + "].Name", entry.Name);
|
||||
|
||||
@Html.Hidden("Roles[" + index + "].RoleId", entry.RoleId)
|
||||
@Html.Hidden("Roles[" + index + "].Name", entry.Name)
|
||||
|
||||
<div>
|
||||
@Html.CheckBox("Roles[" + index + "].Granted", entry.Granted)
|
||||
<label class="forcheckbox" for="@"Roles[" + index + "]_Granted"">@entry.Name</label>
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.Roles[index].Granted)">@entry.Name</label>
|
||||
</div>
|
||||
@++index;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
else {<p>@T("There are no roles.")</p>}
|
||||
else {
|
||||
<p>@T("There are no roles.")</p>
|
||||
}
|
||||
</fieldset>
|
||||
|
@@ -105,8 +105,10 @@ namespace Orchard.Users.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get<UserPart>(id);
|
||||
|
||||
return View(new UserEditViewModel {
|
||||
User = Services.ContentManager.Get<UserPart>(id)
|
||||
User = Services.ContentManager.BuildEditorModel(user)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -115,8 +117,9 @@ namespace Orchard.Users.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get(id);
|
||||
var model = new UserEditViewModel {
|
||||
User = Services.ContentManager.Get<UserPart>(id)
|
||||
User = Services.ContentManager.UpdateEditorModel(user, this)
|
||||
};
|
||||
|
||||
TryUpdateModel(model);
|
||||
|
@@ -28,6 +28,8 @@
|
||||
@Html.ValidationMessageFor(m=>m.ConfirmPassword, "*")
|
||||
</fieldset>
|
||||
|
||||
@Display(Model.User)
|
||||
|
||||
<fieldset>
|
||||
<input class="button primaryAction" type="submit" value="@T("Add")" />
|
||||
</fieldset>
|
||||
|
@@ -16,6 +16,8 @@
|
||||
@Html.ValidationMessageFor(m=>m.Email, "*")
|
||||
</fieldset>
|
||||
|
||||
@Display(Model.User)
|
||||
|
||||
<fieldset>
|
||||
<input class="button primaryAction" type="submit" value="@T("Save") " />
|
||||
</fieldset>
|
||||
|
Reference in New Issue
Block a user