Started on show songs

This commit is contained in:
nelsonlaquet 2013-07-27 23:37:32 -05:00
parent 3b291f3b8f
commit c3744e2931
12 changed files with 2088 additions and 14 deletions

View file

@ -4,6 +4,7 @@
use Entities\Genre;
use Entities\License;
use Entities\ShowSong;
use Entities\TrackType;
class TaxonomiesController extends \ApiControllerBase {
@ -11,7 +12,8 @@
return \Response::json([
'licenses' => License::all()->toArray(),
'genres' => Genre::orderBy('name')->get()->toArray(),
'track_types' => TrackType::all()->toArray()
'track_types' => TrackType::all()->toArray(),
'show_songs' => ShowSong::select('title', 'id', 'slug')->get()->toArray()
], 200);
}
}

View file

@ -6,7 +6,7 @@
class ImagesController extends Controller {
public function getImage($id, $type) {
$coverType = Image::GetImageTypeFromName($type);
$coverType = Image::getImageTypeFromName($type);
if ($coverType == null)
App::abort(404);

File diff suppressed because it is too large Load diff

View file

@ -70,7 +70,7 @@
}
else if (isset($this->_input['cover'])) {
$cover = $this->_input['cover'];
$track->cover_id = Image::Upload($cover, Auth::user())->id;
$track->cover_id = Image::upload($cover, Auth::user())->id;
} else if ($this->_input['remove_cover'] == 'true')
$track->cover_id = null;

View file

@ -15,11 +15,11 @@
public static $ImageTypes = [
self::NORMAL => ['id' => self::NORMAL, 'name' => 'normal', 'width' => 350, 'height' => 350],
self::ORIGINAL => ['id' => self::ORIGINAL, 'name' => 'original', 'width' => null, 'height' => null],
self::SMALL => ['id' => self::SMALL, 'name' => 'small', 'width' => 100, 'height' => 100],
self::SMALL => ['id' => self::SMALL, 'name' => 'small', 'width' => 100, 'height' => 100],
self::THUMBNAIL => ['id' => self::THUMBNAIL, 'name' => 'thumbnail', 'width' => 50, 'height' => 50]
];
public static function GetImageTypeFromName($name) {
public static function getImageTypeFromName($name) {
foreach (self::$ImageTypes as $cover) {
if ($cover['name'] != $name)
continue;
@ -30,7 +30,7 @@
return null;
}
public static function Upload($file, $user) {
public static function upload($file, $user) {
$hash = md5_file($file->getPathname());
$image = Image::whereHash($hash)->whereUploadedBy($user->id)->first();

View file

@ -0,0 +1,7 @@
<?php
namespace Entities;
class ShowSong extends \Eloquent {
protected $table = 'show_songs';
}

View file

@ -23,11 +23,18 @@ angular.module('ponyfm').directive 'pfmPopup', () ->
$popup.removeClass 'open'
return
position = $element.offset()
$popup.addClass 'open'
position = $element.offset()
left = position.left
right = left + $popup.width()
windowWidth = $(window).width() - 15
if right > windowWidth
left -= right - windowWidth
$popup.css
top: position.top + $element.height() + 10
left: position.left
left: left
open = true

View file

@ -4,9 +4,10 @@ angular.module('ponyfm').factory('taxonomies', [
def = null
self =
trackTypes: [],
trackTypes: []
licenses: []
genres: []
showSongs: []
refresh: () ->
return def if def != null
@ -16,6 +17,7 @@ angular.module('ponyfm').factory('taxonomies', [
self.trackTypes.push t for t in taxonomies.track_types
self.licenses.push t for t in taxonomies.licenses
self.genres.push t for t in taxonomies.genres
self.showSongs.push t for t in taxonomies.show_songs
def.resolve self
def

View file

@ -104,6 +104,9 @@
</select>
<div class="error">{{errors.genre_id}}</div>
</div>
</div>
<div class="form-row" ng-show="edit.track_type_id == 2">
</div>
<div class="row-fluid">
<div class="form-row span6" ng-class="{'has-error': errors.cover != null}">

2
vendor/autoload.php vendored
View file

@ -4,4 +4,4 @@
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit3b14f774048abcb51cb73f0018822c49::getLoader();
return ComposerAutoloaderInita1fb7abacafe9eba7b46e2d4ded6e3a5::getLoader();

View file

@ -11,6 +11,7 @@ return array(
'AlbumsController' => $baseDir . '/app/controllers/AlbumsController.php',
'ApiControllerBase' => $baseDir . '/app/controllers/ApiControllerBase.php',
'Api\\Web\\AuthController' => $baseDir . '/app/controllers/Api/Web/AuthController.php',
'Api\\Web\\ImagesController' => $baseDir . '/app/controllers/Api/Web/ImagesController.php',
'Api\\Web\\TaxonomiesController' => $baseDir . '/app/controllers/Api/Web/TaxonomiesController.php',
'Api\\Web\\TracksController' => $baseDir . '/app/controllers/Api/Web/TracksController.php',
'ArtistsController' => $baseDir . '/app/controllers/ArtistsController.php',
@ -129,8 +130,8 @@ return array(
'Commands\\EditTrackCommand' => $baseDir . '/app/models/Commands/EditTrackCommand.php',
'Commands\\UploadTrackCommand' => $baseDir . '/app/models/Commands/UploadTrackCommand.php',
'ContentController' => $baseDir . '/app/controllers/ContentController.php',
'Cover' => $baseDir . '/app/models/Cover.php',
'CreateImagesTable' => $baseDir . '/app/database/migrations/2013_07_26_230827_create_images_table.php',
'CreateSongsTable' => $baseDir . '/app/database/migrations/2013_07_28_034328_create_songs_table.php',
'CreateTracksTable' => $baseDir . '/app/database/migrations/2013_06_27_015259_create_tracks_table.php',
'CreateUsersTable' => $baseDir . '/app/database/migrations/2013_06_07_003952_create_users_table.php',
'DatabaseSeeder' => $baseDir . '/app/database/seeds/DatabaseSeeder.php',
@ -400,6 +401,7 @@ return array(
'Doctrine\\DBAL\\Types\\VarDateTimeType' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Types/VarDateTimeType.php',
'Doctrine\\DBAL\\Version' => $vendorDir . '/doctrine/dbal/lib/Doctrine/DBAL/Version.php',
'Entities\\Genre' => $baseDir . '/app/models/Entities/Genre.php',
'Entities\\Image' => $baseDir . '/app/models/Entities/Image.php',
'Entities\\License' => $baseDir . '/app/models/Entities/License.php',
'Entities\\Track' => $baseDir . '/app/models/Entities/Track.php',
'Entities\\TrackType' => $baseDir . '/app/models/Entities/TrackType.php',
@ -793,6 +795,7 @@ return array(
'Illuminate\\Workbench\\PackageCreator' => $vendorDir . '/laravel/framework/src/Illuminate/Workbench/PackageCreator.php',
'Illuminate\\Workbench\\Starter' => $vendorDir . '/laravel/framework/src/Illuminate/Workbench/Starter.php',
'Illuminate\\Workbench\\WorkbenchServiceProvider' => $vendorDir . '/laravel/framework/src/Illuminate/Workbench/WorkbenchServiceProvider.php',
'ImagesController' => $baseDir . '/app/controllers/ImagesController.php',
'Monolog\\Formatter\\ChromePHPFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php',
'Monolog\\Formatter\\FormatterInterface' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php',
'Monolog\\Formatter\\GelfMessageFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php',

View file

@ -2,7 +2,7 @@
// autoload_real.php generated by Composer
class ComposerAutoloaderInit3b14f774048abcb51cb73f0018822c49
class ComposerAutoloaderInita1fb7abacafe9eba7b46e2d4ded6e3a5
{
private static $loader;
@ -19,9 +19,9 @@ class ComposerAutoloaderInit3b14f774048abcb51cb73f0018822c49
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit3b14f774048abcb51cb73f0018822c49', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInita1fb7abacafe9eba7b46e2d4ded6e3a5', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit3b14f774048abcb51cb73f0018822c49', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInita1fb7abacafe9eba7b46e2d4ded6e3a5', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);