From 5f6416b59562ea1d1f4d10b3887253aacdebcce5 Mon Sep 17 00:00:00 2001 From: Dan Peddle Date: Sun, 1 Mar 2015 11:16:00 +0100 Subject: [PATCH 1/2] add tag list page skeleton --- js/components/tag-list.js | 19 +++++++++++++++++++ js/components/topbar.js | 3 +++ js/index.js | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 js/components/tag-list.js diff --git a/js/components/tag-list.js b/js/components/tag-list.js new file mode 100644 index 0000000..b570fa1 --- /dev/null +++ b/js/components/tag-list.js @@ -0,0 +1,19 @@ +/** + * @jsx React.DOM + */ + +var React = require('react/addons'); + +var Tag = require('./tag'); + +var TagList = React.createClass({ + + render: function() { + return ( +
+ ); + } + +}); + +module.exports = TagList; diff --git a/js/components/topbar.js b/js/components/topbar.js index 87bc42b..306f6d2 100644 --- a/js/components/topbar.js +++ b/js/components/topbar.js @@ -21,6 +21,9 @@ var Topbar = React.createClass({ }, { link: '/about', label: 'About' + }, { + link: '/tag', + label: 'Tags' }, { link: '/blog', label: 'Blog' diff --git a/js/index.js b/js/index.js index 2fa529d..8b5f171 100644 --- a/js/index.js +++ b/js/index.js @@ -18,6 +18,7 @@ var Releases = require('./components/releases'); var ReleaseDetail = require('./components/release-detail'); var About = require('./components/about'); var Blog = require('./components/blog'); +var TagList = require('./components/tag-list'); // slim stat tracking // the router calls it every time the route changes, so we track internal navigation @@ -27,6 +28,7 @@ var SlimStat = require('./lib/slimstat'); React.renderComponent( + From 9ae1a8df8ad312431497a126c414abe7f2ddae9b Mon Sep 17 00:00:00 2001 From: Dan Peddle Date: Sun, 1 Mar 2015 12:01:45 +0100 Subject: [PATCH 2/2] add countries and tags --- js/components/tag-list.js | 25 +++++++++++++++++++++++-- js/models/release.js | 5 +++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/js/components/tag-list.js b/js/components/tag-list.js index b570fa1..bd16869 100644 --- a/js/components/tag-list.js +++ b/js/components/tag-list.js @@ -7,10 +7,31 @@ var React = require('react/addons'); var Tag = require('./tag'); var TagList = React.createClass({ - + getTags:function(){ + return this.props.data.getTags().map(function(tag){ + return ({tag}); + }); + }, + getCountries:function(){ + return this.props.data.getCountries().map(function(country){ + var country = country.replace('.',''); + return (); + }); + }, render: function() { + return ( -
+
+
+ +
+

Countries

+

{this.getCountries()}

+

Tags

+

{this.getTags()}

+
+
+
); } diff --git a/js/models/release.js b/js/models/release.js index 5064579..973a3b9 100644 --- a/js/models/release.js +++ b/js/models/release.js @@ -45,6 +45,11 @@ var ReleaseModel = Backbone.Model.extend({ _.each(tags, function(tag){ + // can remove once https://github.com/enoughrec/arecordlabel/issues/48 is fixed + if (tag == '') { + return; + } + if (tag[0] === '.') { country.push(tag); } else {