No Description

learning-outcomes_new.blade.php 3.0KB

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