index.blade.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. @extends('layouts.admin')
  2. @section('title')
  3. Video Home Page
  4. @stop
  5. @section('content')
  6. <p>Trascina le righe per ordinare gli elementi</p>
  7. <div class="row">
  8. <div class="col-xs-12">
  9. <div class="box">
  10. <div class="box-body">
  11. <div class="box-body table-responsive no-padding">
  12. <table class="table table-striped table-hover">
  13. <thead>
  14. <tr>
  15. <th>Titolo</th>
  16. <th>Piattaforma</th>
  17. <th>Online</th>
  18. <th>Data</th>
  19. <th width="50"></th>
  20. <th width="50"></th>
  21. </tr>
  22. </thead>
  23. <tbody>
  24. @foreach($videos as $video)
  25. <tr class="video_row" data-id="{{$video->id}}" style="cursor:move">
  26. <td><a href="{{ route('videos.edit', array($video->id)) }}" >{{$video->title}}</a></td>
  27. <td>{{$video->type}}</td>
  28. <td>{{$video->online ? 'Si' : 'No'}}</td>
  29. <td>{{date("d/m/Y H:i", strtotime($video->date))}}</td>
  30. <td>
  31. <a href="{{ route('videos.edit', array($video->id)) }}" type="button" class="btn btn-w-m btn-primary">Modifica</a>
  32. </td>
  33. <td>
  34. {!! Form::open(array('class' => 'form-inline', 'method' => 'DELETE', 'route' => array('videos.destroy', $video->id))) !!}
  35. <button type="submit" class="btn btn-w-m btn-danger" onclick="return confirm('Sei sicuro?')">Elimina</button>
  36. {!! Form::close() !!}
  37. </td>
  38. </tr>
  39. @endforeach
  40. </table>
  41. </div>
  42. </div>
  43. </div>
  44. <div class="col-xs-2">
  45. <a href="{{ route('videos.create') }}" class="btn btn-success">Aggiungi</a>
  46. </div>
  47. </div>
  48. @stop
  49. @section('extra_css')
  50. <link rel="stylesheet" href="/plugins/datatables/dataTables.bootstrap.css">
  51. <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.2/css/buttons.dataTables.min.css">
  52. @stop
  53. @section('extra_js')
  54. <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
  55. <script>
  56. $(function () {
  57. $('tbody').sortable({
  58. cursor: "move",
  59. stop: function( ) {
  60. var ids = '';
  61. $(".video_row").each(function()
  62. {
  63. var id = $(this).attr("data-id");
  64. ids += (ids != '' ? ',' : '') + id;
  65. });
  66. $.ajax('/admin/videos/sort/' + ids,
  67. {
  68. success: function (data, status, xhr) {// success callback function
  69. $('p').append(data);
  70. }
  71. });
  72. }
  73. });
  74. });
  75. </script>
  76. @stop