Skip to content

Commit

Permalink
Merge pull request #221 from B2SHARE/ui/private-files-#101
Browse files Browse the repository at this point in the history
fixed #101: added message when a record contains private files
  • Loading branch information
peskk3am committed Apr 1, 2014
2 parents 5db7498 + 0d880c9 commit 5d6a56f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions invenio/lib/record_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,10 @@ def _format_record(recid, of='hd', user_info=current_user, *args, **kwargs):

@register_template_context_processor
def record_context():
files = [f for f in BibRecDocs(recid, human_readable=True).list_latest_files(list_hidden=False) \
if not f.is_icon() and f.is_restricted(current_user)[0] == 0]
all_files = [f for f in BibRecDocs(recid, human_readable=True).list_latest_files(list_hidden=False) \
if not f.is_icon()]
files = [f for f in all_files if f.is_restricted(current_user)[0] == 0]
has_private_files = len(files) < len(all_files)

return dict(recid=recid,
record=record,
Expand All @@ -146,6 +148,7 @@ def record_context():
get_mini_reviews(*args, **kwargs).decode('utf8'),
collection=collection,
format_record=_format_record,
has_private_files=has_private_files,
files=files
)
return f(recid, *args, **kwargs)
Expand Down
5 changes: 4 additions & 1 deletion invenio/templates/record.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
{%- if formattedrecord %}
<div class="span8">
{{formattedrecord}}
<div class="accordion" id="record_detail">
<div class="accordion" id="record_detail" style="margin-top:10px">
{% if files %}
<div class="accordion-group" id="preview">
<div class="accordion-heading">
Expand Down Expand Up @@ -79,6 +79,9 @@
</div>
<a href="/abuse/{{ recid }}">Report abuse</a>
{% endif%}
{% if has_private_files %}
<p><i class="icon-lock"></i>This record contains private files, which are not listed here.</p>
{% endif%}
{% block record_tabs %}
{%- for tab in tabs|sort(attribute='order') -%}
{%- if False and tab.visible and tab.key != 'record.metadata' and tab.key != 'record.files' and tab.enabled -%}
Expand Down

0 comments on commit 5d6a56f

Please sign in to comment.