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 comments to datasets resources #397

Merged
merged 5 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
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
7 changes: 1 addition & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ RUN pip install cython && \
pip install --no-cache-dir -r "${APP_DIR}/src/ckanext-validation/requirements.txt" && \
# datarequests
pip install --no-cache-dir -e "git+https://github.com/conwetlab/ckanext-datarequests.git#egg=ckanext-datarequests" && \
# disqus
pip install --no-cache-dir -e "git+https://github.com/okfn/ckanext-disqus#egg=ckanext-disqus" && \
# hdx
pip uninstall psycopg2-binary -y && \
pip uninstall psycopg2 -y && \
Expand All @@ -55,7 +53,6 @@ ENV CKAN__PLUGINS envvars \
recline_view \
validation \
knowledgehub \
disqus \
stats \
datastore \
datapusher \
Expand All @@ -74,9 +71,7 @@ RUN paster --plugin=ckan config-tool ${APP_DIR}/production.ini "ckan.views.defau
RUN paster --plugin=ckan config-tool ${APP_DIR}/production.ini "ckan.extra_resource_fields = theme sub_theme research_question"
# Show data request badge
RUN paster --plugin=ckan config-tool ${APP_DIR}/production.ini "ckan.datarequests.show_datarequests_badge = true"
# Set up Disqus
RUN paster --plugin=ckan config-tool ${APP_DIR}/production.ini "disqus.name = knowledgehub-ckan"
RUN paster --plugin=ckan config-tool ${APP_DIR}/production.ini "disqus.disqus_url = knowledgehub-staging.keitaro.app"

# Set max resource size to 500MB
RUN paster --plugin=ckan config-tool ${APP_DIR}/production.ini "ckan.max_resource_size = 500"
# Set facets for datasets
Expand Down
2 changes: 1 addition & 1 deletion ckanext/knowledgehub/fanstatic/css/main.css

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions ckanext/knowledgehub/fanstatic/less/_dashboards.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.dashboard-content {
padding-right: 0px;
}

.dashboard-comments {
padding: 0px;
padding-left: 5px;
background-color: #ffffff;

.comments-wrapper {
overflow-x: hidden;
margin: 0px;
}
}

.dashboard-row-wrapper {
background-color: #ffffff;
}
1 change: 1 addition & 0 deletions ckanext/knowledgehub/fanstatic/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
@import "_newsfeed.less";
@import "_comments.less";
@import "_bootstrap-suggest.less";
@import "_dashboards.less";

@import "_responsive-lg.less";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,4 @@
style="max-width: {{ width or 'initial' }}; height: {{ height or 'initial' }};">
Loading...
</div>

</div>
336 changes: 172 additions & 164 deletions ckanext/knowledgehub/templates/dashboard/view.html

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions ckanext/knowledgehub/templates/package/resource_read.html
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@
{% endif %}

{% endif %}

{% endfor %}
{% else %}
{# Views not created #}
Expand Down Expand Up @@ -399,6 +400,13 @@
{% endif %}
</div>

{% if views_created and current_resource_view['id'] %}
<section class="comments">
<h4 class="text-uppercase">{{ _('Comments') }} <i class="fa fa-comments-o"></i> {{ h.get_comments_count(current_resource_view['id']) }}</h4>
{% snippet 'snippets/comments.html', user=c.userobj, ref=current_resource_view['id'], enable_multilevel_replies=False, ref_type='visualization' %}
</section>
{% endif %}

{% endblock %}

{% block primary_content %}
Expand Down Expand Up @@ -540,6 +548,4 @@ <h2>{{ _('Data Quality') }}</h2>
</section>

{{ super() }}

{{ h.disqus_comments() }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
{% set data_quality = h.get_package_data_quality(pkg_dict.id) %}
{% if c.userobj %}
<section class="dataset-comments">
<h3>{{ _('Comments') }} <i class="fa fa-comments-o"></i> {{h.get_comments_count(pkg_dict.id)}}</h3>
{% snippet 'snippets/comments.html', user=c.userobj, ref=pkg_dict.id, enable_multilevel_replies=False, ref_type='dataset' %}
</section>
{% endif %}
<section class="additional-info">
<h3>{{ _('Additional Info') }}</h3>
<table class="table table-striped table-bordered table-condensed">
Expand Down
7 changes: 7 additions & 0 deletions ckanext/knowledgehub/templates/research_question/read.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ <h1 class="text-wrap">
{% snippet "research_question/snippets/additional_info.html", rq=rq %}
{% endblock %}

{% block comments %}
<section class="comments">
<h4 class="text-uppercase">{{ _('Comments') }} <i class="fa fa-comments-o"></i> {{h.get_comments_count(rq.id)}}</h4>
{% snippet 'snippets/comments.html', user=c.userobj, ref=rq.id, enable_multilevel_replies=False, ref_type='research-question' %}
</section>
{% endblock %}

{% block related_dashboards %}
<h4>RELATED DASHBOARDS</h4>
{% set rel_dash = h.get_rqs_dashboards(rq['id']) %}
Expand Down
8 changes: 7 additions & 1 deletion ckanext/knowledgehub/templates/snippets/comments.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,13 @@ <h1>{{pkg.title}}</h1>
{% resource 'knowledgehub/comments' %}
{% resource 'knowledgehub/mentions' %}
{% set enable_multilevel_replies = enable_multilevel_replies if not none else False %}
<div class="container-fluid comments-wrapper" user="{{user.id}}" show-comments-for="{{ref}}" {%if enable_multilevel_replies %} enable-multilevel-replies="true" {% endif %}>
{% set ref_type = ref_type if not none else 'post' %}
{% set user = user if not none else {'id': '', 'display_name': 'Not logged in', 'email_hash': ''}%}
<div class="container-fluid comments-wrapper"
user="{{user.id}}"
show-comments-for="{{ref}}"
ref-type="{{ref_type}}"
{%if enable_multilevel_replies %} enable-multilevel-replies="true" {% endif %}>
<div class="row">
<div class="col-md-12 add-new-comment"></div>
</div>
Expand Down