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

readded changes to youtube.blade.php, containers.scss, ModerateEvent.… #2267

Closed
wants to merge 2 commits into from
Closed
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
2 changes: 1 addition & 1 deletion resources/assets/sass/components/containers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
height: 100%;
background: black;
color: white;
display: flex;
display: none;
align-items: center;
justify-content: center;
text-align: center;
Expand Down
142 changes: 72 additions & 70 deletions resources/js/components/Pagination.vue
Original file line number Diff line number Diff line change
@@ -1,87 +1,89 @@
<template>
<nav class="codeweek-pagination" role="navigation" aria-label="pagination">
<ul>
<li>
<a
class="back"
@click.prevent="changePage(pagination.current_page - 1)"
:disabled="pagination.current_page <= 1"
>
{{ $t('pagination.previous') }}
</a>
</li>
<li v-for="page in pages">
<a
v-if="pagination.current_page != page"
class="page"
@click.prevent="changePage(page)"
>
{{ page }}
</a>
<a v-else class="page current">
{{ page }}
</a>
</li>
<li>
<a
class="next"
@click.prevent="changePage(pagination.current_page + 1)"
:disabled="pagination.current_page >= pagination.last_page"
>
{{ $t('pagination.next') }}
</a>
</li>
</ul>
</nav>

<nav class="codeweek-pagination" role="navigation" aria-label="pagination">
<ul>
<li>
<a class="back"
@click.prevent="changePage(pagination.current_page - 1)"
:disabled="pagination.current_page <= 1">
{{$t('pagination.previous')}}
</a>
</li>
<li v-for="page in pages">
<a v-if="pagination.current_page != page"
class="page"
@click.prevent="changePage(page)">
{{ page }}
</a>
<a v-else
class="page current">
{{ page }}
</a>
</li>
<li>
<a class="next"
@click.prevent="changePage(pagination.current_page + 1)"
:disabled="pagination.current_page >= pagination.last_page">
{{$t('pagination.next')}}
</a>
</li>
</ul>
</nav>

</template>

<style>
.pagination {
margin-top: 40px;
}
.pagination {
margin-top: 40px;
}
</style>

<script>
export default {
props: ['pagination', 'offset'],
export default {
props: ['pagination', 'offset'],

methods: {
isCurrentPage(page) {
return this.pagination.current_page === page;
},
methods: {
isCurrentPage(page) {
return this.pagination.current_page === page;
},

changePage(page) {
if (page < 1 || page > this.pagination.last_page) {
return;
}
this.pagination.current_page = page;
this.$emit('paginate', page); // Emit the event with the new page number
}
},
changePage(page) {
if (page === 0 || (page > this.pagination.last_page)){
return;
}

if (page > this.pagination.last_page) {
page = this.pagination.last_page;
}

this.pagination.current_page = page;
this.$dispatch('paginate');
}
},

computed: {
pages() {
let pages = [];
computed: {
pages() {
let pages = [];

let from = this.pagination.current_page - Math.floor(this.offset / 2);
let from = this.pagination.current_page - Math.floor(this.offset / 2);

if (from < 1) {
from = 1;
}
if (from < 1) {
from = 1;
}

let to = from + this.offset - 1;
let to = from + this.offset - 1;

if (to > this.pagination.last_page) {
to = this.pagination.last_page;
}
if (to > this.pagination.last_page) {
to = this.pagination.last_page;
}

while (from <= to) {
pages.push(from);
from++;
}
while (from <= to) {
pages.push(from);
from++;
}

return pages;
return pages;
}
}
}
}
};
</script>
</script>
Loading