Fixs for added features
This commit is contained in:
parent
1b58469276
commit
df22391bd9
|
@ -52,5 +52,6 @@ class RatingPackageController(PackageController):
|
|||
c.current_page = self._get_page_number(request.params)
|
||||
else:
|
||||
c.current_page = 1
|
||||
c.pkg_type = 'dataset'
|
||||
result = super(RatingPackageController, self).search()
|
||||
return result
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
{% ckan_extends %}
|
||||
|
||||
{% block form %}
|
||||
{% set facets = {
|
||||
'fields': c.fields_grouped,
|
||||
'search': c.search_facets,
|
||||
'titles': c.facet_titles,
|
||||
'translated_fields': c.translated_fields,
|
||||
'remove_field': c.remove_field }
|
||||
%}
|
||||
{% set sorting = [
|
||||
(_('Relevance'), 'score desc, metadata_modified desc'),
|
||||
(_('Name Ascending'), 'title_string asc'),
|
||||
(_('Name Descending'), 'title_string desc'),
|
||||
(_('Rating Ascending'), 'rating asc'),
|
||||
(_('Rating Descending'), 'rating desc'),
|
||||
(_('Last Modified'), 'metadata_modified desc'),
|
||||
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ]
|
||||
%}
|
||||
{% snippet 'snippets/search_form.html', form_id='dataset-search-form', type='dataset', query=c.q, sorting=sorting, sorting_selected=c.sort_by_selected, count=c.page.item_count, facets=facets, show_empty=request.params, error=c.query_error, fields=c.fields %}
|
||||
{% set facets = {
|
||||
'fields': c.fields_grouped,
|
||||
'search': c.search_facets,
|
||||
'titles': c.facet_titles,
|
||||
'translated_fields': c.translated_fields,
|
||||
'remove_field': c.remove_field }
|
||||
%}
|
||||
{% set sorting = [
|
||||
(_('Relevance'), 'score desc, metadata_modified desc'),
|
||||
(_('Name Ascending'), 'title_string asc'),
|
||||
(_('Name Descending'), 'title_string desc'),
|
||||
(_('Rating Ascending'), 'rating asc') if h.show_rating_in_type(c.pkg_type) else (false, false),
|
||||
(_('Rating Descending'), 'rating desc') if h.show_rating_in_type(c.pkg_type) else (false, false),
|
||||
(_('Last Modified'), 'metadata_modified desc'),
|
||||
(_('Popular'), 'views_recent desc') if g.tracking_enabled else (false, false) ]
|
||||
%}
|
||||
{% snippet 'snippets/search_form.html', form_id='dataset-search-form', type='dataset', query=c.q, sorting=sorting, sorting_selected=c.sort_by_selected, count=c.page.item_count, facets=facets, show_empty=request.params, error=c.query_error, fields=c.fields %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -7,28 +7,29 @@ package - The package for which the rating is displayed
|
|||
#}
|
||||
|
||||
{% resource "rating_css/rating.css" %}
|
||||
|
||||
<div class="rating">
|
||||
{% block general_rating %}
|
||||
<h2 class="heading">{{ _('Rating') }}</h2>
|
||||
<div class="rating-container">
|
||||
{% snippet "rating/snippets/stars_inactive.html", package=package %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block user_rating %}
|
||||
{% if h.check_access('check_access_user') %}
|
||||
<h2 class="heading">{{ _('Your rating') }}</h2>
|
||||
{% if h.show_rating_in_type(package.type) %}
|
||||
<div class="rating">
|
||||
{% block general_rating %}
|
||||
<h2 class="heading">{{ _('Rating') }}</h2>
|
||||
<div class="rating-container">
|
||||
{%- snippet "rating/snippets/stars.html", package=package -%}
|
||||
{% block user_rating_br %}<br>{% endblock %}
|
||||
<span class="rating-details">
|
||||
{%- snippet "rating/snippets/rating_description.html", rating=h.get_user_rating(package.id) -%}
|
||||
</span>
|
||||
{% snippet "rating/snippets/stars_inactive.html", package=package %}
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="login-rating-details">
|
||||
<a href="{{h.url_for('login')}}">Login</a> to leave an App Rating
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block user_rating %}
|
||||
{% if h.check_access('check_access_user') %}
|
||||
<h2 class="heading">{{ _('Your rating') }}</h2>
|
||||
<div class="rating-container">
|
||||
{%- snippet "rating/snippets/stars.html", package=package -%}
|
||||
{% block user_rating_br %}<br>{% endblock %}
|
||||
<span class="rating-details">
|
||||
{%- snippet "rating/snippets/rating_description.html", rating=h.get_user_rating(package.id) -%}
|
||||
</span>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="login-rating-details">
|
||||
<a href="{{h.url_for('login')}}">Login</a> to leave an App Rating
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -15,10 +15,10 @@ package - The package for which the rating belongs to
|
|||
<span class="star-rating{% if stars == 0 %} no-stars{% endif %}">
|
||||
<span class="star-rating-stars">
|
||||
{%- for index in range(stars|int) -%}
|
||||
<a class="rating-star" id="star-{{index}}" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"><i class="user-rating-star icon icon-star" id="star-{{index}}""></i></a>
|
||||
<a class="rating-star" id="star-{{index}}" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"><i class="user-rating-star icon icon-star" id="star-{{index}}"></i></a>
|
||||
{%- endfor -%}
|
||||
{%- for index in range(stars|int, 5) -%}
|
||||
<a class="rating-star" id="star-{{index}}" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"><i class="user-rating-star icon icon-star-empty"></i></a>
|
||||
<a class="rating-star" id="star-{{index}}" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"><i class="user-rating-star icon icon-star-empty"></i></a>
|
||||
{%- endfor -%}
|
||||
</span>
|
||||
</span>
|
||||
|
|
Loading…
Reference in New Issue