-
-
Save anirudhjain75/c3666d4bf35462bb9e0fa344274d2c6c to your computer and use it in GitHub Desktop.
Musicbrainz Attributes file ( Convert from .tt to ReactJs )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import Layout from '../../layout'; | |
const Attributes = (models = Props.models, model = Props.model, attributes = Props.attributes) => ( | |
<Layout fullWidth title={ model ? model : l('Attributes')}> | |
{models ? ( | |
<div> | |
<h1>l('Attributes')</h1> | |
{models.map((item) => (<li><a href="[% c.uri_for_action('/admin/attributes/attribute_index', [ {item} ]) %]">{item}</a></li>))} | |
</div> | |
): ( | |
<div> | |
<h1><a href="[% c.uri_for_action('/admin/attributes/index') %]">l('Attributes')</a> / {model}</h1> | |
<table> | |
<thead> | |
<tr> | |
<th>l('ID')</th> | |
<th>l('Name')</th> | |
<th>l('Description')</th> | |
<th>l('Child order')</th> | |
<th>l('Parent ID')</th> | |
{model == 'MediumFormat' ? <th>l('Year')</th> : null} | |
{model == 'MediumFormat' ? <th>l('Disc IDs allowed')</th> : null} | |
{model == 'SeriesType' || model == 'CollectionType' ? <th>l('Entity type')</th> : null} | |
{model == 'WorkAttributeType' ? <th>l('Free text')</th> : null} | |
<th>l('Actions')</th> | |
</tr> | |
</thead> | |
{attributes.sort('name').map((attribute) => { | |
<tr> | |
<td>{attribute.id}</td> | |
<td>{attribute.name}</td> | |
<td>{attribute.description}</td> | |
<td>{attribute.child_order}</td> | |
<td>{attribute.parent_id}</td> | |
{model == 'MediumFormat' ? <td>{attribute.year}</td> : null} | |
{model == 'MediumFormat' ? <td>{attribute.has_discids}</td> : null} | |
{model == 'SeriesType' || model == 'CollectionType' ? <td>{attribute.entity_type}</td> : null} | |
{model == 'WorkAttributeType' ? <td>{attribute.free_text}</td> : null} | |
<td><a href="[% c.uri_for_action('/admin/attributes/edit', [ { model }, {attribute.id}]) %]">l('Edit')</a> | <a href="[% c.uri_for_action('/admin/attributes/delete', [ { model }, {attribute.id} ]) %]">[% l('Remove') %]</a></td> | |
</tr> | |
})} | |
</table> | |
<p><span class="buttons"><a href="[% c.uri_for_action('/admin/attributes/create', [ { model } ]) %]">l('Add new attribute')</a></span></p> | |
</div> | |
)} | |
</Layout> | |
) | |
export default Attributes; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment