Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accounts dashboard base UI for Feature: "Marketplace and Shop owners should be able to create custom permission groups" #2543

Merged
merged 156 commits into from
Jul 22, 2017
Merged
Show file tree
Hide file tree
Changes from 152 commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
01c94a3
Give all users access to shop selector.
spencern Jun 6, 2017
ac4494a
Set ShopId on shop selector change
spencern Jun 6, 2017
8b3df17
Merge branch 'spencer-code-cleanup' into marketplace-shop-switcher
spencern Jun 6, 2017
44ed9bc
Regular Shop Selector should just adjust only the route.
spencern Jun 8, 2017
150514f
Remove empty line at top of navbar
spencern Jun 8, 2017
8947d2c
Change Reaction.shopId to be a ReactiveVar
spencern Jun 8, 2017
9cc050d
Add closeOnClick option to DropDownMenu
spencern Jun 8, 2017
6af82e8
Add shop selector to admin toolbar.
spencern Jun 8, 2017
deae717
WIP - tons of code not committed - Init switching away from getSeller…
spencern Jun 9, 2017
6db6fe1
Switches dashboard context as well as published packages based on act…
spencern Jun 12, 2017
71f7073
Init group file
impactmass Jun 12, 2017
0ef424b
create group
impactmass Jun 12, 2017
f82956b
Test update
impactmass Jun 12, 2017
e82fb99
Considering side effects after group change
impactmass Jun 13, 2017
b6b93ef
multi update on groupname
impactmass Jun 13, 2017
ee999a9
Updating user after group change
impactmass Jun 13, 2017
1f55590
Simpleschema fix
impactmass Jun 14, 2017
13430c8
Resolve update when group name changes
impactmass Jun 14, 2017
9011584
add combinedroles
impactmass Jun 14, 2017
8d24925
Fix error
impactmass Jun 14, 2017
f0cb22c
Init group/addUser
impactmass Jun 15, 2017
951fb0e
Updating user group array and roles
impactmass Jun 15, 2017
d997f2a
more error handling on functions
impactmass Jun 15, 2017
448df6f
debug group/adduser
impactmass Jun 15, 2017
005d659
set field to optional
impactmass Jun 15, 2017
c547026
Update to remove user
impactmass Jun 16, 2017
71ecdf4
Update to remove user
impactmass Jun 16, 2017
63188cb
Refactoring updates on groups user belongs to
impactmass Jun 19, 2017
f688503
Refactoring updates on group name
impactmass Jun 19, 2017
6698d8c
Quick template scaffold to test adding perms to group
impactmass Jun 19, 2017
d706316
Connect update method to event
impactmass Jun 19, 2017
c263417
Update comments
impactmass Jun 20, 2017
0a54f26
Quickly scaffold component
impactmass Jun 20, 2017
0d8b8fe
Updates from first review
impactmass Jun 21, 2017
2714be1
Adding new values to groups
impactmass Jun 21, 2017
54660d0
Add more fields and uniqueness
impactmass Jun 21, 2017
028faa2
Hopefully final fixes
impactmass Jun 22, 2017
ff20eea
Track with id
impactmass Jun 22, 2017
4300863
added accounts holder for table
rhenshaw56 Jun 23, 2017
77f81b7
added table styles
rhenshaw56 Jun 23, 2017
821654d
added deafault style layout for table items
rhenshaw56 Jun 23, 2017
d797c9b
added account-list-item header bar for each table
rhenshaw56 Jun 23, 2017
6e69bc5
created accounts table to hold table data
rhenshaw56 Jun 23, 2017
5a5dd45
fixed eslint style violations
rhenshaw56 Jun 23, 2017
5dd893a
added gravatar to accounts table
rhenshaw56 Jun 23, 2017
0cbd6da
Switch use of Roles to R.haspermission
impactmass Jun 23, 2017
06936e5
Add tests for createGroup and addUser
impactmass Jun 23, 2017
c16dc33
updated added function to get user details on table
rhenshaw56 Jun 28, 2017
ae7b09b
created component for rendering dynamic data
rhenshaw56 Jun 28, 2017
e6cfdb5
restyled table component
rhenshaw56 Jun 28, 2017
13259bf
styles for updated table component (will be refactored)
rhenshaw56 Jun 28, 2017
ef8f951
styles for updated table component (will be refactored)
rhenshaw56 Jun 28, 2017
bcfdffd
Update tests and change _id to groupId
impactmass Jun 28, 2017
14276f8
Change to object-type schema
impactmass Jun 28, 2017
ae56444
Update tests to match schema
impactmass Jun 28, 2017
407c428
Modify and add test for updateGroup
impactmass Jun 28, 2017
0b10d3c
Merge branch 'marketplace' into seun-create-groups-2184
impactmass Jun 28, 2017
fde269b
Remove un-needed ui stuffs
impactmass Jun 28, 2017
a81ddb3
Cleanup
impactmass Jun 28, 2017
1e3702e
updating latest changes
rhenshaw56 Jun 29, 2017
3931e62
Remove done in before and add method to mock
impactmass Jun 29, 2017
4b62ab6
Fixing tests
impactmass Jun 29, 2017
09340b7
Update to test
impactmass Jun 29, 2017
11f38bb
Merge branch 'seun-create-groups-2184' of https://github.com/reaction…
rhenshaw56 Jun 29, 2017
63c653c
Refactor
impactmass Jun 29, 2017
f9f141d
Test changes after refactor
impactmass Jun 29, 2017
4d71287
Fix lint issue
impactmass Jun 29, 2017
802bdf3
saving changes
rhenshaw56 Jun 30, 2017
418fbfd
Merge branch 'seun-create-groups-2184' of https://github.com/reaction…
rhenshaw56 Jun 30, 2017
8dee184
Initial switching roles to groups
impactmass Jun 30, 2017
8091822
Remove comment in json
impactmass Jun 30, 2017
c691632
Fixes on default customer group
impactmass Jul 3, 2017
5d4bb0b
Default guest grp
impactmass Jul 3, 2017
c13c9e4
Fixing tests and changes to groups init
impactmass Jul 5, 2017
8e330ee
one group type per shop
impactmass Jul 5, 2017
72dd5c9
saving changes for testing
rhenshaw56 Jul 5, 2017
14e42a2
one group type per shop during init
impactmass Jul 5, 2017
2fe52d5
Merge branch 'seun-change-roles-group' of https://github.com/reaction…
rhenshaw56 Jul 5, 2017
a987763
saving updated changes after adding groups collection
rhenshaw56 Jul 6, 2017
e3e6e26
moved files around
rhenshaw56 Jul 6, 2017
1ec098c
implemented groups settings side-bar with permissions
rhenshaw56 Jul 7, 2017
2e61906
fixed console errors
rhenshaw56 Jul 7, 2017
5cb1e3d
saving changes to implement the owners tab
rhenshaw56 Jul 7, 2017
691b653
commented out old accounts/dashboard section
rhenshaw56 Jul 7, 2017
c2a8027
made ui responsive to screen-width
rhenshaw56 Jul 7, 2017
ab9c2cf
removed SourceSansPro font
rhenshaw56 Jul 7, 2017
470c653
* customized dropdown menu
rhenshaw56 Jul 10, 2017
5b73681
upgraded dependencies
rhenshaw56 Jul 10, 2017
74b49a3
updated local branch with latest marketplace
rhenshaw56 Jul 11, 2017
1d8f607
File name changes and indentation fixes
impactmass Jul 11, 2017
b97eb99
Subscribe before fetch
impactmass Jul 11, 2017
5a596aa
added shop owner's details and moved getGravatar function to helpers
rhenshaw56 Jul 11, 2017
6097b6a
resolved conflicts after pull
rhenshaw56 Jul 11, 2017
d7bfcec
Modify data passed to table
impactmass Jul 11, 2017
715f9c2
removed in-line styles
rhenshaw56 Jul 12, 2017
8366124
Show account details in cells
impactmass Jul 12, 2017
3c13b69
Fix dropdown
impactmass Jul 12, 2017
792aab9
added form functionality for sending invites
rhenshaw56 Jul 12, 2017
816a1a7
Merge branch 'rowland-accounts-react-conversion-2184' of https://gith…
rhenshaw56 Jul 12, 2017
c389c32
restyled table borders
rhenshaw56 Jul 12, 2017
29021ad
Fix dropdown actions; admin account pub
impactmass Jul 12, 2017
fde6334
Merge branch origin into rowland-accounts-react-conversion-2184
impactmass Jul 12, 2017
f7f817d
fixed proptype validation
rhenshaw56 Jul 13, 2017
d939e62
Button status, show existing templates
impactmass Jul 13, 2017
1e68a23
Show owner group first
impactmass Jul 13, 2017
15ef1d4
Avatar, Prune css
impactmass Jul 13, 2017
d862757
Click on group header, open actionview
impactmass Jul 13, 2017
96e4ec3
Render form, move container
impactmass Jul 13, 2017
75509ed
Remove written html, use rui components, init AddGroupMembers
impactmass Jul 13, 2017
ab02b42
Setup addGroupMember box
impactmass Jul 14, 2017
e0035aa
Replace list component with sortable in addAdminOwner module
impactmass Jul 14, 2017
4e3feec
Init editGroup module
impactmass Jul 14, 2017
312d1ae
Init packagelist comp for editgroups
impactmass Jul 14, 2017
948d290
Group packages
impactmass Jul 14, 2017
6c48e4e
Remove 2factor div
impactmass Jul 14, 2017
aa93792
Move functions; remove un-used code
impactmass Jul 14, 2017
15d64a6
Fixing pkgs list switch
impactmass Jul 16, 2017
40e8174
Switch on click group heading
impactmass Jul 16, 2017
d211fcd
Capitalize title
impactmass Jul 17, 2017
d2da9fa
Add selected state
impactmass Jul 17, 2017
de12bf8
Add togglePermission & call method on toggle
impactmass Jul 17, 2017
9c01e65
Extra margin on empty table
impactmass Jul 17, 2017
487b5ff
Use pencil icon for edits
impactmass Jul 17, 2017
aaac534
Init new group form
impactmass Jul 17, 2017
c0a4da2
Click fixes, stop propagation on edit
impactmass Jul 17, 2017
17a34bb
Modify PermissionsList comp to save with container func
impactmass Jul 17, 2017
dcb4757
Fix update perm
impactmass Jul 17, 2017
0acd094
Get only admin groups
impactmass Jul 17, 2017
818277e
Change fetching of admins
impactmass Jul 18, 2017
9c5a0ef
Once saved switch to update mode
impactmass Jul 18, 2017
2d9ebf5
Fix list toggling
impactmass Jul 18, 2017
48af05a
Prune un-used code
impactmass Jul 18, 2017
3270980
i18n
impactmass Jul 18, 2017
696db92
Use React Alert comp
impactmass Jul 18, 2017
5cbe710
Replace import
impactmass Jul 18, 2017
97d36c8
Resolve lint issue
impactmass Jul 18, 2017
c0c031a
Merge branch 'marketplace' into rowland-accounts-react-conversion-2184
impactmass Jul 18, 2017
3f0b8aa
Fix alert error mesage passed to Translation
impactmass Jul 19, 2017
f0f46a8
Fix alert disappearing and error display
impactmass Jul 19, 2017
f8be4cd
Remove duplicates
impactmass Jul 19, 2017
4d3748e
i18n
impactmass Jul 19, 2017
5bc3f55
Update test
impactmass Jul 19, 2017
57e3c2c
Pull component out of Blaze template
impactmass Jul 19, 2017
5bc4010
Fix test
impactmass Jul 19, 2017
32f1c66
Redo Permissions update
impactmass Jul 20, 2017
d6f672b
Set active group
impactmass Jul 20, 2017
360f68f
Update child data
impactmass Jul 20, 2017
f641194
Remove console
impactmass Jul 20, 2017
f0ddbd3
Change accounts publication to only publish users that are not in the…
spencern Jul 20, 2017
f1b82e4
check for admin permissions for the shopId of the group a user is bei…
spencern Jul 20, 2017
1f7f8de
Remove commented code, and update permissions check
impactmass Jul 21, 2017
5ae737d
Fix linting error by removing unused lodash import
spencern Jul 21, 2017
6a6f495
Refactor components and containers
impactmass Jul 21, 2017
c87490c
Merge branch origin into rowland-accounts-react-conversion-2184
impactmass Jul 21, 2017
643b059
Add class to divs
impactmass Jul 21, 2017
55fdf71
Ensure arrow-parens on all funcs
impactmass Jul 21, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 2 additions & 39 deletions client/modules/accounts/templates/dashboard/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,7 @@
<template name="accountsDashboard">
{{#if hasPermission 'accounts'}}

{{> memberForm}}
<div class="container-fluid-sm">

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span data-i18n="accounts.shopMembers">Shop Members</span>
</h3>
</div>

<ul class="list-group">
{{#each members}}
{{#if isShopMember}}
<li class="list-group-item flex">
{{> member}}
</li>
{{/if}}
{{/each}}
</ul>
</div>

<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<span data-i18n="accounts.guests">Guests</span>
</h3>
</div>

<ul class="list-group">
{{#each members}}
{{#if isShopGuest}}
<li class="list-group-item flex">
{{> member}}
</li>
{{/if}}
{{/each}}
</ul>
</div>
<div>
{{> React component=accountsDashboard }}
</div>
{{/if}}
</template>
Expand Down
5 changes: 5 additions & 0 deletions client/modules/accounts/templates/dashboard/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { ServiceConfiguration } from "meteor/service-configuration";
import { Reaction, i18next } from "/client/api";
import * as Collections from "/lib/collections";
import { ServiceConfigHelper } from "../../helpers/util";
import AccountsDashboardContainer from "/imports/plugins/core/accounts/client/containers/accountsDashboardContainer";

/**
* Accounts helpers
Expand Down Expand Up @@ -81,6 +82,10 @@ Template.accountsDashboard.helpers({
});
}
}
},

accountsDashboard() {
return AccountsDashboardContainer;
}
});

Expand Down
80 changes: 2 additions & 78 deletions client/modules/accounts/templates/members/member.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,83 +18,7 @@
</template>

<template name="memberSettings">

<div class="panel">

<div class="panel-heading panel-title-center">
<div class="profile-image">
<img class="circular-icon" src="{{getGravatar this 80}}" style="width: 80px;border-radius: 50%;" />
<span class="profile-image-display-name">{{displayName this}}</span>
<span>{{this.email}}</span>
</div>
</div>

<div>
{{> React accountsDetail }}
</div>

{{#if showAvalaraTaxSettings }}
{{> taxSettingsPanel member=this }}
{{/if}}

{{#each groupsForUser}}
{{#if permissionGroups}}
<div class="panel-body">
<h3><i class="fa fa-shopping-cart"></i> {{shopLabel}}</h3>
</div>

<div class="panel-group shop-member-groups">
{{#each permissionGroups}}
<div class="panel panel-default">

<div class="panel-heading panel-heading-flex" data-event-action="expandPermission">

<div class="panel-title">
<label for="permissions-{{name}}-{{../../userId}}">
<i class="{{icon}}"></i> {{label}}
</label>
</div>


<div class="panel-controls">
<input type="checkbox" class="checkbox-switch"
id="permissions-{{name}}-{{../../userId}}"
data-userId="{{../../userId}}"
data-permission="{{name}}"
{{hasPermissionChecked name ../../userId}}
{{isOwnerDisabled ../../userId}}
data-event-action="toggleMemberPermission"
/>
</div>
</div>

{{#if hasManyPermissions permissions}}
<ul class="list-group">
{{#each permissions}}
<li class="list-group-item shop-member-permission flex">
<div class="flex-item-fill">
<label for="sub-permissions-{{name}}-{{../../userId}}">
<i class="{{orElse icon 'fa fa-gear'}}"></i> {{label}}
</label>
</div>

<div class="flex-item-static">
<input class="checkbox-switch"
id="sub-permissions-{{name}}-{{../../userId}}"
type="checkbox"
data-userId="{{../../../userId}}"
data-permission="{{permission}}"
{{hasPermissionChecked permission ../../../userId}}
{{isOwnerDisabled ../../../userId}}
data-event-action="toggleMemberPermission"
/>
</div>
</li>
{{/each}}
</ul>
{{/if}}

</div>
{{/each}}
</div>
{{/if}}
{{/each}}
</template>
9 changes: 8 additions & 1 deletion client/modules/accounts/templates/members/member.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Meteor } from "meteor/meteor";
import { Template } from "meteor/templating";
import { $ } from "meteor/jquery";
import { Roles } from "meteor/alanning:roles";
import AccountsManageContainer from "/imports/plugins/core/accounts/client/containers/accountsManageContainer";

const getPermissionMap = (permissions) => {
const permissionMap = {};
Expand Down Expand Up @@ -115,7 +116,6 @@ Template.memberSettings.helpers({
});
}
});

return permissionGroups;
},

Expand All @@ -133,6 +133,13 @@ Template.memberSettings.helpers({
});

return _.get(avalara, "settings.avalara.enabled", false);
},

accountsDetail() {
return {
component: AccountsManageContainer,
...Template.currentData()
};
}
});

Expand Down
20 changes: 0 additions & 20 deletions client/modules/accounts/templates/members/memberForm.html

This file was deleted.

53 changes: 0 additions & 53 deletions client/modules/accounts/templates/members/memberForm.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import AccountsTable from "./accountsTable";
import AccountsManageContainer from "../containers/accountsManageContainer";

class AccountsDashboard extends Component {
static propTypes = {
accounts: PropTypes.array,
groups: PropTypes.array
};

constructor(props) {
super(props);

this.state = {
accounts: props.accounts,
groups: props.groups,
showSideBar: false,
selectedGroup: {}
};
}

componentWillReceiveProps(nextProps) {
const { groups, accounts } = nextProps;
const selectedGroup = groups.find(grp => grp._id === (this.state.selectedGroup || {})._id);
this.setState({ groups, accounts, selectedGroup });
}

handleGroupSelect = group => {
this.setState({ showSideBar: true, selectedGroup: group });
};

tableClassName() {
if (this.state.showSideBar) {
return "col-md-9";
}
return "col-md-12";
}

detailDivClassName() {
if (this.state.showSideBar) {
return "col-md-3";
}
return "hide";
}

renderGroupDetail = () => {
if (this.state.showSideBar) {
const { groups, accounts } = this.state;
return (
<AccountsManageContainer
className="accounts-manage-container"
group={this.state.selectedGroup}
groups={groups}
accounts={accounts}
onChangeGroup={this.handleGroupSelect}
/>
);
}
return null;
};

renderGroupsTable(groups) {
if (Array.isArray(groups)) {
return groups.map((group, index) => {
return (
<div key={index}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this <div> necessary? you can add key to the <AccountsTable />. If it necessary, put a className on it like rui accounts-table-container or something appropriate.

<AccountsTable group={group} onGroupSelect={this.handleGroupSelect} {...this.props} />
</div>
);
});
}

return null;
}

render() {
return (
<div className="row list-group accounts-table">
<div className={this.tableClassName()}>
{this.renderGroupsTable(this.state.groups)}
</div>
<div className={this.detailDivClassName()}>
{this.renderGroupDetail()}
</div>
</div>
);
}
}

export default AccountsDashboard;
Loading