Skip to content

Commit

Permalink
https://github.com/DanePubliczneGovPl/ckanext-danepubliczne/issues/62
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMadejski committed Mar 30, 2015
1 parent c399f70 commit 621378d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
14 changes: 13 additions & 1 deletion ckanext/qa/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import ckan.model as model
import ckan.plugins as p
import ckan.lib.celery_app as celery_app
from ckan.common import _

resource_dictize = model_dictize.resource_dictize
send_task = celery_app.celery.send_task
Expand Down Expand Up @@ -175,7 +176,18 @@ def get_star_rating_html(cls, stars, reason):
return p.toolkit.literal(p.toolkit.render('qa/snippets/stars.html',
extra_vars=extra_vars))

@classmethod
def get_qa_captions(cls):
return [
_('Available under an open license.'),
_('Available as structured data (eg. Excel instead of a scanned table).'),
_('Uses non-proprietary formats (e.g., CSV instead of Excel).'),
_('Uses URIs to identify things, so that people can link to it.'),
_('Linked to other data to provide context.')
]

def get_helpers(self):
return {'qa_stars': self.new_get_star_html,
'qa_stars_rating': self.get_star_rating_html,
'qa_stars_info': self.get_star_info_html}
'qa_stars_info': self.get_star_info_html,
'qa_captions': self.get_qa_captions}
9 changes: 1 addition & 8 deletions ckanext/qa/templates_new/qa/snippets/stars_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,9 @@
{% snippet "qa/snippets/stars_info.html", stars=3 %}

#}
{% set captions = [
_('Available under an open license.'),
_('Available as structured data (eg. Excel instead of a scanned table).'),
_('Uses non-proprietary formats (e.g., CSV instead of Excel).'),
_('Uses URIs to identify things, so that people can link to it.'),
_('Linked to other data to provide context.')
] %}

<ul class="simple-list rating-info unstyled">
{% for caption in captions %}
{% for caption in h.qa_captions() %}
<li{% if stars < loop.index %} class="fail"{% endif %}><span>{{ ('&#9733;' * loop.index) | safe }}</span> {{ caption }}</li>
{% endfor %}
</ul>

0 comments on commit 621378d

Please sign in to comment.