mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2025-03-29 14:27:46 +01:00
Part of the notification front end
This commit is contained in:
parent
674046fc7d
commit
409182c77e
8 changed files with 95 additions and 6 deletions
|
@ -22,18 +22,23 @@ module.exports = angular.module('ponyfm').controller "application", [
|
||||||
$scope.$stateParams = $stateParams
|
$scope.$stateParams = $stateParams
|
||||||
$scope.isPinnedPlaylistSelected = false
|
$scope.isPinnedPlaylistSelected = false
|
||||||
$scope.menuActive = false
|
$scope.menuActive = false
|
||||||
|
$scope.notifActive = false
|
||||||
$loadingElement = null
|
$loadingElement = null
|
||||||
loadingStateName = null
|
loadingStateName = null
|
||||||
|
|
||||||
if 'serviceWorker' of navigator
|
if 'serviceWorker' of navigator
|
||||||
console.log 'Service Worker is supported'
|
console.log 'Service Worker is supported'
|
||||||
navigator.serviceWorker.register('service-worker.js').then((reg) ->
|
navigator.serviceWorker.register('service-worker.js').then((reg) ->
|
||||||
console.log 'SW registered', reg
|
console.log 'SW registered', reg
|
||||||
).catch (err) ->
|
).catch (err) ->
|
||||||
console.log 'SW register failed', err
|
console.log 'SW register failed', err
|
||||||
|
|
||||||
$scope.menuToggle = () ->
|
$scope.menuToggle = () ->
|
||||||
$scope.menuActive = !$scope.menuActive
|
$scope.menuActive = !$scope.menuActive
|
||||||
|
$scope.notifActive = false
|
||||||
|
|
||||||
|
$scope.notifPulloutToggle = () ->
|
||||||
|
$scope.notifActive = !$scope.notifActive
|
||||||
|
|
||||||
if window.pfm.error
|
if window.pfm.error
|
||||||
$state.transitionTo 'errors-' + window.pfm.error
|
$state.transitionTo 'errors-' + window.pfm.error
|
||||||
|
@ -72,6 +77,7 @@ module.exports = angular.module('ponyfm').controller "application", [
|
||||||
statesPreloaded = {}
|
statesPreloaded = {}
|
||||||
$scope.$on '$stateChangeStart', (e, newState, newParams, oldState, oldParams) ->
|
$scope.$on '$stateChangeStart', (e, newState, newParams, oldState, oldParams) ->
|
||||||
$scope.menuActive = false
|
$scope.menuActive = false
|
||||||
|
$scope.notifActive = false
|
||||||
$scope.isPinnedPlaylistSelected = false
|
$scope.isPinnedPlaylistSelected = false
|
||||||
|
|
||||||
if newState.name == 'content.playlist'
|
if newState.name == 'content.playlist'
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
# Pony.fm - A community for pony fan music.
|
||||||
|
# Copyright (C) 2016 Josef Citrine
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU Affero General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Affero General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
module.exports = angular.module('ponyfm').directive 'pfmNotificationList', () ->
|
||||||
|
restrict: 'E'
|
||||||
|
templateUrl: '/templates/directives/notification-list.html'
|
||||||
|
replace: true
|
||||||
|
scope: {}
|
||||||
|
|
||||||
|
controller: [
|
||||||
|
'$scope', 'notifications'
|
||||||
|
($scope, notifications) ->
|
||||||
|
notifications.getNotifications().done (result) ->
|
||||||
|
$scope.notifications = result
|
||||||
|
console.log result
|
||||||
|
]
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
body.is-logged {
|
body.is-logged {
|
||||||
.track-player {
|
.track-player {
|
||||||
margin-right: 75px;
|
margin-right: 130px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
38
resources/assets/styles/content.less
vendored
38
resources/assets/styles/content.less
vendored
|
@ -540,6 +540,21 @@ html {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-menu {
|
||||||
|
float: right;
|
||||||
|
margin-top: 15px;
|
||||||
|
margin-right: 14px;
|
||||||
|
font-size: 20pt;
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #5A5A5A;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.notification {
|
.notification {
|
||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
@ -551,4 +566,27 @@ html {
|
||||||
margin-left: 60px;
|
margin-left: 60px;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.notification-pullout {
|
||||||
|
position: absolute;
|
||||||
|
top: 64px;
|
||||||
|
right: -410px;
|
||||||
|
width: 400px;
|
||||||
|
height: ~"calc(100% - 64px)";
|
||||||
|
z-index: 1000;
|
||||||
|
background: #fff;
|
||||||
|
box-shadow: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
|
||||||
|
transition: transform 0.5s ease;
|
||||||
|
transform: translateX(0px) translateZ(0px);
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
transform: translateX(-410px) translateZ(0px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.notif-container {
|
||||||
|
padding: 20px;
|
||||||
|
max-height: 100%;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
}
|
}
|
1
resources/assets/styles/layout.less
vendored
1
resources/assets/styles/layout.less
vendored
|
@ -28,6 +28,7 @@ html body {
|
||||||
background: #444;
|
background: #444;
|
||||||
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
|
||||||
padding: 0px !important;
|
padding: 0px !important;
|
||||||
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
header {
|
header {
|
||||||
|
|
4
resources/assets/styles/mobile.less
vendored
4
resources/assets/styles/mobile.less
vendored
|
@ -248,4 +248,8 @@
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notification-pullout {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,9 @@
|
||||||
<li><a href="#" pfm-eat-click ng-click="logout()">Logout</a></li>
|
<li><a href="#" pfm-eat-click ng-click="logout()">Logout</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="notification-menu">
|
||||||
|
<a href="#" ng-click="notifPulloutToggle()"><i class="fa fa-bell fa-fw" aria-hidden="true"></i></a>
|
||||||
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<pfm-player></pfm-player>
|
<pfm-player></pfm-player>
|
||||||
</div>
|
</div>
|
||||||
|
@ -128,6 +131,14 @@
|
||||||
<ui-view class="site-content">
|
<ui-view class="site-content">
|
||||||
@yield('app_content')
|
@yield('app_content')
|
||||||
</ui-view>
|
</ui-view>
|
||||||
|
|
||||||
|
@if (Auth::check())
|
||||||
|
<div class="notification-pullout" ng-class="{'active': notifActive}">
|
||||||
|
<div class="notif-container">
|
||||||
|
<pfm-notification-list></pfm-notification-list>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
Loading…
Add table
Reference in a new issue