Permalink
Browse files

Add unlocking of downloads

+ Replaced github commit author icon with username
+ Minor style edits
  • Loading branch information...
1 parent fee5205 commit 5f9366baf6ecae427edcc04b07d14ad2f99d3d98 @JarnoVgr committed Sep 8, 2016
@@ -110,10 +110,11 @@ public function show(String $gitBranch, String $gitHash)
//TODO: Convert to querybuilder... Couldn't get it to work so I wrote a manual query
- $downloadsBuilds = DB::select('SELECT b.filePath, b.fileName, b.fileSize, b.fileHash, f.platform AS flavourPlatform, f.architecture AS flavourArchitecture, f.name as flavourName
+ $downloadsBuilds = DB::select('SELECT b.filePath, b.fileName, b.fileSize, b.fileHash, f.platform AS flavourPlatform, f.architecture AS flavourArchitecture, f.name as flavourName, f.category AS category, f.categoryReason AS categoryReason
FROM downloadsBuilds b
JOIN downloadFlavours f ON (f.flavourId = b.flavourId)
- WHERE parentDownloadId = :id', ['id' => $download->downloadId]);
+ WHERE parentDownloadId = :id
+ ORDER BY f.category ASC, f.identifier DESC', ['id' => $download->downloadId]);
return view('download.download', ['download' => $download,
'downloadsBuilds' => $downloadsBuilds,
@@ -165,10 +166,11 @@ public function showLatest(String $identifier = null)
//TODO: Convert to querybuilder... Couldn't get it to work so I wrote a manual query
- $downloadsBuilds = DB::select('SELECT b.filePath, b.fileName, b.fileSize, b.fileHash, f.platform AS flavourPlatform, f.architecture AS flavourArchitecture, f.name as flavourName
+ $downloadsBuilds = DB::select('SELECT b.filePath, b.fileName, b.fileSize, b.fileHash, f.platform AS flavourPlatform, f.architecture AS flavourArchitecture, f.name as flavourName, f.category AS category, f.categoryReason AS categoryReason
FROM downloadsBuilds b
JOIN downloadFlavours f ON (f.flavourId = b.flavourId)
- WHERE parentDownloadId = :id', ['id' => $download->downloadId]);
+ WHERE parentDownloadId = :id
+ ORDER BY f.category ASC, f.identifier DESC', ['id' => $download->downloadId]);
return view('download.download', ['latest' => $identifier,
'download' => $download,
@@ -5,7 +5,7 @@ body {
font-family: "PT Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
overflow-y: scroll;
height: 100%;
- font-size: 11pt;
+ font-size: 12pt;
}
a {
@@ -411,6 +411,10 @@ table.downloadsTable {
text-align: left;
}
+table.downloadsTable tbody td {
+ padding-top: 3px;
+}
+
table.downloadsTable small.hash {
font-size: 12px;
color: #E0E0E0;
@@ -18,14 +18,66 @@
</thead>
<tbody>
@foreach ($downloadsBuilds as $build)
- <tr>
+ <tr class="{{ $build->category }}" data-category="{{ $build->category }}">
<td class="buildPlatform">{{ $build->flavourName }}</td>
- <td class="buildDownload"><a href="{{$serverURL}}{{ $build->filePath }}/{{ $build->fileName }}">{{ $build->fileName }}</a></td>
+ <td class="buildDownload" {!! (!empty($build->categoryReason) ? ' data-category-reason="'. $build->categoryReason .'"' : '') !!}><a href="{{$serverURL}}{{ $build->filePath }}/{{ $build->fileName }}">{{ $build->fileName }}</a></td>
<td><acronym title="{{ $build->fileHash }}" class="hash">{{ str_limit($build->fileHash, $limit = 9, $end = '&hellip;') }}</acronym></td>
<td class="buildSize">{{ Helpers::formatBytes($build->fileSize) }}</td>
</tr>
@endforeach
</tbody>
+ <script async src="//ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
+ <script>
+ function defer(method) {
+ if (window.jQuery)
+ method();
+ else
+ setTimeout(function() {
+ defer(method);
+ }, 50);
+ }
+
+ function escapeHtml(text) {
+ return text
+ .replace(/&/g, "&amp;")
+ .replace(/</g, "&lt;")
+ .replace(/>/g, "&gt;")
+ .replace(/"/g, "&quot;")
+ .replace(/'/g, "&#039;");
+ }
+
+ //ToDo: Rewrite in plain JS so we don't have to include a lib for just 1 page
+ defer(function() {
+ $(document).ready(function() {
+ $('table.downloadsTable tbody tr').each(function(idx) {
+ var category = $(this).data('category');
+ if (typeof(category) !== 'string')
+ return;
+
+ var td = $(this).find('td.buildDownload');
+ var reason = td.data('category-reason');
+ if (typeof(reason) !== 'string' && category !== 'unstable')
+ return;
+
+ if (typeof(reason) !== 'string' || reason === '')
+ reason = 'This build is unstable.';
+
+
+ td.data('original-html', td.html());
+
+
+ td.html(escapeHtml(reason) +" <a class=\"unlockBuildLink\" href=\"javascript:void(0)\">Unlock download</a>.");
+ });
+
+ $('a.unlockBuildLink').click(function() {
+ var td = $(this).closest('td.buildDownload');
+ td.html(td.data('original-html'));
+ var tr = td.closest('tr');
+ tr.removeClass(tr.data('category'));
+ });
+ });
+ });
+ </script>
</table>
@if(isset($commits))
<h2>Changes in this build</h2>
@@ -41,7 +93,7 @@
<tr class="commit">
<td class="author">
@if(isset($commit['author']))
- <img alt="{{ $commit['author']['login'] }}'s avatar" title="{{ $commit['author']['login'] }}" src="{{ $commit['author']['avatar_url'] }}" style="width:40px;height:40px;">
+ <a href="https://github.com/{{ $commit['author']['login'] }}" target="_blank" title="View GitHub profile" rel="nofollow">{{ $commit['author']['login'] }}</a>
@endif
</td>
<td class="message">{{ $commit['commit']['message'] }}</td>
@@ -7,7 +7,7 @@
@section('page')
<h1>OpenRCT2 in short</h1>
<p>
- The OpenRCT2 project recreates the classic hit RollerCoaster Tycoon 2 into open-source code, expanding the game with <a href="/features">new features</a>, fixing original bugs and raising game limits. Several notable improvements over RCT2 are: Multiplayer co-op, a handy cheat menu and language support.
+ <em>OpenRCT2</em> is an open-source re-implementation of RollerCoaster Tycoon 2 (RCT2), expanding the game with <a href="/features">new features</a>, fixing original bugs and raising game limits. The gameplay revolves around building and maintaining an amusement park containing attractions, shops and facilities. The player must try to make a profit and maintain a good park reputation whilst keeping the guests happy. OpenRCT2 allows for both scenario and sandbox play. Scenarios require the player to complete a certain objective in a set time limit whilst sandbox allows the player to build a more flexible park with optionally no restrictions or finance.
</p>
<p>
Development started on April 2nd 2014 by <a href="http://dev.intelorca.co.uk/" target="_blank">Ted 'IntelOrca' John</a>.
@@ -17,9 +17,9 @@
An installation of RollerCoaster Tycoon 2 is required in order to play.
RCT2, with expansions, is cheap nowadays and can be bought from <a href="//www.g2a.com/r/openrct2" target="_blank">G2A</a>, <a href="//www.gog.com/game/rollercoaster_tycoon_2" target="_blank">GOG</a> and <a href="http://store.steampowered.com/app/285330/" target="_blank">Steam</a>.
</p>
-<h2 class="blue">Download</h2>
+<h2 class="blue">Download and Play</h2>
<p>
- The easiest way to play is to grab a download right from the <a href="/downloads/latest">Downloads-page</a>. It's also possible to compile from source-code.
+ The easiest way to play is to grab a download right from the <a href="/downloads/latest">Downloads-page</a>. It's also possible to <a target="_blank" href="https://github.com/OpenRCT2/OpenRCT2#3-building-the-game">compile from source-code</a>.
</p>
@stop
@section('sidebar')

0 comments on commit 5f9366b

Please sign in to comment.