-
Notifications
You must be signed in to change notification settings - Fork 176
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
Edit rounds ui! #1856
Merged
Merged
Edit rounds ui! #1856
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
87dfb25
Add a fancy show rounds page complete with cutoffs, time limits, and
jfly 972b4e5
Add serializable_hash methods for the javascript infrastructure we're…
jfly c51541f
Added react and built a fancy edit rounds ui that saves WCIF via ajax.
jfly 494739e
Change select to two radio buttons.
jfly 88510a9
Tweaking dialog titles.
jfly a771de3
Catching up with latest WCIF spec: "percentile" -> "percent" and "att…
jfly 7183bc9
Better support for time limits for 333mbf and 333fm, which do not have
jfly 016cfc2
Don't display buttons to edit the time limit for events that do not
jfly fc4ca87
Explicitly disable the edit event form when there are deprecated events.
jfly c021ecf
Remove old test that no longer applies.
jfly 31ac1b9
Clean up the advacement dialog a bit.
jfly 109cdda
Add DISABLE_BULLET environment variable.
jfly a2e27a3
Start of support for timed events vs fmc vs mbld.
jfly 268abe4
Implemented format1 / format2 ui for the cutoff dialog.
jfly 9ad390e
Set backdrop static to prevent dismissing dialogs when clicking on th…
jfly a4876b6
Add a helpful description for the weird cumulative time limits.
jfly 65fed78
Misc styling.
jfly c464071
Actually added support for cross round cumulative time limits.
jfly 330acfb
Refactor modals code a bit, and create a AttemptResultInput component.
jfly 280e7bc
Implement advanceReqToStr.
jfly cec04e4
Add support for mbld points =)
jfly 798a6f7
Some polish: short formatting of times for our tiny buttons.
jfly 6b7f1a7
Add a silly simple centiseconds input.
jfly cd4b8e9
Created a matchResult() method to stringify what it takes to beat a
jfly 50a9133
Grey out events that are not being held.
jfly cd305e4
Implemented the UI for sharing a cumulative time limit with other rou…
jfly 1dcf646
Added javascript feature test of rounds management.
jfly 6bf146b
Polish the look of the advancement condition modal.
jfly 639e7db
Limit the advancement percent to 75%.
jfly d669a51
Add nice big alerts notifying the user when there are unsaved changes.
jfly dd5f8d4
Added some explanation text to the cutoff modal.
jfly 9e68654
Remove upper bound of 60 minutes on time limits.
jfly abad79d
Do not allow adding or removing events to a confirmed competition.
jfly 5ea98d6
Update UI to reflect that events cannot be added or removed to confir…
jfly a7691d1
Less confusing modal behavior.
jfly dbde71e
Update submodal to have the new ok, cancel behavior for all our modals.
jfly a82ae46
Responding to @jonatanklosko's review comments.
jfly e5143e4
Fix as many Bullet warnings as possible, and ignore the one remaining
jfly 18ef0e5
Added explicit add and remove event buttons, along with a confirmation
jfly 94f9956
Improved show events page
viroulep 6b6bbf2
Add support for 0 rounds in an event.
jfly f874096
Some ui polish.
jfly File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,9 @@ | |
"uglify": true | ||
}, | ||
"useBuiltIns": true | ||
}] | ||
}], | ||
"react", | ||
"stage-2" | ||
], | ||
|
||
"plugins": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,4 @@ | |
@import "competition_tabs"; | ||
@import "server_status"; | ||
@import "relations"; | ||
@import "edit_events"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#events-edit-area { | ||
.panel-heading { | ||
padding-top: 10px; | ||
padding-bottom: 10px; | ||
|
||
.panel-title { | ||
white-space: nowrap; | ||
overflow: hidden; | ||
display: flex; | ||
align-items: center; | ||
|
||
$cubing-icon-size: 55px; | ||
.img-thumbnail.cubing-icon { | ||
font-size: 40px; | ||
position: absolute; | ||
top: -5px; | ||
height: $cubing-icon-size; | ||
z-index: 1; | ||
} | ||
|
||
.title { | ||
padding-left: $cubing-icon-size; | ||
padding-right: 5px; | ||
} | ||
|
||
.add-event { | ||
margin-left: auto; | ||
} | ||
|
||
.input-group { | ||
margin-left: auto; | ||
|
||
select { | ||
width: 100px; | ||
} | ||
|
||
.input-group-btn { | ||
display: inline-block; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.panel-body { | ||
select { | ||
width: 100%; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
WcaOnRails/app/javascript/edit-events/ButtonActivatedModal.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react' | ||
import cn from 'classnames' | ||
import Modal from 'react-bootstrap/lib/Modal' | ||
import Button from 'react-bootstrap/lib/Button' | ||
import addEventListener from 'react-overlays/lib/utils/addEventListener'; | ||
import ownerDocument from 'react-overlays/lib/utils/ownerDocument'; | ||
|
||
export default class ButtonActivatedModal extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = { showModal: false }; | ||
} | ||
|
||
open = () => { | ||
this.setState({ showModal: true }); | ||
} | ||
|
||
close = ({ skipUnsavedChangesCheck } = { skipUnsavedChangesCheck: false }) => { | ||
if(skipUnsavedChangesCheck || !this.props.hasUnsavedChanges() || confirm("Are you sure you want to discard your changes?")) { | ||
this.props.reset(); | ||
this.setState({ showModal: false }); | ||
} | ||
} | ||
|
||
render() { | ||
return ( | ||
<button type="button" name={this.props.name} className={cn("btn", this.props.buttonClass)} onClick={this.open}> | ||
{this.props.buttonValue} | ||
<KeydownDismissModal show={this.state.showModal} onHide={this.close}> | ||
<form className={this.props.formClass} onSubmit={e => { e.preventDefault(); this.props.onOk(); }}> | ||
{this.props.children} | ||
<Modal.Footer> | ||
<Button onClick={this.close} bsStyle="warning">Close</Button> | ||
<Button type="submit" bsStyle="success">Ok</Button> | ||
</Modal.Footer> | ||
</form> | ||
</KeydownDismissModal> | ||
</button> | ||
); | ||
} | ||
} | ||
|
||
// More or less copied from https://github.com/react-bootstrap/react-overlays/pull/195 | ||
// This can go away once a new version of react-overlays is released and react-bootstrap | ||
// is updated to depend on it. | ||
class KeydownDismissModal extends React.Component { | ||
static defaultProps = Modal.defaultProps; | ||
|
||
handleDocumentKeyDown = (e) => { | ||
if (this.props.keyboard && e.key === 'Escape' && this._modal._modal.isTopModal()) { | ||
if (this.props.onEscapeKeyDown) { | ||
this.props.onEscapeKeyDown(e); | ||
} | ||
|
||
this.props.onHide(); | ||
} | ||
} | ||
|
||
onShow = () => { | ||
let doc = ownerDocument(this); | ||
this._onDocumentKeydownListener = | ||
addEventListener(doc, 'keydown', this.handleDocumentKeyDown); | ||
} | ||
|
||
onHide = () => { | ||
this._onDocumentKeydownListener.remove(); | ||
} | ||
|
||
render() { | ||
let subprops = { | ||
...this.props, | ||
keyboard: false, | ||
onShow: this.onShow, | ||
}; | ||
return <Modal {...subprops} ref={m => this._modal = m} />; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is this method defined as an arrow function? I believe it's in order to save the
this
context even when passed as an event handler, but then why do you preferbind
here.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.
Ah! Because I wrote that code in
EditEvents
class before I knew you could define instance methods using the arrow function. I've changed theEditEvents
class to get rid of the binds.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.
Makes sense, to be honest I was surprised seeing this property assignment style, I was sure it's not a part of the ES6 spec, but we have a babel plugin enabling this.