mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
feat(settings): add btn to toggle add project btn
This commit is contained in:
parent
3be80896bb
commit
974e4c39fa
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -1,42 +1,51 @@
|
|||||||
PetiteVue.createApp({
|
PetiteVue.createApp({
|
||||||
//$delimiters: ['${', '}'], // https://github.com/vuejs/petite-vue/pull/100
|
//$delimiters: ['${', '}'], // https://github.com/vuejs/petite-vue/pull/100
|
||||||
activeTab: defaultTab,
|
activeTab: defaultTab,
|
||||||
selectedTimezone: userTimeZone,
|
selectedTimezone: userTimeZone,
|
||||||
vibrantColorsEnabled: JSON.parse(localStorage.getItem('wakapi_vibrant_colors') || false),
|
vibrantColorsEnabled: JSON.parse(
|
||||||
get tzOptions() {
|
localStorage.getItem("wakapi_vibrant_colors"),
|
||||||
return [defaultTzOption, ...tzs.sort().map(tz => ({ value: tz, text: tz }))]
|
),
|
||||||
},
|
labels: {},
|
||||||
updateTab() {
|
get tzOptions() {
|
||||||
this.activeTab = window.location.hash.slice(1) || defaultTab
|
return [
|
||||||
},
|
defaultTzOption,
|
||||||
isActive(tab) {
|
...tzs.sort().map((tz) => ({ value: tz, text: tz })),
|
||||||
return this.activeTab === tab
|
];
|
||||||
},
|
},
|
||||||
confirmRegenerate() {
|
updateTab() {
|
||||||
if (confirm('Are you sure?')) {
|
this.activeTab = window.location.hash.slice(1) || defaultTab;
|
||||||
document.querySelector('#form-regenerate-summaries').submit()
|
},
|
||||||
}
|
isActive(tab) {
|
||||||
},
|
return this.activeTab === tab;
|
||||||
confirmWakatimeImport() {
|
},
|
||||||
if (confirm('Are you sure? The import can not be undone.')) {
|
confirmRegenerate() {
|
||||||
document.querySelector('#form-import-wakatime').submit()
|
if (confirm("Are you sure?")) {
|
||||||
}
|
document.querySelector("#form-regenerate-summaries").submit();
|
||||||
},
|
}
|
||||||
confirmClearData() {
|
},
|
||||||
if (confirm('Are you sure? This can not be undone!')) {
|
confirmWakatimeImport() {
|
||||||
document.querySelector('#form-clear-data').submit()
|
if (confirm("Are you sure? The import can not be undone.")) {
|
||||||
}
|
document.querySelector("#form-import-wakatime").submit();
|
||||||
},
|
}
|
||||||
confirmDeleteAccount() {
|
},
|
||||||
if (confirm('Are you sure? This can not be undone!')) {
|
confirmClearData() {
|
||||||
document.querySelector('#form-delete-user').submit()
|
if (confirm("Are you sure? This can not be undone!")) {
|
||||||
}
|
document.querySelector("#form-clear-data").submit();
|
||||||
},
|
}
|
||||||
onToggleVibrantColors() {
|
},
|
||||||
localStorage.setItem('wakapi_vibrant_colors', this.vibrantColorsEnabled)
|
confirmDeleteAccount() {
|
||||||
},
|
if (confirm("Are you sure? This can not be undone!")) {
|
||||||
mounted() {
|
document.querySelector("#form-delete-user").submit();
|
||||||
this.updateTab()
|
}
|
||||||
window.addEventListener('hashchange', () => this.updateTab())
|
},
|
||||||
}
|
onToggleVibrantColors() {
|
||||||
}).mount('#settings-page')
|
localStorage.setItem("wakapi_vibrant_colors", this.vibrantColorsEnabled);
|
||||||
|
},
|
||||||
|
showProjectAddButton(index) {
|
||||||
|
this.labels[index] = true;
|
||||||
|
},
|
||||||
|
mounted() {
|
||||||
|
this.updateTab();
|
||||||
|
window.addEventListener("hashchange", () => this.updateTab());
|
||||||
|
},
|
||||||
|
}).mount("#settings-page");
|
||||||
|
@ -186,7 +186,7 @@
|
|||||||
style="line-height: 1.8">
|
style="line-height: 1.8">
|
||||||
▸ All <span class="font-semibold">{{ $alias.Type | typeName }}s</span> named
|
▸ All <span class="font-semibold">{{ $alias.Type | typeName }}s</span> named
|
||||||
{{ range $j, $value := $alias.Values }}
|
{{ range $j, $value := $alias.Values }}
|
||||||
<span class="text-white chip text-green-700">{{- $value -}}</span>
|
<span class="chip text-green-700">{{- $value -}}</span>
|
||||||
{{ if lt $j (add (len $alias.Values) -2) }}
|
{{ if lt $j (add (len $alias.Values) -2) }}
|
||||||
<span class="-ml-1">{{- ", " | capitalize -}}</span>
|
<span class="-ml-1">{{- ", " | capitalize -}}</span>
|
||||||
{{ else if lt $j (add (len $alias.Values) -1) }}
|
{{ else if lt $j (add (len $alias.Values) -1) }}
|
||||||
@ -194,7 +194,7 @@
|
|||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
are mapped to <span class="font-semibold">{{ $alias.Type | typeName }}</span> <span
|
are mapped to <span class="font-semibold">{{ $alias.Type | typeName }}</span> <span
|
||||||
class="text-white chip text-green-700">{{ $alias.Key }}</span>
|
class="chip text-green-700">{{ $alias.Key }}</span>
|
||||||
</div>
|
</div>
|
||||||
<form class="float-right" action="" method="post">
|
<form class="float-right" action="" method="post">
|
||||||
<input type="hidden" name="action" value="delete_alias">
|
<input type="hidden" name="action" value="delete_alias">
|
||||||
@ -255,7 +255,7 @@
|
|||||||
<div class="mb-8">
|
<div class="mb-8">
|
||||||
<h3 class="inline-block font-semibold text-gray-300">Your labels</h3>
|
<h3 class="inline-block font-semibold text-gray-300">Your labels</h3>
|
||||||
{{ range $i, $label := .Labels }}
|
{{ range $i, $label := .Labels }}
|
||||||
<div class="flex items-center">
|
<div class="flex items-center" data-element-type="label">
|
||||||
<div class="text-gray-500 border-1 w-full border-green-700 inline-block my-1 py-1 text-align text-sm"
|
<div class="text-gray-500 border-1 w-full border-green-700 inline-block my-1 py-1 text-align text-sm"
|
||||||
style="line-height: 1.8">
|
style="line-height: 1.8">
|
||||||
▸ <span class="font-semibold text-gray-300">{{ $label.Key }}:</span>
|
▸ <span class="font-semibold text-gray-300">{{ $label.Key }}:</span>
|
||||||
@ -268,18 +268,25 @@
|
|||||||
<button type="submit" class="bg-gray-900 text-center hover:bg-gray-700 rounded-full w-4 h-4 leading-none text-red-600" title="Delete label">x</button>
|
<button type="submit" class="bg-gray-900 text-center hover:bg-gray-700 rounded-full w-4 h-4 leading-none text-red-600" title="Delete label">x</button>
|
||||||
</form>
|
</form>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
<form action="" method="post" class="inline-flex space-x-1">
|
<div class="ml-3 inline">
|
||||||
<input type="hidden" name="action" class="block" value="add_label">
|
<button @click="showProjectAddButton({{ $i }})" class="top-1 relative" v-show="!labels[{{ $i }}]">
|
||||||
<input type="hidden" name="value" value="{{ $label.Key }}">
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-4 h-4 text-gray-400">
|
||||||
<select name="key" class="block text-sm select-default !w-auto">
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 4.5v15m7.5-7.5h-15" />
|
||||||
{{ range $k, $project := $.Projects }}
|
</svg>
|
||||||
<option value="{{ $project }}">{{ $project }}</option>
|
|
||||||
{{ end }}
|
|
||||||
</select>
|
|
||||||
<button type="submit" class="btn-primary btn-small">
|
|
||||||
Add project
|
|
||||||
</button>
|
</button>
|
||||||
</form>
|
<form action="" method="post" class="inline-flex space-x-1" v-show="labels[{{ $i }}]">
|
||||||
|
<input type="hidden" name="action" class="block" value="add_label">
|
||||||
|
<input type="hidden" name="value" value="{{ $label.Key }}">
|
||||||
|
<select name="key" class="block text-sm select-default !w-auto">
|
||||||
|
{{ range $k, $project := $.Projects }}
|
||||||
|
<option value="{{ $project }}">{{ $project }}</option>
|
||||||
|
{{ end }}
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="btn-primary btn-small">
|
||||||
|
Add project
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user