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
Add route and landing page for Stage Extras v2 #14891
Conversation
def stage_extras | ||
authorize! :read, ScriptLevel | ||
|
||
@stage = Script.get_from_cache(params[:script_id]).stages.select {|s| !s.lockable? && s.relative_position == params[:stage_position].to_i}.first |
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.
nit: Long line.
.clear | ||
|
||
%h2= t('continue') | ||
= link_to t('next_stage'), @stage.script_levels.last.next_level_or_redirect_path_for_user(current_user) |
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.
any reason not to have the rest of this haml in react as well?
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.
Fixed in 1966f21!
export default class StageExtras extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} |
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.
constructor is unnecessary if you're not doing anything in it.
StageExtras.propTypes = { | ||
stageNumber: React.PropTypes.number.isRequired, | ||
nextLevelPath: React.PropTypes.string.isRequired, | ||
}; |
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.
You might be able to do this as static propTypes = {
inside the class definition (as seen here https://babeljs.io/blog/2015/06/07/react-on-es6-plus).
There's also some possibility we need to turn on certain ES7 options to support this - which we should if true.
stageNumber={config.stageNumber} | ||
nextLevelPath={config.nextLevelPath} | ||
/>, | ||
document.querySelector('.stage-extras') |
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.
any reason not to use an id instead of a className, as I assume we expect only one.
@@ -0,0 +1,3 @@ | |||
.stage-extras | |||
|
|||
%script{src: minifiable_asset_path('js/scripts/stage_extras.js'), data: {extras: @stage_extras.to_json}} |
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.
good looking haml file :)
Spec: https://docs.google.com/document/d/1sqquLVBZWs0p3tsYnfb5RhtAUKlWbkj3y-z9YBtrxEk/edit#heading=h.fjj8dwxbffev