Skip to content

Commit

Permalink
add touchpoint contact form
Browse files Browse the repository at this point in the history
  • Loading branch information
FuhuXia committed Jan 11, 2024
1 parent 3cd48d1 commit 756e53c
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
22 changes: 22 additions & 0 deletions ckanext/datagovtheme/fanstatic_library/scripts/contactform.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
jQuery(function ($) {
const tpform_id = "fd986495";
const tpform_js = "https://touchpoints.app.cloud.gov/touchpoints/"+tpform_id+".js";

// load external touchpoint js script
$.getScript(tpform_js, function () {
console.log( "Touchpoint form is loaded." );
set_form();
});

function set_form() {
// unhide the button and set the click event
$("#contact-btn").css('visibility', 'inherit').click(function () {
// change the form location_code value
if ($('article[data-package-name]')) {
const dataset_name = $('article[data-package-name]').attr('data-package-name');
$("#fba_location_code").val(dataset_name);
$("#answer_04").val(dataset_name);
}
});
}
});
12 changes: 12 additions & 0 deletions ckanext/datagovtheme/fanstatic_library/styles/datagovtheme.css
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,18 @@ p.module-content {
float: left;
}

/* BEGIN of styling touchpoint form button */
#contact-btn {
visibility: hidden;
}
.fba-modal-dialog {
border-radius: 10px;
}
.fba-modal-dialog .wrapper {
border-width: 0;
}
/* END of styling touchpoint form button */

/* BEGIN of styling NGDA lable using button arrows for bootstrap 3 */
body .tagged-ngda {
background-color: #3498db;
Expand Down
3 changes: 2 additions & 1 deletion ckanext/datagovtheme/fanstatic_library/webassets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ js:
filters: rjsmin
output: datagovtheme/extension.js
contents:
- scripts/contactform.js
- scripts/geoplatform.js
- scripts/vendor/jquery.placeholder.js
- scripts/vendor/uswds.js
- scripts/jquery.cookie.js
- scripts/tracking.js
- scripts/hideMaxListItem.js
- scripts/sorting.js
- scripts/vendor/uswds.js

styles:
# This name is used in development/debug mode, must match the css file in test_datagovtheme.py
Expand Down
6 changes: 3 additions & 3 deletions ckanext/datagovtheme/templates/package/read_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@

{% block content_action %}
<div class="btn-group actions">
<li> <a href="https://www.data.gov/contact" class="btn btn-warning"> <i class="fa fa-bullhorn"></i> Contact Data.gov </a> </li>
<li> <a href="#" id=contact-btn class="btn btn-warning"> <i class="fa fa-comments"></i> Feedback </a> </li>
{# NOTE: Not implemented in stage 1 #}
{# <li>{% link_for _('History'), controller='dataset', action='history', id=pkg.name, class_='btn', icon='undo' %}</li> #}
{% if h.check_access('package_update', {'id':pkg.id }) %}
<li>{% link_for _('Edit'), controller='dataset', action='edit', id=pkg.name, class_='btn btn-primary', icon='wrench' %}</li>
{% endif %}
<li>{{ h.follow_button('dataset', pkg.id) }}</li>
{# <li>{{ h.follow_button('dataset', pkg.id) }}</li> #}
</div>
{% endblock %}
{% if h.get_pkg_dict_extra(pkg, 'accessLevel') == 'non-public' %}
Expand All @@ -37,7 +37,7 @@
</span></div>
{% endif %}

<article itemscope itemtype="http://schema.org/Dataset" class="module prose">
<article itemscope itemtype="http://schema.org/Dataset" class="module prose" data-package-name="{{ pkg.name }}">

{% block package_revision_info %}
{% if c.pkg_revision_id %}
Expand Down

0 comments on commit 756e53c

Please sign in to comment.