Skip to content

Commit

Permalink
Modify to support Bootstrap 3
Browse files Browse the repository at this point in the history
  • Loading branch information
TakumiMiyazawaAbel committed Feb 19, 2025
1 parent ba9e0f4 commit a785a6c
Show file tree
Hide file tree
Showing 3 changed files with 145 additions and 64 deletions.
6 changes: 6 additions & 0 deletions ckanext/feedback/assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,9 @@ input[name="tab-menu"] {
.management-heading a {
color: #333;
}

.text-truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
2 changes: 1 addition & 1 deletion ckanext/feedback/assets/js/approval_and_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function getCheckedCheckboxes(name, approval) {
}

function processAction(action, isApproval) {
const form = document.getElementById('comments-form');
const form = document.getElementById('feedbacks-form');
form.setAttribute("action", action);

const resourceCommentWaiting = getCheckedCheckboxes('resource-comments-checkbox', 'False');
Expand Down
201 changes: 138 additions & 63 deletions ckanext/feedback/templates/admin/approval_and_delete.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,86 +33,157 @@
<h2>{{ _('Approval and Delete') }}</h2>
</form>
<div>
<form id="comments-form" method="post">
<div class="right-text mb-2">
{% set approval_action=h.url_for( "feedback.approve_target" ) %}
{% set delete_action=h.url_for( "feedback.delete_target" ) %}
<button id="approval-button" class="btn btn-primary" type="button" onclick="runApproval('{{ approval_action }}')">
<i class="fa-solid fa-check"></i>
{{ _('Approval') }}
</button>
<button id="delete-button" class="btn btn-danger" type="button" onclick="runDelete('{{ delete_action }}')">
<i class="fa-solid fa-trash"></i>
{{ _('Delete') }}
</button>
</div>
<div class="container">
{% if page.collection %}
<div class="org">
<div class="border-bottom fw-bold mb-2">
<div style="float:left;"><input class="checkbox-inline" type="checkbox" id="target-checkbox-all"></div>
<div class="row form-check-label fs-6">
<div class="col-2">{{ _('Dataset') }}</div>
<div class="col-2">{{ _('Resource') }}</div>
<div class="col-1">{{ _('Type') }}</div>
<div class="col">{{ _('Post Content') }}</div>
<div class="col-2">{{ _('Status') }}</div>
</div>
<form id="feedbacks-form" method="post">
{% if h.is_base_public_folder_bs3() %}
<div class="right-text" style="margin-bottom: 8px;">
{% set approval_action=h.url_for( "feedback.approve_target" ) %}
{% set delete_action=h.url_for( "feedback.delete_target" ) %}
<button id="approval-button" class="btn btn-primary" type="button" onclick="runApproval('{{ approval_action }}')">
<i class="fa-solid fa-check"></i>
{{ _('Approval') }}
</button>
<button id="delete-button" class="btn btn-danger" type="button" onclick="runDelete('{{ delete_action }}')">
<i class="fa-solid fa-trash"></i>
{{ _('Delete') }}
</button>
</div>
<div class="container" style="width: 100%;">
{% if page.collection %}
<div class="row form-check-label" style="font-weight: bold;">
<div class="col-md-1" style="max-width: 10px;"><input class="checkbox-inline" style="margin: 0;" type="checkbox" id="target-checkbox-all"></div>
<div class="col-md-2">{{ _('Dataset') }}</div>
<div class="col-md-2">{{ _('Resource') }}</div>
<div class="col-md-1">{{ _('Type') }}</div>
<div class="col-md-4" style="min-width: 37%;">{{ _('Post Content') }}</div>
<div class="col-md-2">{{ _('Status') }}</div>
</div>
<div style="border-top: 1px solid #eeeeee; margin-bottom: 8px;"></div>
{% for feedback in page.collection %}
<div class="target">
<div style="float:left;">
<div class="row form-check-label" style="font-size: 14px;">
<div class="col-md-1 target" style="max-width: 10px;">
{% if feedback.feedback_type == 'リソースコメント' %}
<input class="checkbox-inline" type="checkbox" name="resource-comments-checkbox" id="{{ feedback.comment_id }}" value="{{ feedback.comment_id }}" data-approval="{{ feedback.is_approved }}">
<input class="checkbox-inline" style="margin: 0;" type="checkbox" name="resource-comments-checkbox" id="{{ feedback.comment_id }}" value="{{ feedback.comment_id }}" data-approval="{{ feedback.is_approved }}">
{% elif feedback.feedback_type == '利活用申請' %}
<input class="checkbox-inline" type="checkbox" name="utilization-checkbox" id="{{ feedback.utilization_id }}" value="{{ feedback.utilization_id }}" data-approval="{{ feedback.is_approved }}">
<input class="checkbox-inline" style="margin: 0;" type="checkbox" name="utilization-checkbox" id="{{ feedback.utilization_id }}" value="{{ feedback.utilization_id }}" data-approval="{{ feedback.is_approved }}">
{% elif feedback.feedback_type == '利活用コメント' %}
<input class="checkbox-inline" type="checkbox" name="utilization-comments-checkbox" id="{{ feedback.comment_id }}" value="{{ feedback.comment_id }}" data-approval="{{ feedback.is_approved }}">
<input class="checkbox-inline" style="margin: 0;" type="checkbox" name="utilization-comments-checkbox" id="{{ feedback.comment_id }}" value="{{ feedback.comment_id }}" data-approval="{{ feedback.is_approved }}">
{% endif %}
</div>
<a class="col-md-2 text-truncate" href="{{ h.url_for('dataset.search') }}{{ feedback.package_name }}">{{ feedback.package_title }}</a>
<a class="col-md-2 text-truncate" style="text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" href="{{ h.url_for('dataset.search') }}{{ feedback.package_name }}/resource/{{ feedback.resource_id }}">{{ feedback.resource_name }}</a>
{% if feedback.feedback_type == 'リソースコメント' %}
<div class="col-md-1 bubble" style="margin-right: 0;">
<i class="fa-solid fa-comment-dots"></i>
<div class="bubbleText position-right">{{ _('Resource Comment') }}</div>
</div>
<a class="col-md-4 text-truncate" style="min-width: 37%;" href="{{ h.url_for('resource_comment.comment', resource_id=feedback.resource_id) }}#comment-created-{{ feedback.comment_id }}">{{ feedback.content }}</a>
{% elif feedback.feedback_type == '利活用申請' %}
<div class="col-md-1 bubble" style="margin-right: 0;">
<i class="fa-solid fa-seedling"></i>
<div class="bubbleText position-right">{{ _('Utilization') }}</div>
</div>
<a class="col-md-4 text-truncate" style="min-width: 37%;" href="{{ h.url_for('utilization.details', utilization_id=feedback.utilization_id) }}">{{ feedback.content }}</a>
{% elif feedback.feedback_type == '利活用コメント' %}
<div class="col-md-1 bubble" style="margin-right: 0;">
<span class="fa-stack" style="font-size: 7px;">
<i class="fa fa-comment fa-stack-2x" style="text-align: start;"></i>
<i class="fa-solid fa-seedling fa-stack-1x" style="color: #ffffff; text-align: start; margin-left: 3.3px;"></i>
</span>
<div class="bubbleText position-right">{{ _('Utilization Comment') }}</div>
</div>
<a class="col-md-4 text-truncate" style="min-width: 37%;" href="{{ h.url_for('utilization.details', utilization_id=feedback.utilization_id) }}#comment-created-{{ feedback.comment_id }}">{{ feedback.content }}</a>
{% endif %}
<div class="col-md-2">
{% if feedback.is_approved %}
{{ _('Approved') }}
{% else %}
{{ _('Waiting') }}
{% endif %}
</div>
<div class="row form-check-label fs-6">
<a class="col-2 text-truncate" href="{{ h.url_for('dataset.search') }}{{ feedback.package_name }}">{{ feedback.package_title }}</a>
<a class="col-2 text-truncate" href="{{ h.url_for('dataset.search') }}{{ feedback.package_name }}/resource/{{ feedback.resource_id }}">{{ feedback.resource_name }}</a>
</div>
{% endfor %}
{% block page_pagination_bs3 %}
{{ page.pager() }}
{% endblock %}
{% else %}
<p>{{ _('There are no applications.') }}</p>
{% endif %}
</div>
{% else %}
<div class="right-text mb-2">
{% set approval_action=h.url_for( "feedback.approve_target" ) %}
{% set delete_action=h.url_for( "feedback.delete_target" ) %}
<button id="approval-button" class="btn btn-primary" type="button" onclick="runApproval('{{ approval_action }}')">
<i class="fa-solid fa-check"></i>
{{ _('Approval') }}
</button>
<button id="delete-button" class="btn btn-danger" type="button" onclick="runDelete('{{ delete_action }}')">
<i class="fa-solid fa-trash"></i>
{{ _('Delete') }}
</button>
</div>
<div class="container">
{% if page.collection %}
<div class="row form-check-label fs-6 border-bottom fw-bold mb-2">
<div class="col-1" style="float:left; max-width: 10px;"><input class="checkbox-inline" type="checkbox" id="target-checkbox-all"></div>
<div class="col-2">{{ _('Dataset') }}</div>
<div class="col-2">{{ _('Resource') }}</div>
<div class="col-1">{{ _('Type') }}</div>
<div class="col" style="min-width: 37%;">{{ _('Post Content') }}</div>
<div class="col-2">{{ _('Status') }}</div>
</div>
{% for feedback in page.collection %}
<div class="row form-check-label fs-6">
<div class="col-1 target" style="float:left; max-width: 10px;">
{% if feedback.feedback_type == 'リソースコメント' %}
<div class="col-1 bubble" style="margin-right: 0;">
<i class="fa-solid fa-comment-dots"></i>
<div class="bubbleText position-right">{{ _('Resource Comment') }}</div>
</div>
<a class="col text-truncate" href="{{ h.url_for('resource_comment.comment', resource_id=feedback.resource_id) }}#comment-created-{{ feedback.comment_id }}">{{ feedback.content }}</a>
<input class="checkbox-inline" type="checkbox" name="resource-comments-checkbox" id="{{ feedback.comment_id }}" value="{{ feedback.comment_id }}" data-approval="{{ feedback.is_approved }}">
{% elif feedback.feedback_type == '利活用申請' %}
<div class="col-1 bubble" style="margin-right: 0;">
<i class="fa-solid fa-seedling"></i>
<div class="bubbleText position-right">{{ _('Utilization') }}</div>
</div>
<a class="col text-truncate" href="{{ h.url_for('utilization.details', utilization_id=feedback.utilization_id) }}">{{ feedback.content }}</a>
<input class="checkbox-inline" type="checkbox" name="utilization-checkbox" id="{{ feedback.utilization_id }}" value="{{ feedback.utilization_id }}" data-approval="{{ feedback.is_approved }}">
{% elif feedback.feedback_type == '利活用コメント' %}
<div class="col-1 bubble" style="margin-right: 0;">
<span class="fa-stack" style="font-size: 7px;">
<i class="fa fa-comment fa-stack-2x" style="text-align: start;"></i>
<i class="fa-solid fa-seedling fa-stack-1x" style="color: #ffffff; text-align: start; margin-left: 3.3px;"></i>
</span>
<div class="bubbleText position-right">{{ _('Utilization Comment') }}</div>
</div>
<a class="col text-truncate" href="{{ h.url_for('utilization.details', utilization_id=feedback.utilization_id) }}#comment-created-{{ feedback.comment_id }}">{{ feedback.content }}</a>
<input class="checkbox-inline" type="checkbox" name="utilization-comments-checkbox" id="{{ feedback.comment_id }}" value="{{ feedback.comment_id }}" data-approval="{{ feedback.is_approved }}">
{% endif %}
<div class="col-2 text-truncate">
{% if feedback.is_approved %}
{{ _('Approved') }}
{% else %}
{{ _('Waiting') }}
{% endif %}
</div>
<a class="col-2 text-truncate" href="{{ h.url_for('dataset.search') }}{{ feedback.package_name }}">{{ feedback.package_title }}</a>
<a class="col-2 text-truncate" href="{{ h.url_for('dataset.search') }}{{ feedback.package_name }}/resource/{{ feedback.resource_id }}">{{ feedback.resource_name }}</a>
{% if feedback.feedback_type == 'リソースコメント' %}
<div class="col-1 bubble" style="margin-right: 0;">
<i class="fa-solid fa-comment-dots"></i>
<div class="bubbleText position-right">{{ _('Resource Comment') }}</div>
</div>
<a class="col text-truncate" style="min-width: 37%;" href="{{ h.url_for('resource_comment.comment', resource_id=feedback.resource_id) }}#comment-created-{{ feedback.comment_id }}">{{ feedback.content }}</a>
{% elif feedback.feedback_type == '利活用申請' %}
<div class="col-1 bubble" style="margin-right: 0;">
<i class="fa-solid fa-seedling"></i>
<div class="bubbleText position-right">{{ _('Utilization') }}</div>
</div>
<a class="col text-truncate" style="min-width: 37%;" href="{{ h.url_for('utilization.details', utilization_id=feedback.utilization_id) }}">{{ feedback.content }}</a>
{% elif feedback.feedback_type == '利活用コメント' %}
<div class="col-1 bubble" style="margin-right: 0;">
<span class="fa-stack" style="font-size: 7px;">
<i class="fa fa-comment fa-stack-2x" style="text-align: start;"></i>
<i class="fa-solid fa-seedling fa-stack-1x" style="color: #ffffff; text-align: start; margin-left: 3.3px;"></i>
</span>
<div class="bubbleText position-right">{{ _('Utilization Comment') }}</div>
</div>
<a class="col text-truncate" style="min-width: 37%;" href="{{ h.url_for('utilization.details', utilization_id=feedback.utilization_id) }}#comment-created-{{ feedback.comment_id }}">{{ feedback.content }}</a>
{% endif %}
<div class="col-2 text-truncate">
{% if feedback.is_approved %}
{{ _('Approved') }}
{% else %}
{{ _('Waiting') }}
{% endif %}
</div>
</div>
{% endfor %}
{% block page_pagination %}
{{ page.pager() }}
{% endblock %}
</div>
{% else %}
<p>{{ _('There are no applications.') }}</p>
{% endif %}
</div>
{% else %}
<p>{{ _('There are no applications.') }}</p>
{% endif %}
</div>
{% endif %}
</form>
</div>
</div>
Expand Down Expand Up @@ -151,7 +222,11 @@ <h2 class="module-heading">
<span class="item-label">{{ filter_item.label }}</span>
<span class="hidden separator"> - </span>
<span class="item-count badge">{{ filter_item.count }}</span>
{% if filter_item.active %}<span class="facet-close">x</span>{% endif %}
{% if not h.is_base_public_folder_bs3() %}
{% if filter_item.active %}
<span class="facet-close">x</span>
{% endif %}
{% endif %}
</a>
</li>
{% endfor %}
Expand Down

0 comments on commit a785a6c

Please sign in to comment.