Skip to content

Instantly share code, notes, and snippets.

@gtcarlos
Created February 28, 2013 03:56
Show Gist options
  • Save gtcarlos/5054048 to your computer and use it in GitHub Desktop.
Save gtcarlos/5054048 to your computer and use it in GitHub Desktop.
Tabelas
<!DOCTYPE html>
</html>
<head>
<title>Administrador de Aplicação</title>
</head>
<body>
<div id=title><h1>Administrador de Aplicação</h1></div>
<table title="Estados">
<thead>
<tr>
<th>Nome</th>
<th>Sigla</th>
</tr>
</thead>
<tbody id="estados" data-update-url="<%= aplicacao_sort_url %>">
<% @estados.each do |estado| %>
<tr>
<%= content_tag_for(:td, estado) do %>
<%= estado.nome %>
<% end %>
<%= content_tag_for(:td, estado) do %>
<%= estado.sigla %>
<% end %>
</tr>
<% end %>
</tbody>
</table>
</body>
</html>
jQuery ->
$('#estados').sortable(
axis: 'y'
update: ->
$.post($(this).data('update-url'), $(this).sortable('serialize'))
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment