UX: Consolidation group manangement into a single tab.
This commit is contained in:
parent
b945a2dc39
commit
2ecd234e27
|
@ -11,8 +11,8 @@
|
|||
|
||||
{{#unless model.automatic}}
|
||||
<div>
|
||||
<label for='full_name'>{{i18n 'groups.edit.full_name'}}</label>
|
||||
{{input type='text' name='full_name' value=model.full_name class='group-edit-full-name'}}
|
||||
<label for='full_name'>{{i18n 'groups.manage.full_name'}}</label>
|
||||
{{input type='text' name='full_name' value=model.full_name class='group-manage-full-name'}}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
|
|
|
@ -5,7 +5,7 @@ export default Ember.Component.extend({
|
|||
|
||||
@computed('type')
|
||||
label(type) {
|
||||
return I18n.t(`groups.logs.${type}`);
|
||||
return I18n.t(`groups.manage.logs.${type}`);
|
||||
},
|
||||
|
||||
@computed('value', 'type')
|
|
@ -55,7 +55,7 @@ export default Ember.Component.extend({
|
|||
},
|
||||
|
||||
removeMember(member) {
|
||||
const message = I18n.t("groups.edit.delete_member_confirm",{
|
||||
const message = I18n.t("groups.manage.delete_member_confirm",{
|
||||
username: member.get("username"),
|
||||
group: this.get("model.name")
|
||||
});
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
import DropdownSelectBox from "select-kit/components/dropdown-select-box";
|
||||
|
||||
export default DropdownSelectBox.extend({
|
||||
classNames: ["group-navigation-dropdown", "pull-right"],
|
||||
nameProperty: "label",
|
||||
headerIcon: ["bars"],
|
||||
showFullTitle: false,
|
||||
|
||||
computeContent() {
|
||||
const content = [];
|
||||
|
||||
content.push({
|
||||
id: "manageMembership",
|
||||
icon: "user-plus",
|
||||
label: I18n.t("groups.add_members.title"),
|
||||
description: I18n.t("groups.add_members.description"),
|
||||
});
|
||||
|
||||
return content;
|
||||
},
|
||||
|
||||
mutateValue(value) {
|
||||
this.get(value)(this.get('model'));
|
||||
}
|
||||
});
|
|
@ -1,18 +1,19 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
import { extractError } from 'discourse/lib/ajax-error';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
export default Ember.Controller.extend({
|
||||
loading: false,
|
||||
setAsOwner: false,
|
||||
|
||||
@computed('model.usernames')
|
||||
disableAddButton(usernames) {
|
||||
return !usernames || !(usernames.length > 0);
|
||||
@computed('model.usernames', 'loading')
|
||||
disableAddButton(usernames, loading) {
|
||||
return loading || !usernames || !(usernames.length > 0);
|
||||
},
|
||||
|
||||
actions: {
|
||||
addMembers() {
|
||||
this.set('loading', true);
|
||||
|
||||
const model = this.get('model');
|
||||
const usernames = model.get('usernames');
|
||||
if (Em.isEmpty(usernames)) { return; }
|
||||
|
@ -33,7 +34,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
model.set("usernames", null);
|
||||
this.send('closeModal');
|
||||
})
|
||||
.catch(error => this.flash(extractError(error), 'error'));
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => this.set('loading', false));
|
||||
},
|
||||
},
|
||||
});
|
|
@ -13,9 +13,9 @@ export default Ember.Controller.extend({
|
|||
save() {
|
||||
this.set('saving', true);
|
||||
|
||||
this.get('model').save().catch(error => {
|
||||
popupAjaxError(error);
|
||||
}).finally(() => {
|
||||
this.get('model').save()
|
||||
.catch(popupAjaxError)
|
||||
.finally(() => {
|
||||
this.set('saving', false);
|
||||
});
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
export default Ember.Controller.extend({
|
||||
application: Ember.inject.controller(),
|
||||
|
||||
tabs: [
|
||||
{ route: 'group.manage.profile', title: 'groups.manage.profile.title' },
|
||||
{ route: 'group.manage.members', title: 'groups.manage.members.title' },
|
||||
{ route: 'group.manage.logs', title: 'groups.manage.logs.title' },
|
||||
],
|
||||
});
|
|
@ -37,14 +37,11 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
|
||||
if (this.currentUser && this.currentUser.canManageGroup(this.model)) {
|
||||
defaultTabs.push(...[
|
||||
defaultTabs.push(
|
||||
Tab.create({
|
||||
name: 'edit', i18nKey: 'edit.title', icon: 'pencil'
|
||||
}),
|
||||
Tab.create({
|
||||
name: 'logs', i18nKey: 'logs.title', icon: 'list-alt'
|
||||
name: 'manage', i18nKey: 'manage.title', icon: 'wrench'
|
||||
})
|
||||
]);
|
||||
);
|
||||
}
|
||||
|
||||
return defaultTabs;
|
||||
|
|
|
@ -60,8 +60,11 @@ export default function() {
|
|||
this.route('mentions');
|
||||
});
|
||||
|
||||
this.route('manage', function() {
|
||||
this.route('profile');
|
||||
this.route('members');
|
||||
this.route('logs');
|
||||
this.route('edit');
|
||||
});
|
||||
|
||||
this.route('messages', function() {
|
||||
this.route('inbox');
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
export default Discourse.Route.extend({
|
||||
beforeModel() {
|
||||
this.transitionTo("group.manage.profile");
|
||||
}
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
export default Discourse.Route.extend({
|
||||
titleToken() {
|
||||
return I18n.t('groups.logs.title');
|
||||
return I18n.t('groups.manage.logs.title');
|
||||
},
|
||||
|
||||
model() {
|
||||
|
@ -8,13 +8,12 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
this.controllerFor('group-logs').setProperties({ model });
|
||||
this.controllerFor("group").set("showing", 'logs');
|
||||
this.controllerFor('group-manage-logs').setProperties({ model });
|
||||
},
|
||||
|
||||
actions: {
|
||||
willTransition() {
|
||||
this.controllerFor('group-logs').reset();
|
||||
this.controllerFor('group-manage-logs').reset();
|
||||
}
|
||||
}
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
export default Discourse.Route.extend({
|
||||
titleToken() {
|
||||
return I18n.t('groups.manage.members.title');
|
||||
},
|
||||
|
||||
model() {
|
||||
return this.modelFor('group');
|
||||
},
|
||||
});
|
|
@ -0,0 +1,9 @@
|
|||
export default Discourse.Route.extend({
|
||||
titleToken() {
|
||||
return I18n.t('groups.manage.profile.title');
|
||||
},
|
||||
|
||||
model() {
|
||||
return this.modelFor('group');
|
||||
},
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
export default Discourse.Route.extend({
|
||||
titleToken() {
|
||||
return I18n.t('groups.edit.title');
|
||||
return I18n.t('groups.manage.title');
|
||||
},
|
||||
|
||||
model() {
|
||||
|
@ -14,8 +14,7 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
setupController(controller, model) {
|
||||
this.controllerFor('group-edit').setProperties({ model });
|
||||
this.controllerFor("group").set("showing", 'edit');
|
||||
model.findMembers();
|
||||
this.controllerFor('group-manage').setProperties({ model });
|
||||
this.controllerFor("group").set("showing", 'manage');
|
||||
}
|
||||
});
|
|
@ -1,5 +1,4 @@
|
|||
import Group from 'discourse/models/group';
|
||||
import showModal from 'discourse/lib/show-modal';
|
||||
|
||||
export default Discourse.Route.extend({
|
||||
|
||||
|
@ -17,12 +16,5 @@ export default Discourse.Route.extend({
|
|||
|
||||
setupController(controller, model) {
|
||||
controller.setProperties({ model, counts: this.get('counts') });
|
||||
},
|
||||
|
||||
actions: {
|
||||
showGroupMembershipModal(model) {
|
||||
showModal('group-membership', { model });
|
||||
this.controllerFor('modal').set('modalClass', 'group-membership-modal');
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{{#if value}}
|
||||
{{#d-button class="btn-small group-logs-filter" action="clearFilter" actionParam=type}}
|
||||
{{#d-button class="btn-small group-manage-logs-filter" action="clearFilter" actionParam=type}}
|
||||
<span>{{label}}</span>: {{filterText}}
|
||||
{{d-icon "times-circle"}}
|
||||
{{/d-button}}
|
|
@ -1,4 +1,4 @@
|
|||
<tr class="group-logs-row">
|
||||
<tr class="group-manage-logs-row">
|
||||
<td>
|
||||
{{#d-button class="btn-small" action="filter" actionParam=(hash value=log.action key="action")}}
|
||||
{{log.actionTitle}}
|
||||
|
@ -33,7 +33,7 @@
|
|||
|
||||
<td>{{bound-date log.created_at}}</td>
|
||||
|
||||
<td {{action "toggleDetails"}} class="group-logs-expand-details">
|
||||
<td {{action "toggleDetails"}} class="group-manage-logs-expand-details">
|
||||
{{#if log.prev_value}}
|
||||
{{#if expandDetails}}
|
||||
{{d-icon 'ellipsis-v'}}
|
||||
|
@ -48,11 +48,11 @@
|
|||
<tr>
|
||||
<td colspan='6'>
|
||||
<p>
|
||||
<strong>{{i18n 'groups.logs.from'}}</strong>: <code>{{log.prev_value}}</code>
|
||||
<strong>{{i18n 'groups.manage.logs.from'}}</strong>: <code>{{log.prev_value}}</code>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>{{i18n 'groups.logs.to'}}</strong>: <code>{{log.new_value}}</code>
|
||||
<strong>{{i18n 'groups.manage.logs.to'}}</strong>: <code>{{log.new_value}}</code>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
|
@ -24,7 +24,7 @@
|
|||
class="add"
|
||||
icon="plus"
|
||||
disabled=disableAddButton
|
||||
label="groups.edit.add_members"}}
|
||||
label="groups.manage.add_members"}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
|
|
@ -1,66 +0,0 @@
|
|||
<div class='group-edit'>
|
||||
<form class="form-horizontal">
|
||||
<div class="control-group">
|
||||
<label for='full_name'>{{i18n 'groups.edit.full_name'}}</label>
|
||||
{{input type='text' name='full_name' value=model.full_name class='group-edit-full-name'}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for='bio'>{{i18n 'groups.bio'}}</label>
|
||||
{{d-editor value=model.bio_raw class="group-edit-bio"}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
{{group-flair-inputs model=model}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>
|
||||
{{input type='checkbox'
|
||||
checked=model.public_admission
|
||||
class="group-edit-public-admission"
|
||||
disabled=model.allow_membership_requests}}
|
||||
|
||||
{{i18n 'groups.public_admission'}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>
|
||||
{{input type='checkbox'
|
||||
checked=model.public_exit
|
||||
class="group-edit-public-exit"}}
|
||||
|
||||
{{i18n 'groups.public_exit'}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>
|
||||
{{input type='checkbox'
|
||||
checked=model.allow_membership_requests
|
||||
class="group-edit-allow-membership-requests"
|
||||
disabled=model.public_admission}}
|
||||
|
||||
{{i18n 'groups.allow_membership_requests'}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{{#if model.allow_membership_requests}}
|
||||
<div>
|
||||
<label for="membership-request-template">
|
||||
{{i18n 'groups.membership_request_template'}}
|
||||
</label>
|
||||
|
||||
{{expanding-text-area name="membership-request-template"
|
||||
value=model.membership_request_template
|
||||
class="group-edit-membership-request-template"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="group-edit" args=(hash group=model)}}
|
||||
|
||||
{{d-button action="save" class="btn-primary" disabled=saving label="save"}}
|
||||
{{savingText}}
|
||||
</form>
|
||||
</div>
|
|
@ -1,33 +0,0 @@
|
|||
{{#if model.logs}}
|
||||
<div class="group-logs-controls">
|
||||
{{group-logs-filter clearFilter="clearFilter" value=filters.action type="action"}}
|
||||
{{group-logs-filter clearFilter="clearFilter" value=filters.acting_user type="acting_user"}}
|
||||
{{group-logs-filter clearFilter="clearFilter" value=filters.target_user type="target_user"}}
|
||||
{{group-logs-filter clearFilter="clearFilter" value=filters.subject type="subject"}}
|
||||
</div>
|
||||
|
||||
{{#load-more selector=".group-logs .group-logs-row" action="loadMore"}}
|
||||
<table class="group-logs">
|
||||
<thead>
|
||||
<th>{{i18n 'groups.logs.action'}}</th>
|
||||
<th>{{i18n 'groups.logs.acting_user'}}</th>
|
||||
<th>{{i18n 'groups.logs.target_user'}}</th>
|
||||
<th>{{i18n 'groups.logs.subject'}}</th>
|
||||
<th>{{i18n 'groups.logs.when'}}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{#each model.logs as |log|}}
|
||||
{{group-logs-row
|
||||
log=log
|
||||
filters=filters}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/load-more}}
|
||||
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
{{else}}
|
||||
<div>{{i18n "groups.empty.logs"}}</div>
|
||||
{{/if}}
|
|
@ -42,12 +42,6 @@
|
|||
<div class="container">
|
||||
{{group-navigation group=model currentPath=application.currentPath tabs=tabs}}
|
||||
|
||||
{{#if canManageGroup}}
|
||||
{{group-navigation-dropdown
|
||||
model=model
|
||||
manageMembership=(route-action "showGroupMembershipModal")}}
|
||||
{{/if}}
|
||||
|
||||
{{#if displayGroupMessageButton}}
|
||||
{{d-button
|
||||
action="messageGroup"
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<div class='group-manage container'>
|
||||
{{#mobile-nav class='group-manage-nav' desktopClass='pull-left nav nav-stacked' currentPath=application.currentPath}}
|
||||
{{#each tabs as |tab|}}
|
||||
<li>
|
||||
{{#link-to tab.route model.name}}
|
||||
{{i18n tab.title}}
|
||||
{{/link-to}}
|
||||
</li>
|
||||
{{/each}}
|
||||
{{/mobile-nav}}
|
||||
|
||||
<div class="{{if site.mobileView "" "pull-left"}} group-manage-outlet">
|
||||
{{outlet}}
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,33 @@
|
|||
{{#if model.logs}}
|
||||
<div class="group-manage-logs-controls">
|
||||
{{group-manage-logs-filter clearFilter="clearFilter" value=filters.action type="action"}}
|
||||
{{group-manage-logs-filter clearFilter="clearFilter" value=filters.acting_user type="acting_user"}}
|
||||
{{group-manage-logs-filter clearFilter="clearFilter" value=filters.target_user type="target_user"}}
|
||||
{{group-manage-logs-filter clearFilter="clearFilter" value=filters.subject type="subject"}}
|
||||
</div>
|
||||
|
||||
{{#load-more selector=".group-manage-logs .group-manage-logs-row" action="loadMore"}}
|
||||
<table class="group-manage-logs">
|
||||
<thead>
|
||||
<th>{{i18n 'groups.manage.logs.action'}}</th>
|
||||
<th>{{i18n 'groups.manage.logs.acting_user'}}</th>
|
||||
<th>{{i18n 'groups.manage.logs.target_user'}}</th>
|
||||
<th>{{i18n 'groups.manage.logs.subject'}}</th>
|
||||
<th>{{i18n 'groups.manage.logs.when'}}</th>
|
||||
<th></th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
{{#each model.logs as |log|}}
|
||||
{{group-manage-logs-row
|
||||
log=log
|
||||
filters=filters}}
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
{{/load-more}}
|
||||
|
||||
{{conditional-loading-spinner condition=loading}}
|
||||
{{else}}
|
||||
<div>{{i18n "groups.empty.logs"}}</div>
|
||||
{{/if}}
|
|
@ -0,0 +1,25 @@
|
|||
<form class="form-horizontal group-manage-members">
|
||||
<div class="control-group">
|
||||
<label>{{i18n "groups.manage.members.usernames"}}</label>
|
||||
|
||||
{{user-selector
|
||||
usernames=model.usernames
|
||||
placeholderKey="groups.selector_placeholder"
|
||||
id="group-manage-members-user-selector"}}
|
||||
</div>
|
||||
|
||||
{{#if this.currentUser.admin}}
|
||||
<div class="control-group group-manage-members-make-owner">
|
||||
<label>
|
||||
{{input type="checkbox" class="inline" checked=setAsOwner}}
|
||||
{{i18n "groups.manage.members.as_owner"}}
|
||||
</label>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{d-button action="addMembers"
|
||||
class="add btn-primary"
|
||||
icon="plus"
|
||||
disabled=disableAddButton
|
||||
label="groups.add"}}
|
||||
</form>
|
|
@ -0,0 +1,71 @@
|
|||
<form class="form-horizontal">
|
||||
{{#if this.currentUser.admin}}
|
||||
<div class="control-group">
|
||||
<label for='name'>{{i18n 'groups.manage.name'}}</label>
|
||||
{{input type='text' name='name' value=model.name class='group-manage-name'}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
<div class="control-group">
|
||||
<label for='full_name'>{{i18n 'groups.manage.full_name'}}</label>
|
||||
{{input type='text' name='full_name' value=model.full_name class='group-manage-full-name'}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for='bio'>{{i18n 'groups.bio'}}</label>
|
||||
{{d-editor value=model.bio_raw class="group-manage-bio"}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
{{group-flair-inputs model=model}}
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>
|
||||
{{input type='checkbox'
|
||||
checked=model.public_admission
|
||||
class="group-manage-public-admission"
|
||||
disabled=model.allow_membership_requests}}
|
||||
|
||||
{{i18n 'groups.public_admission'}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>
|
||||
{{input type='checkbox'
|
||||
checked=model.public_exit
|
||||
class="group-manage-public-exit"}}
|
||||
|
||||
{{i18n 'groups.public_exit'}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label>
|
||||
{{input type='checkbox'
|
||||
checked=model.allow_membership_requests
|
||||
class="group-manage-allow-membership-requests"
|
||||
disabled=model.public_admission}}
|
||||
|
||||
{{i18n 'groups.allow_membership_requests'}}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{{#if model.allow_membership_requests}}
|
||||
<div>
|
||||
<label for="membership-request-template">
|
||||
{{i18n 'groups.membership_request_template'}}
|
||||
</label>
|
||||
|
||||
{{expanding-text-area name="membership-request-template"
|
||||
value=model.membership_request_template
|
||||
class="group-manage-membership-request-template"}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{plugin-outlet name="group-manage" args=(hash group=model)}}
|
||||
|
||||
{{d-button action="save" class="btn-primary" disabled=saving label="save"}}
|
||||
{{savingText}}
|
||||
</form>
|
|
@ -1,25 +0,0 @@
|
|||
{{#d-modal-body class='group-membership' title="groups.add_members.title"}}
|
||||
<div class="control-group">
|
||||
<label>{{i18n "groups.add_members.usernames"}}</label>
|
||||
|
||||
{{user-selector
|
||||
usernames=model.usernames
|
||||
placeholderKey="groups.selector_placeholder"
|
||||
id="group-membership-user-selector"}}
|
||||
</div>
|
||||
|
||||
{{#if this.currentUser.admin}}
|
||||
<div class="control-group group-membership-make-owner">
|
||||
<label class="inline">{{i18n "groups.add_members.as_owner"}}</label>
|
||||
{{input type="checkbox" class="inline" checked=setAsOwner}}
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/d-modal-body}}
|
||||
|
||||
<div class="modal-footer">
|
||||
{{d-button action="addMembers"
|
||||
class="add btn-primary"
|
||||
icon="plus"
|
||||
disabled=disableAddButton
|
||||
label="groups.add"}}
|
||||
</div>
|
|
@ -78,7 +78,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.group-logs-filter {
|
||||
.group-manage-logs-filter {
|
||||
margin-right: 10px;
|
||||
|
||||
&:hover {
|
||||
|
@ -86,7 +86,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
table.group-logs {
|
||||
table.group-manage-logs {
|
||||
width: 100%;
|
||||
|
||||
th, tr {
|
||||
|
@ -102,7 +102,7 @@ table.group-logs {
|
|||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.group-logs-expand-details {
|
||||
.group-manage-logs-expand-details {
|
||||
cursor: pointer;
|
||||
|
||||
i {
|
||||
|
@ -201,7 +201,7 @@ table.group-members {
|
|||
}
|
||||
}
|
||||
|
||||
.group-edit {
|
||||
.group-manage {
|
||||
.form-horizontal {
|
||||
label {
|
||||
font-weight: bold;
|
||||
|
@ -209,16 +209,8 @@ table.group-members {
|
|||
}
|
||||
}
|
||||
|
||||
.group-membership {
|
||||
.ac-wrap {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.group-membership-make-owner {
|
||||
.group-manage-members {
|
||||
.group-manage-members-make-owner {
|
||||
label {
|
||||
display: inline;
|
||||
vertical-align: middle;
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
.group-edit-membership-request-template {
|
||||
.group-manage-membership-request-template {
|
||||
width: 98%;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,10 @@
|
|||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.group-activity-nav, .group-messages-nav {
|
||||
.group-activity-nav,
|
||||
.group-messages-nav,
|
||||
.group-manage-nav
|
||||
{
|
||||
width: 15%;
|
||||
background-color: transparent;
|
||||
|
||||
|
@ -43,14 +46,14 @@
|
|||
}
|
||||
}
|
||||
|
||||
.group-activity-outlet, .group-messages-outlet {
|
||||
.group-activity-outlet,
|
||||
.group-messages-outlet,
|
||||
.group-manage-outlet
|
||||
{
|
||||
width: 85%;
|
||||
}
|
||||
|
||||
.group-edit {
|
||||
border: 1px solid $primary-low;
|
||||
padding: 10px;
|
||||
|
||||
.group-manage {
|
||||
.form-horizontal {
|
||||
button {
|
||||
float: none;
|
||||
|
|
|
@ -23,11 +23,14 @@
|
|||
float: left;
|
||||
}
|
||||
|
||||
.group-activity {
|
||||
.group-activity, .group-manage {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.group-activity-nav, .group-messages-nav {
|
||||
.group-activity-nav,
|
||||
.group-messages-nav,
|
||||
.group-manage-nav
|
||||
{
|
||||
&.mobile-nav {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
|
@ -51,7 +54,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
table.group-logs {
|
||||
table.group-manage-logs {
|
||||
width: 130%;
|
||||
}
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ class GroupsController < ApplicationController
|
|||
private
|
||||
|
||||
def group_params
|
||||
params.require(:group).permit(
|
||||
permitted_params = [
|
||||
:flair_url,
|
||||
:flair_bg_color,
|
||||
:flair_color,
|
||||
|
@ -421,7 +421,13 @@ class GroupsController < ApplicationController
|
|||
:public_exit,
|
||||
:allow_membership_requests,
|
||||
:membership_request_template,
|
||||
)
|
||||
]
|
||||
|
||||
if current_user.admin
|
||||
permitted_params.push(:name)
|
||||
end
|
||||
|
||||
params.require(:group).permit(*permitted_params)
|
||||
end
|
||||
|
||||
def find_group(param_name)
|
||||
|
|
|
@ -403,6 +403,19 @@ en:
|
|||
remove_user_as_group_owner: "Revoke owner"
|
||||
|
||||
groups:
|
||||
manage:
|
||||
title: 'Manage'
|
||||
name: 'Name'
|
||||
full_name: 'Full Name'
|
||||
add_members: "Add Members"
|
||||
delete_member_confirm: "Remove '%{username}' from the '%{group}' group?"
|
||||
profile:
|
||||
title: Profile
|
||||
members:
|
||||
title: "Members"
|
||||
description: "Manage the membership of this group"
|
||||
usernames: "Usernames"
|
||||
as_owner: "Set user(s) as owner(s) of this group"
|
||||
logs:
|
||||
title: "Logs"
|
||||
when: "When"
|
||||
|
@ -413,11 +426,6 @@ en:
|
|||
details: "Details"
|
||||
from: "From"
|
||||
to: "To"
|
||||
edit:
|
||||
title: 'Edit Group'
|
||||
full_name: 'Full Name'
|
||||
add_members: "Add Members"
|
||||
delete_member_confirm: "Remove '%{username}' from the '%{group}' group?"
|
||||
name_placeholder: "Group name, no spaces, same as username rule"
|
||||
public_admission: "Allow users to join the group freely (Requires publicly visible group)"
|
||||
public_exit: "Allow users to leave the group freely"
|
||||
|
@ -464,11 +472,6 @@ en:
|
|||
one: "Group"
|
||||
other: "Groups"
|
||||
activity: "Activity"
|
||||
add_members:
|
||||
title: "Add Members"
|
||||
description: "Manage the membership of this group"
|
||||
usernames: "Usernames"
|
||||
as_owner: "Set user(s) as owner(s) of this group"
|
||||
members:
|
||||
title: "Members"
|
||||
filter_placeholder_admin: "username or email"
|
||||
|
|
|
@ -472,6 +472,10 @@ Discourse::Application.routes.draw do
|
|||
messages
|
||||
messages/inbox
|
||||
messages/archive
|
||||
manage
|
||||
manage/profile
|
||||
manage/members
|
||||
manage/logs
|
||||
}.each do |path|
|
||||
get path => 'groups#show'
|
||||
end
|
||||
|
|
|
@ -279,6 +279,7 @@ describe GroupsController do
|
|||
expect do
|
||||
put "/groups/#{group.id}.json", params: {
|
||||
group: {
|
||||
name: 'testing',
|
||||
flair_bg_color: 'FFF',
|
||||
flair_color: 'BBB',
|
||||
flair_url: 'fa-adjust',
|
||||
|
@ -292,7 +293,7 @@ describe GroupsController do
|
|||
}
|
||||
end.to change { GroupHistory.count }.by(9)
|
||||
|
||||
expect(response).to be_success
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
group.reload
|
||||
|
||||
|
@ -306,6 +307,7 @@ describe GroupsController do
|
|||
expect(group.allow_membership_requests).to eq(true)
|
||||
expect(group.membership_request_template).to eq('testing')
|
||||
expect(GroupHistory.last.subject).to eq('membership_request_template')
|
||||
expect(group.name).to eq('test')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -316,10 +318,18 @@ describe GroupsController do
|
|||
end
|
||||
|
||||
it 'should be able to update the group' do
|
||||
put "/groups/#{group.id}.json", params: { group: { flair_color: 'BBB' } }
|
||||
put "/groups/#{group.id}.json", params: {
|
||||
group: {
|
||||
flair_color: 'BBB',
|
||||
name: 'testing'
|
||||
}
|
||||
}
|
||||
|
||||
expect(response).to be_success
|
||||
expect(group.reload.flair_color).to eq('BBB')
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
group.reload
|
||||
expect(group.flair_color).to eq('BBB')
|
||||
expect(group.name).to eq('testing')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
import { acceptance, logIn } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Editing Group");
|
||||
|
||||
QUnit.test("Editing group", assert => {
|
||||
logIn();
|
||||
Discourse.reset();
|
||||
|
||||
visit("/groups/discourse/edit");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('.group-flair-inputs').length === 1, 'it should display avatar flair inputs');
|
||||
assert.ok(find('.group-edit-bio').length === 1, 'it should display group bio input');
|
||||
assert.ok(find('.group-edit-full-name').length === 1, 'it should display group full name input');
|
||||
|
||||
assert.ok(
|
||||
find('.group-edit-public-admission').length === 1,
|
||||
'it should display group public admission input'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find('.group-edit-public-exit').length === 1,
|
||||
'it should display group public exit input'
|
||||
);
|
||||
|
||||
assert.ok(find('.group-edit-allow-membership-requests').length === 1, 'it should display group allow_membership_requets input');
|
||||
|
||||
assert.ok(
|
||||
find('.group-edit-allow-membership-requests[disabled]').length === 1,
|
||||
'it should disable group allow_membership_request input'
|
||||
);
|
||||
});
|
||||
|
||||
click('.group-edit-public-admission');
|
||||
click('.group-edit-allow-membership-requests');
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(
|
||||
find('.group-edit-public-admission[disabled]').length === 1,
|
||||
'it should disable group public admission input'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find('.group-edit-public-exit[disabled]').length === 0,
|
||||
'it should not disable group public exit input'
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find('.group-edit-membership-request-template').length, 1,
|
||||
'it should display the membership request template field'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("Editing group as an anonymous user", assert => {
|
||||
visit("/groups/discourse/edit");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(count('.group-members tr') > 0, "it should redirect to members page for an anonymous user");
|
||||
});
|
||||
});
|
|
@ -9,11 +9,6 @@ QUnit.test("Viewing Members as anon user", assert => {
|
|||
assert.ok(count('.avatar-flair .fa-adjust') === 1, "it displays the group's avatar flair");
|
||||
assert.ok(count('.group-members tr') > 0, "it lists group members");
|
||||
|
||||
assert.ok(
|
||||
count('.group-navigation-dropdown') === 0,
|
||||
'it should not display the group navigation dropdown menu'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
count('.group-member-dropdown') === 0,
|
||||
'it does not allow anon user to manage group members'
|
||||
|
@ -34,11 +29,6 @@ QUnit.test("Viewing Members as an admin user", assert => {
|
|||
visit("/groups/discourse");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(
|
||||
count('.group-navigation-dropdown') === 1,
|
||||
'it should display the group navigation dropdown menu'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
count('.group-member-dropdown') > 0,
|
||||
'it allows admin user to manage group members'
|
||||
|
@ -50,23 +40,4 @@ QUnit.test("Viewing Members as an admin user", assert => {
|
|||
'it should display the right filter placehodler'
|
||||
);
|
||||
});
|
||||
|
||||
selectKit('.group-navigation-dropdown').expand().selectRowByValue('manageMembership');
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(
|
||||
count('.group-membership') === 1,
|
||||
'it should display the right modal'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
count('#group-membership-user-selector') === 1,
|
||||
'it should display the user selector'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
count(".group-membership-make-owner input[type='checkbox']") === 1,
|
||||
'it should display the input to set users as owners'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { acceptance } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Group Logs", {
|
||||
acceptance("Group logs", {
|
||||
loggedIn: true,
|
||||
beforeEach() {
|
||||
const response = object => {
|
||||
|
@ -27,14 +27,14 @@ acceptance("Group Logs", {
|
|||
});
|
||||
|
||||
QUnit.test("Browsing group logs", assert => {
|
||||
visit("/groups/snorlax/logs");
|
||||
visit("/groups/snorlax/manage/logs");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('tr.group-logs-row').length === 2, 'it should display the right number of logs');
|
||||
click(find(".group-logs-row button")[0]);
|
||||
assert.ok(find('tr.group-manage-logs-row').length === 2, 'it should display the right number of logs');
|
||||
click(find(".group-manage-logs-row button")[0]);
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('tr.group-logs-row').length === 1, 'it should display the right number of logs');
|
||||
assert.ok(find('tr.group-manage-logs-row').length === 1, 'it should display the right number of logs');
|
||||
});
|
||||
});
|
|
@ -0,0 +1,62 @@
|
|||
import { acceptance, logIn } from "helpers/qunit-helpers";
|
||||
|
||||
acceptance("Managing Group Profile");
|
||||
|
||||
QUnit.test("Editing group", assert => {
|
||||
logIn();
|
||||
Discourse.reset();
|
||||
|
||||
visit("/groups/discourse/manage/profile");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('.group-flair-inputs').length === 1, 'it should display avatar flair inputs');
|
||||
assert.ok(find('.group-manage-bio').length === 1, 'it should display group bio input');
|
||||
assert.ok(find('.group-manage-name').length === 1, 'it should display group name input');
|
||||
assert.ok(find('.group-manage-full-name').length === 1, 'it should display group full name input');
|
||||
|
||||
assert.ok(
|
||||
find('.group-manage-public-admission').length === 1,
|
||||
'it should display group public admission input'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find('.group-manage-public-exit').length === 1,
|
||||
'it should display group public exit input'
|
||||
);
|
||||
|
||||
assert.ok(find('.group-manage-allow-membership-requests').length === 1, 'it should display group allow_membership_requets input');
|
||||
|
||||
assert.ok(
|
||||
find('.group-manage-allow-membership-requests[disabled]').length === 1,
|
||||
'it should disable group allow_membership_request input'
|
||||
);
|
||||
});
|
||||
|
||||
click('.group-manage-public-admission');
|
||||
click('.group-manage-allow-membership-requests');
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(
|
||||
find('.group-manage-public-admission[disabled]').length === 1,
|
||||
'it should disable group public admission input'
|
||||
);
|
||||
|
||||
assert.ok(
|
||||
find('.group-manage-public-exit[disabled]').length === 0,
|
||||
'it should not disable group public exit input'
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
find('.group-manage-membership-request-template').length, 1,
|
||||
'it should display the membership request template field'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test("Editing group as an anonymous user", assert => {
|
||||
visit("/groups/discourse/manage/profile");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(count('.group-members tr') > 0, "it should redirect to members page for an anonymous user");
|
||||
});
|
||||
});
|
|
@ -193,8 +193,11 @@ QUnit.test("Admin Viewing Group", assert => {
|
|||
visit("/groups/discourse");
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find(".nav-pills li a[title='Edit Group']").length === 1, 'it should show edit group tab if user is admin');
|
||||
assert.ok(find(".nav-pills li a[title='Logs']").length === 1, 'it should show Logs tab if user is admin');
|
||||
assert.ok(
|
||||
find(".nav-pills li a[title='Manage']").length === 1,
|
||||
'it should show manage group tab if user is admin'
|
||||
);
|
||||
|
||||
assert.equal(count('.group-message-button'), 1, 'it displays show group message button');
|
||||
assert.equal(find('.group-info-name').text(), 'Awesome Team', 'it should display the group name');
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue