Skip to content

Commit 4f4b7a5

Browse files
committed
Updated changelog and applied js coding standards
1 parent f04cd9b commit 4f4b7a5

File tree

8 files changed

+120
-112
lines changed

8 files changed

+120
-112
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ and this project adheres to [Semantic
77
Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
10-
10+
- [374](https://github.com/itk-dev/os2loop/pull/374)
11+
Added itkdev template with github actions and tasks
1112
- [PR-373](https://github.com/itk-dev/os2loop/pull/373)
1213
Update contrib modules
1314
Update custom modules

task/Taskfile.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ tasks:
7575
- task dev:compose -- exec phpfpm vendor/bin/phpstan analyse --configuration=phpstan.neon
7676
- task dev:compose -- exec phpfpm vendor/bin/twig-cs-fixer lint web/profiles/custom/os2loop/themes/*/templates
7777
- task dev:compose -- run --rm prettier '**/*.{yml,yaml}' --check
78-
- task dev:compose -- run --rm prettier 'web/profiles/custom/os2loop/themes/**/*.{css,scss}' --check
78+
- task dev:compose -- run --rm prettier 'web/profiles/custom/os2loop/**/*.{css,scss}' --check
79+
- task dev:compose -- run --rm prettier 'web/profiles/custom/os2loop/**/*.js' --check
7980
- docker run --rm --volume "$PWD:/md" itkdev/markdownlint '**/*.md'
8081

8182
code:apply-standards:
@@ -85,4 +86,5 @@ tasks:
8586
- task dev:compose -- exec phpfpm vendor/bin/twig-cs-fixer lint web/profiles/custom/os2loop/themes/*/templates --fix
8687
- task dev:compose -- run --rm prettier '**/*.{yml,yaml}' --write
8788
- task dev:compose -- run --rm prettier 'web/profiles/custom/os2loop/themes/**/*.{css,scss}' --write
89+
- task dev:compose -- run --rm prettier 'web/profiles/custom/os2loop/**/*.js' --write
8890
- docker run --rm --volume "$PWD:/md" itkdev/markdownlint '**/*.md' --fix
Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,57 @@
11
(function ($, Drupal, once) {
2-
'use strict';
3-
/**
4-
* Remove entity reference ID from "entity_autocomplete" field.
5-
*
6-
* @type {{attach: Drupal.behaviors.autocompleteReferenceEntityId.attach}}
7-
*/
8-
Drupal.behaviors.autocompleteReferenceEntityId = {
9-
attach: function (context) {
10-
// Remove reference IDs for autocomplete elements on init.
11-
$(once('replaceReferenceIdOnInit', '.form-autocomplete', context)).each(function () {
12-
let splitValues = (this.value && this.value !== 'false') ?
13-
Drupal.autocomplete.splitValues(this.value) : [];
2+
"use strict";
3+
/**
4+
* Remove entity reference ID from "entity_autocomplete" field.
5+
*
6+
* @type {{attach: Drupal.behaviors.autocompleteReferenceEntityId.attach}}
7+
*/
8+
Drupal.behaviors.autocompleteReferenceEntityId = {
9+
attach: function (context) {
10+
// Remove reference IDs for autocomplete elements on init.
11+
$(once("replaceReferenceIdOnInit", ".form-autocomplete", context)).each(
12+
function () {
13+
let splitValues =
14+
this.value && this.value !== "false"
15+
? Drupal.autocomplete.splitValues(this.value)
16+
: [];
1417

15-
if (splitValues.length > 0) {
16-
let labelValues = [];
17-
for (let i in splitValues) {
18-
let value = splitValues[i].trim();
19-
let entityIdMatch = value.match(/\s*\((.*?)\)$/);
20-
if (entityIdMatch) {
21-
labelValues[i] = value.replace(entityIdMatch[0], '');
22-
}
23-
}
24-
if (labelValues.length > 0) {
25-
$(this).data('real-value', splitValues.join(', '));
26-
this.value = labelValues.join(', ');
27-
}
18+
if (splitValues.length > 0) {
19+
let labelValues = [];
20+
for (let i in splitValues) {
21+
let value = splitValues[i].trim();
22+
let entityIdMatch = value.match(/\s*\((.*?)\)$/);
23+
if (entityIdMatch) {
24+
labelValues[i] = value.replace(entityIdMatch[0], "");
25+
}
2826
}
29-
});
30-
}
31-
};
32-
33-
let autocomplete = Drupal.autocomplete.options;
34-
autocomplete.originalValues = [];
35-
autocomplete.labelValues = [];
27+
if (labelValues.length > 0) {
28+
$(this).data("real-value", splitValues.join(", "));
29+
this.value = labelValues.join(", ");
30+
}
31+
}
32+
},
33+
);
34+
},
35+
};
3636

37-
/**
38-
* Add custom select handler.
39-
*/
40-
autocomplete.select = function (event, ui) {
41-
autocomplete.labelValues = Drupal.autocomplete.splitValues(event.target.value);
42-
autocomplete.labelValues.pop();
43-
autocomplete.labelValues.push(ui.item.label);
44-
autocomplete.originalValues.push(ui.item.value);
37+
let autocomplete = Drupal.autocomplete.options;
38+
autocomplete.originalValues = [];
39+
autocomplete.labelValues = [];
4540

46-
$(event.target).data('real-value', autocomplete.originalValues.join(', '));
47-
event.target.value = autocomplete.labelValues.join(', ');
41+
/**
42+
* Add custom select handler.
43+
*/
44+
autocomplete.select = function (event, ui) {
45+
autocomplete.labelValues = Drupal.autocomplete.splitValues(
46+
event.target.value,
47+
);
48+
autocomplete.labelValues.pop();
49+
autocomplete.labelValues.push(ui.item.label);
50+
autocomplete.originalValues.push(ui.item.value);
4851

49-
return FALSE;
50-
}
52+
$(event.target).data("real-value", autocomplete.originalValues.join(", "));
53+
event.target.value = autocomplete.labelValues.join(", ");
5154

55+
return FALSE;
56+
};
5257
})(jQuery, Drupal, once);

web/profiles/custom/os2loop/modules/os2loop_search_db/assets/js/hideFilters.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22
* Hide search filters if the search yields no result.
33
*/
44
(function (Drupal, drupalSettings) {
5-
'use strict';
5+
"use strict";
66
Drupal.behaviors.hideFilters = {
77
attach: function (context, settings) {
8-
let noResult = document.getElementById('js-no-result');
8+
let noResult = document.getElementById("js-no-result");
99
if (noResult) {
10-
document.getElementById('js-search-filters').style.display = 'none';
10+
document.getElementById("js-search-filters").style.display = "none";
1111
}
12-
}
12+
},
1313
};
14-
1514
})(Drupal, drupalSettings);

web/profiles/custom/os2loop/modules/os2loop_section_page/js/hide-empty-sections.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Drupal.behaviors.hideEmptySections = {
55
for (let i = 0; i < empty_views.length; i++) {
66
let el = empty_views.item(i);
77
// Look for class section in parents.
8-
let section = findUpClass(el, 'section');
8+
let section = findUpClass(el, "section");
99
if (section) {
1010
// Add explanatory class.
1111
section.classList.add("js-empty-list");
@@ -14,16 +14,15 @@ Drupal.behaviors.hideEmptySections = {
1414
section.classList.add("d-none");
1515
}
1616
}
17-
}
17+
},
1818
};
1919

2020
// Iterate up through parents looking for a class.
2121
function findUpClass(el, tag) {
2222
while (el.parentNode) {
2323
el = el.parentNode;
24-
let classList = el.className.split(' ')
25-
if (classList.includes(tag))
26-
return el;
24+
let classList = el.className.split(" ");
25+
if (classList.includes(tag)) return el;
2726
}
2827
return null;
2928
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
document.querySelector('#drupal-login input[type="submit"]').addEventListener('click', function(event) {
2-
// Make sure that we keep the fragment id in the form action url.
3-
// If we don't do this, any login errors will not be visible.
4-
event.target.form.action = document.location.href
5-
})
1+
document
2+
.querySelector('#drupal-login input[type="submit"]')
3+
.addEventListener("click", function (event) {
4+
// Make sure that we keep the fragment id in the form action url.
5+
// If we don't do this, any login errors will not be visible.
6+
event.target.form.action = document.location.href;
7+
});

web/profiles/custom/os2loop/themes/os2loop_theme/assets/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jQuery(() => {
3131
.on("autocompleteopen", (event) =>
3232
jQuery(event.target)
3333
.parent()
34-
.addClass("search-api-autocomplete-has-suggestions")
34+
.addClass("search-api-autocomplete-has-suggestions"),
3535
)
3636
.on("autocompleteclose", (event) =>
3737
jQuery(event.target)
3838
.parent()
39-
.removeClass("search-api-autocomplete-has-suggestions")
39+
.removeClass("search-api-autocomplete-has-suggestions"),
4040
);
4141

4242
// Add target="_blank" to all external links in main content.

web/profiles/custom/os2loop/themes/os2loop_theme/webpack.config.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,65 @@ var CopyWebpackPlugin = require("copy-webpack-plugin");
44
// Manually configure the runtime environment if not already configured yet by the "encore" command.
55
// It's useful when you use tools that rely on webpack.config.js file.
66
if (!Encore.isRuntimeEnvironmentConfigured()) {
7-
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || "dev");
7+
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || "dev");
88
}
99

1010
Encore
11-
// directory where compiled assets will be stored
12-
.setOutputPath("build/")
13-
// public path used by the web server to access the output path
14-
.setPublicPath(".")
15-
// only needed for CDN's or sub-directory deploy
16-
.setManifestKeyPrefix("build/")
11+
// directory where compiled assets will be stored
12+
.setOutputPath("build/")
13+
// public path used by the web server to access the output path
14+
.setPublicPath(".")
15+
// only needed for CDN's or sub-directory deploy
16+
.setManifestKeyPrefix("build/")
1717

18-
/*
19-
* ENTRY CONFIG
20-
*
21-
* Add 1 entry for each "page" of your app
22-
* (including one that's included on every page - e.g. "app")
23-
*
24-
* Each entry will result in one JavaScript file (e.g. app.js)
25-
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
26-
*/
27-
.addEntry("app", "./assets/app.js")
28-
.addEntry("pdf", "./assets/components/pdf/pdf.scss")
18+
/*
19+
* ENTRY CONFIG
20+
*
21+
* Add 1 entry for each "page" of your app
22+
* (including one that's included on every page - e.g. "app")
23+
*
24+
* Each entry will result in one JavaScript file (e.g. app.js)
25+
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
26+
*/
27+
.addEntry("app", "./assets/app.js")
28+
.addEntry("pdf", "./assets/components/pdf/pdf.scss")
2929

30-
// Color templates
31-
.addEntry("default", "./assets/color-templates/default.scss")
32-
.addEntry("blue", "./assets/color-templates/blue.scss")
33-
.addEntry("green", "./assets/color-templates/green.scss")
34-
.addEntry("red", "./assets/color-templates/red.scss")
35-
.addEntry("yellow", "./assets/color-templates/yellow.scss")
36-
.addEntry("lightblue", "./assets/color-templates/lightblue.scss")
30+
// Color templates
31+
.addEntry("default", "./assets/color-templates/default.scss")
32+
.addEntry("blue", "./assets/color-templates/blue.scss")
33+
.addEntry("green", "./assets/color-templates/green.scss")
34+
.addEntry("red", "./assets/color-templates/red.scss")
35+
.addEntry("yellow", "./assets/color-templates/yellow.scss")
36+
.addEntry("lightblue", "./assets/color-templates/lightblue.scss")
3737

38-
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
39-
//.splitEntryChunks()
38+
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
39+
//.splitEntryChunks()
4040

41-
// will require an extra script tag for runtime.js
42-
// but, you probably want this, unless you're building a single-page app
43-
.disableSingleRuntimeChunk()
41+
// will require an extra script tag for runtime.js
42+
// but, you probably want this, unless you're building a single-page app
43+
.disableSingleRuntimeChunk()
4444

45-
/*
46-
* FEATURE CONFIG
47-
*
48-
* Enable & configure other features below. For a full
49-
* list of features, see:
50-
* https://symfony.com/doc/current/frontend.html#adding-more-features
51-
*/
52-
.cleanupOutputBeforeBuild()
53-
.enableBuildNotifications()
54-
.enableSourceMaps(!Encore.isProduction())
55-
// enables hashed filenames (e.g. app.abc123.css)
56-
//.enableVersioning(Encore.isProduction())
45+
/*
46+
* FEATURE CONFIG
47+
*
48+
* Enable & configure other features below. For a full
49+
* list of features, see:
50+
* https://symfony.com/doc/current/frontend.html#adding-more-features
51+
*/
52+
.cleanupOutputBeforeBuild()
53+
.enableBuildNotifications()
54+
.enableSourceMaps(!Encore.isProduction())
55+
// enables hashed filenames (e.g. app.abc123.css)
56+
//.enableVersioning(Encore.isProduction())
5757

58-
// enables @babel/preset-env polyfills
59-
.configureBabelPresetEnv((config) => {
60-
config.useBuiltIns = "usage";
61-
config.corejs = 3;
62-
})
58+
// enables @babel/preset-env polyfills
59+
.configureBabelPresetEnv((config) => {
60+
config.useBuiltIns = "usage";
61+
config.corejs = 3;
62+
})
6363

64-
// enables Sass/SCSS support
65-
.enableSassLoader();
64+
// enables Sass/SCSS support
65+
.enableSassLoader();
6666

6767
// uncomment if you use TypeScript
6868
//.enableTypeScriptLoader()

0 commit comments

Comments
 (0)