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

enhancements for the reply form #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 8 additions & 13 deletions widget/components/Reply.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@
const refresh = getContext('refresh')

async function addComment() {
if (!content) {
alert(t('content_is_required'))
return
}

if (!nickname) {
alert(t('nickname_is_required'))
return
}

try {
loading = true
const res = await api.post('/api/open/comments', {
Expand Down Expand Up @@ -60,18 +50,21 @@
<div class="grid grid-cols-1 gap-4">
<div class="grid grid-cols-2 gap-4">
<div>
<label class="mb-2 block dark:text-gray-200" for="nickname">{t('nickname')}</label>
<label class="mb-2 block dark:text-gray-200" for="cusdis_nickname">{t('nickname')}</label>
<input
name="nickname"
id="cusdis_nickname"
class="w-full p-2 border border-gray-200 bg-transparent dark:text-gray-100 dark:outline-none"
type="text"
required
bind:value={nickname}
/>
</div>
<div>
<label class="mb-2 block dark:text-gray-200" for="email">{t('email')}</label>
<label class="mb-2 block dark:text-gray-200" for="cusdis_email">{t('email')}</label>
<input
name="email"
id="cusdis_email"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can it be t('email')?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's an id 😢

class="w-full p-2 border border-gray-200 bg-transparent dark:text-gray-100 dark:outline-none"
type="email"
bind:value={email}
Expand All @@ -80,9 +73,11 @@
</div>

<div>
<label class="mb-2 block dark:text-gray-200" for="reply_content">{t('reply_placeholder')}</label>
<label class="mb-2 block dark:text-gray-200" for="cusdis_reply_content">{t('reply_placeholder')}</label>
<textarea
name="reply_content"
id="cusdis_reply_content"
required
class="w-full p-2 border border-gray-200 h-24 bg-transparent dark:text-gray-100 dark:outline-none"
bind:value={content}
/>
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'El contingut és obligatori',
nickname_is_required: 'El nom és obligatori',

comment_has_been_sent:
'El teu comentari ha estat enviat. Si us plau, espera la seva aprovació.',
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export default {

// reply
mod_badge: 'MOD',
content_is_required: 'Content is required',
nickname_is_required: 'Nickname is required',

comment_has_been_sent:
'Your comment has been sent. Please wait for approval.',
Expand Down
4 changes: 1 addition & 3 deletions widget/lang/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'El contenido es obligatorio',
nickname_is_required: 'El nombre es obligatorio',


comment_has_been_sent:
'Tu comentario ha sido enviado. Por favor, espera su aprobación.',
}
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'Sisältö on pakollinen',
nickname_is_required: 'Nimi on pakollinen',

comment_has_been_sent:
'Kommenttisi on lähetetty. Odotathan hetken sen hyväksyntää.',
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'Commentaire requis',
nickname_is_required: 'Pseudonyme requis',

comment_has_been_sent:
'Votre commentaire a été publié. Attendez son approbation.',
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/id.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'Konten wajib diisi',
nickname_is_required: 'Nama wajib diisi',

comment_has_been_sent:
'Komentar berhasil terkirim. Mohon tunggu persetujuan.',
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/oc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'Lo contengut es requerit',
nickname_is_required: 'L’escais es requerit',

comment_has_been_sent:
'Comentari enviat. Esperatz sa validacion.',
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/pt-br.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'Conteúdo é requerido',
nickname_is_required: 'Apelido é requerido',

comment_has_been_sent:
'Seu comentário foi enviado. Por favor aguarde pela aprovação.',
Expand Down
2 changes: 0 additions & 2 deletions widget/lang/tr.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: 'MOD',
content_is_required: 'Yorum gereklidir',
nickname_is_required: 'Nickname gereklidir',

comment_has_been_sent:
'Yorumunuz gönderildi. Lütfen onaylanmasını bekleyin.',
Expand Down
4 changes: 1 addition & 3 deletions widget/lang/zh-cn.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ window.CUSDIS_LOCALE = {

// reply
mod_badge: '管理员',
content_is_required: '内容不能为空',
nickname_is_required: '昵称不能为空',


comment_has_been_sent:
'评论已发送,管理员审核通过后会展示',
}