Make sortable installed plugins table

This commit is contained in:
uu59 2014-06-10 13:51:12 +09:00
parent 3b3a9d096d
commit 81e9ca3d85

View File

@ -2,16 +2,16 @@
-# TODO: should more blush up this page
%table{class: "table table-striped table-hover"}
%table{class: "table table-striped table-hover", id: "plugins-table"}
%thead
%tr
%th= t('.name')
%th= t('.authors')
%th= t('.summary')
%th= t('.installed_version')
%th= t('.latest_version')
%th
%th{width: "32"}
%th.col-lg-1= t('.name')
%th{width: 160}= t('.authors')
%th{width: 320}= t('.summary')
%th.col-lg-1= t('.installed_version')
%th.col-lg-1= t('.latest_version')
%th.col-lg-1
%th.col-lg-1
%tbody
- @plugins.each do |plugin|
%tr
@ -27,7 +27,9 @@
%td
= plugin.latest_version
%td
- unless plugin.latest_version?
- if plugin.latest_version?
= t('.latest_version')
- else
= form_tag(upgrade_plugins_path, method: :patch) do
= hidden_field_tag("plugins[name]", plugin.gem_name)
= hidden_field_tag("plugins[version]", plugin.latest_version)
@ -36,3 +38,16 @@
= form_tag(uninstall_plugins_path, method: :patch) do
= hidden_field_tag("plugins[]", plugin.gem_name)
= submit_tag t('.uninstall'), class: "btn btn-danger"
:javascript
$(document).ready(function() {
$('#plugins-table').dataTable({
"ordering": true,
"paging": false,
"info": false,
"searching": true,
"language": {
"search": "#{t("terms.search")} "
}
});
});