설명 없음

learning-outcomes_new.blade.php 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. @extends('layouts.master')
  2. @section('navigation')
  3. @if(Auth::user()->role==1)
  4. @include('local.managers.admins._navigation')
  5. @elseif(Auth::user()->role==2)
  6. @include('local.managers.sCoords._navigation')
  7. @elseif(Auth::user()->role==3)
  8. @include('local.managers.pCoords._navigation')
  9. @endif
  10. @stop
  11. @section('main')
  12. <div class="row">
  13. <div class="col-md-12">
  14. <p>Click on the values you want to change. Invalid values will be rejected automatically. To save your changes, click the 'Save' button at the bottom of the page.</p>
  15. <table class="table table-striped table-condensed editable-table">
  16. <thead><tr class="center-text">
  17. <th class="col-md-4">Learning Outcome</th>
  18. <th class="col-md-7">Definition</th>
  19. <th class="col-md-1">Expected Value</th>
  20. </thead>
  21. <tbody>
  22. @foreach ($outcomes as $outcome)
  23. <tr data-id="{{ $outcome->id }}">
  24. <td contenteditable="true" class="name col-md-4" >{{ $outcome->name }}</td>
  25. <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ $outcome->definition }}</td>
  26. <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
  27. </tr>
  28. @endforeach
  29. </tbody>
  30. </table>
  31. </div>
  32. </div>
  33. <div class="row">
  34. <div class="col-md-12"><button class="btn btn-lg btn-primary center-block">Save</button></div>
  35. </div>
  36. @stop
  37. @section('javascript')
  38. $('button').on('click', function(e)
  39. {
  40. e.preventDefault();
  41. var outcomeArray= new Array();
  42. // For each learning outcome, get its value and put it into an array
  43. $('tbody tr').each(function( index )
  44. {
  45. var outcomeObject = new Object();
  46. outcomeObject.id= $(this).data('id');
  47. outcomeObject.name= $(this).children('.name').text();
  48. outcomeObject.definition= $(this).children('.definition').text();
  49. outcomeObject.expected_outcome= $(this).children('.expected-outcome').text();
  50. if($(this).find('.glyphicon-eye-close').length>0)
  51. {
  52. outcomeObject.delete=1;
  53. }
  54. else
  55. outcomeObject.delete=0;
  56. var clone = jQuery.extend({}, outcomeObject);
  57. outcomeArray.push(clone);
  58. });
  59. $.post(
  60. "{{ URL::action('OutcomesController@update') }}",
  61. { outcomeArray: JSON.stringify(outcomeArray)},
  62. function(data)
  63. {
  64. location.reload();
  65. }
  66. );
  67. });
  68. $('span').on('click', function()
  69. {
  70. if($(this).hasClass('glyphicon-eye-open'))
  71. $(this).removeClass('glyphicon-eye-open').addClass('glyphicon-eye-close');
  72. else
  73. $(this).removeClass('glyphicon-eye-close').addClass('glyphicon-eye-open');
  74. });
  75. @stop