Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update field names to be consistent with FLEx #1731

Merged
merged 8 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Api/Model/Languageforge/Lexicon/Config/LexConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ public static function flexOptionlistCode($fieldName)
* @var array
*/
private static $flexOptionlistNames = [
"grammatical-info" => "Part of Speech",
"grammatical-info" => "Grammatical Category",
"semantic-domain-ddp4" => "Semantic Domain",
"domain-type" => "Academic Domains",
self::ENVIRONMENTS => "Environments",
"location" => "Location",
"usage-type" => "Usages",
"reversal-type" => "Reversal Entries",
"sense-type" => "Type",
"sense-type" => "Sense Type",
megahirt marked this conversation as resolved.
Show resolved Hide resolved
"anthro-code" => "Anthropology Categories",
"do-not-publish-in" => "Publish In",
"status" => "Status",
Expand All @@ -145,7 +145,7 @@ public static function flexOptionlistCode($fieldName)
"paradigm" => "Paradigm",
"users" => "Users",
"translation-type" => "Translation Type",
"from-part-of-speech" => "From Part of Speech",
"from-part-of-speech" => "From Grammatical Category",
"morph-type" => "Morph Type",
"noun-slot" => "Noun Slot",
"verb-slot" => "Verb Slot",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ public function __construct()
$this->entry->fieldOrder[] = LexConfig::SENSES_LIST;

$this->entry->fields[LexConfig::LEXEME] = new LexConfigMultiText();
$this->entry->fields[LexConfig::LEXEME]->label = "Word";
$this->entry->fields[LexConfig::LEXEME]->label = "Lexeme Form";
$this->entry->fields[LexConfig::LEXEME]->inputSystems[] = "th";

$this->entry->fields[LexConfig::SENSES_LIST] = new LexConfigFieldList();
$this->entry->fields[LexConfig::SENSES_LIST]->label = "Meaning";
$this->entry->fields[LexConfig::SENSES_LIST]->label = "Sense";
$this->entry->fields[LexConfig::SENSES_LIST]->fieldOrder[] = LexConfig::GLOSS;
$this->entry->fields[LexConfig::SENSES_LIST]->fieldOrder[] = LexConfig::DEFINITION;
$this->entry->fields[LexConfig::SENSES_LIST]->fieldOrder[] = LexConfig::PICTURES;
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Model/Languageforge/Lexicon/Import/LiftDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ public function readSense($sxeNode, $sense)
);
break;
case "grammatical-info":
// Part Of Speech
// Grammatical Category
$sense->partOfSpeech->value = \Normalizer::normalize((string) $element["value"]);
break;
case "illustration":
Expand Down
2 changes: 1 addition & 1 deletion src/Api/Model/Languageforge/Lexicon/Import/LiftImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function getReport()

/**
* Convert a LIFT range to an option list of the right code
* Usage example: rangeToOptionList($projectModel, 'grammatical-info', 'Part of Speech', $liftRanges['grammatical-info'])
* Usage example: rangeToOptionList($projectModel, 'grammatical-info', 'Grammatical Category', $liftRanges['grammatical-info'])
* @param LexProjectModel $projectModel
* @param string $optionListCode
* @param string $optionListName
Expand Down
10 changes: 4 additions & 6 deletions src/Api/Model/Languageforge/Lexicon/LexCommentFieldReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

class LexCommentFieldReference extends ObjectForEncoding
{
/** @var string - the field name e.g. "lexeme" */
/** @var string */
public $field;

/** @var string - the field name for display e.g. "Word" */
/** @var string */
public $fieldNameForDisplay;

/** @var string */
Expand All @@ -21,11 +21,9 @@ class LexCommentFieldReference extends ObjectForEncoding
/** @var string */
public $inputSystemAbbreviation;

// The EntryContext and SenseContext are strings storing the value of the effective "word" (the entry context) and "meaning" (the sense context) at the time the comment was made

/** @var string - the "Word" value of the entry at comment time */
/** @var string */
public $word;

/** @var string - the "Meaning" value of the entry at comment time */
/** @var string */
public $meaning;
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class Activity {
if (index.includes('#examples')) {
label = 'Example - ' + label;
} else if (index.indexOf('#examples')) {
label = 'Meaning - ' + label;
label = 'Sense - ' + label;
}
return label;
}
Expand All @@ -109,7 +109,7 @@ class Activity {
label = 'Example ' + fieldLabel.example + (label !== 'examples' ? ' ' + label : '');
}
if (fieldLabel.sense) {
label = 'Meaning ' + fieldLabel.sense + (label !== 'senses' ? ' ' + label : '');
label = 'Sense ' + fieldLabel.sense + (label !== 'senses' ? ' ' + label : '');
}
return label;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class EntryListModifiers {
filterText = () => this.filterBy && this.filterBy.text || '';
filterByLabel = () => this.filterBy && this.filterBy.option && this.filterBy.option.label || '';
filterActive = () => !!(this.filterText() || this.filterBy && this.filterBy.option);
sortOptionLabel = (s: string) => s === 'Default' ? `Default (${this.filterText() ? 'Relevance' : 'Word'})` : s;
sortOptionLabel = (s: string) => s === 'Default' ? `Default (${this.filterText() ? 'Relevance' : 'Lexeme Form'})` : s;
}

const entriesIncrement = 50;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<dc-fieldrepeat config="$ctrl.config" model="$ctrl.model" control="$ctrl.control" parent-context-guid="$ctrl.contextGuid"></dc-fieldrepeat>
</div>
</div>
<!-- Place links to "Add Meaning" at the top and bottom of the senses so users can easily find them -->
<div data-ng-if="$ctrl.control.rights.canEditEntry() && isAtEditorEntry()" class="addItem topAddMeaning">
<a class="btn btn-sm btn-std" data-ng-click="$ctrl.addSense(0)"><i class="fa fa-plus"></i> Add Meaning</a>

<div data-ng-if="$ctrl.control.rights.canEditEntry() && isAtEditorEntry()" class="addItem topAddMeaning">
<a class="btn btn-sm btn-std" data-ng-click="$ctrl.addSense(0)"><i class="fa fa-plus"></i> Add Sense</a>
</div>
<div data-ng-if="$ctrl.config.fields.senses.fieldOrder.length > 0">
<!--suppress JSUnusedLocalSymbols -->
Expand All @@ -30,6 +30,6 @@
</div>
</div>
<div data-ng-if="$ctrl.control.rights.canEditEntry() && $ctrl.isAtEditorEntry()" class="addItem">
<a class="btn btn-sm btn-std" data-ng-click="$ctrl.addSense()"><i class="fa fa-plus"></i> Add Meaning</a>
<a class="btn btn-sm btn-std" data-ng-click="$ctrl.addSense()"><i class="fa fa-plus"></i> Add Sense</a>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export class FieldEntryController implements angular.IController {
}

deleteSense = (index: number): void => {
const deletemsg = 'Are you sure you want to delete the meaning <b>\'' +
const deletemsg = 'Are you sure you want to delete the sense <b>\'' +
LexiconUtilityService.getMeaning(this.control.config, this.config.fields.senses as LexConfigFieldList,
this.model.senses[index]) + '\'</b>?';
this.modal.showModalSimple('Delete Meaning', deletemsg, 'Cancel', 'Delete Meaning')
this.modal.showModalSimple('Delete Sense', deletemsg, 'Cancel', 'Delete Sense')
.then(() => {
// Adding or removing senses makes for a non-delta update, so save a possible delta update first
this.control.saveCurrentEntry(false, () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="dc-sense card">
<div class="meaning-label card-header">
<div data-ng-if="$ctrl.control.rights.canEditEntry() && $ctrl.isAtEditorEntry()" class="d-flex align-items-center">
Meaning <span class="notranslate pl-1">{{$ctrl.index+1}}</span>
Sense <span class="notranslate pl-1">{{$ctrl.index+1}}</span>

<span class="flex-grow"></span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export class FieldSenseController implements angular.IController {
const field = this.config.fields[fieldName];
if (field.senseLabel == null) {
field.senseLabel = [];
field.senseLabel[-1] = 'Meaning';
field.senseLabel[-1] = 'Sense';
}

field.senseLabel[this.index] = 'Meaning ' + (this.index + 1);
field.senseLabel[this.index] = 'Sense ' + (this.index + 1);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
</tr>
<tr class="table-secondary">
<td></td>
<th class="text-center align-middle">Meaning Fields</th>
<th class="text-center align-middle">Sense Fields</th>
<td></td>
<th class="text-center align-middle">Select All</th>
<td class="text-center align-middle">
Expand Down
32 changes: 16 additions & 16 deletions test/e2e/tests/editor/editor.audio.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ test.describe('Editor audio', () => {

test.beforeAll(async ({ managerTab }) => {
const configurationPage = await new ConfigurationPageFieldsTab(managerTab, project()).goto();
await configurationPage.toggleFieldExpanded('Entry Fields', 'Word');
await (await configurationPage.getFieldCheckbox('Entry Fields', 'Word', 'ภาษาไทย (IPA)')).check();
await (await configurationPage.getFieldCheckbox('Entry Fields', 'Word', 'ภาษาไทย (Voice)')).check();
await configurationPage.toggleFieldExpanded('Entry Fields', 'Lexeme Form');
await (await configurationPage.getFieldCheckbox('Entry Fields', 'Lexeme Form', 'ภาษาไทย (IPA)')).check();
await (await configurationPage.getFieldCheckbox('Entry Fields', 'Lexeme Form', 'ภาษาไทย (Voice)')).check();
await configurationPage.applyButton.click();
});

Expand All @@ -25,7 +25,7 @@ test.describe('Editor audio', () => {

test('Audio input system is present, playable and has "more" control (member)', async () => {
await editorPageMember.goto();
const audio = editorPageMember.getAudioPlayer('Word', 'taud');
const audio = editorPageMember.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.playIcon).toBeVisible();
await expect(audio.togglePlaybackAnchor).toBeEnabled();

Expand All @@ -36,9 +36,9 @@ test.describe('Editor audio', () => {
await expect(audio.downloadButton).not.toBeVisible();
});

test('Word 2 (without audio): audio input system is not playable but has "upload" button (member)', async () => {
test('Lexeme 2 (without audio): audio input system is not playable but has "upload" button (member)', async () => {
await editorPageMember.goto({ entryId: entryIds()[1] });
const audio = editorPageMember.getAudioPlayer('Word', 'taud');
const audio = editorPageMember.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.togglePlaybackAnchor).not.toBeVisible();
await expect(audio.dropdownToggle).toBeEnabled();
await expect(audio.uploadButton).toBeVisible();
Expand All @@ -56,7 +56,7 @@ test.describe('Editor audio', () => {

test('Audio Input System is playable but does not have "more" control (observer)', async () => {
await editorPageObserver.goto();
const audio = editorPageObserver.getAudioPlayer('Word', 'taud');
const audio = editorPageObserver.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.playIcon).toBeVisible();
await expect(audio.togglePlaybackAnchor).toBeVisible();
await expect(audio.togglePlaybackAnchor).toBeEnabled();
Expand All @@ -65,9 +65,9 @@ test.describe('Editor audio', () => {
await expect(audio.downloadButton).toBeVisible();
});

test('Word 2 (without audio): audio input system is not playable and does not have "upload" button (observer)', async () => {
test('Lexeme 2 (without audio): audio input system is not playable and does not have "upload" button (observer)', async () => {
await editorPageObserver.goto({ entryId: entryIds()[1] });
const audio = editorPageObserver.getAudioPlayer('Word', 'taud');
const audio = editorPageObserver.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.togglePlaybackAnchor).not.toBeVisible();
await expect(audio.dropdownToggle).not.toBeVisible();
await expect(audio.uploadButton).not.toBeVisible();
Expand All @@ -85,7 +85,7 @@ test.describe('Editor audio', () => {

test('Audio input system is present, playable and has "more" control (manager)', async () => {
await editorPageManager.goto();
const audio = editorPageManager.getAudioPlayer('Word', 'taud');
const audio = editorPageManager.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.playIcon).toBeVisible();
await expect(audio.togglePlaybackAnchor).toBeEnabled();
await expect(audio.dropdownToggle).toBeVisible();
Expand All @@ -97,7 +97,7 @@ test.describe('Editor audio', () => {

test('Slider is present and updates with seeking', async () => {
await editorPageManager.goto();
const audio = editorPageManager.getAudioPlayer('Word', 'taud');
const audio = editorPageManager.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.slider).toBeVisible();
const bounds = await audio.slider.boundingBox();
const yMiddle = bounds.y + bounds.height / 2;
Expand All @@ -113,7 +113,7 @@ test.describe('Editor audio', () => {
const cancelAddingAudio = editorPageManager.getCancelDropboxButton(editorPageManager.entryCard, 'Audio');
await expect(cancelAddingAudio).not.toBeVisible();

const audio = editorPageManager.getAudioPlayer('Word', 'taud');
const audio = editorPageManager.getAudioPlayer('Lexeme Form', 'taud');
await audio.dropdownToggle.click();
await audio.dropdownMenu.uploadReplacementButton.click();
await expect(audio.dropdownToggle).not.toBeVisible();
Expand All @@ -126,9 +126,9 @@ test.describe('Editor audio', () => {
await expect(cancelAddingAudio).not.toBeVisible();
});

test('Word 2 (without audio): audio input system is not playable but has "upload" button (manager)', async () => {
test('Lexeme 2 (without audio): audio input system is not playable but has "upload" button (manager)', async () => {
await editorPageManager.goto({ entryId: entryIds()[1] });
const audio = editorPageManager.getAudioPlayer('Word', 'taud');
const audio = editorPageManager.getAudioPlayer('Lexeme Form', 'taud');
await expect(audio.playIcon).not.toBeVisible();

await expect(audio.dropdownToggle).not.toBeVisible();
Expand All @@ -139,7 +139,7 @@ test.describe('Editor audio', () => {

test('Can delete audio input system (manager)', async () => {
await editorPageManager.goto();
const audio = editorPageManager.getAudioPlayer('Word', 'taud');
const audio = editorPageManager.getAudioPlayer('Lexeme Form', 'taud');
await audio.dropdownToggle.click();
await audio.dropdownMenu.deleteAudioButton.click();
const confirmModal = new ConfirmModal(editorPageManager.page);
Expand All @@ -154,7 +154,7 @@ test.describe('Editor audio', () => {
await expect(noticeElement.notices).toHaveCount(0);

// Can't upload a non-audio file
const audio = editorPageManager.getAudioPlayer('Word', 'taud');
const audio = editorPageManager.getAudioPlayer('Lexeme Form', 'taud');
await audio.uploadButton.click();

// Note that Promise.all prevents a race condition between clicking and waiting for the file chooser.
Expand Down
Loading