Skip to content

Commit

Permalink
Merge pull request #133 from mjanez/ckan-2.9.11
Browse files Browse the repository at this point in the history
Add slug-preview patch
  • Loading branch information
mjanez authored May 21, 2024
2 parents e4b1354 + 3a51ddd commit c58b305
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,14 @@ To start the containers:
docker compose -f docker-compose.dev.yml up
```
See [CKAN images](#5-ckan-images) for more details of what happens when using development mode.
See [CKAN images](#ckan-images) for more details of what happens when using development mode.
> [!TIP]
> To enable the [Flask tool console](https://flask.palletsprojects.com/en/2.3.x/debugging/#debugging-application-errors), you need to enable tool debugging mode. This is done by setting the tool logging level to `DEBUG` in the CKAN configuration file, `ckan.ini`. Here is the code snippet you need to add to your `ckan.ini` file:
> ```ini
> [logger_werkzeug]
> level = DEBUG
>```
#### Create an extension
You can use the ckan [extension](https://docs.ckan.org/en/latest/extensions/tutorial.html#creating-a-new-extension) instructions to create a CKAN extension, only executing the command inside the CKAN container and setting the mounted `src/` folder as output:
Expand Down
16 changes: 16 additions & 0 deletions ckan/patches/ckan/00_plugin_slug_preview.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/ckan/public/base/javascript/plugins/jquery.slug-preview.js b/ckan/public/base/javascript/plugins/jquery.slug-preview.js
index 4a4f78fe25..8c03e816d2 100644
--- a/ckan/public/base/javascript/plugins/jquery.slug-preview.js
+++ b/ckan/public/base/javascript/plugins/jquery.slug-preview.js
@@ -33,6 +33,11 @@
var value = preview.find('.slug-preview-value');
var required = $('<div>').append($('.control-required', element).clone()).html();

+ // Check if slugPreview already exists in the parent container
+ if (element.parent().find('.slug-preview').length > 0) {
+ return;
+ }
+
function setValue() {
var val = escape(field.val()) || options.placeholder;
value.text(val);

0 comments on commit c58b305

Please sign in to comment.