mirror of
https://github.com/vale981/Vulcan
synced 2025-03-04 09:11:43 -05:00
allow single user view
This commit is contained in:
parent
e93f4062d8
commit
ec745b2d86
6 changed files with 18 additions and 17 deletions
|
@ -2,23 +2,25 @@ import React from 'react';
|
|||
import { Components, withCurrentUser, AdminColumns } from 'meteor/vulcan:core';
|
||||
import { FormattedMessage } from 'meteor/vulcan:i18n';
|
||||
import Users from 'meteor/vulcan:users';
|
||||
import { withRouter } from 'react-router';
|
||||
|
||||
import '../modules/columns.js';
|
||||
|
||||
const AdminHome = ({ currentUser }) =>
|
||||
<div className="admin-home page">
|
||||
const AdminHome = ({ currentUser, match }) => {
|
||||
return <div className="admin-home page">
|
||||
<Components.ShowIf check={Users.isAdmin} document={currentUser} failureComponent={<p className="admin-home-message"><FormattedMessage id="app.noPermission" /></p>}>
|
||||
<Components.Datatable
|
||||
collection={Users}
|
||||
columns={AdminColumns}
|
||||
<Components.Datatable
|
||||
collection={Users}
|
||||
columns={AdminColumns}
|
||||
options={{
|
||||
fragmentName: 'UsersAdmin',
|
||||
terms: {view: 'usersAdmin'},
|
||||
limit: 20
|
||||
fragmentName: 'UsersAdmin',
|
||||
terms: {view: 'usersAdmin', query: match.params.id},
|
||||
}}
|
||||
showEdit={true}
|
||||
query={match.params.id}
|
||||
/>
|
||||
</Components.ShowIf>
|
||||
</div>;
|
||||
};
|
||||
|
||||
export default withCurrentUser(AdminHome);
|
||||
export default withRouter(withCurrentUser(AdminHome));
|
||||
|
|
|
@ -5,9 +5,7 @@ import { Components } from 'meteor/vulcan:core';
|
|||
const AdminUsersName = ({ document: user, flash }) =>
|
||||
<div>
|
||||
|
||||
<Components.Avatar user={user} link={false}/>
|
||||
|
||||
<span>{Users.getDisplayName(user)}</span>
|
||||
<span>{user.fullName}</span>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import AdminUsersCreated from '../components/users/columns/AdminUsersCreated.jsx
|
|||
|
||||
addAdminColumn([
|
||||
{
|
||||
name: 'name',
|
||||
name: 'fullName',
|
||||
order: 1,
|
||||
component: AdminUsersName
|
||||
},
|
||||
|
|
|
@ -9,6 +9,6 @@ addRoute({
|
|||
});
|
||||
addRoute({
|
||||
name: 'admin2',
|
||||
path: '/admin/users',
|
||||
path: '/admin/users/:id?',
|
||||
component: () => getDynamicComponent(import('../components/AdminHome.jsx')),
|
||||
});
|
||||
|
|
|
@ -31,12 +31,12 @@ const getColumnName = column => (
|
|||
|
||||
class Datatable extends PureComponent {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.updateQuery = this.updateQuery.bind(this);
|
||||
this.state = {
|
||||
value: '',
|
||||
query: '',
|
||||
query: props.query ? props.query : '',
|
||||
currentSort: {}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ const schema = {
|
|||
type: String,
|
||||
optional: true,
|
||||
canRead: ['guests'],
|
||||
searchable: true,
|
||||
},
|
||||
username: {
|
||||
type: String,
|
||||
|
|
Loading…
Add table
Reference in a new issue