Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add visualize btn #263

Merged
merged 3 commits into from
Nov 26, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 58 additions & 4 deletions ckanext/knowledgehub/templates/package/resource_read.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,62 @@
{% ckan_extends %}

{% block resource_actions %}
{{ super() }}

<ul>
{% block resource_actions_inner %}
{% if h.check_access('package_update', {'id':pkg.id }) %}
<li>{% link_for _('Manage'), controller='package', action='resource_edit', id=pkg.name, resource_id=res.id, class_='btn btn-default', icon='wrench' %}</li>

<li>
<div class="btn-group">
<a class="btn btn-primary dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-bar-chart"></i>
{{ _('visualize') }}
<span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li>
<a href="{% url_for 'chart_view.new_chart', id=pkg.name, resource_id=res.id %}"><i class="fa fa-line-chart"></i>
{{ _('Chart') }}</a>
</li>
<li>
<a href="{% url_for 'table_view.new_table', id=pkg.name, resource_id=res.id %}"><i class="fa fa-table"></i>
{{ _('Table') }}</a>
</li>
<li>
<a href="{% url_for 'map_view.new_map', id=pkg.name, resource_id=res.id %}"><i class="fa fa-map"></i>
{{ _('Map') }}</a>
</li>
</ul>
</div>
</li>
{% endif %}

{% if res.url and h.is_url(res.url) %}
<li>
<div class="btn-group">
<a class="btn btn-primary resource-url-analytics resource-type-{{ res.resource_type }}" href="{{ res.url }}">
{% if res.resource_type in ('listing', 'service') %}
<i class="fa fa-eye"></i> {{ _('View') }}
{% elif res.resource_type == 'api' %}
<i class="fa fa-key"></i> {{ _('API Endpoint') }}
{% elif (not res.has_views or not res.can_be_previewed) and not res.url_type == 'upload' %}
<i class="fa fa-external-link"></i> {{ _('Go to resource') }}
{% else %}
<i class="fa fa-arrow-circle-o-down"></i> {{ _('Download') }}
{% endif %}
</a>
{% block download_resource_button %}
{{ super() }}
{% endblock %}
</div>
</li>
{% endif %}

{% if res.datastore_active %}
<li>{% snippet 'package/snippets/data_api_button.html', resource=res %}</li>
{% endif %}
{% endblock %}
</ul>
{% endblock %}
{% block resource_content %}
{% block resource_read_title %}<h1 class="page-heading">{{ h.resource_display_name(res) | truncate(50) }}</h1>{% endblock %}
Expand Down Expand Up @@ -52,7 +106,7 @@ <h3>{{ _('From the dataset abstract') }}</h3>
<input id="dataset" value="{{ res.package_id }}" type="hidden" />
</div>
</div>

{% endblock %}

{% block resource_view_content %}
Expand Down Expand Up @@ -215,7 +269,7 @@ <h3>{{ _('From the dataset abstract') }}</h3>
<a href="javascript:void(0);" data-toggle="collapse" data-target="#data-view-info">
{{ _('Click here for more information.') }}</a>
</p>

<div id="data-view-info" class="collapse">
<p>{{ _('Here are some reasons you may not be seeing expected views:') }}</p>
<ul>
Expand Down