Change phonotactics exceptions to notes where used
This commit is contained in:
parent
686a7fa542
commit
1c2570684d
|
@ -305,8 +305,8 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label>Exceptions <small>(Markdown-enabled)</small><br>
|
<label>Notes <small>(Markdown-enabled)</small><br>
|
||||||
<textarea id="editExceptions"></textarea>
|
<textarea id="editPhonotacticsNotes"></textarea>
|
||||||
</label>
|
</label>
|
||||||
<h3>Orthography</h3>
|
<h3>Orthography</h3>
|
||||||
<label>Notes <small>(Markdown-enabled)</small><a class="label-button maximize-button">Maximize</a><br>
|
<label>Notes <small>(Markdown-enabled)</small><a class="label-button maximize-button">Maximize</a><br>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { getTimestampInSeconds } from "./helpers";
|
import { getTimestampInSeconds } from "./helpers";
|
||||||
|
|
||||||
export const MIGRATE_VERSION = '2.0.1';
|
export const MIGRATE_VERSION = '2.1.0';
|
||||||
export const DEFAULT_DICTIONARY = {
|
export const DEFAULT_DICTIONARY = {
|
||||||
name: 'New',
|
name: 'New',
|
||||||
specification: 'Dictionary',
|
specification: 'Dictionary',
|
||||||
|
|
|
@ -13,8 +13,8 @@ export function updateDictionary () {
|
||||||
|
|
||||||
export function openEditModal() {
|
export function openEditModal() {
|
||||||
const { name, specification, description, partsOfSpeech } = window.currentDictionary;
|
const { name, specification, description, partsOfSpeech } = window.currentDictionary;
|
||||||
const { consonants, vowels, blends, phonotactics } = window.currentDictionary.details.phonology;
|
const { consonants, vowels, blends } = window.currentDictionary.details.phonology;
|
||||||
const { orthography, grammar } = window.currentDictionary.details;
|
const { phonotactics, orthography, grammar } = window.currentDictionary.details;
|
||||||
const { allowDuplicates, caseSensitive, sortByDefinition, theme, isPublic } = window.currentDictionary.settings;
|
const { allowDuplicates, caseSensitive, sortByDefinition, theme, isPublic } = window.currentDictionary.settings;
|
||||||
|
|
||||||
document.getElementById('editName').value = name;
|
document.getElementById('editName').value = name;
|
||||||
|
@ -28,7 +28,7 @@ export function openEditModal() {
|
||||||
document.getElementById('editOnset').value = phonotactics.onset.join(',');
|
document.getElementById('editOnset').value = phonotactics.onset.join(',');
|
||||||
document.getElementById('editNucleus').value = phonotactics.nucleus.join(',');
|
document.getElementById('editNucleus').value = phonotactics.nucleus.join(',');
|
||||||
document.getElementById('editCoda').value = phonotactics.coda.join(',');
|
document.getElementById('editCoda').value = phonotactics.coda.join(',');
|
||||||
document.getElementById('editExceptions').value = phonotactics.exceptions;
|
document.getElementById('editPhonotacticsNotes').value = phonotactics.notes;
|
||||||
|
|
||||||
document.getElementById('editOrthography').value = orthography.notes;
|
document.getElementById('editOrthography').value = orthography.notes;
|
||||||
document.getElementById('editGrammar').value = grammar.notes;
|
document.getElementById('editGrammar').value = grammar.notes;
|
||||||
|
@ -54,10 +54,10 @@ export function saveEditModal() {
|
||||||
window.currentDictionary.details.phonology.consonants = document.getElementById('editConsonants').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
window.currentDictionary.details.phonology.consonants = document.getElementById('editConsonants').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
||||||
window.currentDictionary.details.phonology.vowels = document.getElementById('editVowels').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
window.currentDictionary.details.phonology.vowels = document.getElementById('editVowels').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
||||||
window.currentDictionary.details.phonology.blends = document.getElementById('editBlends').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
window.currentDictionary.details.phonology.blends = document.getElementById('editBlends').value.split(' ').map(val => val.trim()).filter(val => val !== '');
|
||||||
window.currentDictionary.details.phonology.phonotactics.onset = document.getElementById('editOnset').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
window.currentDictionary.details.phonotactics.onset = document.getElementById('editOnset').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
||||||
window.currentDictionary.details.phonology.phonotactics.nucleus = document.getElementById('editNucleus').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
window.currentDictionary.details.phonotactics.nucleus = document.getElementById('editNucleus').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
||||||
window.currentDictionary.details.phonology.phonotactics.coda = document.getElementById('editCoda').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
window.currentDictionary.details.phonotactics.coda = document.getElementById('editCoda').value.split(',').map(val => val.trim()).filter(val => val !== '');
|
||||||
window.currentDictionary.details.phonology.phonotactics.exceptions = removeTags(document.getElementById('editExceptions').value.trim());
|
window.currentDictionary.details.phonotactics.notes = removeTags(document.getElementById('editPhonotacticsNotes').value.trim());
|
||||||
|
|
||||||
window.currentDictionary.details.orthography.notes = removeTags(document.getElementById('editOrthography').value.trim());
|
window.currentDictionary.details.orthography.notes = removeTags(document.getElementById('editOrthography').value.trim());
|
||||||
window.currentDictionary.details.grammar.notes = removeTags(document.getElementById('editGrammar').value.trim());
|
window.currentDictionary.details.grammar.notes = removeTags(document.getElementById('editGrammar').value.trim());
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
|
import { LOCAL_STORAGE_KEY, DEFAULT_DICTIONARY, MIGRATE_VERSION } from "../constants";
|
||||||
|
import { saveDictionary } from "./dictionaryManagement";
|
||||||
|
|
||||||
export default function migrate() {
|
export default function migrate() {
|
||||||
if (window.location.pathname === '/') {
|
if (window.location.pathname === '/') {
|
||||||
|
@ -103,7 +104,8 @@ export function migrateDictionary() {
|
||||||
migrated = true;
|
migrated = true;
|
||||||
} else if (window.currentDictionary.version !== MIGRATE_VERSION) {
|
} else if (window.currentDictionary.version !== MIGRATE_VERSION) {
|
||||||
switch (window.currentDictionary.version) {
|
switch (window.currentDictionary.version) {
|
||||||
case '2.0.1': {
|
default: console.error('Unknown version'); break;
|
||||||
|
case '2.0.0': {
|
||||||
window.currentDictionary.details.phonotactics = Object.assign({}, window.currentDictionary.details.phonology.phonotactics);
|
window.currentDictionary.details.phonotactics = Object.assign({}, window.currentDictionary.details.phonology.phonotactics);
|
||||||
delete window.currentDictionary.details.phonology.phonotactics;
|
delete window.currentDictionary.details.phonology.phonotactics;
|
||||||
window.currentDictionary.details.phonotactics.notes = window.currentDictionary.details.phonotactics.exceptions;
|
window.currentDictionary.details.phonotactics.notes = window.currentDictionary.details.phonotactics.exceptions;
|
||||||
|
@ -111,10 +113,10 @@ export function migrateDictionary() {
|
||||||
// Add window.currentDictionary.details.orthography.translations = [];
|
// Add window.currentDictionary.details.orthography.translations = [];
|
||||||
// Add window.currentDictionary.custom.css = '';
|
// Add window.currentDictionary.custom.css = '';
|
||||||
window.currentDictionary = Object.assign({}, DEFAULT_DICTIONARY, window.currentDictionary);
|
window.currentDictionary = Object.assign({}, DEFAULT_DICTIONARY, window.currentDictionary);
|
||||||
|
window.currentDictionary.version = MIGRATE_VERSION;
|
||||||
migrated = true;
|
migrated = true;
|
||||||
break;
|
// break; By skipping the break, all migrations can happen in sequence.
|
||||||
}
|
}
|
||||||
default: console.error('Unknown version'); break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,14 +75,14 @@ export function renderDescription() {
|
||||||
|
|
||||||
export function renderDetails() {
|
export function renderDetails() {
|
||||||
const { partsOfSpeech, alphabeticalOrder } = window.currentDictionary;
|
const { partsOfSpeech, alphabeticalOrder } = window.currentDictionary;
|
||||||
const { phonology, orthography, grammar } = window.currentDictionary.details;
|
const { phonology, phonotactics, orthography, grammar } = window.currentDictionary.details;
|
||||||
const partsOfSpeechHTML = `<p><strong>Parts of Speech:</strong> ${partsOfSpeech.map(partOfSpeech => '<span class="tag">' + partOfSpeech + '</span>').join(' ')}</p>`;
|
const partsOfSpeechHTML = `<p><strong>Parts of Speech:</strong> ${partsOfSpeech.map(partOfSpeech => '<span class="tag">' + partOfSpeech + '</span>').join(' ')}</p>`;
|
||||||
const alphabeticalOrderHTML = `<p><strong>Alphabetical Order:</strong> ${
|
const alphabeticalOrderHTML = `<p><strong>Alphabetical Order:</strong> ${
|
||||||
(alphabeticalOrder.length > 0 ? alphabeticalOrder : ['English Alphabet']).map(letter => `<span class="tag">${letter}</span>`).join(' ')
|
(alphabeticalOrder.length > 0 ? alphabeticalOrder : ['English Alphabet']).map(letter => `<span class="tag">${letter}</span>`).join(' ')
|
||||||
}</p>`;
|
}</p>`;
|
||||||
const generalHTML = `<h3>General</h3>${partsOfSpeechHTML}${alphabeticalOrderHTML}`;
|
const generalHTML = `<h3>General</h3>${partsOfSpeechHTML}${alphabeticalOrderHTML}`;
|
||||||
|
|
||||||
const { consonants, vowels, blends, phonotactics } = phonology
|
const { consonants, vowels, blends } = phonology
|
||||||
const consonantHTML = `<p><strong>Consonants:</strong> ${consonants.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
const consonantHTML = `<p><strong>Consonants:</strong> ${consonants.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
||||||
const vowelHTML = `<p><strong>Vowels:</strong> ${vowels.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
const vowelHTML = `<p><strong>Vowels:</strong> ${vowels.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
||||||
const blendHTML = blends.length > 0 ? `<p><strong>Polyphthongs / Blends:</strong> ${blends.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>` : '';
|
const blendHTML = blends.length > 0 ? `<p><strong>Polyphthongs / Blends:</strong> ${blends.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>` : '';
|
||||||
|
@ -93,18 +93,18 @@ export function renderDetails() {
|
||||||
</div>
|
</div>
|
||||||
${blendHTML}`;
|
${blendHTML}`;
|
||||||
|
|
||||||
const { onset, nucleus, coda, exceptions } = phonotactics;
|
const { onset, nucleus, coda } = phonotactics;
|
||||||
const onsetHTML = `<p><strong>Onset:</strong> ${onset.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
const onsetHTML = `<p><strong>Onset:</strong> ${onset.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
||||||
const nucleusHTML = `<p><strong>Nucleus:</strong> ${nucleus.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
const nucleusHTML = `<p><strong>Nucleus:</strong> ${nucleus.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
||||||
const codaHTML = `<p><strong>Coda:</strong> ${coda.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
const codaHTML = `<p><strong>Coda:</strong> ${coda.map(letter => `<span class="tag">${letter}</span>`).join(' ')}</p>`;
|
||||||
const exceptionsHTML = exceptions.trim().length > 0 ? '<p><strong>Exceptions:</strong></p><div>' + md(removeTags(exceptions)) + '</div>' : '';
|
const phonotacticsNotesHTML = phonotactics.notes.trim().length > 0 ? '<p><strong>Notes:</strong></p><div>' + md(removeTags(phonotactics.notes)) + '</div>' : '';
|
||||||
const phonotacticsHTML = `<h3>Phonotactics</h3>
|
const phonotacticsHTML = `<h3>Phonotactics</h3>
|
||||||
<div class="split three">
|
<div class="split three">
|
||||||
<div>${onsetHTML}</div>
|
<div>${onsetHTML}</div>
|
||||||
<div>${nucleusHTML}</div>
|
<div>${nucleusHTML}</div>
|
||||||
<div>${codaHTML}</div>
|
<div>${codaHTML}</div>
|
||||||
</div>
|
</div>
|
||||||
${exceptionsHTML}`;
|
${phonotacticsNotesHTML}`;
|
||||||
|
|
||||||
const orthographyHTML = '<h3>Orthography</h3><p><strong>Notes:</strong></p><div>' + md(removeTags(orthography.notes)) + '</div>';
|
const orthographyHTML = '<h3>Orthography</h3><p><strong>Notes:</strong></p><div>' + md(removeTags(orthography.notes)) + '</div>';
|
||||||
const grammarHTML = '<h3>Grammar</h3><p><strong>Notes:</strong></p><div>' + md(removeTags(grammar.notes)) + '</div>';
|
const grammarHTML = '<h3>Grammar</h3><p><strong>Notes:</strong></p><div>' + md(removeTags(grammar.notes)) + '</div>';
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Dictionary {
|
||||||
$insert_dictionary = $this->db->execute($insert_dictionary_query, array($new_id, $user, 'A new dictionary.', time()));
|
$insert_dictionary = $this->db->execute($insert_dictionary_query, array($new_id, $user, 'A new dictionary.', time()));
|
||||||
|
|
||||||
if ($insert_dictionary === true) {
|
if ($insert_dictionary === true) {
|
||||||
$insert_linguistics_query = "INSERT INTO dictionary_linguistics (dictionary, parts_of_speech, exceptions, orthography_notes, grammar_notes)
|
$insert_linguistics_query = "INSERT INTO dictionary_linguistics (dictionary, parts_of_speech, phonotactics_notes, orthography_notes, grammar_notes)
|
||||||
VALUES ($new_id, ?, ?, ?, ?)";
|
VALUES ($new_id, ?, ?, ?, ?)";
|
||||||
$insert_linguistics = $this->db->execute($insert_linguistics_query, array(
|
$insert_linguistics = $this->db->execute($insert_linguistics_query, array(
|
||||||
$this->defaults['partsOfSpeech'],
|
$this->defaults['partsOfSpeech'],
|
||||||
|
@ -109,12 +109,12 @@ VALUES ($new_id, ?, ?, ?, ?)";
|
||||||
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
|
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
|
||||||
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
|
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
|
||||||
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
|
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
|
||||||
'phonotactics' => array(
|
),
|
||||||
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
|
'phonotactics' => array(
|
||||||
'nucleus' => $result['nucleus'] !== '' ? explode(',', $result['nucleus']) : array(),
|
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
|
||||||
'coda' => $result['coda'] !== '' ? explode(',', $result['coda']) : array(),
|
'nucleus' => $result['nucleus'] !== '' ? explode(',', $result['nucleus']) : array(),
|
||||||
'exceptions' => $result['exceptions'],
|
'coda' => $result['coda'] !== '' ? explode(',', $result['coda']) : array(),
|
||||||
),
|
'notes' => $result['phonotactics_notes'],
|
||||||
),
|
),
|
||||||
'orthography' => array(
|
'orthography' => array(
|
||||||
'notes' => $result['orthography_notes'],
|
'notes' => $result['orthography_notes'],
|
||||||
|
@ -260,12 +260,12 @@ VALUES ($new_id, ?, ?, ?, ?)";
|
||||||
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
|
'consonants' => $result['consonants'] !== '' ? explode(' ', $result['consonants']) : array(),
|
||||||
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
|
'vowels' => $result['vowels'] !== '' ? explode(' ', $result['vowels']) : array(),
|
||||||
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
|
'blends' => $result['blends'] !== '' ? explode(' ', $result['blends']) : array(),
|
||||||
'phonotactics' => array(
|
),
|
||||||
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
|
'phonotactics' => array(
|
||||||
'nucleus' => $result['nucleus'] !== '' ? explode(',', $result['nucleus']) : array(),
|
'onset' => $result['onset'] !== '' ? explode(',', $result['onset']) : array(),
|
||||||
'coda' => $result['coda'] !== '' ? explode(',', $result['coda']) : array(),
|
'nucleus' => $result['nucleus'] !== '' ? explode(',', $result['nucleus']) : array(),
|
||||||
'exceptions' => $result['exceptions'],
|
'coda' => $result['coda'] !== '' ? explode(',', $result['coda']) : array(),
|
||||||
),
|
'notes' => $result['phonotactics_notes'],
|
||||||
),
|
),
|
||||||
'orthography' => array(
|
'orthography' => array(
|
||||||
'notes' => $result['orthography_notes'],
|
'notes' => $result['orthography_notes'],
|
||||||
|
@ -326,7 +326,7 @@ SET parts_of_speech=:parts_of_speech,
|
||||||
onset=:onset,
|
onset=:onset,
|
||||||
nucleus=:nucleus,
|
nucleus=:nucleus,
|
||||||
coda=:coda,
|
coda=:coda,
|
||||||
exceptions=:exceptions,
|
phonotactics_notes=:phonotactics_notes,
|
||||||
orthography_notes=:orthography_notes,
|
orthography_notes=:orthography_notes,
|
||||||
grammar_notes=:grammar_notes
|
grammar_notes=:grammar_notes
|
||||||
WHERE dictionary=$dictionary";
|
WHERE dictionary=$dictionary";
|
||||||
|
@ -337,10 +337,10 @@ WHERE dictionary=$dictionary";
|
||||||
':consonants' => implode(' ', $linguistics['phonology']['consonants']),
|
':consonants' => implode(' ', $linguistics['phonology']['consonants']),
|
||||||
':vowels' => implode(' ', $linguistics['phonology']['vowels']),
|
':vowels' => implode(' ', $linguistics['phonology']['vowels']),
|
||||||
':blends' => implode(' ', $linguistics['phonology']['blends']),
|
':blends' => implode(' ', $linguistics['phonology']['blends']),
|
||||||
':onset' => implode(',', $linguistics['phonology']['phonotactics']['onset']),
|
':onset' => implode(',', $linguistics['phonotactics']['onset']),
|
||||||
':nucleus' => implode(',', $linguistics['phonology']['phonotactics']['nucleus']),
|
':nucleus' => implode(',', $linguistics['phonotactics']['nucleus']),
|
||||||
':coda' => implode(',', $linguistics['phonology']['phonotactics']['coda']),
|
':coda' => implode(',', $linguistics['phonotactics']['coda']),
|
||||||
':exceptions' => $linguistics['phonology']['phonotactics']['exceptions'],
|
':phonotactics_notes' => $linguistics['phonotactics']['notes'],
|
||||||
':orthography_notes' => $linguistics['orthography']['notes'],
|
':orthography_notes' => $linguistics['orthography']['notes'],
|
||||||
':grammar_notes' => $linguistics['grammar']['notes'],
|
':grammar_notes' => $linguistics['grammar']['notes'],
|
||||||
));
|
));
|
||||||
|
|
|
@ -40,7 +40,7 @@ CREATE TABLE IF NOT EXISTS `dictionary_linguistics` (
|
||||||
`onset` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Comma-separated',
|
`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',
|
`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',
|
`coda` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' COMMENT 'Comma-separated',
|
||||||
`exceptions` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
|
`phonotactics_notes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
|
||||||
`orthography_notes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
|
`orthography_notes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
|
||||||
`grammar_notes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
|
`grammar_notes` text CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL COMMENT 'Markdown',
|
||||||
UNIQUE KEY `dictionary` (`dictionary`)
|
UNIQUE KEY `dictionary` (`dictionary`)
|
||||||
|
|
|
@ -306,8 +306,8 @@
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label>Exceptions <small>(Markdown-enabled)</small><br>
|
<label>Notes <small>(Markdown-enabled)</small><br>
|
||||||
<textarea id="editExceptions"></textarea>
|
<textarea id="editPhonotacticsNotes"></textarea>
|
||||||
</label>
|
</label>
|
||||||
<h3>Orthography</h3>
|
<h3>Orthography</h3>
|
||||||
<label>Notes <small>(Markdown-enabled)</small><a class="label-button maximize-button">Maximize</a><br>
|
<label>Notes <small>(Markdown-enabled)</small><a class="label-button maximize-button">Maximize</a><br>
|
||||||
|
|
Loading…
Reference in New Issue