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

Add Baidu analytics script and report download tracking #604

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -532,3 +532,4 @@ To setup Google Analytics using GA4, you need to install a specific branch (`ed-
[`ckanext-googleanalytics` with GA4 support](https://github.com/datopian/ckanext-googleanalytics/tree/ed-dev-ga4)

Then follow the instructions in the ["Setup" section of the README](https://github.com/datopian/ckanext-googleanalytics/tree/ed-dev-ga4#setup).

2 changes: 1 addition & 1 deletion ckanext/querytool/fanstatic/css/main.css

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

128 changes: 128 additions & 0 deletions ckanext/querytool/fanstatic/javascript/modules/group-confirm-action.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
this.ckan.module('group-confirm-action', function (jQuery) {
return {
/* An object of module options */
options: {
/* Content can be overriden by setting data-module-content to a
* *translated* string inside the template, e.g.
*
* <a href="..."
* data-module="confirm-action"
* data-module-content="{{ _('Are you sure?') }}">
* {{ _('Delete') }}
* </a>
*/
content: '',

/* This is part of the old i18n system and is kept for backwards-
* compatibility for templates which set the content via the
* `i18n.content` attribute instead of via the `content` attribute
* as described above.
*/
i18n: {
content: '',
},

template: [
'<div class="modal">',
'<div class="modal-header">',
'<button type="button" class="close" data-dismiss="modal">×</button>',
'<h3></h3>',
'</div>',
'<div class="modal-body"></div>',
'<div class="modal-footer">',
'<button class="btn btn-cancel"></button>',
'<button class="btn btn-primary"></button>',
'</div>',
'</div>'
].join('\n')
},

/* Sets up the event listeners for the object. Called internally by
* module.createInstance().
*
* Returns nothing.
*/
initialize: function () {
jQuery.proxyAll(this, /_on/);
this.el.on('click', this._onClick);
},

/* Presents the user with a confirm dialogue to ensure that they wish to
* continue with the current action.
*
* Examples
*
* jQuery('.delete').click(function () {
* module.confirm();
* });
*
* Returns nothing.
*/
confirm: function () {
this.sandbox.body.append(this.createModal());
this.modal.modal('show');

// Center the modal in the middle of the screen.
this.modal.css({
'margin-top': this.modal.height() * -0.5,
'top': '50%'
});
},

/* Performs the action for the current item.
*
* Returns nothing.
*/
performAction: function () {
// create a form and submit it to confirm the deletion
var form = jQuery('<form/>', {
action: this.el.attr('href'),
method: 'POST'
});
form.appendTo('body').submit();
},

/* Creates the modal dialog, attaches event listeners and localised
* strings.
*
* Returns the newly created element.
*/
createModal: function () {
if (!this.modal) {
var element = this.modal = jQuery(this.options.template);
element.on('click', '.btn-primary', this._onConfirmSuccess);
element.on('click', '.btn-cancel', this._onConfirmCancel);
element.modal({show: false});

element.find('h3').text(this._('Please Confirm Action'));
var content = this.options.content ||
this.options.i18n.content || /* Backwards-compatibility */
this._('Are you sure you want to perform this action?');

content = content.split(', ').join('<br><br>');

element.find('.modal-body').html(content);
element.find('.btn-primary').text(this._('Confirm'));
element.find('.btn-cancel').text(this._('Cancel'));
}
return this.modal;
},

/* Event handler that displays the confirm dialog */
_onClick: function (event) {
event.preventDefault();
this.confirm();
},

/* Event handler for the success event */
_onConfirmSuccess: function (event) {
this.performAction();
},

/* Event handler for the cancel event */
_onConfirmCancel: function (event) {
this.modal.modal('hide');
}
};
});

10 changes: 10 additions & 0 deletions ckanext/querytool/fanstatic/less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -568,3 +568,13 @@ form.custom-lang-select {
.mb-20 {
margin-bottom: 20px !important;
}

.report-group-select {
display: flex;
align-items: center;
flex-wrap: nowrap;
}

.orphan-label {
margin-right: 5px;
}
1 change: 1 addition & 0 deletions ckanext/querytool/fanstatic/resource.config
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ share =
javascript/dist/modules/export-to-png.js
javascript/dist/modules/tool-embed.js
javascript/modules/querytool_image_upload.js
javascript/modules/group-confirm-action.js
Loading