mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-23 06:31:51 +00:00
add article indexing(keyinput, store event)
This commit is contained in:
49
browser/main/Components/BlueprintDeleteModal.jsx
Normal file
49
browser/main/Components/BlueprintDeleteModal.jsx
Normal file
@@ -0,0 +1,49 @@
|
||||
var React = require('react')
|
||||
var PlanetStore = require('../Stores/PlanetStore')
|
||||
var PlanetActions = require('../Actions/PlanetActions')
|
||||
|
||||
var BlueprintDeleteModal = React.createClass({
|
||||
propTypes: {
|
||||
close: React.PropTypes.func,
|
||||
blueprint: React.PropTypes.object
|
||||
},
|
||||
componentDidMount: function () {
|
||||
this.unsubscribe = PlanetStore.listen(this.onListen)
|
||||
},
|
||||
componentWillUnmount: function () {
|
||||
this.unsubscribe()
|
||||
},
|
||||
onListen: function (res) {
|
||||
switch (res.status) {
|
||||
case 'articleDeleted':
|
||||
this.props.close()
|
||||
break
|
||||
}
|
||||
},
|
||||
stopPropagation: function (e) {
|
||||
e.stopPropagation()
|
||||
},
|
||||
submit: function () {
|
||||
PlanetActions.deleteBlueprint(this.props.blueprint.id)
|
||||
},
|
||||
render: function () {
|
||||
return (
|
||||
<div onClick={this.stopPropagation} className='BlueprintDeleteModal modal'>
|
||||
<div className='modal-header'>
|
||||
<h1>Delete Blueprint</h1>
|
||||
</div>
|
||||
<div className='modal-body'>
|
||||
<p>Are you sure to delete it?</p>
|
||||
</div>
|
||||
<div className='modal-footer'>
|
||||
<div className='modal-control'>
|
||||
<button onClick={this.props.close} className='btn-default'>Cancle</button>
|
||||
<button onClick={this.submit} className='btn-primary'>Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = BlueprintDeleteModal
|
||||
38
browser/main/Components/BlueprintEditModal.jsx
Normal file
38
browser/main/Components/BlueprintEditModal.jsx
Normal file
@@ -0,0 +1,38 @@
|
||||
var React = require('react')
|
||||
var BlueprintForm = require('./BlueprintForm')
|
||||
var PlanetStore = require('../Stores/PlanetStore')
|
||||
|
||||
var BlueprintEditModal = React.createClass({
|
||||
propTypes: {
|
||||
close: React.PropTypes.func,
|
||||
blueprint: React.PropTypes.object
|
||||
},
|
||||
componentDidMount: function () {
|
||||
this.unsubscribe = PlanetStore.listen(this.onListen)
|
||||
},
|
||||
componentWillUnmount: function () {
|
||||
this.unsubscribe()
|
||||
},
|
||||
onListen: function (res) {
|
||||
switch (res.status) {
|
||||
case 'articleUpdated':
|
||||
this.props.close()
|
||||
break
|
||||
}
|
||||
},
|
||||
stopPropagation: function (e) {
|
||||
e.stopPropagation()
|
||||
},
|
||||
render: function () {
|
||||
return (
|
||||
<div onClick={this.stopPropagation} className='BlueprintEditModal modal'>
|
||||
<div className='modal-header'>
|
||||
<h1>Edit Blueprint</h1>
|
||||
</div>
|
||||
<BlueprintForm blueprint={this.props.blueprint} close={this.props.close}/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
module.exports = BlueprintEditModal
|
||||
@@ -40,12 +40,19 @@ var BlueprintForm = React.createClass({
|
||||
PREVIEW_MODE: 1
|
||||
},
|
||||
getInitialState: function () {
|
||||
var blueprint = Object.assign({
|
||||
title: '',
|
||||
content: '',
|
||||
Tags: []
|
||||
}, this.props.blueprint)
|
||||
blueprint.Tags = blueprint.Tags.map(function (tag) {
|
||||
return {
|
||||
label: tag.name,
|
||||
value: tag.name
|
||||
}
|
||||
})
|
||||
return {
|
||||
blueprint: {
|
||||
title: '',
|
||||
content: '',
|
||||
Tags: []
|
||||
},
|
||||
blueprint: blueprint,
|
||||
mode: BlueprintForm.EDIT_MODE
|
||||
}
|
||||
},
|
||||
|
||||
@@ -25,10 +25,7 @@ var LaunchModal = React.createClass({
|
||||
},
|
||||
onListen: function (res) {
|
||||
switch (res.status) {
|
||||
case 'snippetCreated':
|
||||
this.props.close()
|
||||
break
|
||||
case 'blueprintCreated':
|
||||
case 'articleCreated':
|
||||
this.props.close()
|
||||
break
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ var SnippetDeleteModal = React.createClass({
|
||||
},
|
||||
onListen: function (res) {
|
||||
switch (res.status) {
|
||||
case 'snippetDeleted':
|
||||
case 'articleDeleted':
|
||||
this.props.close()
|
||||
break
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ var SnippetEditModal = React.createClass({
|
||||
},
|
||||
onListen: function (res) {
|
||||
switch (res.status) {
|
||||
case 'snippetUpdated':
|
||||
case 'articleUpdated':
|
||||
this.props.close()
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user