Skip to content

Commit

Permalink
Improve names edit handling (fixes #123) (fixes #149) (#404)
Browse files Browse the repository at this point in the history
* Fix type not shown as selected

* Align names edit ux as editable list

* Add delete name

* Add validation to name form

* Improve name type ux

* Use classMap instead of style

* Add ui improvements to surnames

* Fix show more in name edit

* Add edit features to surnames

* Add nick to name

* Use existing strings

* Adjust call and remove nickname

* Add language strings

* Only show edit buttons on "show more"

---------

Co-authored-by: BlitzundBogen <[email protected]>
  • Loading branch information
BlitzundBogen and BlitzundBogen authored Jun 29, 2024
1 parent a4ce54d commit fdebaf5
Show file tree
Hide file tree
Showing 35 changed files with 284 additions and 154 deletions.
2 changes: 1 addition & 1 deletion lang/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"Year": "Година",
"Not authorized": "Неоторизиран",
"Blog": "Блог",
"Switch to custom type": "Преминете към потребителски тип",
"Add custom type": "Преминете към потребителски тип",
"Please confirm your e-mail address by clicking the link in the e-mail you received and then wait for the tree owner to activate your account.": "Моля, потвърдете своя имейл адрес, като щракнете върху връзката в имейла, който сте получили, и след това изчакайте собственикът на дървото да активира вашия акаунт.",
"Select at least one object type": "Изберете поне един тип обект",
"Edit coordinates": "Редактиране на координати",
Expand Down
2 changes: 1 addition & 1 deletion lang/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Manage users": "Gestionar usuaris",
"Global": "Global",
"Please upload a file in Gramps XML (.gramps) format without media files.": "Penja un fitxer en format Gramps XML (.gramps) sense fitxers multimèdia.",
"Switch to custom type": "Canviar al tipus personalitzat",
"Add custom type": "Afegeix un tipus personalitzat",
"Switch to default type": "Canviar al tipus predeterminat",
"Custom type": "Tipus personalitzat",
"A new version of the app is available.": "Hi ha disponible una nova versió de l'aplicació.",
Expand Down
2 changes: 1 addition & 1 deletion lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"Select at least one object type": "Výběr alespoň jednoho typu objektu",
"filter": "filtrovat",
"Properties": "Vlastnosti",
"Switch to custom type": "Přepnout na vlastní typ",
"Add custom type": "Přepnout na vlastní typ",
"Switch to default type": "Přepnout na výchozí typ",
"Custom type": "Vlastní typ",
"unconfirmed": "nepotvrzené",
Expand Down
2 changes: 1 addition & 1 deletion lang/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"login": "login",
"Lost password?": "Glemt kodeord?",
"Register new account": "Registrer ny konto",
"Switch to custom type": "Skift til tilpasset type",
"Add custom type": "Skift til tilpasset type",
"Switch to default type": "Skift til standardtype",
"Custom type": "Tilpasseet type",
"Blog": "Blog",
Expand Down
3 changes: 2 additions & 1 deletion lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"Recently changed objects": "Zuletzt geänderte Objekte",
"Select language": "Sprache auswählen",
"Show in tree": "Im Baum anzeigen",
"Show more": "Mehr anzeigen",
"User settings": "Benutzereinstellungen",
"Anniversaries": "Jahrestage",
"Export": "Exportieren",
Expand Down Expand Up @@ -68,7 +69,7 @@
"unconfirmed": "unbestätigt",
"Switch to default type": "Zu Standardart wechseln",
"Custom type": "Benutzerdefinierte Art",
"Switch to custom type": "Zu benutzerdefinierter Art wechseln",
"Add custom type": "Benutzerdefinierte Art hinzufügen",
"Replace file": "Datei ersetzen",
"Year": "Jahr",
"Month": "Monat",
Expand Down
3 changes: 2 additions & 1 deletion lang/de_AT.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"Update search index": "Suchindex aktualisieren",
"Manually updating the search index is usually unnecessary, but it may become necessary after an upgrade.": "Eine manuelle Aktualisierung des Suchindexes ist in der Regel nicht erforderlich, kann aber nach einem Upgrade notwendig werden.",
"Event Year": "Ereignisjahr",
"Switch to custom type": "Wechseln zu benutzerdefinierter Art",
"Add custom type": "Benutzerdefinierte Art hinzufügen",
"Switch to default type": "Wechseln zu Standard-Art",
"Custom type": "Benutzerdefinierte Art",
"New account registered successfully.": "Neues Konto erfolgreich registriert.",
Expand Down Expand Up @@ -129,6 +129,7 @@
"Task": "Aufgabe",
"New Task": "Neue Aufgabe",
"Show in blog": "Im Blog anzeigen",
"Show more": "Mehr anzeigen",
"Set Priority": "Priorität festlegen",
"Set Status": "Status festlegen",
"Done": "Erledigt",
Expand Down
8 changes: 6 additions & 2 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"Contributor": "Contributor",
"Editor": "Editor",
"Owner": "Owner",
"Switch to custom type": "Switch to custom type",
"Add custom type": "Add custom type",
"Switch to default type": "Switch to default type",
"Custom type": "Custom type",
"Replace file": "Replace file",
Expand Down Expand Up @@ -113,6 +113,7 @@
"Tasks": "Tasks",
"New Task": "New Task",
"Show in blog": "Show in blog",
"Show more": "Show more",
"Set Priority": "Set Priority",
"Set Status": "Set Status",
"Done": "Done",
Expand Down Expand Up @@ -166,5 +167,8 @@
"Delete Tag": "Delete Tag",
"Edit Tag": "Edit Tag",
"Revision History": "Revision History",
"simple": "simple"
"simple": "simple",
"Are you sure?": "Are you sure?",
"This action cannot be undone.": "This action cannot be undone.",
"Yes": "Yes"
}
3 changes: 2 additions & 1 deletion lang/en_GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"Recently changed objects": "Recently changed objects",
"Select language": "Select language",
"Show in tree": "Show in tree",
"Show more": "Show more",
"User settings": "User settings",
"Anniversaries": "Anniversaries",
"Export": "Export",
Expand Down Expand Up @@ -66,7 +67,7 @@
"Contributor": "Contributor",
"Editor": "Editor",
"Owner": "Owner",
"Switch to custom type": "Switch to custom type",
"Add custom type": "Add custom type",
"Switch to default type": "Switch to default type",
"Custom type": "Custom type",
"Replace file": "Replace file",
Expand Down
2 changes: 1 addition & 1 deletion lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"To start using the blog, add a source with tag 'Blog'.": "Para empezar a utilizar el blog, añada una fuente con la etiqueta 'Blog'.",
"Optionally, enter existing IMAP credentials to enable e-mail notifications required e.g. for user registration.": "Opcionalmente, introduzca las credenciales IMAP existentes para habilitar las notificaciones por correo electrónico necesarias, por ejemplo, para el registro de usuarios.",
"SMTP user": "Usuario SMTP",
"Switch to custom type": "Cambiar a un tipo personalizado",
"Add custom typee": "Añadir un tipo personalizado",
"Switch to default type": "Cambiar al tipo por defecto",
"Custom type": "Tipo personalizado",
"Blog": "Blog",
Expand Down
2 changes: 1 addition & 1 deletion lang/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"Place Hierarchy": "Paikkahierarkia",
"If you intend to synchronize an existing Gramps database with Gramps Web, use the Gramps XML (.gramps) format instead.": "Jos aiot synkronisoida olemassaolevan Gramps-tietokannan Gramps Webiin, käytä Gramps XML (.gramps) -muotoa tämän sijaan.",
"Owner": "Omistaja",
"Switch to custom type": "Vaihda mukautettuun tyyppiin",
"Add custom type": "Vaihda mukautettuun tyyppiin",
"Switch to default type": "Vaihda oletustyyppiin",
"Custom type": "Mukautettu",
"Global": "Globaali",
Expand Down
2 changes: 1 addition & 1 deletion lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"Properties": "Propriétés",
"Update search index": "Mettre à jour l'index de recherche",
"Manually updating the search index is usually unnecessary, but it may become necessary after an upgrade.": "La mise à jour manuelle de l'index de recherche est généralement inutile, mais cela peut devenir nécessaire après une mise à niveau.",
"Switch to custom type": "Changer pour un type personnalisé",
"Add custom type": "Ajouter un type personnalisé",
"Switch to default type": "Changer pour un type par défaut",
"Year": "Année",
"Month": "Mois",
Expand Down
2 changes: 1 addition & 1 deletion lang/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"Username": "שם משתמש",
"All": "הכול",
"Select at least one object type": "נא לבחור לפחות סוג עצם אחד",
"Switch to custom type": "החלפה לסוג מותאם אישית",
"Add custom type": "החלפה לסוג מותאם אישית",
"Switch to default type": "החלפה לסוג ברירת מחדל",
"Custom type": "סוג מותאם אישית",
"filter": "מסנן",
Expand Down
2 changes: 1 addition & 1 deletion lang/hr.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"Contributor": "Doprinositelj",
"Editor": "Urednik",
"Owner": "Vlasnik",
"Switch to custom type": "Promijeni na prilagođenu vrstu",
"Add custom type": "Promijeni na prilagođenu vrstu",
"Switch to default type": "Promijeni na zadanu vrstu",
"Custom type": "Prilagođena vrsta",
"Replace file": "Zamijeni datoteku",
Expand Down
2 changes: 1 addition & 1 deletion lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"Contributor": "Collaboratore",
"Member": "Membro",
"Owner": "Proprietario",
"Switch to custom type": "Passa a tipo personalizzato",
"Add custom type": "Aggiungi un tipo personalizzato",
"Custom type": "Tipo personalizzato",
"Switch to default type": "Passa a tipo predefinito",
"unconfirmed": "non confermato",
Expand Down
2 changes: 1 addition & 1 deletion lang/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"Register new account": "Registrer ny konto",
"Password": "Passord",
"Select at least one object type": "Velg minst én objekttype",
"Switch to custom type": "Bytt til egendefinert type",
"Add custom type": "Bytt til egendefinert type",
"Switch to default type": "Bytt til forvalgt type",
"Custom type": "Egendefinert type",
"All": "Alle",
Expand Down
2 changes: 1 addition & 1 deletion lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"Select at least one object type": "Selecteer ten minste één objecttype",
"Properties": "Eigenschappen",
"filter": "filteren",
"Switch to custom type": "Schakelen naar aangepast type",
"Add custom type": "Een aangepast type toevoegen",
"Switch to default type": "Schakelen naar standaardtype",
"Custom type": "Aangepast type",
"unconfirmed": "onbevestigd",
Expand Down
2 changes: 1 addition & 1 deletion lang/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"A new version of the app is available.": "Ein ny versjon av appen er tilgjengeleg.",
"Blog": "Blogg",
"Change E-mail": "Byte epostadresse",
"Switch to custom type": "Byt til tilpassa type",
"Add custom type": "Byt til tilpassa type",
"Switch to default type": "Byt til standardtype",
"Custom type": "Tilpassa type",
"Change password": "Endre passord",
Expand Down
2 changes: 1 addition & 1 deletion lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"Register new account": "Zarejestruj nowe konto",
"Select at least one object type": "Wybierz co najmniej jeden typ objektu",
"All": "Wszystkie",
"Switch to custom type": "Przełącz na typ niestandardowy",
"Add custom type": "Przełącz na typ niestandardowy",
"Switch to default type": "Przełącz na typ domyślny",
"Custom type": "Typ niestandardowy",
"Place Hierarchy": "Hierarchia miejsc",
Expand Down
2 changes: 1 addition & 1 deletion lang/pt_PT.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"Guest": "Convidado",
"Member": "Membro",
"Editor": "Editor",
"Switch to custom type": "Mudar para tipo personalizado",
"Add custom type": "Adicionar tipo personalizado",
"Custom type": "Tipo personalizado",
"Switch to default type": "Mudar para tipo pré-definido",
"Replace file": "Substituir ficheiro",
Expand Down
2 changes: 1 addition & 1 deletion lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"Select at least one object type": "Выберите хотя бы один тип объекта",
"filter": "фильтр",
"Properties": "Свойства",
"Switch to custom type": "Переключить на пользовательский тип",
"Add custom type": "Переключить на пользовательский тип",
"Switch to default type": "Переключить на тип по умолчанию",
"Custom type": "Пользовательский тип",
"unconfirmed": "неподтверждено",
Expand Down
2 changes: 1 addition & 1 deletion lang/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"Properties": "Vlastnosti",
"filter": "filtrovať",
"Switch to default type": "Prepnúť na štandardný typ",
"Switch to custom type": "Prepnúť na prispôsobený typ",
"Add custom type": "Prepnúť na prispôsobený typ",
"Custom type": "Prispôsobený typ",
"Owner": "Majiteľ",
"Editor": "Editor",
Expand Down
2 changes: 1 addition & 1 deletion lang/sr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Switch to custom type": "Пребаци на прилагођени тип",
"Add custom type": "Пребаци на прилагођени тип",
"Switch to default type": "Пребаци на подразумевани тип",
"Custom type": "Прилагођени тип",
"A new version of the app is available.": "Доступна је нова верзија апликације.",
Expand Down
2 changes: 1 addition & 1 deletion lang/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"Contributor": "Bidragsgivare",
"Editor": "Redaktör",
"Owner": "Ägare",
"Switch to custom type": "Byt till anpassad typ",
"Add custom type": "Byt till anpassad typ",
"Switch to default type": "Byt till standardtyp",
"Custom type": "Anpassad typ",
"Replace file": "Byt ut fil",
Expand Down
2 changes: 1 addition & 1 deletion lang/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"From address": "Adresten",
"filter": "süzgeç",
"Properties": "Özellikler",
"Switch to custom type": "Özel türe geç",
"Add custom type": "Özel türe geç",
"Switch to default type": "Varsayılan türe geç",
"Custom type": "Özel tür",
"unconfirmed": "doğrulanmamış",
Expand Down
2 changes: 1 addition & 1 deletion lang/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"unconfirmed": "не підтверджено",
"Owner": "Власник",
"disabled": "вимкнено",
"Switch to custom type": "Перехід на користувацький тип",
"Add custom type": "Перехід на користувацький тип",
"Switch to default type": "Перехід на типовий тип",
"Custom type": "Користувацький тип",
"Replace file": "Замінити файл",
Expand Down
2 changes: 1 addition & 1 deletion lang/zh_CN.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Switch to custom type": "切换到自定义类型",
"Add custom type": "切换到自定义类型",
"Switch to default type": "切换到默认类型",
"Custom type": "自定义类型",
"A new version of the app is available.": "应用存在可用新版本。",
Expand Down
2 changes: 1 addition & 1 deletion src/components/GrampsjsEditableList.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export class GrampsjsEditableList extends GrampsjsTranslateMixin(LitElement) {
css`
mwc-list,
mwc-list > * {
--mdc-ripple-color: tranparent;
--mdc-ripple-color: transparent;
}
mwc-list > * {
Expand Down
30 changes: 28 additions & 2 deletions src/components/GrampsjsFormEditName.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ import './GrampsjsFormSelectType.js'
import {GrampsjsObjectForm} from './GrampsjsObjectForm.js'

class GrampsjsFormEditName extends GrampsjsObjectForm {
static get properties() {
return {
isFormValid: {type: Boolean},
}
}

constructor() {
super()
this.isFormValid = false
}

renderForm() {
return html`
<grampsjs-form-select-type
Expand All @@ -21,7 +32,7 @@ class GrampsjsFormEditName extends GrampsjsObjectForm {
typeName="name_types"
?loadingTypes=${this.loadingTypes}
defaultTypeName="Birth Name"
initialValue=${this.data?.type || ''}
initialValue=${this.data?.type?.string || this.data?.type || null}
.types="${this.types}"
.typesLocale="${this.typesLocale}"
@formdata:changed="${this._handleFormData}"
Expand All @@ -30,7 +41,6 @@ class GrampsjsFormEditName extends GrampsjsObjectForm {
<grampsjs-form-name
origintype
showMore
id="name"
@formdata:changed="${this._handleFormData}"
?loadingTypes=${this.loadingTypes}
Expand All @@ -42,6 +52,22 @@ class GrampsjsFormEditName extends GrampsjsObjectForm {
</grampsjs-form-name>
`
}

_handleFormData(e) {
super._handleFormData(e)
this.checkFormValidity()
}

checkFormValidity() {
const selectType = this.shadowRoot.querySelector(
'grampsjs-form-select-type'
)
this.isFormValid = selectType === null ? true : selectType.isValid()
}

get isValid() {
return this.isFormValid
}
}

window.customElements.define('grampsjs-form-edit-name', GrampsjsFormEditName)
Loading

0 comments on commit fdebaf5

Please sign in to comment.