mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-14 02:06:29 +00:00
add PlanetSettingModal(Only visible things)
This commit is contained in:
@@ -132,7 +132,7 @@ var BlueprintForm = React.createClass({
|
|||||||
<div className='modal-footer'>
|
<div className='modal-footer'>
|
||||||
<button onClick={this.togglePreview} className='btn-default'>Toggle Preview</button>
|
<button onClick={this.togglePreview} className='btn-default'>Toggle Preview</button>
|
||||||
<div className='modal-control'>
|
<div className='modal-control'>
|
||||||
<button onClick={this.props.close} className='btn-default'>Cancle</button>
|
<button onClick={this.props.close} className='btn-default'>Cancel</button>
|
||||||
<button onClick={this.submit} className='btn-primary'>Launch</button>
|
<button onClick={this.submit} className='btn-primary'>Launch</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ var BlueprintForm = require('./BlueprintForm')
|
|||||||
var LaunchModal = React.createClass({
|
var LaunchModal = React.createClass({
|
||||||
mixins: [Catalyst.LinkedStateMixin, ReactRouter.State],
|
mixins: [Catalyst.LinkedStateMixin, ReactRouter.State],
|
||||||
propTypes: {
|
propTypes: {
|
||||||
submit: React.PropTypes.func,
|
|
||||||
close: React.PropTypes.func
|
close: React.PropTypes.func
|
||||||
},
|
},
|
||||||
getInitialState: function () {
|
getInitialState: function () {
|
||||||
@@ -39,13 +38,6 @@ var LaunchModal = React.createClass({
|
|||||||
selectBlueprintTab: function () {
|
selectBlueprintTab: function () {
|
||||||
this.setState({currentTab: 'blueprint'})
|
this.setState({currentTab: 'blueprint'})
|
||||||
},
|
},
|
||||||
submit: function () {
|
|
||||||
if (this.state.currentTab === 'snippet') {
|
|
||||||
console.log(this.state.snippet)
|
|
||||||
} else {
|
|
||||||
console.log(this.state.blueprint)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
handleKeyDown: function (e) {
|
handleKeyDown: function (e) {
|
||||||
if (e.keyCode === 37 && e.metaKey) {
|
if (e.keyCode === 37 && e.metaKey) {
|
||||||
this.selectSnippetTab()
|
this.selectSnippetTab()
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ var React = require('react/addons')
|
|||||||
|
|
||||||
var PlanetHeader = React.createClass({
|
var PlanetHeader = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
openSettingModal: React.PropTypes.func,
|
||||||
currentPlanet: React.PropTypes.object,
|
currentPlanet: React.PropTypes.object,
|
||||||
currentUser: React.PropTypes.object,
|
|
||||||
onSearchChange: React.PropTypes.func,
|
onSearchChange: React.PropTypes.func,
|
||||||
search: React.PropTypes.string
|
search: React.PropTypes.string
|
||||||
},
|
},
|
||||||
@@ -27,7 +27,7 @@ var PlanetHeader = React.createClass({
|
|||||||
<div className='headerLabel'>
|
<div className='headerLabel'>
|
||||||
<span className='userName'>{currentUserName}</span><br/>
|
<span className='userName'>{currentUserName}</span><br/>
|
||||||
<span className='planetName'>{currentPlanetName}</span>
|
<span className='planetName'>{currentPlanetName}</span>
|
||||||
<button className={'menuBtn'}>
|
<button onClick={this.props.openSettingModal} className={'menuBtn'}>
|
||||||
<i className='fa fa-gears'></i>
|
<i className='fa fa-gears'></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ var PlanetNavigator = React.createClass({
|
|||||||
name: React.PropTypes.string,
|
name: React.PropTypes.string,
|
||||||
Users: React.PropTypes.array
|
Users: React.PropTypes.array
|
||||||
}),
|
}),
|
||||||
currentUser: React.PropTypes.shape({
|
|
||||||
name: React.PropTypes.string
|
|
||||||
}),
|
|
||||||
openLaunchModal: React.PropTypes.func,
|
openLaunchModal: React.PropTypes.func,
|
||||||
openAddUserModal: React.PropTypes.func
|
openAddUserModal: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|||||||
106
browser/main/Components/PlanetSettingModal.jsx
Normal file
106
browser/main/Components/PlanetSettingModal.jsx
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
var React = require('react/addons')
|
||||||
|
var Select = require('react-select')
|
||||||
|
var Catalyst = require('../Mixins/Catalyst')
|
||||||
|
|
||||||
|
module.exports = React.createClass({
|
||||||
|
mixins: [Catalyst.LinkedStateMixin],
|
||||||
|
propTypes: {
|
||||||
|
close: React.PropTypes.func,
|
||||||
|
currentPlanet: React.PropTypes.object
|
||||||
|
},
|
||||||
|
getInitialState: function () {
|
||||||
|
return {
|
||||||
|
currentTab: 'planetProfile',
|
||||||
|
planetName: this.props.currentPlanet.name,
|
||||||
|
isDeletePlanetChecked: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
activePlanetProfile: function () {
|
||||||
|
this.setState({currentTab: 'planetProfile'})
|
||||||
|
|
||||||
|
},
|
||||||
|
activeManageMember: function () {
|
||||||
|
this.setState({currentTab: 'manageMember'})
|
||||||
|
},
|
||||||
|
doubleCheckDeletePlanet: function () {
|
||||||
|
if (this.state.isDeletePlanetChecked) {
|
||||||
|
console.log('delete it')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
this.setState({isDeletePlanetChecked: true})
|
||||||
|
React.findDOMNode(this.refs.deleteCancelButton).focus()
|
||||||
|
},
|
||||||
|
cancelDeletePlanet: function () {
|
||||||
|
this.setState({isDeletePlanetChecked: false})
|
||||||
|
},
|
||||||
|
interceptClick: function (e) {
|
||||||
|
e.stopPropagation()
|
||||||
|
},
|
||||||
|
render: function () {
|
||||||
|
var content
|
||||||
|
if (this.state.currentTab === 'planetProfile') {
|
||||||
|
content = (
|
||||||
|
<div className='planetProfile'>
|
||||||
|
<div className='planetProfileForm'>
|
||||||
|
<label>Planet name </label>
|
||||||
|
<input valueLink={this.linkState('planetName')} className='inline-input'/>
|
||||||
|
<button className='saveButton btn-primary'>Save</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='planetDeleteForm'>
|
||||||
|
<div className='planetDeleteControl'>
|
||||||
|
<div className={'toggle' + (this.state.isDeletePlanetChecked ? '' : ' hide')}>
|
||||||
|
<div className='planetDeleteLabel'>Are you sure to delete this planet?</div>
|
||||||
|
<button ref='deleteCancelButton' onClick={this.cancelDeletePlanet} className='cancelButton btn-default'>Cancel</button>
|
||||||
|
</div>
|
||||||
|
<button onClick={this.doubleCheckDeletePlanet} className='deleteButton btn-primary'>{!this.state.isDeletePlanetChecked ? 'Delete Planet' : 'Confirm'}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
var members = this.props.currentPlanet.Users.map(function (user) {
|
||||||
|
return (
|
||||||
|
<li key={'user-' + user.id}>
|
||||||
|
<img className='userPhoto' width='44' height='44' src='../vendor/dummy.jpg'/>
|
||||||
|
<div className='userName'>{user.name}</div>
|
||||||
|
<div className='userControl'>
|
||||||
|
{this.props.currentPlanet.OwnerId !== user.id ? <button className='btn-default'>Delete</button> : <span className='ownerLabel'>Owner</span>}
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
}.bind(this))
|
||||||
|
|
||||||
|
content = (
|
||||||
|
<div className='manageMember'>
|
||||||
|
<ul className='userList'>
|
||||||
|
{members}
|
||||||
|
</ul>
|
||||||
|
<div className='addUserForm'>
|
||||||
|
<div className='addUserLabel'>Invite user</div>
|
||||||
|
<div className='addUserControl'>
|
||||||
|
<Select className='addUserSelect'/>
|
||||||
|
<button className='addUserSubmit btn-primary'>Invite</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div onClick={this.interceptClick} className='PlanetSettingModal modal'>
|
||||||
|
<div className='settingNav'>
|
||||||
|
<h1>Planet setting</h1>
|
||||||
|
<nav>
|
||||||
|
<button className={this.state.currentTab === 'planetProfile' ? 'active' : ''} onClick={this.activePlanetProfile}><i className='fa fa-globe'/> Planet profile</button>
|
||||||
|
<button className={this.state.currentTab === 'manageMember' ? 'active' : ''} onClick={this.activeManageMember}><i className='fa fa-group'/> Manage member</button>
|
||||||
|
</nav>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='settingBody'>
|
||||||
|
{content}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
@@ -121,7 +121,7 @@ var SnippetForm = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
<div className='modal-footer'>
|
<div className='modal-footer'>
|
||||||
<div className='modal-control'>
|
<div className='modal-control'>
|
||||||
<button onClick={this.props.close} className='btn-default'>Cancle</button>
|
<button onClick={this.props.close} className='btn-default'>Cancel</button>
|
||||||
<button onClick={this.submit} className='btn-primary'>{this.props.snippet == null ? 'Launch' : 'Relaunch'}</button>
|
<button onClick={this.submit} className='btn-primary'>{this.props.snippet == null ? 'Launch' : 'Relaunch'}</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ var SnippetDeleteModal = require('../Components/SnippetDeleteModal')
|
|||||||
var BlueprintEditModal = require('../Components/BlueprintEditModal')
|
var BlueprintEditModal = require('../Components/BlueprintEditModal')
|
||||||
var BlueprintDeleteModal = require('../Components/BlueprintDeleteModal')
|
var BlueprintDeleteModal = require('../Components/BlueprintDeleteModal')
|
||||||
var PlanetAddUserModal = require('../Components/PlanetAddUserModal')
|
var PlanetAddUserModal = require('../Components/PlanetAddUserModal')
|
||||||
|
var PlanetSettingModal = require('../Components/PlanetSettingModal')
|
||||||
|
|
||||||
var PlanetActions = require('../Actions/PlanetActions')
|
var PlanetActions = require('../Actions/PlanetActions')
|
||||||
|
|
||||||
@@ -248,9 +249,6 @@ module.exports = React.createClass({
|
|||||||
closeAddUserModal: function () {
|
closeAddUserModal: function () {
|
||||||
this.setState({isAddUserModalOpen: false})
|
this.setState({isAddUserModalOpen: false})
|
||||||
},
|
},
|
||||||
submitAddUserModal: function () {
|
|
||||||
this.setState({isAddUserModalOpen: false})
|
|
||||||
},
|
|
||||||
openEditModal: function () {
|
openEditModal: function () {
|
||||||
if (this.refs.detail.props.article == null) {return}
|
if (this.refs.detail.props.article == null) {return}
|
||||||
this.setState({isEditModalOpen: true})
|
this.setState({isEditModalOpen: true})
|
||||||
@@ -271,6 +269,12 @@ module.exports = React.createClass({
|
|||||||
submitDeleteModal: function () {
|
submitDeleteModal: function () {
|
||||||
this.setState({isDeleteModalOpen: false})
|
this.setState({isDeleteModalOpen: false})
|
||||||
},
|
},
|
||||||
|
openSettingModal: function () {
|
||||||
|
this.setState({isSettingModalOpen: true})
|
||||||
|
},
|
||||||
|
closeSettingModal: function () {
|
||||||
|
this.setState({isSettingModalOpen: false})
|
||||||
|
},
|
||||||
focus: function () {
|
focus: function () {
|
||||||
React.findDOMNode(this).focus()
|
React.findDOMNode(this).focus()
|
||||||
},
|
},
|
||||||
@@ -407,7 +411,7 @@ module.exports = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<div tabIndex='1' onKeyDown={this.handleKeyDown} className='PlanetContainer'>
|
<div tabIndex='1' onKeyDown={this.handleKeyDown} className='PlanetContainer'>
|
||||||
<ModalBase isOpen={this.state.isLaunchModalOpen} close={this.closeLaunchModal}>
|
<ModalBase isOpen={this.state.isLaunchModalOpen} close={this.closeLaunchModal}>
|
||||||
<LaunchModal submit={this.submitLaunchModal} close={this.closeLaunchModal}/>
|
<LaunchModal close={this.closeLaunchModal}/>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
|
|
||||||
<ModalBase isOpen={this.state.isEditModalOpen} close={this.closeEditModal}>
|
<ModalBase isOpen={this.state.isEditModalOpen} close={this.closeEditModal}>
|
||||||
@@ -419,12 +423,17 @@ module.exports = React.createClass({
|
|||||||
</ModalBase>
|
</ModalBase>
|
||||||
|
|
||||||
<ModalBase isOpen={this.state.isAddUserModalOpen} close={this.closeAddUserModal}>
|
<ModalBase isOpen={this.state.isAddUserModalOpen} close={this.closeAddUserModal}>
|
||||||
<PlanetAddUserModal submit={this.submitAddUserModal} close={this.closeAddUserModal}/>
|
<PlanetAddUserModal close={this.closeAddUserModal}/>
|
||||||
</ModalBase>
|
</ModalBase>
|
||||||
|
|
||||||
<PlanetHeader search={this.state.search} onSearchChange={this.handleSearchChange} currentPlanet={this.state.currentPlanet} currentUser={user}/>
|
<ModalBase isOpen={this.state.isSettingModalOpen} close={this.closeSettingModal}>
|
||||||
|
<PlanetSettingModal currentPlanet={this.state.currentPlanet} close={this.closeSettingModal}/>
|
||||||
|
</ModalBase>
|
||||||
|
|
||||||
<PlanetNavigator openLaunchModal={this.openLaunchModal} openAddUserModal={this.openAddUserModal} currentPlanet={this.state.currentPlanet} currentUser={user}/>
|
<PlanetHeader search={this.state.search}
|
||||||
|
openSettingModal={this.openSettingModal} onSearchChange={this.handleSearchChange} currentPlanet={this.state.currentPlanet}/>
|
||||||
|
|
||||||
|
<PlanetNavigator openLaunchModal={this.openLaunchModal} openAddUserModal={this.openAddUserModal} currentPlanet={this.state.currentPlanet}/>
|
||||||
|
|
||||||
<PlanetArticleList ref='list' articles={filteredArticles}/>
|
<PlanetArticleList ref='list' articles={filteredArticles}/>
|
||||||
|
|
||||||
|
|||||||
25
browser/styles/mixins/btnStyle.styl
Normal file
25
browser/styles/mixins/btnStyle.styl
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
btnDefault()
|
||||||
|
border-style solid
|
||||||
|
border-width 1px
|
||||||
|
border-color brandBorderColor
|
||||||
|
background-color transparent
|
||||||
|
color brandColor
|
||||||
|
&:hover, &.hover, &:focus, &.focus
|
||||||
|
border-color darken(brandBorderColor, 30%)
|
||||||
|
color darken(brandColor, 30%)
|
||||||
|
&:active, &.active
|
||||||
|
background-color brandColor
|
||||||
|
color white
|
||||||
|
|
||||||
|
btnPrimary()
|
||||||
|
border-style solid
|
||||||
|
border-width 1px
|
||||||
|
border-color brandBorderColor
|
||||||
|
background-color transparent
|
||||||
|
color brandColor
|
||||||
|
&:hover, &.hover, &:focus, &.focus
|
||||||
|
border-color darken(brandBorderColor, 30%)
|
||||||
|
color darken(brandColor, 30%)
|
||||||
|
&:active, &.active
|
||||||
|
background-color brandColor
|
||||||
|
color white
|
||||||
@@ -105,15 +105,116 @@
|
|||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
width 55px
|
width 55px
|
||||||
height 55px
|
height 55px
|
||||||
border-style solid
|
|
||||||
border-width 1px
|
|
||||||
circle()
|
circle()
|
||||||
border-color brandBorderColor
|
btnPrimary()
|
||||||
background-color transparent
|
.PlanetSettingModal.modal
|
||||||
|
width 720px
|
||||||
|
height 500px
|
||||||
|
.settingNav
|
||||||
|
absolute top bottom left
|
||||||
|
width 200px
|
||||||
|
box-sizing border-box
|
||||||
|
padding 10px
|
||||||
|
border-right solid 1px borderColor
|
||||||
|
h1
|
||||||
|
margin 40px 15px
|
||||||
|
font-size 1.5em
|
||||||
color brandColor
|
color brandColor
|
||||||
&:hover, &.hover, &:focus, &.focus
|
nav
|
||||||
border-color darken(brandBorderColor, 30%)
|
button
|
||||||
color darken(brandColor, 30%)
|
font-size 1em
|
||||||
|
display block
|
||||||
|
box-sizing border-box
|
||||||
|
padding 15px 15px
|
||||||
|
margin 10px 0
|
||||||
|
border none
|
||||||
|
border-radius 10px
|
||||||
|
width 100%
|
||||||
|
text-align left
|
||||||
|
background-color transparent
|
||||||
|
color textColor
|
||||||
|
cursor pointer
|
||||||
|
transition 0.1s
|
||||||
|
&:hover, &.hover
|
||||||
|
background-color hoverBackgroundColor
|
||||||
&:active, &.active
|
&:active, &.active
|
||||||
background-color brandColor
|
color brandColor
|
||||||
color white
|
|
||||||
|
.settingBody
|
||||||
|
absolute top bottom right
|
||||||
|
left 200px
|
||||||
|
padding 15px
|
||||||
|
.planetProfile
|
||||||
|
height 500px
|
||||||
|
padding-top 50px
|
||||||
|
.planetProfileForm
|
||||||
|
height 275px
|
||||||
|
box-sizing border-box
|
||||||
|
border-bottom solid 1px borderColor
|
||||||
|
.planetDeleteForm
|
||||||
|
height 225px
|
||||||
|
.planetDeleteControl
|
||||||
|
margin-top 15px
|
||||||
|
clearfix()
|
||||||
|
.toggle
|
||||||
|
float left
|
||||||
|
transition width 0.3s, color 0.1s, border-color 0.1s
|
||||||
|
overflow hidden
|
||||||
|
white-space nowrap
|
||||||
|
width 345px
|
||||||
|
height 44px
|
||||||
|
&.hide
|
||||||
|
width 0
|
||||||
|
.planetDeleteLabel
|
||||||
|
display inline-block
|
||||||
|
line-height 44px
|
||||||
|
.cancelButton
|
||||||
|
display inline-block
|
||||||
|
margin-left 15px
|
||||||
|
margin-right 0
|
||||||
|
.deleteButton
|
||||||
|
float left
|
||||||
|
.manageMember
|
||||||
|
height 500px
|
||||||
|
box-sizing border-box
|
||||||
|
padding-top 50px
|
||||||
|
.userList
|
||||||
|
height 275px
|
||||||
|
box-sizing border-box
|
||||||
|
border-bottom solid 1px borderColor
|
||||||
|
li
|
||||||
|
clearfix()
|
||||||
|
margin-bottom 10px
|
||||||
|
img.userPhoto
|
||||||
|
float left
|
||||||
|
width 44px
|
||||||
|
height 44px
|
||||||
|
circle()
|
||||||
|
.userName
|
||||||
|
float left
|
||||||
|
height 44px
|
||||||
|
font-size 1.3em
|
||||||
|
line-height 44px
|
||||||
|
margin-left 15px
|
||||||
|
.userControl
|
||||||
|
float right
|
||||||
|
height 44px
|
||||||
|
.ownerLabel
|
||||||
|
height 44px
|
||||||
|
padding 0 15px
|
||||||
|
line-height 44px
|
||||||
|
.addUserForm
|
||||||
|
height 225px
|
||||||
|
.addUserLabel
|
||||||
|
margin-top 15px
|
||||||
|
font-size 1.3em
|
||||||
|
.addUserControl
|
||||||
|
clearfix()
|
||||||
|
margin-top 15px
|
||||||
|
.addUserSelect
|
||||||
|
float left
|
||||||
|
height 44px
|
||||||
|
width 350px
|
||||||
|
margin-top 5px
|
||||||
|
.addUserSubmit
|
||||||
|
float right
|
||||||
|
|||||||
Reference in New Issue
Block a user