aboutsummaryrefslogtreecommitdiff
path: root/src/web/js/components
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-03-02 08:25:52 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-03-02 08:25:52 +0100
commitb32ca6c0f5968f5e9f59847db5012e3ef7f98631 (patch)
tree83d6bd430c56ae552acb9577a53f0a2c9fbb7052 /src/web/js/components
parentminor update to the navbar (diff)
downloadnewspipe-b32ca6c0f5968f5e9f59847db5012e3ef7f98631.tar.gz
newspipe-b32ca6c0f5968f5e9f59847db5012e3ef7f98631.tar.bz2
newspipe-b32ca6c0f5968f5e9f59847db5012e3ef7f98631.zip
Code update. Some problems with CSRF token on Chromium...
Diffstat (limited to 'src/web/js/components')
-rw-r--r--src/web/js/components/MainApp.react.js2
-rw-r--r--src/web/js/components/Menu.react.js8
-rw-r--r--src/web/js/components/MiddlePanel.react.js8
-rw-r--r--src/web/js/components/RightPanel.react.js30
4 files changed, 32 insertions, 16 deletions
diff --git a/src/web/js/components/MainApp.react.js b/src/web/js/components/MainApp.react.js
index cbdc5833..ffb14589 100644
--- a/src/web/js/components/MainApp.react.js
+++ b/src/web/js/components/MainApp.react.js
@@ -15,7 +15,7 @@ var MainApp = React.createClass({
<Grid fluid id="jarr-container">
<Menu />
<Col id="middle-panel" mdOffset={3} lgOffset={2}
- xs={4} sm={4} md={4} lg={4}>
+ xs={12} sm={4} md={4} lg={4}>
<MiddlePanel.MiddlePanelFilter />
<MiddlePanel.MiddlePanel />
</Col>
diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js
index 60578f8a..f4ad76d0 100644
--- a/src/web/js/components/Menu.react.js
+++ b/src/web/js/components/Menu.react.js
@@ -84,13 +84,15 @@ var CategoryGroup = React.createClass({
name: React.PropTypes.string.isRequired,
feeds: React.PropTypes.array.isRequired,
unread: React.PropTypes.number.isRequired,
- folded: React.PropTypes.bool.isRequired,
+ folded: React.PropTypes.bool,
},
getInitialState: function() {
- return {folded: this.props.folded};
+ return {folded: false};
},
componentWillReceiveProps: function(nextProps) {
- this.setState({folded: nextProps.folded});
+ if(nextProps.folded != null) {
+ this.setState({folded: nextProps.folded});
+ }
},
render: function() {
// hidden the no category if empty
diff --git a/src/web/js/components/MiddlePanel.react.js b/src/web/js/components/MiddlePanel.react.js
index dad33acc..cb5be92d 100644
--- a/src/web/js/components/MiddlePanel.react.js
+++ b/src/web/js/components/MiddlePanel.react.js
@@ -35,7 +35,7 @@ var TableLine = React.createClass({
icon = <Glyphicon glyph="ban-circle" />;
}
var title = (<a href={'/article/redirect/' + this.props.article_id}
- onClick={this.openRedirectLink}>
+ onClick={this.openRedirectLink} target="_blank">
{icon} {this.props.feed_title}
</a>);
var read = (<Glyphicon glyph={this.state.read?"check":"unchecked"}
@@ -43,10 +43,6 @@ var TableLine = React.createClass({
var liked = (<Glyphicon glyph={this.state.liked?"star":"star-empty"}
onClick={this.toogleLike} />);
icon = <Glyphicon glyph={"new-window"} />;
- var newTab = (<a href={'/article/redirect/' + this.props.article_id}
- onClick={this.openRedirectLink} target="_blank">
- {icon}
- </a>);
var clsses = "list-group-item";
if(this.props.selected) {
clsses += " active";
@@ -57,7 +53,7 @@ var TableLine = React.createClass({
<h5><strong>{title}</strong></h5>
<JarrTime text={this.props.date}
stamp={this.props.timestamp} />
- <div>{read} {liked} {newTab} {this.props.title}</div>
+ <div>{read} {liked} {this.props.title}</div>
</div>
);
},
diff --git a/src/web/js/components/RightPanel.react.js b/src/web/js/components/RightPanel.react.js
index 39b06f38..6005e954 100644
--- a/src/web/js/components/RightPanel.react.js
+++ b/src/web/js/components/RightPanel.react.js
@@ -35,6 +35,7 @@ var PanelMixin = {
</Button>);
}
btn_grp = (<ButtonGroup bsSize="small">
+ {this.getExtraButton()}
{edit_button}
{rem_button}
</ButtonGroup>);
@@ -169,13 +170,28 @@ var Article = React.createClass({
],
obj_type: 'article',
getTitle: function() {return this.props.obj.title;},
+ getExtraButton: function() {
+ if(!this.props.obj.readability_available) {
+ return null;
+ }
+ return (<Button id="readability-reload" onClick={this.reloadParsed}
+ active={this.props.obj.readability_parsed}>
+ <img src="/static/img/readability.png" />
+ </Button>);
+ },
getBody: function() {
return (<div className="panel-body">
{this.getCore()}
- <div dangerouslySetInnerHTML={
+ <div id="article-content" dangerouslySetInnerHTML={
{__html: this.props.obj.content}} />
</div>);
},
+ reloadParsed: function() {
+ if(this.props.obj.readability_available
+ && !this.props.obj.readability_parsed) {
+ RightPanelActions.loadArticle(this.props.obj.id, true, true);
+ }
+ },
});
var Feed = React.createClass({
@@ -188,10 +204,13 @@ var Feed = React.createClass({
{'title': 'Feed link', 'type': 'link', 'key': 'link'},
{'title': 'Site link', 'type': 'link', 'key': 'site_link'},
{'title': 'Enabled', 'type': 'bool', 'key': 'enabled'},
+ {'title': 'Auto Readability',
+ 'type': 'bool', 'key': 'readability_auto_parse'},
{'title': 'Filters', 'type': 'ignore', 'key': 'filters'},
{'title': 'Category', 'type': 'ignore', 'key': 'category_id'},
],
getTitle: function() {return this.props.obj.title;},
+ getExtraButton: function() {return null;},
getFilterRow: function(i, filter) {
return (<dd key={'d' + i + '-' + this.props.obj.id}
className="input-group filter-row">
@@ -317,8 +336,6 @@ var Feed = React.createClass({
<dd><JarrTime stamp={this.props.obj.last_stamp}
text={this.props.obj.last_retrieved} />
</dd>
- <dt>Number of articles</dt>
- <dd>{this.props.obj.nb_articles}</dd>
</dl>
{this.getErrorFields()}
{this.getCategorySelect()}
@@ -353,6 +370,7 @@ var Category = React.createClass({
if(this.props.obj.id != 0) {return true;}
else {return false;}
},
+ getExtraButton: function () {return null;},
isRemovable: function() {return this.isEditable();},
obj_type: 'category',
fields: [{'title': 'Category name', 'type': 'string', 'key': 'name'}],
@@ -423,9 +441,9 @@ var RightPanel = React.createClass({
key={this.state.category.id} />);
}
- return (<Col id="right-panel" xsOffset={4} smOffset={4}
- mdOffset={7} lgOffset={6}
- xs={8} sm={8} md={5} lg={6}>
+ return (<Col id="right-panel" xsHidden
+ smOffset={4} mdOffset={7} lgOffset={6}
+ sm={8} md={5} lg={6}>
{breadcrum}
{cntnt}
</Col>
bgstack15