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

Add route and landing page for Stage Extras v2 #14891

Merged
merged 9 commits into from May 9, 2017
Merged

Conversation

joshlory
Copy link
Contributor

@joshlory joshlory commented May 5, 2017

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
Copy link
Contributor

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)
Copy link
Contributor

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?

Copy link
Contributor Author

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);
}
Copy link
Contributor

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,
};
Copy link
Contributor

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')
Copy link
Contributor

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}}
Copy link
Contributor

Choose a reason for hiding this comment

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

good looking haml file :)

@joshlory joshlory merged commit 0ec3224 into staging May 9, 2017
@joshlory joshlory deleted the stage-extras branch May 9, 2017 02:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants