From 3f04e3e86bd231d930ec725b3a7d36493b4c422c Mon Sep 17 00:00:00 2001 From: josh coffman Date: Sat, 9 May 2015 19:24:12 -0700 Subject: [PATCH 1/5] moved vars to state --- react/react.js | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/react/react.js b/react/react.js index 34c2bc7..90dd2f7 100644 --- a/react/react.js +++ b/react/react.js @@ -28,10 +28,7 @@ var IssueList = React.createClass({ }); var IssueRow = React.createClass({ - render: function() { - var converter = new Showdown.converter(); - var dangerousHtml = converter.makeHtml(this.props.body.toString()); - + getInitialState: function() { var state = this.props.state; var classString = 'issue ' + state; var tagList = ''; @@ -44,14 +41,37 @@ var IssueRow = React.createClass({ title={tag.name} />); }); + return { + classString: classString, + state: state, + tagList: tagList, + tags: tags, + }; + }, + toggleExpanded: function(ev) { + var newClassString + var expandedClass = ' expanded'; + if (this.state.classString.indexOf(expandedClass) > 0) { + newClassString = this.state.classString.replace(expandedClass, ''); + } else { + newClassString += expandedClass; + } + this.setState({ + classString: newClassString, + }); + }, + render: function() { + var converter = new Showdown.converter(); + var dangerousHtml = converter.makeHtml(this.props.body.toString()); + return ( -
+

{this.props.authorUserLogin}

-
+
state:
-

{state}

+

{this.state.state}

@@ -69,7 +89,7 @@ var IssueRow = React.createClass({
tagged:
-

{tags}

+

{this.state.tags}

From cb6f25fce5a06ab25805b3b91c5e65900733a204 Mon Sep 17 00:00:00 2001 From: josh coffman Date: Sat, 9 May 2015 19:27:34 -0700 Subject: [PATCH 2/5] setting the class for expanded view --- react/react.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/react/react.js b/react/react.js index 90dd2f7..7aadef0 100644 --- a/react/react.js +++ b/react/react.js @@ -49,13 +49,15 @@ var IssueRow = React.createClass({ }; }, toggleExpanded: function(ev) { - var newClassString + var newClassString = this.state.classString; var expandedClass = ' expanded'; + if (this.state.classString.indexOf(expandedClass) > 0) { newClassString = this.state.classString.replace(expandedClass, ''); } else { newClassString += expandedClass; } + this.setState({ classString: newClassString, }); From 8cbdee9f08ae3318d841ba235133d09b92a08758 Mon Sep 17 00:00:00 2001 From: josh coffman Date: Sat, 9 May 2015 19:44:52 -0700 Subject: [PATCH 3/5] toggle area now works like magic --- react/react.js | 4 ++++ style.css | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/react/react.js b/react/react.js index 7aadef0..74e7d7a 100644 --- a/react/react.js +++ b/react/react.js @@ -94,6 +94,10 @@ var IssueRow = React.createClass({

{this.state.tags}

+
+
Im expandable:
+

woot!

+
); }, diff --git a/style.css b/style.css index d699503..0952056 100644 --- a/style.css +++ b/style.css @@ -140,7 +140,7 @@ h6 { .header-thing h1 { color: rgba(255, 255, 255, 0.83); float: right; - letter-spacing: 7px; + letter-spacing: 7px; text-align: center; } @@ -184,3 +184,13 @@ h6 { background-color: rgb(203, 216, 203); box-shadow: 0px 0px 3px rgba(0,0,0,0.3); } + +.expandableArea { + clear: both; + display: none; +} + +.expanded > .expandableArea { + display: inline !important; +} + From da6cc99ff462666ce2fe53e4727277e895be4662 Mon Sep 17 00:00:00 2001 From: josh coffman Date: Sat, 9 May 2015 23:05:05 -0700 Subject: [PATCH 4/5] added some info the the expanding area --- react/react.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/react/react.js b/react/react.js index 74e7d7a..6138450 100644 --- a/react/react.js +++ b/react/react.js @@ -11,10 +11,13 @@ var IssueList = React.createClass({ body={issue.body} createdAt={issue.created_at} updatedAt={issue.updated_at} + closedAt={issue.closed_at} url={issue.html_url} labels={issue.labels} milestone={issue.milestone} number={issue.number} + comments={issue.comments} + pullRequest={issue.pull_request} state={issue.state} title={issue.title} />); }); @@ -95,8 +98,11 @@ var IssueRow = React.createClass({
-
Im expandable:
-

woot!

+
+
+ comments : {this.props.comments} +
+
); From 74cd4e7d20ae92c0c56c7106f4ac0dd3a167ac2f Mon Sep 17 00:00:00 2001 From: josh coffman Date: Sat, 9 May 2015 23:27:15 -0700 Subject: [PATCH 5/5] removing jquery --- index.html | 1 + react/react.js | 16 +++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index e548be7..1b94e31 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,7 @@ + diff --git a/react/react.js b/react/react.js index 6138450..0542be6 100644 --- a/react/react.js +++ b/react/react.js @@ -221,6 +221,7 @@ var FilterableIssueList = React.createClass({ }, updateIssues: function() { var headers = null; + var self = this; if (this.state.authToken !== null && this.state.authToken.length > 0) { headers = { @@ -228,7 +229,7 @@ var FilterableIssueList = React.createClass({ }; } - $.ajax({ + reqwest({ url: 'https://api.github.com/repos/' + this.state.repo + '/issues', headers: headers, data: { @@ -236,13 +237,14 @@ var FilterableIssueList = React.createClass({ sort: this.state.sort, state: this.state.state, }, - success: function(result) { - if (this.isMounted()) { - this.setState({ - issues: result, - }); + method: 'get', + success: function (result) { + if (self.isMounted()) { + self.setState({ + issues: result, + }); + } } - }.bind(this), }); }, onUpdateDisplayClosed: function(val) {