1
0
mirror of https://github.com/devfake/flox.git synced 2024-11-14 22:22:39 +01:00

Show ratings optionally (#98)

* show ratings optionally

* update production files
This commit is contained in:
Viktor Geringer 2017-11-05 17:06:27 +01:00 committed by GitHub
parent 7059f55d44
commit 1f1967c2b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 2806 additions and 67 deletions

View File

@ -58,6 +58,7 @@
'spoiler' => $settings->episode_spoiler_protection,
'version' => $this->version,
'watchlist' => $settings->show_watchlist_everywhere,
'ratings' => $settings->show_ratings,
];
}
@ -81,6 +82,7 @@
'show_date' => Input::get('date'),
'episode_spoiler_protection' => Input::get('spoiler'),
'show_watchlist_everywhere' => Input::get('watchlist'),
'show_ratings' => Input::get('ratings'),
]);
}
}

View File

@ -17,5 +17,6 @@
'episode_spoiler_protection',
'last_fetch_to_file_parser',
'show_watchlist_everywhere',
'show_ratings',
];
}

View File

@ -0,0 +1,17 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddShowRatingsField extends Migration
{
public function up()
{
Schema::table('settings', function (Blueprint $table) {
$table->string('show_ratings')->default('always');
});
}
public function down() {}
}

View File

@ -26,24 +26,27 @@
{
$this->getJson('api/settings');
$setting1 = Setting::first();
$oldSettings = Setting::first();
$this->actingAs($this->user)->patchJson('api/settings', [
'genre' => 1,
'date' => 0,
'spoiler' => 0,
'watchlist' => 1,
'ratings' => 'hover',
]);
$setting2 = Setting::first();
$newSettings = Setting::first();
$this->assertEquals(0, $setting1->show_genre);
$this->assertEquals(1, $setting1->show_date);
$this->assertEquals(1, $setting1->episode_spoiler_protection);
$this->assertEquals(0, $setting1->show_watchlist_everywhere);
$this->assertEquals(1, $setting2->show_genre);
$this->assertEquals(0, $setting2->show_date);
$this->assertEquals(0, $setting2->episode_spoiler_protection);
$this->assertEquals(1, $setting2->show_watchlist_everywhere );
$this->assertEquals(0, $oldSettings->show_genre);
$this->assertEquals(1, $oldSettings->show_date);
$this->assertEquals(1, $oldSettings->episode_spoiler_protection);
$this->assertEquals(0, $oldSettings->show_watchlist_everywhere);
$this->assertEquals('always', $oldSettings->show_ratings);
$this->assertEquals(1, $newSettings->show_genre);
$this->assertEquals(0, $newSettings->show_date);
$this->assertEquals(0, $newSettings->episode_spoiler_protection);
$this->assertEquals(1, $newSettings->show_watchlist_everywhere);
$this->assertEquals('hover', $newSettings->show_ratings);
}
}

View File

@ -20,6 +20,7 @@
:key="index"
:genre="displayGenre"
:date="displayDate"
:ratings="displayRatings"
></Item>
<span class="nothing-found" v-if=" ! items.length">{{ lang('nothing found') }}</span>
@ -52,7 +53,8 @@
data() {
return {
displayGenre: null,
displayDate: null
displayDate: null,
displayRatings: null,
}
},
@ -98,6 +100,7 @@
this.displayGenre = data.genre;
this.displayDate = data.date;
this.displayRatings = data.ratings;
});
},

View File

@ -1,6 +1,6 @@
<template>
<transition mode="out-in" name="fade">
<div class="item-wrap">
<div class="item-wrap" :class="'show-ratings-' + ratings">
<div class="item-image-wrap no-select">
<rating :rated="rated" :item="localItem" :set-item="setItem"></rating>
@ -43,7 +43,7 @@
export default {
mixins: [MiscHelper, ItemHelper],
props: ['item', 'genre', 'date'],
props: ['item', 'genre', 'date', 'ratings'],
data() {
return {

View File

@ -13,6 +13,14 @@
<div class="setting-box">
<input type="checkbox" value="watchlist" v-model="watchlist" id="watchlist" @change="updateOptions"><label for="watchlist">{{ lang('show watchlist') }}</label>
</div>
<div class="setting-box select-box">
<label for="ratings">{{ lang('show own ratings') }}</label>
<select id="ratings" v-model="ratings" @change="updateOptions">
<option value="always">{{ lang('always') }}</option>
<option value="hover">{{ lang('on hover') }}</option>
<option value="never">{{ lang('never') }}</option>
</select>
</div>
</div>
</template>
@ -35,7 +43,8 @@
genre: null,
date: null,
spoiler: null,
watchlist: null
watchlist: null,
ratings: null,
}
},
@ -58,6 +67,7 @@
this.date = data.date;
this.spoiler = data.spoiler;
this.watchlist = data.watchlist;
this.ratings = data.ratings;
});
},
@ -68,8 +78,9 @@
const genre = this.genre;
const spoiler = this.spoiler;
const watchlist = this.watchlist;
const ratings = this.ratings;
http.patch(`${config.api}/settings`, {date, genre, spoiler, watchlist}).then(response => {
http.patch(`${config.api}/settings`, {date, genre, spoiler, watchlist, ratings}).then(response => {
this.SET_LOADING(false);
}, error => {
alert(error.message);
@ -78,4 +89,4 @@
}
}
</script>
</script>

View File

@ -4,12 +4,12 @@
<section class="big-teaser-wrap" :class="{active: itemLoadedSubpage}" v-show=" ! loading">
<div class="big-teaser-image" :style="backdropImage"></div>
<div class="wrap">
<div class="big-teaser-content">
<div class="big-teaser-data-wrap">
<div class="subpage-poster-wrap-mobile">
<div class="subpage-poster-wrap-mobile" :class="'show-ratings-' + displayRatings">
<rating :rated="rated" :item="item" :set-item="setItem"></rating>
<img class="base" :src="noImage" width="120" height="180">
<img class="real" :src="posterImage" width="120" height="180">
@ -48,7 +48,7 @@
</div>
<div class="subpage-sidebar">
<div class="subpage-poster-wrap">
<div class="subpage-poster-wrap" :class="'show-ratings-' + displayRatings">
<rating :rated="rated" :item="item" :set-item="setItem"></rating>
<img class="base" :src="noImage" width="272" height="408">
<img class="real" :src="posterImage" width="272" height="408">
@ -89,6 +89,7 @@
created() {
document.body.classList.add('subpage-open');
window.scrollTo(0, 0);
this.fetchSettings();
this.fetchData();
},
@ -104,7 +105,8 @@
latestEpisode: null,
loadingImdb: false,
auth: config.auth,
rated: false
rated: false,
displayRatings: null
}
},
@ -183,6 +185,12 @@
}
},
fetchSettings() {
http(`${config.api}/settings`).then(value => {
this.displayRatings = value.data.ratings;
});
},
fetchData() {
const tmdbId = this.$route.params.tmdbId;
@ -237,7 +245,7 @@
this.SET_ITEM_LOADED_SUBPAGE(false);
http.patch(`${config.api}/refresh/${this.item.id}`).then(response => {
this.fetchData();
location.reload();
}, error => {
alert(error);
this.SET_LOADING(false);
@ -249,4 +257,4 @@
Rating
}
}
</script>
</script>

View File

@ -7,6 +7,7 @@
:key="index"
:genre="true"
:date="true"
:ratings="displayRatings"
></Item>
</div>
</div>
@ -27,13 +28,15 @@
mixins: [MiscHelper],
created() {
this.fetchSettings();
this.init();
},
data() {
return {
items: [],
path: ''
path: '',
displayRatings: null
}
},
@ -80,6 +83,12 @@
this.items = response.data;
this.SET_LOADING(false);
});
},
fetchSettings() {
http(`${config.api}/settings`).then(value => {
this.displayRatings = value.data.ratings;
});
}
},
@ -94,4 +103,4 @@
}
}
}
</script>
</script>

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Zeige Watchlist Items überall an",
"feedback": "Solltest du Feedback für uns haben, erstelle bitte ein neues issue auf",
"no release": "Noch kein Veröffentlichungsdatum"
"no release": "Noch kein Veröffentlichungsdatum",
"show own ratings": "Zeige eigenes Rating",
"always": "Immer",
"on hover": "Beim hovern",
"never": "Niemals"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
}
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -62,5 +62,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
}
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -64,5 +64,9 @@
"watchlist": "Watchlist",
"show watchlist": "Show Watchlist Items everywhere",
"feedback": "If you have any feedback for us, please open an issue on",
"no release": "No release date yet"
"no release": "No release date yet",
"show own ratings": "Show own ratings",
"always": "Always",
"on hover": "On hover",
"never": "Never"
}

View File

@ -5,12 +5,13 @@ $rating1: #6bb01a;
$rating2: #da9527;
$rating3: #cd2727;
@mixin transition($type, $type2: '') {
@if $type2 == '' {
transition: $type .2s ease 0s;
}
@else {
@mixin transition($type, $type2: '', $type3: '') {
@if $type3 != '' {
transition: $type .2s ease 0s, $type2 .2s ease 0s, $type3 .2s ease 0s;
} @else if $type2 != '' {
transition: $type .2s ease 0s, $type2 .2s ease 0s;
} @else {
transition: $type .2s ease 0s;
}
}

View File

@ -69,6 +69,27 @@ main {
@include media(6) { lost-column: 1/2; }
}
.show-ratings-never {
.rating-0,
.rating-1,
.rating-2,
.rating-3 {
display: none;
}
}
.show-ratings-hover {
.item-rating {
opacity: 0;
}
&:hover {
.item-rating {
opacity: 1;
}
}
}
.item-image-wrap {
position: relative;
float: left;
@ -219,7 +240,7 @@ main {
transform: translate(-50%, -50%) scale(1.1) !important;
}
@include transition(transform, background);
@include transition(transform, background, opacity);
}
@include media(3) {
@ -758,7 +779,10 @@ main {
font-size: 15px;
margin: 0 0 0 10px;
cursor: pointer;
width: calc(100% - 30px);
@include media(5) {
width: calc(100% - 30px);
}
}
.dark & {
@ -766,6 +790,19 @@ main {
}
}
.select-box {
margin: 10px 0;
label {
margin: 0 10px 0 0;
}
select {
float: left;
font-size: 14px;
}
}
.userdata-changed {
float: left;
width: 100%;
@ -840,4 +877,4 @@ main {
float: left;
width: 100%;
margin: 0 0 20px 0;
}
}

View File

@ -64,7 +64,6 @@ if(process.env.NODE_ENV === 'production') {
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
})
])
}

2617
public/assets/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long