<script src="{{ STATIC_URL }}jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script>
- /**
- * Added by Thomas Balastegui :
- * function that get variables from the Add popup
- * and create a new playlist
- */
- var p = playlistUtils;
- var ID = ""; // ID var: used to edit playlist
- var title = "";
- var description = "";
-
- function addNewPlaylist() {
- title = $('#titleAdd').val();
- description = $('#descriptionAdd').val();
- p.add({title,description});
- }
-
- // function to change global var ID (used when edit button is pressed)
- function editVar(id) {
- ID = id;
- for (var i=0; i< p.playlists.length; i++){
- if (p.playlists[i].id == id){
- $('#titleEdit').val(p.playlists[i].title);
- $('#descriptionEdit').val(p.playlists[i].description);
- }
- }
- }
-
- function editPlaylist() {
- title = $('#titleEdit').val();
- description = $('#descriptionEdit').val();
- // Use of a function that convert params then use playlist.update
- p.updateConvert(ID, title, description);
- ID = ""; // init ID
- }
-
{% for playlist in playlists %}
playlistUtils.addEditPlaylist('{{playlist.playlist.public_id}}','{{ playlist.playlist.title }}','{{playlist.playlist.description}}');
{% endfor %}