<commit_before>{% extends "layout.html" %}
{% block content %}
<h2>Playlist: {{ playlist.title }}</h2>
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editPlaylistName">Edit</button>
<hr>
{% if entries|length > 0 %}
<table class="table table-striped">
  <thead>
    <tr>
      <th>Title</th>
      <th>Artist</th>
      <th>Album</th>
      <th>Duration</th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    {% for song in entries %}
    <tr class="ui-state-default">
      <td>{{song.title}}</td>
      <td>{{song.artist}}</td>
      <td>{{song.album}}</td>
      <td>{{ format_duration(song.duration) }}</td>
      <td><a class="btn btn-default btn-sm" href="{{ url_for('song_info', song_id=song.id) }}"><span class="glyphicon glyphicon-info-sign"></span></a></td>
      {% if song.external_url != None %}
      <td>
        <a class="btn btn-sm btn-primary" href="{{ song.external_url }}" target="#"><span class="glyphicon glyphicon-play"></span></a>
      </td>
      {% else %}
      <td></td>
      {% endif %}
      <td> <a onclick="removeSongFromPlaylist({{song.position}})" class="btn btn-sm btn-default" ><span class="glyphicon glyphicon-minus-sign"></span></a> <td>
    </tr>
    {% endfor %}
  </tbody>
</table>
<script>
$('table tbody').sortable({
  start: function(event, ui) {
    ui.item.startPos = ui.item.index();
  },
  stop: function(event, ui) {
    movePlaylistItem(ui.item.startPos, ui.item.index());
  }
});
function movePlaylistItem(oldpos, newpos){
  $.ajax({
    type: "POST",
    url: "{{ url_for('playlist_song_move') }}",
    data: JSON.stringify({
      old_position: oldpos,
      new_position: newpos,
      playlist_id: {{playlist.id}}
    }),
    contentType: "application/json",<commit_msg>Drag/drop handle<commit_after>{% extends "layout.html" %}
{% block content %}
<h2>Playlist: {{ playlist.title }}</h2>
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#editPlaylistName">Edit</button>
<hr>
{% if entries|length > 0 %}
<table class="table table-striped">
  <thead>
    <tr>
      <th>
      <th>Title</th>
      <th>Artist</th>
      <th>Album</th>
      <th>Duration</th>
      <th></th>
      <th></th>
      <th></th>
    </tr>
  </thead>
  <tbody>
    {% for song in entries %}
    <tr class="ui-state-default">
      <td class="handle"><i class="fa fa-bars" aria-hidden="true"></i></td>
      <td>{{song.title}}</td>
      <td>{{song.artist}}</td>
      <td>{{song.album}}</td>
      <td>{{ format_duration(song.duration) }}</td>
      <td><a class="btn btn-default btn-sm" href="{{ url_for('song_info', song_id=song.id) }}"><span class="glyphicon glyphicon-info-sign"></span></a></td>
      {% if song.external_url != None %}
      <td>
        <a class="btn btn-sm btn-primary" href="{{ song.external_url }}" target="#"><span class="glyphicon glyphicon-play"></span></a>
      </td>
      {% else %}
      <td></td>
      {% endif %}
      <td> <a onclick="removeSongFromPlaylist({{song.position}})" class="btn btn-sm btn-default" ><span class="glyphicon glyphicon-minus-sign"></span></a> <td>
    </tr>
    {% endfor %}
  </tbody>
</table>
<script>
$('table tbody').sortable({
  handle: ".handle",
  start: function(event, ui) {
    ui.item.startPos = ui.item.index();
  },
  stop: function(event, ui) {
    movePlaylistItem(ui.item.startPos, ui.item.index());
  }
});
function movePlaylistItem(oldpos, newpos){
  $.ajax({
    type: "POST",
    url: "{{ url_for('playlist_song_move') }}",
    data: JSON.stringify({
      old_position: oldpos,
      new_position: newpos,
      playlist_id: {{playlist.id}}
    }),
    contentType: "application/json",
{'fraction_non_alphanumeric': 0.2197357778376921, 'fraction_numerical': 0.0016176867080075492, 'mean_word_length': 3.2351598173515983, 'pattern_counts': {'":': 0, '<': 124, '<?xml version=': 0, '>': 126, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5540124', 'n_tokens_mistral': 1392, 'n_tokens_neox': 1307, 'n_words': 244}