Display user movies.

This commit is contained in:
Pierre HUBERT 2019-01-15 07:17:06 +01:00
parent 0e3aee13bd
commit f9c1f37ac6
3 changed files with 56 additions and 1 deletions

View File

@ -169,8 +169,31 @@
</div> </div>
<!-- Entire movies list -->
<div id="movies" class="category container"> <div id="movies" class="category container">
Loading movies
<h1>Your movies</h1>
<table id="full-movie-list-table">
<thead>
<tr>
<th>Number</th>
<th>Name</th>
<th>File type</th>
<th>File size</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- Movies will go here -->
</tbody>
</table>
</div> </div>
<div id="all-conversations-message" class="category container"> <div id="all-conversations-message" class="category container">
@ -193,6 +216,7 @@
<script src="assets/js/categories/comments.js"></script> <script src="assets/js/categories/comments.js"></script>
<script src="assets/js/categories/likes.js"></script> <script src="assets/js/categories/likes.js"></script>
<script src="assets/js/categories/survey.js"></script> <script src="assets/js/categories/survey.js"></script>
<script src="assets/js/categories/movies.js"></script>
<script src="assets/js/main.js"></script> <script src="assets/js/main.js"></script>
</body> </body>
</html> </html>

View File

@ -0,0 +1,30 @@
/**
* Movies category
*
* @author Pierre HUBERT
*/
/**
* Apply the list of movies of the user
*/
function ApplyMovies(){
let target = document.querySelector("#full-movie-list-table tbody");
//Process the list of movies
data.movies.forEach(movie => {
createElem2({
appendTo: target,
type: "tr",
innerHTML:
"<td>" + movie.id + "</td>" +
"<td>" + movie.name + "</td>" +
"<td>" + movie.file_type + "</td>" +
"<td>" + movie.size + "</td>" +
"<td> <a href='"+getFilePathFromURL(movie.url)+"'>Open</a></td>"
});
});
}

View File

@ -79,6 +79,7 @@ xhr.onload = function(){
ApplyCommentsList(); ApplyCommentsList();
ApplyUserLikes(); ApplyUserLikes();
ApplySurveyResponses(); ApplySurveyResponses();
ApplyMovies();
} }
xhr.send(null); xhr.send(null);