From 81e9ca3d85a4b5cef402b26f1d3d9899d0c206ae Mon Sep 17 00:00:00 2001 From: uu59 Date: Tue, 10 Jun 2014 13:51:12 +0900 Subject: [PATCH] Make sortable installed plugins table --- app/views/plugins/installed.html.haml | 33 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/app/views/plugins/installed.html.haml b/app/views/plugins/installed.html.haml index a6e7041..ef2ae42 100644 --- a/app/views/plugins/installed.html.haml +++ b/app/views/plugins/installed.html.haml @@ -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")} " + } + }); + });