Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag browser page #47

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions js/components/tag-list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* @jsx React.DOM
*/

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 tag={tag}>{tag}</Tag>);
});
},
getCountries:function(){
return this.props.data.getCountries().map(function(country){
var country = country.replace('.','');
return (<img className="artist-country" title="" src={"/flags/_flag_" + country + ".png"} />);
});
},
render: function() {

return (
<div className="release-full article">
<div className="centered-article">

<div className="post">
<h1 className="article-title">Countries</h1>
<p>{this.getCountries()}</p>
<h1 className="article-title">Tags</h1>
<p>{this.getTags()}</p>
</div>
</div>
</div>
);
}

});

module.exports = TagList;
3 changes: 3 additions & 0 deletions js/components/topbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ var Topbar = React.createClass({
}, {
link: '/about',
label: 'About'
}, {
link: '/tag',
label: 'Tags'
}, {
link: '/blog',
label: 'Blog'
Expand Down
2 changes: 2 additions & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,6 +28,7 @@ var SlimStat = require('./lib/slimstat');
React.renderComponent(
<Routes onActiveStateChange={SlimStat} location="history">
<Route name="home" path="/" handler={App} data={enrReleases}>
<Route name="tags" path="tag" handler={TagList} data={enrReleases} />
<Route name="tag" path="tag/:tag" handler={Releases} data={enrReleases} />
<Route name="release" path="release/:cat" handler={ReleaseDetail} data={enrReleases} />
<Route name="about" path="about" handler={About} data={enrReleases} />
Expand Down
5 changes: 5 additions & 0 deletions js/models/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down