-
Notifications
You must be signed in to change notification settings - Fork 19
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
Team management page updates #14926
Team management page updates #14926
Changes from 10 commits
e0ad6db
4e394af
ec2da7e
19afb32
6df1d14
96b51e1
d5d03ad
8e9e35a
86259aa
b17285c
8ddbacb
e382afe
6e11a8b
80d6c29
3dfe37e
5c6fb1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,9 +8,9 @@ def index | |
format.html { render template: "queue/index" } | ||
format.json do | ||
render json: { | ||
judge_teams: JudgeTeam.all.order(:id).map { |jt| serialize_org(jt) }, | ||
private_bars: PrivateBar.all.order(:id).map { |private_bar| serialize_org(private_bar) }, | ||
vsos: Vso.all.order(:id).map { |vso| serialize_org(vso) }, | ||
judge_teams: JudgeTeam.order(:name).map { |jt| serialize_org(jt) }, | ||
private_bars: PrivateBar.order(:name).map { |private_bar| serialize_org(private_bar) }, | ||
vsos: Vso.order(:name).map { |vso| serialize_org(vso) }, | ||
other_orgs: other_orgs.map { |org| serialize_org(org) } | ||
} | ||
end | ||
|
@@ -70,17 +70,10 @@ def update_params | |
end | ||
|
||
def other_orgs | ||
Organization.all.order(:id).reject { |org| org.is_a?(JudgeTeam) || org.is_a?(Representative) } | ||
Organization.order(:name).reject { |org| org.is_a?(JudgeTeam) || org.is_a?(Representative) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
|
||
def serialize_org(org) | ||
{ | ||
id: org.id, | ||
name: org.name, | ||
participant_id: org.participant_id, | ||
type: org.type, | ||
url: org.url, | ||
user_admin_path: org.user_admin_path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like we lost this along the way, link no longer works in this PR - checking Stack PR 3 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. works in the final PR - not sweating it! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed! |
||
} | ||
org.serialize | ||
lomky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,10 @@ def selectable_in_queue? | |
false | ||
end | ||
|
||
def serialize | ||
super.merge(name: judge.full_name.titleize) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
end | ||
|
||
private | ||
|
||
def use_judge_team_roles? | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,7 +64,7 @@ class TeamManagement extends React.PureComponent { | |
<OrgHeader> | ||
VSOs <Button name={COPY.TEAM_MANAGEMENT_ADD_VSO_BUTTON} onClick={this.addIhpWritingVso} /> | ||
</OrgHeader> | ||
<OrgList orgs={this.props.vsos} showBgsParticipantId /> | ||
<OrgList orgs={this.props.vsos} isRepresentative /> | ||
|
||
<OrgHeader> | ||
Private Bar | ||
|
@@ -79,7 +79,7 @@ class TeamManagement extends React.PureComponent { | |
/> | ||
</span> | ||
</OrgHeader> | ||
<OrgList orgs={this.props.privateBars} showBgsParticipantId /> | ||
<OrgList orgs={this.props.privateBars} isRepresentative /> | ||
|
||
<OrgHeader>Other teams</OrgHeader> | ||
<OrgList orgs={this.props.otherOrgs} /> | ||
|
@@ -153,27 +153,26 @@ class OrgList extends React.PureComponent { | |
render = () => { | ||
return <React.Fragment> | ||
<tr {...labelRowStyling}> | ||
<td>{COPY.TEAM_MANAGEMENT_ID_COLUMN_HEADING}</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<td>{COPY.TEAM_MANAGEMENT_NAME_COLUMN_HEADING}</td> | ||
<td>{COPY.TEAM_MANAGEMENT_URL_COLUMN_HEADING}</td> | ||
<td>{ this.props.showBgsParticipantId && COPY.TEAM_MANAGEMENT_PARTICIPANT_ID_COLUMN_HEADING}</td> | ||
<td>{this.props.isRepresentative && COPY.TEAM_MANAGEMENT_URL_COLUMN_HEADING}</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<td>{this.props.isRepresentative && COPY.TEAM_MANAGEMENT_PARTICIPANT_ID_COLUMN_HEADING}</td> | ||
<td></td> | ||
<td></td> | ||
</tr> | ||
{ this.props.orgs.map((org) => | ||
<OrgRow {...org} key={org.id} showBgsParticipantId={this.props.showBgsParticipantId} /> | ||
<OrgRow {...org} key={org.id} isRepresentative={this.props.isRepresentative} /> | ||
) } | ||
</React.Fragment>; | ||
} | ||
} | ||
|
||
OrgList.defaultProps = { | ||
showBgsParticipantId: false | ||
isRepresentative: false | ||
}; | ||
|
||
OrgList.propTypes = { | ||
orgs: PropTypes.array, | ||
showBgsParticipantId: PropTypes.bool | ||
isRepresentative: PropTypes.bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We show participant ids for all representatives. We also allow editing of names, urls, and participant ids for all representatives. Rename bool to be less specific |
||
}; | ||
|
||
class OrgRow extends React.PureComponent { | ||
|
@@ -222,27 +221,28 @@ class OrgRow extends React.PureComponent { | |
// TODO: Indicate that changes have been made to the row by enabling the submit changes button. Default to disabled. | ||
render = () => { | ||
return <tr> | ||
<td>{ this.props.id }</td> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
<td> | ||
<TextField | ||
name={`${COPY.TEAM_MANAGEMENT_NAME_COLUMN_HEADING}-${this.props.id}`} | ||
label={false} | ||
useAriaLabel | ||
value={this.state.name} | ||
onChange={this.changeName} | ||
readOnly={!this.props.isRepresentative} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/> | ||
</td> | ||
<td> | ||
<TextField | ||
{ this.props.isRepresentative && <TextField | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
name={`${COPY.TEAM_MANAGEMENT_URL_COLUMN_HEADING}-${this.props.id}`} | ||
label={false} | ||
useAriaLabel | ||
value={this.state.url} | ||
onChange={this.changeUrl} | ||
/> | ||
readOnly={!this.props.isRepresentative} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
/> } | ||
</td> | ||
<td> | ||
{ this.props.showBgsParticipantId && | ||
{ this.props.isRepresentative && | ||
<TextField | ||
name={`${COPY.TEAM_MANAGEMENT_PARTICIPANT_ID_COLUMN_HEADING}-${this.props.id}`} | ||
label={false} | ||
|
@@ -253,29 +253,36 @@ class OrgRow extends React.PureComponent { | |
} | ||
</td> | ||
<td> | ||
<Button | ||
name={COPY.TEAM_MANAGEMENT_UPDATE_ROW_BUTTON} | ||
id={`${this.props.id}`} | ||
classNames={['usa-button-secondary']} | ||
onClick={this.submitUpdate} | ||
/> | ||
{ this.props.isRepresentative && | ||
<Button | ||
name={COPY.TEAM_MANAGEMENT_UPDATE_ROW_BUTTON} | ||
id={`${this.props.id}`} | ||
classNames={['usa-button-secondary']} | ||
onClick={this.submitUpdate} | ||
/> | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</td> | ||
<td> | ||
{ this.state.url && <Link to={this.state.user_admin_path}>Org admin page</Link> } | ||
{ this.state.url && <Link to={this.state.user_admin_path}> | ||
<Button | ||
name="Org Admin Page" | ||
classNames={['usa-button-secondary']} | ||
/> | ||
</Link> } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
</td> | ||
</tr>; | ||
} | ||
} | ||
|
||
OrgRow.defaultProps = { | ||
showBgsParticipantId: false | ||
isRepresentative: false | ||
}; | ||
|
||
OrgRow.propTypes = { | ||
id: PropTypes.number, | ||
name: PropTypes.string, | ||
participant_id: PropTypes.number, | ||
showBgsParticipantId: PropTypes.bool, | ||
isRepresentative: PropTypes.bool, | ||
url: PropTypes.string, | ||
user_admin_path: PropTypes.string | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.all
is not needed here