Code cleanup

This commit is contained in:
Josef Citrine 2016-08-08 17:11:20 +01:00
parent 0afa0b3971
commit 514d5a3c2d
21 changed files with 196 additions and 167 deletions

View file

@ -82,6 +82,7 @@ gulp.task("webpack-dev-server", function () {
gulp.task("styles-app", function () {
var includedStyles = [
"node_modules/angular-material/angular-material.css",
"node_modules/ng-sortable/dist/ng-sortable.css",
"resources/assets/styles/app.less",
];
@ -98,8 +99,8 @@ gulp.task("styles-app", function () {
if (!styleCache.hasOwnProperty(file))
continue;
if (!endsWith(file, "app.less") && !endsWith(file, "angular-material.css"))
continue;
/*if (!endsWith(file, "app.less") && !endsWith(file, "angular-material.css"))
continue;*/
delete styleCache[file];
}

View file

@ -37,6 +37,7 @@
"jquery": "2.2.0",
"jquery-ui": "1.10.5",
"merge-stream": "^1.0.0",
"ng-sortable": "^1.3.6",
"script-loader": "0.7.0",
"underscore": "1.8.3",
"webpack": "1.13.1",

View file

@ -10,21 +10,18 @@
<li class="delete" ng-show="!isNew"><a ng-class="{disabled: isSaving}" class="btn btn-danger" href="#" ng-click="deleteAlbum()" pfm-eat-click>Delete Album</a></li>
</ul>
<div class="stretch-to-bottom">
<div class="form-row" ng-class="{'has-error': errors.title != null}">
<label for="title" class="strong">Title:</label>
<input ng-disabled="isSaving" ng-change="touchModel()" placeholder="Album Title" type="text" id="title" ng-model="album.title" />
<div class="error">{{errors.title}}</div>
</div>
<div class="form-row">
<label for="description" class="strong">Description:</label>
<textarea ng-disabled="isSaving" ng-change="touchModel()" placeholder="Description (optional)" id="description" ng-model="album.description"></textarea>
<div class="error">{{errors.description}}</div>
</div>
<div class="form-row" ng-show="isAdmin" ng-class="{'has-error': errors.username != null}">
<label for="title" class="strong">User:</label>
<input ng-disabled="isSaving" ng-change="touchModel()" placeholder="Username" type="text" id="username" ng-model="album.username" />
<div class="error">{{errors.username}}</div>
</div>
<md-input-container>
<label>Title</label>
<input ng-disabled="isSaving" ng-change="touchModel()" type="text" ng-model="album.title">
</md-input-container>
<md-input-container>
<label>Description</label>
<textarea ng-disabled="isSaving" ng-change="touchModel()" ng-model="album.description"></textarea>
</md-input-container>
<md-input-container ng-show="isAdmin">
<label>User</label>
<input ng-disabled="isSaving" ng-change="touchModel()" type="text" ng-model="album.username">
</md-input-container>
<div class="form-row" ng-class="{'has-error': errors.cover != null}">
<label class="strong">Album Cover: </label>
<pfm-image-upload set-image="setCover" image="album.cover" user-id="album.user_id"></pfm-image-upload>
@ -40,10 +37,10 @@
</ul>
</div>
<ul class="album-track-listing" ui-sortable="{handle: '.handle', axis: 'y', forcePlaceholderSizeType: true, update: sortTracks}" ng-model="tracks">
<li ng-repeat="track in tracks track by track.id">
<ul class="album-track-listing" as-sortable ng-model="tracks">
<li ng-repeat="track in tracks track by track.id" as-sortable-item>
<div>
<span class="btn btn-sm pull-left handle"><i class="material-icons">swap_vert</i></span>
<span class="btn btn-sm pull-left handle" as-sortable-item-handle><i class="material-icons">swap_vert</i></span>
<a href="#" class="btn btn-sm pull-right btn-danger" ng-click="toggleTrack(track)" pfm-eat-click><i class="material-icons">delete</i></a>
<span>{{::track.title}}</span>
</div>

View file

@ -1,6 +1,6 @@
<div ng-show="::content.albums.length">
<h2>Albums</h2>
<pfm-albums-list albums="::content.albums"></pfm-albums-list>
<pfm-albums-list albums="::content.albums" size="large"></pfm-albums-list>
</div>
<div ng-show="::content.singles.length">

View file

@ -5,6 +5,6 @@
</div>
<div class="col-md-6">
<h2>Albums</h2>
<pfm-albums-list albums="favourites.albums" class="two-columns"></pfm-albums-list>
<pfm-albums-list albums="favourites.albums" class="two-columns" size="small"></pfm-albums-list>
</div>
</div>

View file

@ -1,5 +1,9 @@
<div layout="row" layout-wrap>
<a ng-repeat="album in albums track by album.id" ng-href="{{::album.url}}" class="clickable" flex-xs="100" flex-sm="50" flex-md="25" flex-lg="20">
<div ng-if="!albums.length" class="empty ng-scope">
No albums found…
</div>
<a ng-repeat="album in albums track by album.id" ng-href="{{::album.url}}" class="clickable" flex-xs="{{xsSize}}" flex-sm="50" flex-gt-sm="{{smSize}}" flex-gt-md="{{mdSize}}" flex-gt-lg="{{lgSize}}">
<md-card class="album">
<img class="md-card-image" pfm-src-loader="::album.covers.normal" pfm-src-size="normal">

View file

@ -31,10 +31,12 @@ angular = require 'angular'
require 'angular-ui-router'
require 'angular-material'
require 'ng-sortable'
require '../base/angular-ui-sortable'
require '../base/angularytics'
require '../base/jquery.cookie'
require '../base/jquery.timeago'
require 'script!../base/modernizr'
require 'script!../base/marked'
require 'script!../base/moment'
require '../base/soundmanager2-nodebug'
@ -50,7 +52,7 @@ require '../shared/pfm-angular-sanitize'
require '../shared/init.coffee'
ponyfm = angular.module 'ponyfm', ['ngMaterial', 'mgcrea.ngStrap', 'ui.router', 'ui.sortable', 'angularytics', 'ngSanitize', 'hc.marked', 'chart.js']
ponyfm = angular.module 'ponyfm', ['ngMaterial', 'mgcrea.ngStrap', 'as.sortable', 'ui.router', 'ui.sortable', 'angularytics', 'ngSanitize', 'hc.marked', 'chart.js']
window.pfm.preloaders = {}
# Inspired by: https://stackoverflow.com/a/30652110/3225811

View file

@ -20,10 +20,26 @@ module.exports = angular.module('ponyfm').directive 'pfmAlbumsList', () ->
templateUrl: '/templates/directives/albums-list.html'
scope:
albums: '=albums',
class: '@class'
class: '@class',
size: '@size'
controller: [
'$scope', 'auth'
($scope, auth) ->
if typeof $scope.size == 'undefined'
$scope.size = 'large'
if $scope.size == 'small'
$scope.lgSize = '20'
$scope.mdSize = '33'
$scope.smSize = '50'
$scope.xsSize = '100'
else
$scope.lgSize = '15'
$scope.mdSize = ''
$scope.smSize = '20'
$scope.xsSize = '50'
console.log $scope.size
$scope.auth = auth.data
]

View file

@ -43,13 +43,13 @@
width: 300px;
ul {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
li {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
a {
.ellipsis();

View file

@ -21,22 +21,22 @@
ul.playlists {
overflow-y: auto;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
margin: 0px 5px;
margin: 0 5px;
margin-top: 10px;
li {
overflow: hidden;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
height: 40px;
border-bottom: 1px solid #ddd;
img {
border-right: 1px solid #ddd;
padding: 0px;
padding: 0;
display: block;
height: 40px;
width: 40px;
@ -97,11 +97,11 @@ ul.playlists {
ul {
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
li {
margin: 0px;
margin: 0;
float: left;
width: 20%;
cursor: pointer;
@ -142,15 +142,15 @@ html {
}
.title {
margin: 0px;
margin: 0;
font-size: 12pt;
padding: 0px;
padding: 0;
margin-top: 5px;
}
.published {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
}
}
}
@ -160,15 +160,15 @@ html {
.account-tracks-listing, .account-albums-listing {
overflow-y: auto;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
li {
.box-sizing(border-box);
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
line-height: normal;
&.empty {
@ -200,7 +200,7 @@ html {
.transition(350px ease-out all);
display: block;
margin: 0px;
margin: 0;
padding: 5px;
font-size: 9pt;
font-weight: normal;

View file

@ -76,9 +76,7 @@ a {
}
h2 {
margin: 0px;
margin-top: 1.5em;
margin-bottom: 0.5em;
margin: 1.5em 0 0.5em;
font-size: 13pt;
color: #C2889C;
line-height: normal;
@ -97,8 +95,8 @@ a {
color: #222;
position: relative;
overflow: hidden;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
h2 {
}
@ -107,7 +105,7 @@ a {
#gradient>.vertical(rgba(255,255,255,0), rgba(255,255,255,1));
.box-sizing(border-box);
position: absolute;
top: 0px;
top: 0;
left: -1px;
width: 100%;
height: 100%;
@ -123,8 +121,8 @@ a {
.box-sizing(border-box);
display: block;
position: absolute;
bottom: 0px;
left: 0px;
bottom: 0;
left: 0;
width: 100%;
background: #eee;
padding: 3px;
@ -158,14 +156,14 @@ a {
.stats {
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
font-size: 9pt;
color: #555;
li {
padding: 5px 0px;
margin: 0px;
padding: 5px 0;
margin: 0;
border-bottom: 1px solid #ddd;
strong {
@ -177,16 +175,21 @@ a {
}
.comments {
h4 {
text-overflow: initial !important;
white-space: normal !important;
line-height: 1.4 !important;
}
form {
margin: 0px;
margin-bottom: 10px;
margin: 0 0 10px;
.form-row {
margin: 0px;
margin: 0;
}
input[type=text] {
margin: 0px;
margin: 0;
padding: 5px;
width: 100%;
}
@ -194,13 +197,13 @@ a {
ul {
list-style: none;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
li {
line-height: normal;
padding: 5px 0px;
margin: 0px;
padding: 5px 0;
margin: 0;
overflow: hidden;
img {
@ -213,7 +216,7 @@ a {
.meta {
font-size: 8pt;
padding: 5px 0px;
padding: 5px 0;
}
.content {

View file

@ -28,14 +28,14 @@
.dropdowns {
.clearfix();
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
margin-bottom: 10px;
> li {
float: left;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
margin-right: 10px;
line-height: normal;
@ -49,7 +49,7 @@
.transition(background 300ms ease-out);
display: none;
margin: 0px;
margin: 0;
}
> .btn {
@ -97,7 +97,7 @@
.dropdown-menu {
.material-shadow(2);
margin: 0px;
margin: 0;
border: 0;
border-radius: 2px;
@ -135,14 +135,14 @@
.clearfix();
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
margin-bottom: 10px;
border-bottom: 4px solid #ddd;
font-size: 15px;
li {
margin: 0px;
margin: 0;
float: left;
line-height: normal;
@ -203,11 +203,11 @@ ui-view {
opacity: 0;
background: #fff;
content: ' ';
top: 0px;
left: 0px;
top: 0;
left: 0;
z-index: 999;
width: 0px;
height: 0px;
width: 0;
height: 0;
position: absolute;
display: block;
overflow: hidden;
@ -227,9 +227,9 @@ ui-view {
.toolbar {
#gradient>.vertical(#555, #222);
list-style: none;
margin: 0px;
margin: 0;
margin-bottom: 10px;
padding: 0px;
padding: 0;
overflow: hidden;
li {
@ -354,7 +354,7 @@ html .dropdown-menu {
transform-origin: top left;
> li {
margin: 0px;
margin: 0;
> a {
padding: 10px 16px;
@ -447,7 +447,7 @@ html .dropdown-menu {
.modal {
form {
margin: 0px;
margin: 0;
}
}
@ -485,9 +485,9 @@ html {
.border-radius(0px);
border: none;
background: #eee;
margin: 0px;
margin: 0;
margin-bottom: 10px;
padding: 0px;
padding: 0;
overflow: hidden;
width: 100%;

View file

@ -35,7 +35,7 @@
display: block;
width: 64px;
height: 64px;
padding: 0px;
padding: 0;
}
.loader {
@ -114,16 +114,16 @@
.bar, .loader-bar {
position: absolute;
top: 0px;
left: 0px;
top: 0;
left: 0;
height: 100%;
}
}
.buttons {
list-style: none;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
float: right;
margin-top: 12px;
margin-right: 5px;
@ -141,13 +141,13 @@
li {
line-height: normal;
float: left;
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
font-size: 24px;
> a {
display: block;
padding: 3px 0px 7px;
padding: 3px 0 7px;
width: 44px;
text-align: center;
color: #5A5A5A;
@ -198,7 +198,7 @@
display: none;
z-index: 1000;
position: absolute;
left: 0px;
left: 0;
bottom: 44px;
width: 100%;
height: 150px;
@ -214,7 +214,7 @@
.knob {
position: absolute;
top: 0px;
top: 0;
left: -3px;
background: darken(@pfm-purple, 20%);

View file

@ -23,14 +23,14 @@
.track-editor {
.list {
.dropdowns {
margin-top: 0px;
margin-top: 0;
}
}
}
.license-grid {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
overflow: hidden;
list-style: none;
@ -39,7 +39,7 @@
width: 25%;
> div {
margin: 0px 5px;
margin: 0 5px;
border: 1px solid #ddd;
padding: 10px;
cursor: pointer;
@ -47,9 +47,9 @@
strong {
font-size: 9pt;
display: block;
margin: 0px;
margin: 0;
margin-bottom: 5px;
padding: 0px;
padding: 0;
line-height: normal;
}
}
@ -77,11 +77,11 @@
}
&:first-child > div {
margin-left: 0px;
margin-left: 0;
}
&:last-child > div {
margin-right: 0px;
margin-right: 0;
}
}
}

View file

@ -20,7 +20,7 @@
.uploader {
h1 {
margin: 10px 0px;
margin: 10px 0;
}
.dropzone {
@ -31,8 +31,8 @@
margin-bottom: 10px;
p {
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
}
&.file-over {
@ -49,8 +49,8 @@
}
.uploads {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
li {
@ -64,7 +64,7 @@
p {
margin: 5px;
padding: 0px;
padding: 0;
height: 26px;
line-height: 26px;
@ -74,8 +74,8 @@
.bar {
position: absolute;
bottom: 0px;
left: 0px;
bottom: 0;
left: 0;
height: 10px;
z-index: -1;
background: @pfm-purple;

View file

@ -51,8 +51,8 @@
}
.albums-listing, .playlists-listing, .users-listing {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
height: 100%;
@ -103,7 +103,7 @@
font-weight: bold;
font-size: 11pt;
padding-left: 3px;
padding-bottom: 0px;
padding-bottom: 0;
}
.published {
@ -112,7 +112,7 @@
}
.published, .stats {
padding-top: 0px;
padding-top: 0;
}
.stats {
@ -149,6 +149,10 @@
font-size: inherit;
}
.no-cssfilters .blurred-background {
background: #a2a2a2 !important;
}
.resource-details {
.info {
margin-left: 15px;
@ -166,7 +170,8 @@
width: 100%;
height: 250px;
-webkit-filter: blur(30px) brightness(0.8);
filter: blur(15px) brightness(0.75);
-ms-filter: blur(30px) brightness(0.8);
filter: blur(30px) brightness(0.8);
z-index: -1;
top: 0;
left: 0;
@ -273,12 +278,12 @@
margin-bottom: 10px;
h1 {
margin: 0px;
margin: 0;
}
h2 {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
font-weight: normal;
clear: none;
line-height: normal;
@ -300,8 +305,8 @@
color: #C2889C;
font-size: 10pt;
border-bottom: 2px solid #ddd;
padding: 5px 0px;
margin: 0px;
padding: 5px 0;
margin: 0;
margin-bottom: 5px;
line-height: normal;
}
@ -311,14 +316,14 @@
background: #eee;
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
margin-bottom: 5px;
> li {
padding: 5px;
float: left;
margin: 0px;
margin: 0;
}
}
}
@ -423,8 +428,8 @@ html .single-player .play-button {
.transition(background 250ms ease-out);
position: absolute;
top: 0px;
left: 0px;
top: 0;
left: 0;
width: 100%;
height: 100%;
line-height: 32px;
@ -486,8 +491,8 @@ html {
}
.tracks-listing {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
overflow: hidden;
@ -497,8 +502,8 @@ html {
overflow: hidden;
line-height: normal;
padding: 0px;
margin: 5px 0px;
padding: 0;
margin: 5px 0;
padding-right: 10px;
position: relative;
height: 43px;

View file

@ -24,7 +24,7 @@
color: #fff;
font-size: 10pt;
padding: 5px;
margin: 0px 0px 5px;
margin: 0 0 5px;
}
}
@ -74,7 +74,7 @@
font-size: 14px;
background: darken(@pfm-purple, 20%);
margin: -5px;
margin-left: 0px;
margin-left: 0;
padding: 5px;
i {
@ -103,12 +103,12 @@
ul {
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
li {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
&.read {
a {
@ -126,7 +126,7 @@
font-size: 10pt;
background: lighten(@pfm-purple, 30%);
border-left: 5px solid @pfm-purple;
margin: 5px 0px;
margin: 5px 0;
overflow: hidden;
em {

View file

@ -119,8 +119,8 @@ body {
.loader, .seeker {
height: 100%;
position: absolute;
top: 0px;
left: 0px;
top: 0;
left: 0;
}
.loader {

View file

@ -24,7 +24,7 @@ html, body {
height: 100%;
background: transparent;
font-family: "Roboto", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
padding: 0px !important;
padding: 0 !important;
overflow: hidden;
overflow-y: hidden !important;
position: initial !important;
@ -59,7 +59,7 @@ header {
.dropdown-menu {
transform-origin: top right;
left: auto !important;
right: 0px;
right: 0;
}
img {
@ -126,8 +126,8 @@ header {
width: @pfm-sidebar-size;
height: 100%;
list-style: none;
padding: 0px;
margin: 0px;
padding: 0;
margin: 0;
font-size: 10pt;
position: absolute;
bottom: 0;
@ -135,8 +135,8 @@ header {
.material-shadow(3);
li {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
line-height: normal;
&.selected {
@ -175,7 +175,7 @@ header {
h3 {
padding: 10px 25px;
padding-right: 10px;
margin: 0px;
margin: 0;
font-size: 10pt;
color: #eee;
background: darken(#515151, 5%);
@ -206,7 +206,7 @@ header {
> a.dropdown-toggle {
float: right;
padding: 10px 0px;
padding: 10px 0;
display: none;
}

View file

@ -17,13 +17,13 @@
*/
.navigation-list() {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
list-style: none;
li {
margin: 0px;
padding: 0px;
margin: 0;
padding: 0;
float: left;
a {

View file

@ -12,7 +12,7 @@
}
.site-content {
margin-left: 0px;
margin-left: 0;
padding: 5px;
}
@ -142,10 +142,10 @@
}
.track-player {
margin-right: 0px !important;
margin-right: 0 !important;
.inner {
margin-left: 0px !important;
margin-left: 0 !important;
}
.image {
@ -174,7 +174,7 @@
}
.transport {
border-radius: 0px !important;
border-radius: 0 !important;
margin-top: 4px;
height: 10px;
left: 0;
@ -182,13 +182,13 @@
bottom: 55px;
.bar, .loader-bar {
border-radius: 0px;
border-radius: 0;
}
}
}
.dropdowns {
margin-bottom: 0px;
margin-bottom: 0;
> li {
margin-bottom: 10px;
> .btn {
@ -202,12 +202,12 @@
}
.right {
float: none;
padding: 0px;
padding: 0;
width: auto;
}
.left {
margin-right: 0px;
margin-left: 0px;
margin-right: 0;
margin-left: 0;
margin-top: 10px;
}
}
@ -223,7 +223,7 @@
> .stretch-to-bottom {
padding: 0 10px;
.col-md-6 {
padding: 0px;
padding: 0;
}
}
@ -241,7 +241,7 @@
}
> .artist-right {
margin-left: 0px !important;
margin-left: 0 !important;
margin-top: 15px !important;
text-align: center;
@ -280,7 +280,7 @@
}
header {
margin-bottom: 0px;
margin-bottom: 0;
h1 {
font-size: 16pt;
}
@ -288,7 +288,7 @@
font-size: 11pt;
}
h1, h2 {
margin-left: 0px !important;
margin-left: 0 !important;
}
}
}
@ -430,7 +430,7 @@
}
.account-tabs {
margin: -49px 0px 5px;
margin: -49px 0 5px;
}
.modal-dialog {