Skip to content

Commit

Permalink
Merge pull request #164 from c-3lab/feature/support-bootstrap3
Browse files Browse the repository at this point in the history
Bootstrap のバージョンを切り替え可能にする
  • Loading branch information
ryo-ma committed May 15, 2024
2 parents 24dc610 + 04283ea commit 3b6a430
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 10 deletions.
5 changes: 5 additions & 0 deletions ckanext/feedback/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,10 @@ def is_enabled_rating(self):
enable = config.get('ckan.feedback.resources.comment.rating.enable', False)
return toolkit.asbool(enable)

def is_base_public_folder_bs3(self):
base_templates_folder = config.get('ckan.base_public_folder', 'public')
return base_templates_folder == 'public-bs3'

# ITemplateHelpers

def get_helpers(self):
Expand All @@ -240,6 +244,7 @@ def get_helpers(self):
'is_enabled_rating': self.is_enabled_rating,
'is_enabled_rating_org': self.is_enabled_rating_org,
'is_organization_admin': check.is_organization_admin,
'is_base_public_folder_bs3': self.is_base_public_folder_bs3,
'has_organization_admin_role': check.has_organization_admin_role,
'get_resource_downloads': download_summary_service.get_resource_downloads,
'get_package_downloads': download_summary_service.get_package_downloads,
Expand Down
14 changes: 11 additions & 3 deletions ckanext/feedback/templates/resource/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ <h4>{{ _('Comment') }}</h4>
{% if c.userobj.sysadmin or h.has_organization_admin_role(resource.package.owner_org) %}
{% if comment.approval %}
{% if not reply %}
<input type="button" class="btn btn-primary float-end" data-bs-toggle='modal' data-bs-target='#reply-form-window' onclick="setReplyFormContent('{{ comment.id }}')" value="{{ _('Reply') }}"/>
{% if h.is_base_public_folder_bs3() %}
<input type="button" class="btn btn-primary pull-right" data-toggle='modal' data-target='#reply-form-window' onclick="setReplyFormContent('{{ comment.id }}')" value="{{ _('Reply') }}"/>
{% else %}
<input type="button" class="btn btn-primary float-end" data-bs-toggle='modal' data-bs-target='#reply-form-window' onclick="setReplyFormContent('{{ comment.id }}')" value="{{ _('Reply') }}"/>
{% endif %}
{% else %}
<input type="button" class="btn btn-primary float-end" value="{{ _('Reply') }}" disabled/>
{% endif %}
Expand Down Expand Up @@ -138,14 +142,18 @@ <h4 class="reply">{{ reply.created.strftime('%Y/%m/%d %H:%M') }}</h4>
<form id="reply-form" class="top-centered-content" action="{{ url_for('resource_comment.reply', resource_id=resource.id ) }}" method="post">
<input type="hidden" id="selected_resource_comment_id" name="resource_comment_id">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
{% if h.is_base_public_folder_bs3() %}
<button type="button" class="close" data-dismiss="modal">&times;</button>
{% else %}
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
{% endif %}
</div>
<div class="modal-body">
<h4 id="selected_comment_header"></h4>
<p class="content-align wrap-text" id="selected_comment"></p>
<div class="form-group control-full">
<label class="control-label" for="code">{{ _('Input') }}</label>
<div class="controls ">
<div class="controls">
<textarea id="reply_content" name="reply_content" cols="20" rows="3" placeholder="" class="form-control"></textarea>
</div>
<div>
Expand Down
6 changes: 5 additions & 1 deletion ckanext/feedback/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
{% asset 'feedback/feedback-tooltip-css' %}
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<li>
<a href="{{ h.url_for(package.type ~ '.read', id=package.name) }}" class="badge badge-default" data-format="{{ resource.lower() }}">{{ resource }}</a>
{% if h.is_base_public_folder_bs3() %}
<a href="{{ h.url_for(package.type ~ '.read', id=package.name) }}" class="label label-default" data-format="{{ resource.lower() }}">{{ resource }}</a>
{% else %}
<a href="{{ h.url_for(package.type ~ '.read', id=package.name) }}" class="badge badge-default" data-format="{{ resource.lower() }}">{{ resource }}</a>
{% endif %}
</li>
{% endfor %}
<li>
Expand Down
30 changes: 24 additions & 6 deletions ckanext/feedback/templates/utilization/details.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,22 @@ <h4>{{ _('Utilization description') }}</h4>
<hr>
</div>
<h4>{{ _('Issue Resolutions') }}</h4>
<a href="#issue-resolution-detail" data-bs-toggle="modal">
{% if h.is_base_public_folder_bs3() %}
<a href="#issue-resolution-detail" data-toggle="modal">
{% else %}
<a href="#issue-resolution-detail" data-bs-toggle="modal">
{% endif %}
{% if issue_resolutions|length > 0 %}
<img src="/images/issue_resolution_badge.png" alt="issue resolution badge" width="28" height="28">
{% endif %}
{{ issue_resolutions|length }}
</a>
{% if c.userobj.sysadmin or h.has_organization_admin_role(utilization.owner_org) %}
<button class="btn btn-primary right-aligned" data-bs-toggle="modal" data-bs-target="#issue-resolution-form">{{ _('Resolve issue') }}</button>
{% if h.is_base_public_folder_bs3() %}
<button class="btn btn-primary right-aligned" data-toggle="modal" data-target="#issue-resolution-form">{{ _('Resolve issue') }}</button>
{% else %}
<button class="btn btn-primary right-aligned" data-bs-toggle="modal" data-bs-target="#issue-resolution-form">{{ _('Resolve issue') }}</button>
{% endif %}
{% endif %}
<br>
<hr>
Expand Down Expand Up @@ -106,8 +114,13 @@ <h4>
<div class="modal-content">
<form name="issue_resolution_form" class="top-centered-content" action="{{ url_for('utilization.create_issue_resolution', utilization_id=utilization_id ) }}" method="post">
<div class="modal-header">
<h2 class="modal-title">{{ _('Certification of issue resolution') }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
{% if h.is_base_public_folder_bs3() %}
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h2 class="modal-title">{{ _('Certification of issue resolution') }}</h2>
{% else %}
<h2 class="modal-title">{{ _('Certification of issue resolution') }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
{% endif %}
</div>
<div class="modal-body">
<div>
Expand Down Expand Up @@ -136,8 +149,13 @@ <h2 class="modal-title">{{ _('Certification of issue resolution') }}</h2>
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h2 class="modal-title">{{ _('Resolved Issue details') }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
{% if h.is_base_public_folder_bs3() %}
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h2 class="modal-title">{{ _('Resolved Issue details') }}</h2>
{% else %}
<h2 class="modal-title">{{ _('Resolved Issue details') }}</h2>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
{% endif %}
</div>
<div id="issue-resolution-table" class="modal-body">
<div>
Expand Down

0 comments on commit 3b6a430

Please sign in to comment.