improve security UI

This commit is contained in:
Sam 2013-07-17 15:10:49 +10:00
parent 625204c8bd
commit 2573935155
4 changed files with 25 additions and 16 deletions

View File

@ -105,6 +105,10 @@ Discourse.EditCategoryController = Discourse.ObjectController.extend(Discourse.M
return false;
},
editPermissions: function(){
this.set('editingPermissions', true);
},
addPermission: function(group, permission_id){
this.get('model').addPermission({group_name: group + "", permission: Discourse.PermissionType.create({id: permission_id})});
},

View File

@ -66,13 +66,19 @@
<span class="name"><span class="badge-group">{{group_name}}</span></span>
{{{i18n "category.can"}}}
<span class="permission">{{permission.description}}</span>
<a {{action removePermission this}}><i class="icon icon-remove-sign"></i></a>
{{#if controller.editingPermissions}}
<a {{action removePermission this}}><i class="icon icon-remove-sign"></i></a>
{{/if}}
</li>
{{/each}}
</ul>
{{view Ember.Select contentBinding="availableGroups" valueBinding="selectedGroup"}}
{{view Ember.Select class="permission-selector" optionValuePath="content.id" optionLabelPath="content.description" contentBinding="availablePermissions" valueBinding="selectedPermission"}}
<button {{action addPermission selectedGroup selectedPermission}} class="btn btn-small">{{i18n category.add_group}}</button>
{{#if controller.editingPermissions}}
{{view Ember.Select contentBinding="availableGroups" valueBinding="selectedGroup"}}
{{view Ember.Select class="permission-selector" optionValuePath="content.id" optionLabelPath="content.description" contentBinding="availablePermissions" valueBinding="selectedPermission"}}
<button {{action addPermission selectedGroup selectedPermission}} class="btn btn-small">{{i18n category.add_permission}}</button>
{{else}}
<button {{action editPermissions}} class="btn btn-small">{{i18n category.edit_permissions}}</button>
{{/if}}
</section>
</div>
<div {{bindAttr class=":modal-tab :options-tab settingsSelected::invisible"}}>

View File

@ -263,16 +263,17 @@
}
}
.permission-selector{
width: 300px;
}
.permission-list{
list-style:none;
margin: 0 0 15px;
margin: 0 0 30px;
padding: 0;
.name {
margin-right: 20px;
display: inline-block;
min-width: 80px;
min-width: 100px;
}
.permission {
margin-left: 20px;
}
.icon-remove-sign {
margin-left: 5px;

View File

@ -905,12 +905,10 @@ en:
change_in_category_topic: "Edit Description"
hotness: "Hotness"
already_used: 'This color has been used by another category'
is_secure: "Secure category?"
add_group: "Add Group"
security: "Security"
allowed_groups: "Allowed Groups:"
auto_close_label: "Auto-close topics after:"
edit_permissions: "Edit Permissions"
add_permission: "Add Permission"
flagging:
title: 'Why are you flagging this post?'
@ -999,9 +997,9 @@ en:
browser_update: 'Unfortunately, <a href="http://www.discourse.org/faq/#browser">your browser is too old to work on this Discourse forum</a>. Please <a href="http://browsehappy.com">upgrade your browser</a>.'
permission_types:
full: "CREATE / REPLY / SEE"
create_post: "REPLY / SEE"
readonly: "SEE"
full: "Create / Reply / See"
create_post: "Reply / See"
readonly: "See"
# This section is exported to the javascript for i18n in the admin section
admin_js: