mirror of
https://github.com/BoostIo/Boostnote
synced 2026-01-08 06:29:26 +00:00
add Tag filter
This commit is contained in:
@@ -11,7 +11,8 @@ var PlanetArticleDetail = React.createClass({
|
||||
propTypes: {
|
||||
article: React.PropTypes.object,
|
||||
onOpenEditModal: React.PropTypes.func,
|
||||
onOpenDeleteModal: React.PropTypes.func
|
||||
onOpenDeleteModal: React.PropTypes.func,
|
||||
showOnlyWithTag: React.PropTypes.func
|
||||
},
|
||||
getInitialState: function () {
|
||||
return {
|
||||
@@ -29,9 +30,9 @@ var PlanetArticleDetail = React.createClass({
|
||||
}
|
||||
var tags = article.Tags.length > 0 ? article.Tags.map(function (tag) {
|
||||
return (
|
||||
<a key={tag.id} href>#{tag.name}</a>
|
||||
<a onClick={this.props.showOnlyWithTag(tag.name)} key={tag.id}>#{tag.name}</a>
|
||||
)
|
||||
}) : (
|
||||
}.bind(this)) : (
|
||||
<a className='noTag'>Not tagged yet</a>
|
||||
)
|
||||
if (article.type === 'snippet') {
|
||||
|
||||
@@ -8,7 +8,8 @@ var Markdown = require('../Mixins/Markdown')
|
||||
var PlanetArticleList = React.createClass({
|
||||
mixins: [ReactRouter.Navigation, ReactRouter.State, ForceUpdate(60000), Markdown],
|
||||
propTypes: {
|
||||
articles: React.PropTypes.array
|
||||
articles: React.PropTypes.array,
|
||||
showOnlyWithTag: React.PropTypes.func
|
||||
},
|
||||
handleKeyDown: function (e) {
|
||||
e.preventDefault()
|
||||
@@ -17,9 +18,9 @@ var PlanetArticleList = React.createClass({
|
||||
var articles = this.props.articles.map(function (article) {
|
||||
var tags = article.Tags.length > 0 ? article.Tags.map(function (tag) {
|
||||
return (
|
||||
<a key={tag.id} href>#{tag.name}</a>
|
||||
<a onClick={this.props.showOnlyWithTag(tag.name)} key={tag.id}>#{tag.name}</a>
|
||||
)
|
||||
}) : (
|
||||
}.bind(this)) : (
|
||||
<a className='noTag'>Not tagged yet</a>
|
||||
)
|
||||
var params = this.getParams()
|
||||
|
||||
Reference in New Issue
Block a user