jonahoffline/csv2api

View on GitHub
lib/csv2api/views/layout.erb

Summary

Maintainability
Test Coverage
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <link rel="stylesheet" href="css/normalize.css">
  <link rel="stylesheet" media="screen" href="css/jquery.handsontable.full.css">

  <script src="js/jquery.min.js"></script>
  <script src="js/jquery.handsontable.full.js"></script>

  <title>CSV2API: <%= title %></title>
</head>
<body>
<div class="container">
  <h3><%= title %></h3>

  <div id="grid"></div>
</div>

<script type="text/javascript">
  $(document).ready(function() {
  var $container = $('#grid');

  $.ajax({
    url: 'http://localhost:4567/<%= endpoint %>.json',
    dataType: 'json',
    type: 'GET',
    success: function(res) {
      $container.handsontable({
        data: res,
        minSpareRows: 1,
        colHeaders: true,
        contextMenu: true,
        colHeaders: <%= column_headers %>,
        manualColumnResize: true,
        manualRowResize: true
      });
    }
  });
});
</script>
</body>
</html>