diff --git a/app/controllers/TracksController.php b/app/controllers/TracksController.php index cff770ae..acd365dc 100644 --- a/app/controllers/TracksController.php +++ b/app/controllers/TracksController.php @@ -9,6 +9,14 @@ return View::make('tracks.index'); } + public function getEmbed($id) { + $track = Track::find($id); + if (!$track || !$track->canView(Auth::user())) + App::abort(404); + + return View::make('tracks.embed', ['track' => $track]); + } + public function getTrack($id, $slug) { $track = Track::find($id); if (!$track || !$track->canView(Auth::user())) diff --git a/app/models/Entities/Track.php b/app/models/Entities/Track.php index 72c658d1..6c845f86 100644 --- a/app/models/Entities/Track.php +++ b/app/models/Entities/Track.php @@ -114,7 +114,7 @@ $returnValue['share'] = [ 'url' => URL::to('/t' . $track->id), - 'html' => '', + 'html' => '', 'bbcode' => '[url=' . $track->url . '][img]' . $track->getCoverUrl() . '[/img][/url]', 'twitterUrl' => 'https://platform.twitter.com/widgets/tweet_button.html?text=' . $track->title . ' by ' . $track->user->display_name . ' on Pony.fm' ]; diff --git a/app/routes.php b/app/routes.php index 2e28f1ea..bdbe18c0 100644 --- a/app/routes.php +++ b/app/routes.php @@ -22,6 +22,7 @@ Route::get('tracks/{id}-{slug}', 'TracksController@getTrack'); Route::get('t{id}', 'TracksController@getShortlink' ); + Route::get('t{id}/embed', 'TracksController@getEmbed' ); Route::get('t{id}/stream', 'TracksController@getStream' ); Route::get('t{id}/dl.{extension}', 'TracksController@getDownload' ); diff --git a/app/views/tracks/embed.blade.php b/app/views/tracks/embed.blade.php new file mode 100644 index 00000000..6ef69c7b --- /dev/null +++ b/app/views/tracks/embed.blade.php @@ -0,0 +1,78 @@ + + + + + @section('title')Pony.fm + @yield_section + + {{-- --}} + + + + + + + + {{ HTML::style( 'css/app-embed.css?' . filemtime(path('public').'/css/app.css') ) }} + {{ Asset::styles() }} + + + + + + +
+ @if($track->explicit && !(Auth::check() && Auth::user()->can_see_explicit_content)) +
+ Enable explicit content in {{ HTML::link(URL::to_action('account@edit'), 'your account', ['target' => '_blank']) }} to play this track. + +
+ Hosted by Pony.fm +
+
+ @else +
+
+
+ {{ HTML::image($track->get_cover_url('normal')) }} +
+
+ @if (Auth::check()) + + @endif +
+
+
+
+
+
+ {{ HTML::link( $track->url, $track->title, ['target' => '_blank'] ) }} + by: {{ HTML::link($track->user->url, $track->artist, ['target' => '_blank']) }} / {{ HTML::link($track->genre->url, $track->genre->title, ['target' => '_blank']) }} / {{ HTML::timestamp($track->published_at) }} +
+
+
+ Views: {{ $track->views }} / Plays: {{ $track->plays }} / Downloads: {{ $track->downloads }} / + Hosted by Pony.fm +
+
+ @endif +
+ + + {{ Asset::scripts() }} + + + \ No newline at end of file diff --git a/public/templates/albums/show.html b/public/templates/albums/show.html index d4fa2789..fd8c06f6 100644 --- a/public/templates/albums/show.html +++ b/public/templates/albums/show.html @@ -8,7 +8,7 @@
  • -
  • Share or Embed
  • +
  • Share
  • Edit
  • diff --git a/public/templates/tracks/show.html b/public/templates/tracks/show.html index 5a1a8f32..244b8c96 100644 --- a/public/templates/tracks/show.html +++ b/public/templates/tracks/show.html @@ -22,7 +22,7 @@
  • Add to New Playlist
  • -
  • Share
  • +
  • Share or Embed
  • Edit