diff --git a/app/ChannelMilestonePlatform.php b/app/ChannelMilestonePlatform.php new file mode 100644 index 0000000..2eaec21 --- /dev/null +++ b/app/ChannelMilestonePlatform.php @@ -0,0 +1,21 @@ +belongsTo(ChannelPlatform::class); + } + + public function milestonePlatform() { + return $this->belongsTo(MilestonePlatform::class); + } +} diff --git a/app/Http/Controllers/Admin/ChannelMilestonePlatformController.php b/app/Http/Controllers/Admin/ChannelMilestonePlatformController.php new file mode 100644 index 0000000..6efc440 --- /dev/null +++ b/app/Http/Controllers/Admin/ChannelMilestonePlatformController.php @@ -0,0 +1,41 @@ +authorize('edit_milestone'); + + $channelMilestonePlatform = ChannelMilestonePlatform::create([ + 'milestone_platform_id' => $milestonePlatform->id, + 'channel_platform_id' => $channelPlatform->id, + 'active' => 1 + ]); + + return redirect()->back()->with('status', ''.$channelPlatform->name.' has been added to '.$milestonePlatform->platform->name.' for '.$milestonePlatform->milestone->name.'.'); + } + + public function toggle(ChannelMilestonePlatform $channelMilestonePlatform) { + $this->authorize('edit_milestone'); + + $channelMilestonePlatform->update([ + 'active' => $channelMilestonePlatform->active === 1 ? 0 : 1 + ]); + + return redirect()->back()->with('status', ''.$channelMilestonePlatform->channelPlatform->name.' has been toggled for '.$channelMilestonePlatform->milestonePlatform->platform->name.' for '.$channelMilestonePlatform->milestonePlatform->milestone->name.'.'); + } + + public function destroy(ChannelMilestonePlatform $channelMilestonePlatform) { + $this->authorize('edit_milestone'); + + $channelMilestonePlatform->delete(); + + return redirect()->back()->with('status', ''.$channelMilestonePlatform->channelPlatform->name.' has been removed from '.$channelMilestonePlatform->milestonePlatform->platform->name.' for '.$channelMilestonePlatform->milestonePlatform->milestone->name.'.'); + } +} diff --git a/app/Http/Controllers/Admin/MilestonePlatformController.php b/app/Http/Controllers/Admin/MilestonePlatformController.php new file mode 100644 index 0000000..db11535 --- /dev/null +++ b/app/Http/Controllers/Admin/MilestonePlatformController.php @@ -0,0 +1,30 @@ +authorize('edit_milestone'); + + $milestonePlatform = MilestonePlatform::create([ + 'milestone_id' => $milestone->id, + 'platform_id' => $platform->id + ]); + + return redirect()->back()->with('status', ''.$milestonePlatform->platform->name.' has been added to '.$milestonePlatform->milestone->name.'.'); + } + + public function destroy(MilestonePlatform $milestonePlatform) { + $this->authorize('edit_milestone'); + + $milestonePlatform->delete(); + + return redirect()->back()->with('status', ''.$milestonePlatform->platform->name.' has been removed from '.$milestonePlatform->milestone->name.'.'); + } +} diff --git a/app/Http/Controllers/admin/MilestoneController.php b/app/Http/Controllers/admin/MilestoneController.php index 00dccfb..560c623 100644 --- a/app/Http/Controllers/admin/MilestoneController.php +++ b/app/Http/Controllers/admin/MilestoneController.php @@ -5,6 +5,9 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Milestone; +use App\Platform; +use App\MilestonePlatform; +use App\ChannelMilestonePlatform; use Twitter; class MilestoneController extends Controller @@ -50,8 +53,10 @@ public function store(Request $request) { */ public function edit(Milestone $milestone) { $this->authorize('edit_milestone'); + + $platforms = Platform::all(); - return view('core.milestones.edit', compact('milestone')); + return view('core.milestones.edit', compact('milestone', 'platforms')); } /** diff --git a/app/Milestone.php b/app/Milestone.php index 1a9a51a..517469a 100644 --- a/app/Milestone.php +++ b/app/Milestone.php @@ -20,6 +20,10 @@ public function releases() { return $this->hasMany(Release::class, 'milestone'); } + public function milestonePlatforms() { + return $this->hasMany(MilestonePlatform::class); + } + public function getBgColorAttribute() { return 'background-color: #'.$this->color; } diff --git a/app/MilestonePlatform.php b/app/MilestonePlatform.php new file mode 100644 index 0000000..80a132e --- /dev/null +++ b/app/MilestonePlatform.php @@ -0,0 +1,25 @@ +belongsTo(Milestone::class); + } + + public function platform() { + return $this->belongsTo(Platform::class); + } + + public function channelMilestonePlatform() { + return $this->hasMany(ChannelMilestonePlatform::class); + } +} diff --git a/app/Platform.php b/app/Platform.php index 55cce7a..d72c320 100644 --- a/app/Platform.php +++ b/app/Platform.php @@ -31,7 +31,7 @@ public function getColoredIconAttribute() { } public function getBgColorAttribute() { - return 'background-color: #'.$this->color; + return 'background-color: '.$this->color; } public function getRouteKeyName() { diff --git a/composer.lock b/composer.lock index 3a2ac1f..1a23e4a 100644 --- a/composer.lock +++ b/composer.lock @@ -1356,16 +1356,16 @@ }, { "name": "laravel/framework", - "version": "v8.17.0", + "version": "v8.17.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "09bd79531d3f958f02fa34f1f14197b1716ef29b" + "reference": "b89363b540bd8ad6e727ee165b510a19fe170a28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/09bd79531d3f958f02fa34f1f14197b1716ef29b", - "reference": "09bd79531d3f958f02fa34f1f14197b1716ef29b", + "url": "https://api.github.com/repos/laravel/framework/zipball/b89363b540bd8ad6e727ee165b510a19fe170a28", + "reference": "b89363b540bd8ad6e727ee165b510a19fe170a28", "shasum": "" }, "require": { @@ -1515,7 +1515,7 @@ "framework", "laravel" ], - "time": "2020-12-01T15:01:58+00:00" + "time": "2020-12-03T13:47:59+00:00" }, { "name": "laravel/tinker", @@ -2166,16 +2166,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.10.2", + "version": "v4.10.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de" + "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/658f1be311a230e0907f5dfe0213742aff0596de", - "reference": "658f1be311a230e0907f5dfe0213742aff0596de", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", + "reference": "dbe56d23de8fcb157bbc0cfb3ad7c7de0cfb0984", "shasum": "" }, "require": { @@ -2214,7 +2214,7 @@ "parser", "php" ], - "time": "2020-09-26T10:30:38+00:00" + "time": "2020-12-03T17:45:45+00:00" }, { "name": "opis/closure", @@ -2623,16 +2623,16 @@ }, { "name": "psy/psysh", - "version": "v0.10.4", + "version": "v0.10.5", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "a8aec1b2981ab66882a01cce36a49b6317dc3560" + "reference": "7c710551d4a2653afa259c544508dc18a9098956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/a8aec1b2981ab66882a01cce36a49b6317dc3560", - "reference": "a8aec1b2981ab66882a01cce36a49b6317dc3560", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/7c710551d4a2653afa259c544508dc18a9098956", + "reference": "7c710551d4a2653afa259c544508dc18a9098956", "shasum": "" }, "require": { @@ -2691,7 +2691,7 @@ "interactive", "shell" ], - "time": "2020-05-03T19:32:03+00:00" + "time": "2020-12-04T02:51:30+00:00" }, { "name": "ralouphie/getallheaders", @@ -6556,16 +6556,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.4.4", + "version": "9.5.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6535e637961f0829832621dc1b7308c2d24a799e" + "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6535e637961f0829832621dc1b7308c2d24a799e", - "reference": "6535e637961f0829832621dc1b7308c2d24a799e", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", + "reference": "8e16c225d57c3d6808014df6b1dd7598d0a5bbbe", "shasum": "" }, "require": { @@ -6581,7 +6581,7 @@ "phar-io/version": "^3.0.2", "php": ">=7.3", "phpspec/prophecy": "^1.12.1", - "phpunit/php-code-coverage": "^9.2", + "phpunit/php-code-coverage": "^9.2.3", "phpunit/php-file-iterator": "^3.0.5", "phpunit/php-invoker": "^3.1.1", "phpunit/php-text-template": "^2.0.3", @@ -6612,7 +6612,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "9.4-dev" + "dev-master": "9.5-dev" } }, "autoload": { @@ -6651,7 +6651,7 @@ "type": "github" } ], - "time": "2020-12-01T04:58:47+00:00" + "time": "2020-12-04T05:05:53+00:00" }, { "name": "sebastian/cli-parser", diff --git a/database/migrations/2020_12_02_214725_create_channel_milestone_platforms_table.php b/database/migrations/2020_12_02_214725_create_channel_milestone_platforms_table.php new file mode 100644 index 0000000..6369f0c --- /dev/null +++ b/database/migrations/2020_12_02_214725_create_channel_milestone_platforms_table.php @@ -0,0 +1,34 @@ +id(); + $table->foreignId('channel_platform_id')->references('id')->on('channel_platforms'); + $table->foreignId('milestone_platform_id')->references('id')->on('milestone_platforms'); + $table->integer('active')->required()->default(1); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('channel_milestone_platforms'); + } +} diff --git a/public/css/admin.css b/public/css/admin.css index f253de9..92bbba6 100644 --- a/public/css/admin.css +++ b/public/css/admin.css @@ -11593,6 +11593,9 @@ textarea.form-control-lg { .card .card-header + .card-body { padding: 0 1rem 1rem; } +.card :first-child { + border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; +} .card .card-description-overflow { overflow: hidden; text-overflow: ellipsis; @@ -12102,6 +12105,23 @@ a:hover { border-width: 1.5px; } +.dropdown-item { + height: 2.25rem; +} +.dropdown-item > svg[style] { + transition: all 0.2s ease-in-out; +} +.dropdown-item:hover > svg[style] { + color: #fff !important; +} + +.dot { + width: 6px; + height: 6px; + border-radius: 6px !important; + margin-right: 0.5rem; +} + .action-close { background-color: transparent; width: 40px; diff --git a/readme.md b/readme.md index af84564..f19a6db 100644 --- a/readme.md +++ b/readme.md @@ -108,4 +108,8 @@ alter table `channel_platforms` add constraint `channel_platforms_channel_id_for alter table `channel_platforms` add `short_name` varchar(191) not null after `channel_id`, `name` varchar(191) not null after `channel_id`; alter table `platforms` add `position` int not null default '1' after `icon`; + +create table `channel_milestone_platforms` (`id` bigint unsigned not null auto_increment primary key, `channel_platform_id` bigint unsigned not null, `milestone_platform_id` bigint unsigned not null, `active` int not null default '1', `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci'; +alter table `channel_milestone_platforms` add constraint `channel_milestone_platforms_channel_platform_id_foreign` foreign key (`channel_platform_id`) references `channel_platforms` (`id`); +alter table `channel_milestone_platforms` add constraint `channel_milestone_platforms_milestone_platform_id_foreign` foreign key (`milestone_platform_id`) references `milestone_platforms` (`id`); ``` \ No newline at end of file diff --git a/resources/sass/core/_card.scss b/resources/sass/core/_card.scss index e191395..30d6bdd 100644 --- a/resources/sass/core/_card.scss +++ b/resources/sass/core/_card.scss @@ -12,6 +12,10 @@ padding: 0 1rem 1rem; } + :first-child { + border-radius: calc(0.25rem - 1px) calc(0.25rem - 1px) 0 0; + } + .card-description-overflow { overflow: hidden; text-overflow: ellipsis; diff --git a/resources/sass/core/admin.scss b/resources/sass/core/admin.scss index c7571e3..1c272f5 100644 --- a/resources/sass/core/admin.scss +++ b/resources/sass/core/admin.scss @@ -277,6 +277,29 @@ a { border-width: 1.5px; } +// Dropdowns +.dropdown-item { + height: 2.25rem; + + > svg[style] { + transition: $transition-base; + } + + &:hover { + > svg[style] { + color: #fff !important; + } + } +} + +// Dots +.dot { + width: 6px; + height: 6px; + border-radius: 6px !important; + margin-right: .5rem; +} + // Jumbotron .action-close { background-color: transparent; diff --git a/resources/views/core/milestones/edit.blade.php b/resources/views/core/milestones/edit.blade.php index b85f59c..73c6969 100644 --- a/resources/views/core/milestones/edit.blade.php +++ b/resources/views/core/milestones/edit.blade.php @@ -211,6 +211,110 @@ +