Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
#87 #88 Dynamically generate platform channel forms
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Dec 1, 2020
1 parent 6640656 commit 2ed1e39
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 60 deletions.
4 changes: 4 additions & 0 deletions app/Channel.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public function getBgColorAttribute() {
return 'background-color: '.$this->color;
}

public function getTextColorAttribute() {
return 'color: '.$this->color;
}

public function getRouteKeyName() {
return 'slug';
}
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/admin/FlightController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Release;
use App\Platform;
use App\Milestone;
use Twitter;

Expand All @@ -17,12 +18,13 @@ class FlightController extends Controller
*/
public function index() {
$releases = Release::orderBy('date', 'desc')->orderBy('build', 'desc')->orderBy('delta', 'desc')->orderBy('ring', 'desc')->paginate(100);
$platforms = Platform::where('active', 1)->get();

foreach ($releases as $release) {
$timeline[$release->date->format('j F Y')][$release->build][$release->delta][$release->platform][$release->ring] = $release;
}

return view('core.flights.index', compact('releases', 'timeline'));
return view('core.flights.index', compact('releases', 'platforms', 'timeline'));
}

/**
Expand Down
1 change: 1 addition & 0 deletions app/Http/Controllers/admin/MilestoneController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function store(Request $request) {
*/
public function edit(Milestone $milestone) {
$this->authorize('edit_milestone');

return view('core.milestones.edit', compact('milestone'));
}

Expand Down
2 changes: 0 additions & 2 deletions app/Release.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ static function getMilestoneByString($string) {

$milestone = Milestone::where('start_build', '<=', $build)->orderBy('start_build', 'desc')->first();

dd($build, $delta, $milestone->id);

return $milestone->id;
}

Expand Down
70 changes: 13 additions & 57 deletions resources/views/core/flights/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,63 +47,19 @@
<label class="form-label" for="tweet">Tweet this</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="tweet" name="tweet" value="1" checked="checked"><label class="form-check-label" for="tweet"> Send a tweet on <a href="https://twitter.com/changewindows">@ChangeWindows</a></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">PC</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f12" name="flight[1][2]" value="2"><label class="form-check-label" for="f12"><span class="label fast">Dev</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f13" name="flight[1][3]" value="3"><label class="form-check-label" for="f13"><span class="label slow">Beta</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f15" name="flight[1][5]" value="5"><label class="form-check-label" for="f15"><span class="label release">Release Preview</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f16" name="flight[1][6]" value="6"><label class="form-check-label" for="f16"><span class="label targeted">Semi-Annual Targeted</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f17" name="flight[1][7]" value="7"><label class="form-check-label" for="f17"><span class="label broad">Semi-Annual Broad</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f18" name="flight[1][8]" value="8"><label class="form-check-label" for="f18"><span class="label ltsc">LTSC</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">Xbox</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f31" name="flight[3][1]" value="1"><label class="form-check-label" for="f31"><span class="label skip">Skip Ahead</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f32" name="flight[3][2]" value="2"><label class="form-check-label" for="f32"><span class="label fast">Alpha Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f33" name="flight[3][3]" value="3"><label class="form-check-label" for="f33"><span class="label slow">Beta Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f34" name="flight[3][4]" value="4"><label class="form-check-label" for="f34"><span class="label preview">Delta Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f35" name="flight[3][5]" value="5"><label class="form-check-label" for="f35"><span class="label release">Omega Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f36" name="flight[3][6]" value="6"><label class="form-check-label" for="f36"><span class="label targeted">Production</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">Server</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f43" name="flight[4][3]" value="3"><label class="form-check-label" for="f43"><span class="label slow">Preview</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f46" name="flight[4][6]" value="6"><label class="form-check-label" for="f46"><span class="label targeted">Semi-Annual Targeted</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f48" name="flight[4][8]" value="8"><label class="form-check-label" for="f48"><span class="label ltsc">LTSC</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">Holographic</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f52" name="flight[5][2]" value="2"><label class="form-check-label" for="f52"><span class="label fast">Fast Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f53" name="flight[5][3]" value="3"><label class="form-check-label" for="f53"><span class="label slow">Slow Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f56" name="flight[5][6]" value="6"><label class="form-check-label" for="f56"><span class="label targeted">Semi-Annual Targeted</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f57" name="flight[5][7]" value="7"><label class="form-check-label" for="f57"><span class="label broad">Semi-Annual Broad</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f58" name="flight[5][8]" value="8"><label class="form-check-label" for="f58"><span class="label ltsc">LTSC</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">IoT</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f63" name="flight[6][3]" value="3"><label class="form-check-label" for="f63"><span class="label slow">Preview</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f66" name="flight[6][6]" value="6"><label class="form-check-label" for="f66"><span class="label targeted">Semi-Annual Targeted</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f67" name="flight[6][7]" value="7"><label class="form-check-label" for="f67"><span class="label broad">Semi-Annual Broad</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">Team</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f72" name="flight[7][2]" value="2"><label class="form-check-label" for="f72"><span class="label fast">Fast Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f73" name="flight[7][3]" value="3"><label class="form-check-label" for="f73"><span class="label slow">Slow Ring</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f76" name="flight[7][6]" value="6"><label class="form-check-label" for="f76"><span class="label targeted">Semi-Annual Targeted</span></label></label></div>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f77" name="flight[7][7]" value="7"><label class="form-check-label" for="f77"><span class="label broad">Semi-Annual Broad</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">10X</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f103" name="flight[10][3]" value="3"><label class="form-check-label" for="f103"><span class="label slow">Preview</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">ISO</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f86" name="flight[8][6]" value="6"><label class="form-check-label" for="f86"><span class="label targeted">Public</span></label></label></div>
</div>
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">SDK</label>
<div class="form-check"><input type="checkbox" class="form-check-input" id="f96" name="flight[9][6]" value="6"><label class="form-check-label" for="f96"><span class="label targeted">Public</span></label></label></div>
</div>
@foreach($platforms as $platform)
<div class="col-md-4 col-sm-6">
<label for="ring" class="control-label mb-2">{!! $platform->colored_icon !!} {{ $platform->name }}</label>
@foreach($platform->channelPlatforms as $channelPlatform)
<div class="form-check">
<input type="checkbox" class="form-check-input" id="f{{ $platform->id }}{{ $channelPlatform->channel->id }}" name="flight[{{ $platform->id }}][{{ $channelPlatform->channel->id }}]" value="{{ $channelPlatform->channel->id }}" />
<label class="form-check-label" for="f{{ $platform->id }}{{ $channelPlatform->channel->id }}">
<span style="{{ $channelPlatform->channel->text_color }}">{{ $channelPlatform->name }}</span>
</label>
</div>
@endforeach
</div>
@endforeach
</div>
</form>
@endcan
Expand Down

0 comments on commit 2ed1e39

Please sign in to comment.