-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class Tasks::Sounds::BrowseController < ApplicationController | ||
include TaskControllerConfiguration | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import baseCRUD from './base' | ||
|
||
const permitParams = { | ||
sound: { | ||
name: Number, | ||
sound_file: String | ||
} | ||
} | ||
|
||
export const Sound = { | ||
...baseCRUD('sounds', permitParams) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<template> | ||
<h1>Browse sound</h1> | ||
</template> | ||
|
||
<script setup> | ||
import { ref, onBeforeMount } from 'vue' | ||
import { Sound } from '@/routes/endpoints' | ||
import { getPagination, URLParamsToJSON } from '@/helpers' | ||
import VPagination from '@/components/pagination.vue' | ||
const per = ref(50) | ||
const list = ref([]) | ||
const page = ref(1) | ||
const currentSound = ref(null) | ||
const pagination = ref(null) | ||
Sound.where({ per: 50 }).then((response) => { | ||
pagination.value = response | ||
}) | ||
onBeforeMount(() => { | ||
const params = URLParamsToJSON(window.location.href) | ||
const soundId = params.sound_id | ||
if (soundId) { | ||
Sound.find(soundId).then(({ body }) => { | ||
currentSound.value = body | ||
}) | ||
} | ||
}) | ||
</script> |
26 changes: 26 additions & 0 deletions
26
app/javascript/vue/tasks/sounds/browse/components/SoundList.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="sound in sounds" | ||
:key="sound.id" | ||
> | ||
<td>{{ sound.name }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</template> | ||
|
||
<script setup> | ||
const props = defineProps({ | ||
sounds: { | ||
type: Array, | ||
default: () => [] | ||
} | ||
}) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { createApp } from 'vue' | ||
import App from './App.vue' | ||
|
||
function initApp(element) { | ||
const app = createApp(App) | ||
|
||
app.mount(element) | ||
} | ||
|
||
document.addEventListener('turbolinks:load', () => { | ||
const el = document.querySelector('#vue-browse-sound') | ||
|
||
if (el) { | ||
initApp(el) | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div id="vue-browse-sound"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters