mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 13:07:59 +01:00
Many things
This commit is contained in:
parent
148ffe97ec
commit
3485f79c51
12 changed files with 113 additions and 53 deletions
|
@ -34,4 +34,10 @@
|
|||
'popular_tracks' => Track::popular(30, Auth::check() && Auth::user()->can_see_explicit_content),
|
||||
'news' => News::getNews(0, 10)], 200);
|
||||
}
|
||||
|
||||
public function postReadNews() {
|
||||
News::markPostAsRead(Input::get('url'));
|
||||
return Response::json([
|
||||
]);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
$postHashes[] = self::calculateHash($post->get_permalink());
|
||||
}
|
||||
|
||||
$seenRecords = self::where('user_id', '=', Auth::user()->id)->whereIn('post_hash', $postHashes)->get();
|
||||
$seenRecords = Auth::check() ? self::where('user_id', '=', Auth::user()->id)->whereIn('post_hash', $postHashes)->get() : [];
|
||||
$seenHashes = [];
|
||||
|
||||
foreach ($seenRecords as $record) {
|
||||
|
@ -36,11 +36,9 @@
|
|||
foreach ($posts as $post) {
|
||||
$autoRead = $post->get_date('U') < $readCutoffDate;
|
||||
$postsReturn[] = [
|
||||
'post' => [
|
||||
'title' => $post->get_title(),
|
||||
'date' => $post->get_date('j F Y g:i a'),
|
||||
'url' => $post->get_permalink()
|
||||
],
|
||||
'url' => $post->get_permalink(),
|
||||
'read' => $autoRead || isset($seenHashes[self::calculateHash($post->get_permalink())])];
|
||||
}
|
||||
|
||||
|
@ -49,7 +47,9 @@
|
|||
|
||||
public static function markPostAsRead($postUrl) {
|
||||
$postHash = self::calculateHash($postUrl);
|
||||
$news = News::create(['user_id' => Auth::user()->id, 'post_hash' => $postHash]);
|
||||
$news = new News();
|
||||
$news->user_id = Auth::user()->id;
|
||||
$news->post_hash = $postHash;
|
||||
$news->save();
|
||||
}
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@
|
|||
Route::post('/favourites/toggle', 'Api\Web\FavouritesController@postToggle');
|
||||
|
||||
Route::post('/follow/toggle', 'Api\Web\FollowController@postToggle');
|
||||
|
||||
Route::post('/dashboard/read-news', 'Api\Web\DashboardController@postReadNews');
|
||||
});
|
||||
|
||||
Route::group(['before' => 'auth'], function() {
|
||||
|
|
|
@ -2976,8 +2976,7 @@ class ExceptionHandler
|
|||
<h2><span>%d/%d</span> %s: %s</h2>
|
||||
</div>
|
||||
<div class="block">
|
||||
<ol class="traces list_exception">
|
||||
', $ind, $total, $class, $message);
|
||||
<ol class="traces list_exception">', $ind, $total, $class, $message);
|
||||
foreach ($e['trace'] as $trace) {
|
||||
$content .= ' <li>';
|
||||
if ($trace['function']) {
|
||||
|
@ -3006,7 +3005,7 @@ class ExceptionHandler
|
|||
}
|
||||
}
|
||||
}
|
||||
return " <div id=\"sf-resetcontent\" class=\"sf-reset\">\r\n <h1>{$title}</h1>\r\n {$content}\r\n </div>";
|
||||
return " <div id=\"sf-resetcontent\" class=\"sf-reset\">\n <h1>{$title}</h1>\n {$content}\n </div>";
|
||||
}
|
||||
public function getStylesheet(FlattenException $exception)
|
||||
{
|
||||
|
@ -3063,7 +3062,7 @@ class ExceptionHandler
|
|||
}
|
||||
private function decorate($content, $css)
|
||||
{
|
||||
return "<!DOCTYPE html>\r\n<html>\r\n <head>\r\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\r\n <meta name=\"robots\" content=\"noindex,nofollow\" />\r\n <style>\r\n /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */\r\n html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}\r\n\r\n html { background: #eee; padding: 10px }\r\n img { border: 0; }\r\n #sf-resetcontent { width:970px; margin:0 auto; }\r\n {$css}\r\n </style>\r\n </head>\r\n <body>\r\n {$content}\r\n </body>\r\n</html>";
|
||||
return "<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/>\n <meta name=\"robots\" content=\"noindex,nofollow\" />\n <style>\n /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */\n html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}\n\n html { background: #eee; padding: 10px }\n img { border: 0; }\n #sf-resetcontent { width:970px; margin:0 auto; }\n {$css}\n </style>\n </head>\n <body>\n {$content}\n </body>\n</html>";
|
||||
}
|
||||
private function abbrClass($class)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
$bundle->setTargetPath($filePath);
|
||||
}
|
||||
|
||||
// $bundle = new AssetCache($bundle, new FilesystemCache("$cacheDirectory/scripts"));
|
||||
$bundle = new AssetCache($bundle, new FilesystemCache("$cacheDirectory/scripts"));
|
||||
} else if ($_GET['type'] == 'less') {
|
||||
header('Content-Type: text/css');
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ window.pfm.preloaders['dashboard'] = [
|
|||
]
|
||||
|
||||
angular.module('ponyfm').controller "dashboard", [
|
||||
'$scope', 'dashboard'
|
||||
($scope, dashboard) ->
|
||||
'$scope', 'dashboard', 'auth', '$http'
|
||||
($scope, dashboard, auth, $http) ->
|
||||
$scope.recentTracks = null
|
||||
$scope.popularTracks = null
|
||||
$scope.news = null
|
||||
|
@ -14,4 +14,9 @@ angular.module('ponyfm').controller "dashboard", [
|
|||
$scope.recentTracks = res.recent_tracks
|
||||
$scope.popularTracks = res.popular_tracks
|
||||
$scope.news = res.news
|
||||
|
||||
$scope.markAsRead = (post) ->
|
||||
if auth.data.isLogged
|
||||
$http.post('/api/web/dashboard/read-news', {url: post.url, _token: window.pfm.token}).success ->
|
||||
post.read = true
|
||||
]
|
|
@ -8,8 +8,10 @@ angular.module('ponyfm').controller "home", [
|
|||
($scope, dashboard) ->
|
||||
$scope.recentTracks = null
|
||||
$scope.popularTracks = null
|
||||
$scope.news = null
|
||||
|
||||
dashboard.refresh().done (res) ->
|
||||
$scope.recentTracks = res.recent_tracks
|
||||
$scope.popularTracks = res.popular_tracks
|
||||
$scope.news = res.news
|
||||
]
|
|
@ -33,7 +33,16 @@
|
|||
}
|
||||
}
|
||||
|
||||
.recent-tracks {
|
||||
@media (max-width: 720px) {
|
||||
html .dashboard {
|
||||
section {
|
||||
float: none !important;
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard {
|
||||
h1 {
|
||||
a {
|
||||
color: #fff;
|
||||
|
@ -46,9 +55,7 @@
|
|||
padding: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.dashboard {
|
||||
section {
|
||||
.box-sizing(border-box);
|
||||
|
||||
|
@ -66,5 +73,44 @@
|
|||
|
||||
.news {
|
||||
width: 25%;
|
||||
|
||||
ul {
|
||||
list-style: none;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
|
||||
li {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
|
||||
&.read {
|
||||
a {
|
||||
background: #eee;
|
||||
border-left-color: #ddd;
|
||||
}
|
||||
}
|
||||
|
||||
a {
|
||||
.ellipsis();
|
||||
|
||||
color: #000;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
font-size: 10pt;
|
||||
background: lighten(@pfm-purple, 30%);
|
||||
border-left: 5px solid @pfm-purple;
|
||||
margin: 5px 0px;
|
||||
overflow: hidden;
|
||||
|
||||
em {
|
||||
display: block;
|
||||
color: #444;
|
||||
float: right;
|
||||
font-size: 8pt;
|
||||
font-style: normal;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ html body {
|
|||
height: 100%;
|
||||
background: #444;
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||
padding: 0px !important;
|
||||
}
|
||||
|
||||
header {
|
||||
|
|
|
@ -15,12 +15,15 @@
|
|||
</section>
|
||||
|
||||
<section class="news">
|
||||
<h1>Pony.fm News</h1>
|
||||
<h1>
|
||||
<a href="http://mlpforums.com/blog/404-ponyfm-development-blog/" target="_blank">read all</a>
|
||||
Pony.fm News
|
||||
</h1>
|
||||
<ul>
|
||||
<li ng-repeat="post in news">
|
||||
<a href="{{post.url}}">
|
||||
{{post.title}}
|
||||
<li ng-repeat="post in news" ng-class="{'read': post.read}">
|
||||
<a href="{{post.url}}" target="_blank" ng-click="markAsRead(post)">
|
||||
<em>{{post.date}}</em>
|
||||
{{post.title}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
|
@ -1,33 +1,31 @@
|
|||
<div class="stretch-to-bottom">
|
||||
<div class="welcome">
|
||||
<h1>Welcome to Pony.fm</h1>
|
||||
<p>The pony fan music site. By a brony, for bronies.</p>
|
||||
<p>
|
||||
We provide a comprehensive set of free tools to host, distribute, and catalogue your music, integrated with a rich community experience for artists and listeners alike.
|
||||
</p>
|
||||
<p>
|
||||
Features include <strong>unlimited downloads</strong>, <strong>unlimited uploads</strong>, <strong>lossless uploads</strong> and much more! Click <a href="/about">here</a> to get all of our features!
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="dashboard">
|
||||
<div class="dashboard stretch-to-bottom">
|
||||
<section class="recent-tracks">
|
||||
<div>
|
||||
<h1>
|
||||
<a href="/tracks"><i class="icon-music"></i> see more</a>
|
||||
The Newest Tunes
|
||||
</h1>
|
||||
<pfm-tracks-list tracks="recentTracks" class="two-columns"></pfm-tracks-list>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="popular-tracks">
|
||||
<div>
|
||||
<h1>
|
||||
What's Popular Today
|
||||
</h1>
|
||||
<pfm-tracks-list tracks="popularTracks" class="two-columns"></pfm-tracks-list>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="news">
|
||||
<h1>
|
||||
<a href="http://mlpforums.com/blog/404-ponyfm-development-blog/" target="_blank">read all</a>
|
||||
Pony.fm News
|
||||
</h1>
|
||||
<ul>
|
||||
<li ng-repeat="post in news">
|
||||
<a href="{{post.url}}" target="_blank">
|
||||
<em>{{post.date}}</em>
|
||||
{{post.title}}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
|
@ -67,7 +67,6 @@
|
|||
<root url="file://$MODULE_DIR$/vendor/psr/log" />
|
||||
<root url="file://$MODULE_DIR$/vendor/filp/whoops" />
|
||||
<root url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
||||
<root url="file://$MODULE_DIR$/vendor/guzzle/parser" />
|
||||
<root url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
||||
<root url="file://$MODULE_DIR$/vendor/predis/predis" />
|
||||
<root url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
||||
|
@ -106,7 +105,6 @@
|
|||
<root url="file://$MODULE_DIR$/vendor/psr/log" />
|
||||
<root url="file://$MODULE_DIR$/vendor/filp/whoops" />
|
||||
<root url="file://$MODULE_DIR$/vendor/nikic/php-parser" />
|
||||
<root url="file://$MODULE_DIR$/vendor/guzzle/parser" />
|
||||
<root url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
||||
<root url="file://$MODULE_DIR$/vendor/predis/predis" />
|
||||
<root url="file://$MODULE_DIR$/vendor/laravel/framework" />
|
||||
|
|
Loading…
Reference in a new issue