Skip to content

Commit

Permalink
Modified publish action in editor menu to dropdown with two options: …
Browse files Browse the repository at this point in the history
…publish as dev or

production. Action not modified yet
  • Loading branch information
twagoo committed Aug 25, 2016
1 parent 77a222d commit b163e4d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
34 changes: 30 additions & 4 deletions src/scripts/app/components/editor/EditorMenuGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ var LinkButton = require('../LinkButton');

//bootstrap
var Button = require('react-bootstrap/lib/Button');
var DropDownButton = require('react-bootstrap/lib/DropdownButton');
var MenuItem = require('react-bootstrap/lib/MenuItem');
var ButtonGroup = require('react-bootstrap/lib/ButtonGroup');
var ButtonModal = require('../ButtonModal');
var ReactAlert = require('../../util/ReactAlert');
var Constants = require('../../constants');

/**
* EditorMenuGroup
Expand All @@ -32,15 +36,37 @@ var EditorMenuGroup = React.createClass({
};
},

onPublishProduction: function() {
ReactAlert.showConfirmationDialogue(
"Move to public space and put in production?",
<p>
If your profile/component is ready to be used by other people and no further changes are required, press <strong>'Yes'</strong>.
Otherwise press <strong>'No'</strong> and save it in your workspace or continue editing.
</p>,
this.props.onPublish.bind(null, Constants.STATUS_PRODUCTION)
);
},

onPublishDevelopment: function() {
ReactAlert.showConfirmationDialogue(
"Move to public space as public draft?",
<p>
If your profile/component is ready to be used by other people, but still should be open for editing (by you), press <strong>'Yes'</strong>.
Otherwise press <strong>'No'</strong> and save it in your workspace or continue editing.
</p>,
this.props.onPublish.bind(null, Constants.STATUS_DEVELOPMENT)
);
},

render: function () {
return (
<ButtonGroup className="actionMenu">
<Button bsStyle={(!this.props.isNew) ? "primary" : "default" } onClick={this.props.onSave} disabled={this.props.disabled || this.props.isNew}>Save</Button>
<Button bsStyle={(this.props.isNew) ? "primary" : "default" } onClick={this.props.onSaveNew} disabled={this.props.disabled} >Save new</Button>
<ButtonModal {...this.props} action={this.props.onPublish} disabled={this.props.disabled || this.props.isNew}
btnLabel="Publish"
title="Publish"
desc="If your profile/component is ready to be used by other people press ok, otherwise press cancel and save it in your workspace or continue editing." />
<DropDownButton id="publishActions" title="Publish" {...this.props} disabled={this.props.disabled || this.props.isNew}>
<MenuItem eventKey="1" onClick={this.onPublishProduction}>Publish</MenuItem>
<MenuItem eventKey="2" onClick={this.onPublishDevelopment}>Publish as draft</MenuItem>
</DropDownButton>
<Button onClick={this.props.onCancel} disabled={this.props.disabled}>Cancel</Button>
</ButtonGroup>
);
Expand Down
5 changes: 5 additions & 0 deletions src/scripts/app/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ module.exports = {
SPACE_PRIVATE: "private",
SPACE_TEAM: "team",

/*STATUS*/
STATUS_DEVELOPMENT: "development",
STATUS_PRODUCTION: "production",
STATUS_DEPRECATED: "deprecated",

SPACE_NAMES: {
public: "Public space",
private: "Private space",
Expand Down

0 comments on commit b163e4d

Please sign in to comment.