diff --git a/src/constants.js b/src/constants.js
index dca587e..4b193a3 100644
--- a/src/constants.js
+++ b/src/constants.js
@@ -1,6 +1,6 @@
import { getTimestampInSeconds } from "./helpers";
-export const MIGRATE_VERSION = '2.0.1';
+export const MIGRATE_VERSION = '2.0.2';
export const DEFAULT_DICTIONARY = {
name: 'New',
specification: 'Dictionary',
@@ -12,6 +12,7 @@ export const DEFAULT_DICTIONARY = {
consonants: [],
vowels: [],
blends: [],
+ notes: '',
},
phonotactics: {
onset: [],
diff --git a/src/js/dictionaryManagement.js b/src/js/dictionaryManagement.js
index a5d2e90..800b60d 100644
--- a/src/js/dictionaryManagement.js
+++ b/src/js/dictionaryManagement.js
@@ -14,8 +14,8 @@ export function updateDictionary () {
export function openEditModal() {
const { name, specification, description, partsOfSpeech, alphabeticalOrder } = window.currentDictionary;
- const { consonants, vowels, blends } = window.currentDictionary.details.phonology;
- const { phonotactics, orthography, grammar } = window.currentDictionary.details;
+ const { phonology, phonotactics, orthography, grammar } = window.currentDictionary.details;
+ const { consonants, vowels, blends } = phonology;
const { allowDuplicates, caseSensitive, sortByDefinition, theme, isPublic } = window.currentDictionary.settings;
document.getElementById('editName').value = name;
@@ -27,6 +27,8 @@ export function openEditModal() {
document.getElementById('editConsonants').value = consonants.join(' ');
document.getElementById('editVowels').value = vowels.join(' ');
document.getElementById('editBlends').value = blends.join(' ');
+ document.getElementById('editPhonologyNotes').value = phonology.notes;
+
document.getElementById('editOnset').value = phonotactics.onset.join(',');
document.getElementById('editNucleus').value = phonotactics.nucleus.join(',');
document.getElementById('editCoda').value = phonotactics.coda.join(',');
@@ -60,6 +62,8 @@ export function saveEditModal() {
updatedDictionary.details.phonology.consonants = document.getElementById('editConsonants').value.split(' ').map(val => val.trim()).filter(val => val !== '');
updatedDictionary.details.phonology.vowels = document.getElementById('editVowels').value.split(' ').map(val => val.trim()).filter(val => val !== '');
updatedDictionary.details.phonology.blends = document.getElementById('editBlends').value.split(' ').map(val => val.trim()).filter(val => val !== '');
+ updatedDictionary.details.phonology.notes = removeTags(document.getElementById('editPhonologyNotes').value.trim());
+
updatedDictionary.details.phonotactics.onset = document.getElementById('editOnset').value.split(',').map(val => val.trim()).filter(val => val !== '');
updatedDictionary.details.phonotactics.nucleus = document.getElementById('editNucleus').value.split(',').map(val => val.trim()).filter(val => val !== '');
updatedDictionary.details.phonotactics.coda = document.getElementById('editCoda').value.split(',').map(val => val.trim()).filter(val => val !== '');
diff --git a/src/js/migration.js b/src/js/migration.js
index 5976bf6..d092072 100644
--- a/src/js/migration.js
+++ b/src/js/migration.js
@@ -106,6 +106,7 @@ export function migrateDictionary() {
switch (window.currentDictionary.version) {
default: console.error('Unknown version'); break;
case '2.0.0': {
+ window.currentDictionary.details.phonology.notes = '';
window.currentDictionary.details.phonotactics = Object.assign({}, window.currentDictionary.details.phonology.phonotactics);
delete window.currentDictionary.details.phonology.phonotactics;
window.currentDictionary.details.phonotactics.notes = window.currentDictionary.details.phonotactics.exceptions;
diff --git a/src/js/render/details.js b/src/js/render/details.js
index f1e4b97..77a0fa7 100644
--- a/src/js/render/details.js
+++ b/src/js/render/details.js
@@ -62,12 +62,14 @@ export function renderDetails() {
const consonantHTML = `
Consonants
${consonants.map(letter => `${letter}`).join(' ')}
`;
const vowelHTML = `Vowels
${vowels.map(letter => `${letter}`).join(' ')}
`;
const blendHTML = blends.length > 0 ? `Polyphthongs / Blends
${blends.map(letter => `${letter}`).join(' ')}
` : '';
+ const phonologyNotesHTML = phonology.notes.trim().length > 0 ? 'Notes
' + md(removeTags(phonology.notes)) + '
' : '';
const phonologyHTML = `Phonology
${consonantHTML}
${vowelHTML}
- ${blendHTML}`;
+ ${blendHTML}
+ ${phonologyNotesHTML}`;
const { onset, nucleus, coda } = phonotactics;
const onsetHTML = `Onset
${onset.map(letter => `${letter}`).join(' ')}
`;
@@ -76,29 +78,32 @@ export function renderDetails() {
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? 'Notes
' + md(removeTags(phonotactics.notes)) + '
' : '';
const phonotacticsHTML = onset.length + nucleus.length + coda.length + phonotacticsNotesHTML.length > 0
? `Phonotactics
-
+ ${onset.length > 0 || nucleus.length > 0 || coda.length > 0
+ ? `
${onsetHTML}
${nucleusHTML}
${codaHTML}
-
+
` : ''}
${phonotacticsNotesHTML}`
: '';
const { translations } = orthography;
- const translationsHTML = `Translations
${translations.map(translation => {
+ const translationsHTML = translations.length > 0 ? `
Translations
${translations.map(translation => {
translation = translation.split('=').map(value => value.trim());
if (translation.length > 1 && translation[0] !== '' && translation[1] !== '') {
return `${translation[0]}${translation[1]}`;
}
return false;
- }).filter(html => html !== false).join(' ')}
`;
+ }).filter(html => html !== false).join(' ')}` : '';
const orthographyNotesHTML = orthography.notes.trim().length > 0 ? 'Notes
' + md(removeTags(orthography.notes)) + '' : '';
- const orthographyHTML = translations.length > 0 || orthographyNotesHTML.length > 0
+ const orthographyHTML = translations.length + orthographyNotesHTML.length > 0
? `
Orthography
- ${translations.length > 0 ? translationsHTML : ''}
+ ${translationsHTML}
${orthographyNotesHTML}`
: '';
- const grammarHTML = 'Grammar
' + md(removeTags(grammar.notes)) + '
';
+ const grammarHTML = grammar.notes.trim().length > 0 ? 'Grammar
'
+ + (grammar.notes.trim().length > 0 ? md(removeTags(grammar.notes)) : '')
+ + '
' : '';
detailsPanel.innerHTML = generalHTML + phonologyHTML + phonotacticsHTML + orthographyHTML + grammarHTML;
}
diff --git a/src/php/api/Dictionary.php b/src/php/api/Dictionary.php
index fc7412a..7660e3d 100644
--- a/src/php/api/Dictionary.php
+++ b/src/php/api/Dictionary.php
@@ -33,14 +33,15 @@ class Dictionary {
$insert_dictionary = $this->db->execute($insert_dictionary_query, array($new_id, $user, 'A new dictionary.', time()));
if ($insert_dictionary === true) {
- $insert_linguistics_query = "INSERT INTO dictionary_linguistics (dictionary, parts_of_speech, phonotactics_notes, translations, orthography_notes, grammar_notes)
-VALUES ($new_id, ?, ?, ?, ?, ?)";
+ $insert_linguistics_query = "INSERT INTO dictionary_linguistics (dictionary, parts_of_speech, phonology_notes, phonotactics_notes, translations, orthography_notes, grammar_notes)
+VALUES ($new_id, ?, ?, ?, ?, ?, ?)";
$insert_linguistics = $this->db->execute($insert_linguistics_query, array(
$this->defaults['partsOfSpeech'],
'',
'',
'',
'',
+ '',
));
if ($insert_linguistics === true) {
@@ -110,6 +111,7 @@ VALUES ($new_id, ?, ?, ?, ?, ?)";
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
+ 'notes' => $result['phonology_notes'],
),
'phonotactics' => array(
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
@@ -287,6 +289,7 @@ VALUES ($new_id, ?, ?, ?, ?, ?)";
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
+ 'notes' => $result['phonology_notes'],
),
'phonotactics' => array(
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
@@ -351,6 +354,7 @@ SET parts_of_speech=:parts_of_speech,
consonants=:consonants,
vowels=:vowels,
blends=:blends,
+ phonology_notes=:phonology_notes,
onset=:onset,
nucleus=:nucleus,
coda=:coda,
@@ -366,6 +370,7 @@ WHERE dictionary=$dictionary";
':consonants' => implode(' ', $linguistics['phonology']['consonants']),
':vowels' => implode(' ', $linguistics['phonology']['vowels']),
':blends' => implode(' ', $linguistics['phonology']['blends']),
+ ':phonology_notes' => $linguistics['phonology']['notes'],
':onset' => implode(',', $linguistics['phonotactics']['onset']),
':nucleus' => implode(',', $linguistics['phonotactics']['nucleus']),
':coda' => implode(',', $linguistics['phonotactics']['coda']),
diff --git a/src/structure.sql b/src/structure.sql
index 8deeea9..a0a6545 100644
--- a/src/structure.sql
+++ b/src/structure.sql
@@ -37,6 +37,7 @@ CREATE TABLE IF NOT EXISTS `dictionary_linguistics` (
`consonants` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated',
`vowels` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated',
`blends` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Space-separated',
+ `phonology_notes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
`onset` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Comma-separated',
`nucleus` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Comma-separated',
`coda` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Comma-separated',
diff --git a/template-index.html b/template-index.html
index 9202c9a..21a3667 100644
--- a/template-index.html
+++ b/template-index.html
@@ -292,6 +292,9 @@
+
Phonotactics