edit link, validate input
Gitea Actions Demo / build_and_push (push) Successful in 1m3s
Details
Gitea Actions Demo / build_and_push (push) Successful in 1m3s
Details
This commit is contained in:
parent
df94eba559
commit
c0d0a3e8ae
|
|
@ -95,8 +95,11 @@
|
||||||
<input type="checkbox" v-model="workoutItem.is_public" v-on:change="changePublic(workoutItem.is_public)">
|
<input type="checkbox" v-model="workoutItem.is_public" v-on:change="changePublic(workoutItem.is_public)">
|
||||||
</div>
|
</div>
|
||||||
<div class="workout-item-params" >
|
<div class="workout-item-params" >
|
||||||
<div class="workout-item-params-name">Ссылки на описание:</div>
|
<div class="workout-item-params-name">Ссылки на описание: </div>
|
||||||
<div v-if="dzenLink"><a :href="dzenLink" target="_blank">Дзен</a></div>
|
<div v-if="dzenLink">
|
||||||
|
<a :href="dzenLink" target="_blank">Дзен</a>
|
||||||
|
<VaIcon v-if="isPrivate" name="edit" @click="showModalLink = !showModalLink"/>
|
||||||
|
</div>
|
||||||
<div class="workout-item-params-pointer" v-else><a @click="showModalLink = !showModalLink">Добавить</a> </div>
|
<div class="workout-item-params-pointer" v-else><a @click="showModalLink = !showModalLink">Добавить</a> </div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -120,17 +123,31 @@
|
||||||
ok-text="OK"
|
ok-text="OK"
|
||||||
:beforeOk="saveName"
|
:beforeOk="saveName"
|
||||||
>
|
>
|
||||||
|
<VaForm ref="form" @submit.prevent="saveName" @keyup.enter="saveName">
|
||||||
<h3>Редактирование названия</h3>
|
<h3>Редактирование названия</h3>
|
||||||
<input v-if="workoutItem" v-model="workoutItem.name" type="text" placeholder="Название" class="workout-item-input" />
|
<VaInput v-if="workoutItem"
|
||||||
|
v-model="workoutItem.name"
|
||||||
|
:rules="[(v: string) => v.length < 70 || `Слишком длинное название ${v.length}`]"
|
||||||
|
type="text"
|
||||||
|
placeholder="Название"
|
||||||
|
class="workout-item-input" />
|
||||||
<div v-else>Тренировка не найдена</div>
|
<div v-else>Тренировка не найдена</div>
|
||||||
|
</VaForm>
|
||||||
</VaModal>
|
</VaModal>
|
||||||
<VaModal v-if="isPrivate"
|
<VaModal v-if="isPrivate"
|
||||||
v-model="showModalLink"
|
v-model="showModalLink"
|
||||||
ok-text="OK"
|
ok-text="OK"
|
||||||
:beforeOk="saveLink"
|
:beforeOk="saveLink"
|
||||||
>
|
>
|
||||||
|
<VaForm ref="form" @submit.prevent="saveName" @keyup.enter="saveName">
|
||||||
<h3>Редактирование ссылок</h3>
|
<h3>Редактирование ссылок</h3>
|
||||||
<input v-model="dzenLink" type="text" placeholder="Название" class="workout-item-input" />
|
<VaInput
|
||||||
|
v-model="dzenLink"
|
||||||
|
:rules="[(v: string) => v.includes('https://dzen.ru/') || 'Ссылка должна включать https://dzen.ru/']"
|
||||||
|
type="text"
|
||||||
|
placeholder="Название"
|
||||||
|
class="workout-item-input" />
|
||||||
|
</VaForm>
|
||||||
</VaModal>
|
</VaModal>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
|
@ -139,7 +156,7 @@ import VaZoomOut from "../../../components/icons/VaZoomOut.vue";
|
||||||
import 'chartjs-adapter-moment';
|
import 'chartjs-adapter-moment';
|
||||||
import { AxiosResponse, AxiosInstance, AxiosError } from "axios";
|
import { AxiosResponse, AxiosInstance, AxiosError } from "axios";
|
||||||
import { ref, inject, shallowRef } from 'vue'
|
import { ref, inject, shallowRef } from 'vue'
|
||||||
import { useToast } from "vuestic-ui/web-components";
|
import { useToast,useForm } from "vuestic-ui/web-components";
|
||||||
import zoomPlugin, { resetZoom } from 'chartjs-plugin-zoom';
|
import zoomPlugin, { resetZoom } from 'chartjs-plugin-zoom';
|
||||||
import {
|
import {
|
||||||
Chart as ChartJS,
|
Chart as ChartJS,
|
||||||
|
|
@ -368,10 +385,15 @@ const saveLink = (hide: any) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { validate } = useForm("form");
|
||||||
const saveName = (hide: any) => {
|
const saveName = (hide: any) => {
|
||||||
if (!workoutItem) {
|
if (!workoutItem) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!validate()) {
|
||||||
|
return
|
||||||
|
}
|
||||||
if (workoutItem.name.length == 0) {
|
if (workoutItem.name.length == 0) {
|
||||||
init({
|
init({
|
||||||
message: "Название не может быть пустым",
|
message: "Название не может быть пустым",
|
||||||
|
|
@ -490,10 +512,6 @@ h3 {
|
||||||
.workout-item-editable-title i {
|
.workout-item-editable-title i {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
.workout-item-input {
|
|
||||||
border: #333 1px solid;
|
|
||||||
padding-left: 5px;
|
|
||||||
}
|
|
||||||
.workout-item-params-pointer {
|
.workout-item-params-pointer {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue