Skip to content

Instantly share code, notes, and snippets.

@onelittlenightmusic
Created March 21, 2016 15:53
Show Gist options
  • Save onelittlenightmusic/ed5b9119753a5bbc28ec to your computer and use it in GitHub Desktop.
Save onelittlenightmusic/ed5b9119753a5bbc28ec to your computer and use it in GitHub Desktop.
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require jquery-ui/sortable
jQuery ->
$('.table-sortable').sortable
axis: 'y'
items: '.item'
<p id="notice"><%= notice %></p>
<h1>Listing Data Models</h1>
<table class="table-sortable">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th colspan="3"></th>
</tr>
</thead>
<tbody>
<% @data_models.each do |data_model| %>
<tr class="item">
<td><%= data_model.name %></td>
<td><%= data_model.description %></td>
<td><%= link_to 'Show', data_model %></td>
<td><%= link_to 'Edit', edit_data_model_path(data_model) %></td>
<td><%= link_to 'Destroy', data_model, method: :delete, data: { confirm: 'Are you sure?' } %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'New Data model', new_data_model_path %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment