Skip to content

Commit 2d72791

Browse files
author
dularion
committed
Manage Content - List order #109
1 parent 3c68e3b commit 2d72791

28 files changed

+17018
-5631
lines changed

grails-app/assets/javascripts/application.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
//= require angular-ui-router/release/angular-ui-router.js
1212
//= require angular-sanitize/angular-sanitize.js
1313
//= require bootstrap/dist/js/bootstrap.js
14-
//= require ui-bootstrap-custom-build/ui-bootstrap-custom-0.13.1.js
15-
//= require ui-bootstrap-custom-build/ui-bootstrap-custom-tpls-0.13.1.js
14+
//= require angular-bootstrap/ui-bootstrap.js
15+
//= require angular-bootstrap/ui-bootstrap-tpls.js
1616
//= require alertify/alertify.js
1717
//= require lodash/lodash.js
1818
//= require ng-file-upload/ng-file-upload.js

grails-app/assets/javascripts/controllers/dash-ctrl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ streamaApp.controller('dashCtrl', [
3636

3737
apiService.video.dash()
3838
.success(function (data) {
39-
$scope.episodes = data.firstEpisodes;
39+
$scope.tvShows = data.tvShowsForDash;
4040
$scope.continueWatching = data.continueWatching;
4141
$scope.movies = data.movies;
4242
$scope.loading = false;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
'use strict';
2+
3+
streamaApp.directive('videoSortOrderDropdown', [function () {
4+
return {
5+
restrict: 'AE',
6+
templateUrl: 'directive--video-sort-order-dropdown.htm',
7+
scope: {
8+
currentSort: '=',
9+
dropdownType: '='
10+
},
11+
link: function ($scope, $elem, $attrs) {
12+
$scope.sortOrders = [
13+
{sort: '-dateCreated', label: 'Most Recently Added'},
14+
{sort: 'dateCreated', label: 'First Added'}
15+
];
16+
17+
console.log('%c $scope.dropdownType', 'color: deeppink; font-weight: bold; text-shadow: 0 0 5px deeppink;', $scope.dropdownType);
18+
19+
if($scope.dropdownType == 'movie'){
20+
$scope.sortOrders = $scope.sortOrders.concat([
21+
{sort: 'title', label: 'A-Z'},
22+
{sort: '-title', label: 'Z-A'},
23+
{sort: '-release_date', label: 'Latest Release'},
24+
{sort: 'release_date', label: 'Oldest Release'}
25+
])
26+
}
27+
28+
if($scope.dropdownType == 'tvShow'){
29+
$scope.sortOrders = $scope.sortOrders.concat([
30+
{sort: 'name', label: 'A-Z'},
31+
{sort: '-name', label: 'Z-A'},
32+
{sort: '-first_air_date', label: 'Most recently aired'},
33+
{sort: 'first_air_date', label: 'Oldest Air-Date'}
34+
])
35+
}
36+
37+
$scope.setCurrentSort = function (sortOrder) {
38+
$scope.currentSort = sortOrder;
39+
};
40+
41+
$scope.currentSort = $scope.sortOrders[0];
42+
}
43+
}
44+
}]);

grails-app/assets/javascripts/streama-app/templates/admin-movies.tpl.htm

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<button class="btn btn-primary pull-right btn-lg" ng-click="openMovieModal()">Create new Movie</button>
22

3-
<h1>Movies</h1>
3+
<h1>
4+
Movies
5+
<video-sort-order-dropdown current-sort="currentSort" dropdown-type="'movie'"/>
6+
</h1>
47

58
<div class="row">
69
<div class="col-md-5">
@@ -16,8 +19,7 @@ <h1>Movies</h1>
1619

1720
<hr/>
1821

19-
20-
<div class="media-list-item media-poster-item" ng-repeat="movie in movies | filter:search" ui-sref="admin.movie({movieId: movie.id})">
22+
<div class="media-list-item media-poster-item" ng-repeat="movie in movies | filter:search | orderBy:currentSort.sort" ui-sref="admin.movie({movieId: movie.id})">
2123
<div class="media-item" >
2224
<img ng-src="https://image.tmdb.org/t/p/w300/{{movie.poster_path}}"/>
2325

grails-app/assets/javascripts/streama-app/templates/admin-shows.tpl.htm

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<button class="btn btn-primary pull-right btn-lg" ng-click="openShowModal()">Create new Show</button>
22

3-
<h1>Shows</h1>
3+
<h1>
4+
Shows
5+
<video-sort-order-dropdown current-sort="currentSort" dropdown-type="'tvShow'"/>
6+
</h1>
47

58
<div class="row">
69
<div class="col-md-5">
@@ -18,7 +21,7 @@ <h1>Shows</h1>
1821
<hr/>
1922

2023
<div class="media-list">
21-
<div class="media-list-item media-poster-item" ng-repeat="show in shows | filter:search" ui-sref="admin.show({showId: show.id})">
24+
<div class="media-list-item media-poster-item" ng-repeat="show in shows | filter:search | orderBy:currentSort.sort" ui-sref="admin.show({showId: show.id})">
2225
<div class="media-item" >
2326
<img ng-if="show.poster_path" ng-src="https://image.tmdb.org/t/p/w300/{{show.poster_path}}"/>
2427
<div ng-if="!show.poster_path" class="fallback-image"></div>

grails-app/assets/javascripts/streama-app/templates/dash.tpl.htm

+13-11
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,22 @@ <h3>Continue watching</h3>
3838
<hr/>
3939
</div>
4040

41-
<div ng-if="episodes.length">
42-
<h3>Discover Shows</h3>
41+
<div ng-if="tvShows.length">
42+
<h3>Discover Shows
43+
<video-sort-order-dropdown current-sort="showSort" dropdown-type="'tvShow'"></video-sort-order-dropdown></h3>
4344
<div class="media-list">
44-
<div class="media-list-item media-poster-item" ng-repeat="episode in episodes">
45+
<div class="media-list-item media-poster-item" ng-repeat="tvShow in tvShows | orderBy:showSort.sort">
4546
<div class="media-item" >
46-
<img ng-if="episode.show.poster_path" ng-src="https://image.tmdb.org/t/p/w300/{{episode.show.poster_path}}"/>
47-
<div ng-if="!episode.show.poster_path" class="fallback-image"></div>
47+
<img ng-if="tvShow.poster_path" ng-src="https://image.tmdb.org/t/p/w300/{{tvShow.poster_path}}"/>
48+
<div ng-if="!tvShow.poster_path" class="fallback-image"></div>
4849

4950
<div class="play-text">
50-
<h4>{{episode.show.name}}</h4>
51-
<p>{{episode.episodeString}} - {{episode.name}}</p>
51+
<h4>{{tvShow.name}}</h4>
52+
<p>{{tvShow.firstEpisode.episodeString}} - {{tvShow.firstEpisode.name}}</p>
5253
</div>
5354

54-
<i class="info-icon ion-ios-information" ng-click="showDetails(episode.show)"></i>
55-
<a class="play-icon ion-ios-play" ui-sref="player({videoId: episode.id})"></a>
55+
<i class="info-icon ion-ios-information" ng-click="showDetails(tvShow)"></i>
56+
<a class="play-icon ion-ios-play" ui-sref="player({videoId: tvShow.firstEpisode.id})"></a>
5657
</div>
5758
</div>
5859
</div>
@@ -61,9 +62,10 @@ <h4>{{episode.show.name}}</h4>
6162
</div>
6263

6364
<div ng-if="movies.length">
64-
<h3>Discover Movies</h3>
65+
<h3>Discover Movies
66+
<video-sort-order-dropdown current-sort="movieSort" dropdown-type="'movie'"></video-sort-order-dropdown></h3>
6567
<div class="media-list">
66-
<div class="media-list-item media-poster-item" ng-repeat="movie in movies">
68+
<div class="media-list-item media-poster-item" ng-repeat="movie in movies | orderBy:movieSort.sort">
6769
<div class="media-item" >
6870
<img ng-src="https://image.tmdb.org/t/p/w300/{{movie.poster_path}}"/>
6971

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<div class="sort-by btn-group" uib-dropdown dropdown-append-to-body>
2+
<button id="btn-append-to-body" type="button" class="btn btn-white btn-outline btn-sm" uib-dropdown-toggle>
3+
{{currentSort.label}}<span class="caret"></span>
4+
</button>
5+
<ul class="uib-dropdown-menu" role="menu" aria-labelledby="btn-append-to-body">
6+
<li role="menuitem" ng-repeat="sortOrder in sortOrders"><a ng-click="setCurrentSort(sortOrder)">{{sortOrder.label}}</a></li>
7+
</ul>
8+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"author": {
3+
"name": "https://github.com/angular-ui/bootstrap/graphs/contributors"
4+
},
5+
"name": "angular-bootstrap",
6+
"keywords": [
7+
"angular",
8+
"angular-ui",
9+
"bootstrap"
10+
],
11+
"license": "MIT",
12+
"ignore": [],
13+
"description": "Native AngularJS (Angular) directives for Bootstrap.",
14+
"version": "0.14.3",
15+
"main": [
16+
"./ui-bootstrap-tpls.js"
17+
],
18+
"dependencies": {
19+
"angular": ">=1.3.0"
20+
},
21+
"homepage": "https://github.com/angular-ui/bootstrap-bower",
22+
"_release": "0.14.3",
23+
"_resolution": {
24+
"type": "version",
25+
"tag": "0.14.3",
26+
"commit": "306d1a30b4a8e8144741bb9c0126331ac884126a"
27+
},
28+
"_source": "git://github.com/angular-ui/bootstrap-bower.git",
29+
"_target": "~0.14.3",
30+
"_originalSource": "angular-bootstrap",
31+
"_direct": true
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bower.json
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
### UI Bootstrap - [AngularJS](http://angularjs.org/) directives specific to [Bootstrap](http://getbootstrap.com)
2+
3+
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/angular-ui/bootstrap?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
[![Build Status](https://secure.travis-ci.org/angular-ui/bootstrap.svg)](http://travis-ci.org/angular-ui/bootstrap)
5+
[![devDependency Status](https://david-dm.org/angular-ui/bootstrap/dev-status.svg?branch=master)](https://david-dm.org/angular-ui/bootstrap#info=devDependencies)
6+
7+
### Quick links
8+
- [Demo](#demo)
9+
- [Installation](#installation)
10+
- [NPM](#install-with-npm)
11+
- [Bower](#install-with-bower)
12+
- [NuGet](#install-with-nuget)
13+
- [Custom](#custom-build)
14+
- [Manual](#manual-download)
15+
- [Support](#support)
16+
- [FAQ](#faq)
17+
- [Supported browsers](#supported-browsers)
18+
- [Need help?](#need-help)
19+
- [Found a bug?](#found-a-bug)
20+
- [Contributing to the project](#contributing-to-the-project)
21+
- [Development, meeting minutes, roadmap and more.](#development-meeting-minutes-roadmap-and-more)
22+
23+
24+
# Demo
25+
26+
Do you want to see directives in action? Visit http://angular-ui.github.io/bootstrap/!
27+
28+
# Installation
29+
30+
Installation is easy as UI Bootstrap has minimal dependencies - only the AngularJS and Twitter Bootstrap's CSS are required.
31+
Note: Since version 0.13.0, UI Bootstrap depends on [ngAnimate](https://docs.angularjs.org/api/ngAnimate) for transitions and animations, such as the accordion, carousel, etc. Include `ngAnimate` in the module dependencies for your app in order to enable animation.
32+
33+
#### Install with NPM
34+
35+
```sh
36+
$ npm install angular-ui-bootstrap
37+
```
38+
39+
This will install AngularJS and Bootstrap NPM packages.
40+
41+
#### Install with Bower
42+
```sh
43+
$ bower install angular-bootstrap
44+
```
45+
46+
Note: do not install 'angular-ui-bootstrap'. A separate repository - [bootstrap-bower](https://github.com/angular-ui/bootstrap-bower) - hosts the compiled javascript file and bower.json.
47+
48+
#### Install with NuGet
49+
To install AngularJS UI Bootstrap, run the following command in the Package Manager Console
50+
51+
```sh
52+
PM> Install-Package Angular.UI.Bootstrap
53+
```
54+
55+
#### Custom build
56+
57+
Head over to http://angular-ui.github.io/bootstrap/ and hit the *Custom build* button to create your own custom UI Bootstrap build, just the way you like it.
58+
59+
#### Manual download
60+
61+
After downloading dependencies (or better yet, referencing them from your favorite CDN) you need to download build version of this project. All the files and their purposes are described here:
62+
https://github.com/angular-ui/bootstrap/tree/gh-pages#build-files
63+
Don't worry, if you are not sure which file to take, opt for `ui-bootstrap-tpls-[version].min.js`.
64+
65+
### Adding dependency to your project
66+
67+
When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the `ui.bootstrap` AngularJS module:
68+
69+
```js
70+
angular.module('myModule', ['ui.bootstrap']);
71+
```
72+
73+
If you're a Browserify or Webpack user, you can do:
74+
75+
```js
76+
var uibs = require('angular-ui-bootstrap');
77+
78+
angular.module('myModule', [uibs]);
79+
```
80+
81+
# Support
82+
83+
## FAQ
84+
85+
https://github.com/angular-ui/bootstrap/wiki/FAQ
86+
87+
## Supported browsers
88+
89+
Directives from this repository are automatically tested with the following browsers:
90+
* Chrome (stable and canary channel)
91+
* Firefox
92+
* IE 9 and 10
93+
* Opera
94+
* Safari
95+
96+
Modern mobile browsers should work without problems.
97+
98+
99+
## Need help?
100+
Need help using UI Bootstrap?
101+
102+
* Live help in the IRC (`#angularjs` channel at the `freenode` network). Use this [webchat](https://webchat.freenode.net/) or your own IRC client.
103+
* Ask a question in [StackOverflow](http://stackoverflow.com/) under the [angular-ui-bootstrap](http://stackoverflow.com/questions/tagged/angular-ui-bootstrap) tag.
104+
105+
**Please do not create new issues in this repository to ask questions about using UI Bootstrap**
106+
107+
## Found a bug?
108+
Please take a look at [CONTRIBUTING.md](CONTRIBUTING.md#you-think-youve-found-a-bug) and submit your issue [here](https://github.com/angular-ui/bootstrap/issues/new).
109+
110+
111+
----
112+
113+
114+
# Contributing to the project
115+
116+
We are always looking for the quality contributions! Please check the [CONTRIBUTING.md](CONTRIBUTING.md) for the contribution guidelines.
117+
118+
# Development, meeting minutes, roadmap and more.
119+
120+
Head over to the [Wiki](https://github.com/angular-ui/bootstrap/wiki) for notes on development for UI Bootstrap, meeting minutes from the UI Bootstrap team, roadmap plans, project philosophy and more.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"author": {
3+
"name": "https://github.com/angular-ui/bootstrap/graphs/contributors"
4+
},
5+
"name": "angular-bootstrap",
6+
"keywords": [
7+
"angular",
8+
"angular-ui",
9+
"bootstrap"
10+
],
11+
"license": "MIT",
12+
"ignore": [],
13+
"description": "Native AngularJS (Angular) directives for Bootstrap.",
14+
"version": "0.14.3",
15+
"main": ["./ui-bootstrap-tpls.js"],
16+
"dependencies": {
17+
"angular": ">=1.3.0"
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require('./ui-bootstrap-tpls');
2+
module.exports = 'ui.bootstrap';
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "angular-ui-bootstrap",
3+
"version": "0.14.3",
4+
"description": "Bootstrap widgets for Angular",
5+
"main": "index.js",
6+
"homepage": "http://angular-ui.github.io/bootstrap/",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/angular-ui/bootstrap.git"
10+
},
11+
"keywords": [
12+
"angular",
13+
"bootstrap",
14+
"angular-ui",
15+
"components",
16+
"client-side"
17+
],
18+
"author": "https://github.com/angular-ui/bootstrap/graphs/contributors",
19+
"peerDependencies": {
20+
"angular": "^1.3.x || >= 1.4.0-beta.0 || >= 1.5.0-beta.0"
21+
},
22+
"license": "MIT"
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/* Include this file in your html if you are using the CSP mode. */
2+
3+
.ng-animate.item:not(.left):not(.right) {
4+
-webkit-transition: 0s ease-in-out left;
5+
transition: 0s ease-in-out left
6+
}

0 commit comments

Comments
 (0)