-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #615 from leepeuker/add-location-option-cinema
Add location option cinema
- Loading branch information
Showing
16 changed files
with
185 additions
and
14 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
db/migrations/mysql/20240904142241_AddCinemaFlagToLocationTable.php
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,24 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class AddCinemaFlagToLocationTable extends AbstractMigration | ||
{ | ||
public function down() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
ALTER TABLE location DROP COLUMN is_cinema; | ||
SQL, | ||
); | ||
} | ||
|
||
public function up() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
ALTER TABLE location ADD COLUMN is_cinema TINYINT(1) DEFAULT 0 AFTER name; | ||
SQL, | ||
); | ||
} | ||
} |
54 changes: 54 additions & 0 deletions
54
db/migrations/sqlite/20240904142241_AddCinemaFlagToLocationTable.php
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,54 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Phinx\Migration\AbstractMigration; | ||
|
||
final class AddCinemaFlagToLocationTable extends AbstractMigration | ||
{ | ||
public function down() : void | ||
{ | ||
$this->execute( | ||
<<<SQL | ||
CREATE TABLE `location_tmp` ( | ||
`id` INTEGER NOT NULL, | ||
`user_id` TEXT NOT NULL, | ||
`name` TEXT NOT NULL, | ||
`created_at` TEXT NOT NULL, | ||
`updated_at` TEXT DEFAULT NULL, | ||
PRIMARY KEY (`id`), | ||
FOREIGN KEY (`user_id`) REFERENCES user (`id`) ON DELETE CASCADE | ||
) | ||
SQL, | ||
); | ||
$this->execute( | ||
'INSERT INTO `location_tmp` (id, user_id, name, created_at, updated_at) | ||
SELECT id, user_id, name, created_at, updated_at FROM location', | ||
); | ||
$this->execute('DROP TABLE `location`'); | ||
$this->execute('ALTER TABLE `location_tmp` RENAME TO `location`'); | ||
} | ||
|
||
public function up() : void | ||
{ | ||
|
||
$this->execute( | ||
<<<SQL | ||
CREATE TABLE `location_tmp` ( | ||
`id` INTEGER NOT NULL, | ||
`user_id` TEXT NOT NULL, | ||
`name` TEXT NOT NULL, | ||
`is_cinema` INTEGER DEFAULT 0, | ||
`created_at` TEXT NOT NULL, | ||
`updated_at` TEXT DEFAULT NULL, | ||
PRIMARY KEY (`id`), | ||
FOREIGN KEY (`user_id`) REFERENCES user (`id`) ON DELETE CASCADE | ||
) | ||
SQL, | ||
); | ||
$this->execute( | ||
'INSERT INTO `location_tmp` (id, user_id, name, created_at, updated_at) | ||
SELECT * FROM location', | ||
); | ||
$this->execute('DROP TABLE `location`'); | ||
$this->execute('ALTER TABLE `location_tmp` RENAME TO `location`'); | ||
} | ||
} |
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
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
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
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
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
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
32 changes: 32 additions & 0 deletions
32
templates/component/dashboard/row-last-plays-cinema.html.twig
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,32 @@ | ||
{% macro create(dashboardRow, lastPlaysCinema, routeUsername) %} | ||
|
||
{% import 'component/dashboard/row-item-toggle.html.twig' as rowItemToggle %} | ||
{{ rowItemToggle.create(dashboardRow) }} | ||
|
||
<li class="list-group-item {{ dashboardRow.isExtended ? 'activeItem' : 'inactiveItem' }}" style="padding: 1rem 0.4rem 0 0.4rem;"> | ||
<div class="row row-cols-3 row-cols-md-3 row-cols-lg-6"> | ||
{% for lastPlay in lastPlaysCinema %} | ||
<div class="col" style="padding-bottom: 1rem;"> | ||
<div class="card h-100" style="cursor: pointer" onclick="window.location='/users/{{ routeUsername }}/movies/{{ lastPlay.id }}'"> | ||
<div style="height: 100%"> | ||
<img src="{{ lastPlay.poster_path }}" | ||
class="card-img-top" | ||
alt="{{ lastPlay.title }} Poster"> | ||
|
||
</div> | ||
<div class="card-footer" style="padding: 0.1rem"> | ||
<small class="text-muted" style="font-size: 0.8rem;">{{ lastPlay.watched_at|date(dateFormatPhp) }}</small> | ||
</div> | ||
|
||
{% if lastPlay.user_rating is not null %} | ||
<span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-warning text-dark" style="font-size: 0.8rem"> | ||
{{ lastPlay.user_rating }} | ||
</span> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
<a class="btn btn-outline-secondary btn-sm" href="/users/{{ routeUsername }}/history" style="margin-bottom: 1rem;width: 100%;border-color: lightgrey">more</a> | ||
</li> | ||
{% endmacro %} |
Oops, something went wrong.