Skip to content

Commit

Permalink
Edit tags including adding Wikidata infobox
Browse files Browse the repository at this point in the history
  • Loading branch information
samwilson committed Apr 1, 2021
1 parent cd508b9 commit 65c5577
Show file tree
Hide file tree
Showing 33 changed files with 501 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"extends": "stylelint-config-standard",
"ignoreFiles": ["**/*.js"],
"ignoreFiles": ["**/*.js", "**/*.png"],
"rules": {
"no-descending-specificity": null
}
Expand Down
18 changes: 12 additions & 6 deletions assets/css/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,18 @@ form {
background-color: #efefef;
padding: 1rem;

p label { display: block; }
label { display: block; }

p.fields {
.fields {
display: flex;
align-items: start;
margin-bottom: 0.4rem;
flex-wrap: wrap;
.field.size-1 { flex: 1; }
.field.size-2 { flex: 2; }
.field.size-4 { flex: 4; }
.field.size-6 { flex: 6; }
}
p .field.size-1 { flex: 1; }
p .field.size-2 { flex: 2; }
p .field.size-4 { flex: 4; }
p .field.size-6 { flex: 6; }

textarea,
input[type="text"],
Expand All @@ -166,6 +166,12 @@ form {
box-sizing: border-box;
height: 1.9rem;
}
textarea { height: auto; }

input[disabled] {
background-color: #fdfafa;
cursor: not-allowed;
}

input[type='submit'],
a.button {
Expand Down
30 changes: 30 additions & 0 deletions assets/css/tags.less
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,33 @@
color: black;
}
}

#autoComplete_list {
top: auto;
left: auto;
right: auto;
margin: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}

table.wikidata {
background-color: #fcfeff;
float: right;

ul {
margin: 0;
list-style-type: none;
}
th { text-align: left; }
}

.authority-control {
clear: both;
font-size: smaller;
}

hr.end {
clear: both;
visibility: hidden;
}
Binary file added assets/img/wikidata-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/js/app.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import '../css/app.less';
import './timezone-converter';
import './tags';
34 changes: 34 additions & 0 deletions assets/js/tags.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import AutoComplete from '@tarekraafat/autocomplete.js/dist/js/autoComplete.js';
import '@tarekraafat/autocomplete.js/dist/css/autoComplete.css';

const elementId = '#wikidata';

// eslint-disable-next-line no-new
new AutoComplete({
selector: elementId + '-label',
debounce: 500,
maxResults: 20,
data: {
src: async () => {
const input = document.querySelector(elementId + '-label');
input.disabled = true;
const source = await fetch(`/wikidata.json?q=${input.value}`);
const data = await source.json();
input.disabled = false;
return data;
},
key: ['title']
},
resultItem: {
content: (data, element) => {
element.innerHTML = `
<a href="https://www.wikidata.org/wiki/${data.value.value}">${data.value.value}</a>:
<strong>${data.value.title}</strong> &mdash;
<dfn>${data.value.description}</dfn>`;
}
},
onSelection: feedback => {
document.querySelector(elementId).value = feedback.selection.value.value;
document.querySelector(elementId + '-label').value = feedback.selection.value.title;
}
});
5 changes: 5 additions & 0 deletions package-lock.json

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

7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
{
"license": "GPL-3.0-or-later",
"private": true,
"dependencies": {
"leaflet": "^1.7.1",
"normalize.css": "^8.0.1"
},
"devDependencies": {
"@symfony/webpack-encore": "^0.30.0",
"@tarekraafat/autocomplete.js": "^8.3.2",
"leaflet": "^1.7.1",
"normalize.css": "^8.0.1",
"core-js": "^3.0.0",
"eslint": "^7.9.0",
"eslint-config-standard": "^14.1.1",
Expand Down
1 change: 1 addition & 0 deletions public/build/0.6cd39f54.js

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

6 changes: 0 additions & 6 deletions public/build/0.b868e304.js

This file was deleted.

1 change: 0 additions & 1 deletion public/build/1.10bbd395.css

This file was deleted.

Loading

0 comments on commit 65c5577

Please sign in to comment.