Skip to content

Commit

Permalink
Implemented the reviewal of labels
Browse files Browse the repository at this point in the history
  • Loading branch information
spellew committed Aug 8, 2019
1 parent 0558b7c commit 8bfae4f
Show file tree
Hide file tree
Showing 9 changed files with 87 additions and 1 deletion.
1 change: 1 addition & 0 deletions critiquebrainz/db/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"place",
"release_group",
"artist",
"label",
]


Expand Down
7 changes: 7 additions & 0 deletions critiquebrainz/frontend/static/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
@artist-color: @blue;
@event-color: @green;
@place-color: @yellow;
@label-color: @blue;

body {
padding-bottom: 25px;
Expand Down Expand Up @@ -131,6 +132,9 @@ ul.sharing {
&.place {
background-color: fade(@place-color, 70%);
}
&.label {
background-color: fade(@label-color, 70%);
}
&.event {
background-color: fade(@event-color, 70%);
}
Expand Down Expand Up @@ -493,6 +497,9 @@ a#edit-review { margin-top: 20px; }
&.place {
background-color: fade(@place-color, 70%);
}
&.label {
background-color: fade(@label-color, 70%);
}
&.event {
background-color: fade(@event-color, 70%);
}
Expand Down
2 changes: 2 additions & 0 deletions critiquebrainz/frontend/templates/entity_review.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
artist = entity['artist-credit-phrase'] | default(_('[Unknown artist]'))) }}
{% elif review.entity_type == 'artist' %}
{{ _('%(artist)s', artist = '<b>'|safe + entity.name | default(_('[Unknown artist]')) + '</b>'|safe) }}
{% elif review.entity_type == 'label' %}
{{ _('%(label)s', label = '<b>'|safe + entity.name | default(_('[Unknown label]')) + '</b>'|safe) }}
{% elif review.entity_type == 'event' %}
{{ _('%(event)s', event = '<b>'|safe + entity.name | default(_('[Unknown event]')) + '</b>'|safe) }}
{% elif review.entity_type == 'place' %}
Expand Down
22 changes: 22 additions & 0 deletions critiquebrainz/frontend/templates/label/entity.html
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
{% extends 'base.html' %}

{# {% block title %}{{ event.name }} - CritiqueBrainz{% endblock %} #}

{% block content %}
<div class="clearfix">
<h2 class="pull-left">
{# {{ event.name }} #}
</h2>

{% if not my_review %}
<a id="write-review" href="{{ url_for('review.create', label=id) }}"
role="button" class="btn btn-success pull-right">
<span class="glyphicon glyphicon-asterisk"></span> {{ _('Write a review') }}
</a>
{% else %}
<a id="edit-review" href="{{ url_for('review.edit', id=my_review.id) }}"
role="button" class="btn btn-primary pull-right">
<span class="glyphicon glyphicon-edit"></span> {{ _('Edit my review') }}
</a>
{% endif %}
</div>
{% endblock %}
7 changes: 7 additions & 0 deletions critiquebrainz/frontend/templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@
{{ _('Artist') }}
</span>
{% endif %}
{% elif entity_type == 'label' %}
<img src="{{ get_static_path('images/placeholder_place.svg') }}" {{ attributes }} />
{% if overlay_type %}
<span class="entity-type label">
{{ _('Label') }}
</span>
{% endif %}
{% else %} {# release-group #}
<img {{ attributes }} />
{% if overlay_type %}
Expand Down
2 changes: 2 additions & 0 deletions critiquebrainz/frontend/templates/review/browse.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ <h2>{{ _('Reviews') }}</h2>
<a href="{{ url_for('review.browse', entity_type='release_group') }}">{{ _('Release group') }}</a></li>
<li role="presentation" {{ "class=active" if entity_type == 'artist' }}>
<a href="{{ url_for('review.browse', entity_type='artist') }}">{{ _('Artist') }}</a></li>
<li role="presentation" {{ "class=active" if entity_type == 'label' }}>
<a href="{{ url_for('review.browse', entity_type='label') }}">{{ _('Label') }}</a></li>
<li role="presentation" {{ "class=active" if entity_type == 'event' }}>
<a href="{{ url_for('review.browse', entity_type='event') }}">{{ _('Event') }}</a></li>
<li role="presentation" {{ "class=active" if entity_type == 'place' }}>
Expand Down
24 changes: 24 additions & 0 deletions critiquebrainz/frontend/templates/review/entity/label.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{% extends 'review/entity/base.html' %}

{% set label = review.entity_id | entity_details(type='label') %}

{% block title %}
{% set label_title = label.name | default(_('[Unknown label]')) %}
{{ _('Review of "%(label)s" by %(user)s', label=label_title, user=review.user.display_name) }} - CritiqueBrainz
{% endblock %}

{% block entity_title %}
<h2 id="title">
{% if label %}
{% set label_name = '<a href="%s">' | safe % url_for('label.entity', id=review.entity_id) ~ label.name ~ '</a>'|safe %}
{% else %}
{% set label_name = _('[Unknown label]') %}
{% endif %}

{{ _('%(label)s', label=label_name) }}

{% if label['life-span'] %}
<small>{{ label['life-span']['begin'][:4] }}</small>
{% endif %}
</h2>
{% endblock %}
21 changes: 21 additions & 0 deletions critiquebrainz/frontend/templates/review/modify/label.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{% if entity is not defined %}
{% set entity = review.entity_id | entity_details(type=entity_type) %}
{% endif %}
<div class="col-md-12">
<dl class="dl-horizontal">
<dt>{{ _('Label') }}</dt>
<dd>
{{ entity['name'] | default(_('[Unknown label]')) }}
{% if entity['life-span'] %}
<span class="text-muted">({{ entity['life-span']['begin'] }} - {{ entity['life-span']['end'] }})</span>
{% endif %}
</dd>
<dt>{{ _('Type') }}</dt>
<dd>{{ entity['type'] or '-' }}</dd>
<dt>{{ _('Country') }}</dt>
<dd>{{ entity['area'] or '-' }}</dd>
{% block more_info %}
{# Information like creation date, votes etc. #}
{% endblock %}
</dl>
</div>
2 changes: 1 addition & 1 deletion critiquebrainz/frontend/templates/search/selector.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,12 @@ <h3>{{ _('Label selection') }}</h3>
<th>{{ _('Name') }}</th>
<th>{{ _('Type') }}</th>
<th>{{ _('Country') }}</th>
<th></th>
</tr>
{% endif %}
</thead>
<tbody id="results">{% include 'search/selector_results.html' %}</tbody>
</table>

<div class="row">
{% if count > limit %}
<div class="col-md-6">
Expand Down

0 comments on commit 8bfae4f

Please sign in to comment.