From c678806489cbe7d63d3946de1265697c7fb996e6 Mon Sep 17 00:00:00 2001 From: elijah Date: Sun, 10 Jan 2016 16:27:16 -0800 Subject: fix user list --- app/helpers/core_helper.rb | 8 ++++++++ app/views/users/_user.html.haml | 10 +++++----- app/views/users/index.html.haml | 3 +-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/helpers/core_helper.rb b/app/helpers/core_helper.rb index f34d2f2..05efb95 100644 --- a/app/helpers/core_helper.rb +++ b/app/helpers/core_helper.rb @@ -29,4 +29,12 @@ module CoreHelper }.join(" ").html_safe end + # + # displays the datetime as time ago in words, + # but has the absolute time in a tooltip. + # + def simple_date(datetime) + content_tag :span, time_ago_in_words(datetime), :title => datetime.to_s, :class => 'date' + end + end diff --git a/app/views/users/_user.html.haml b/app/views/users/_user.html.haml index 1cabcf5..e34de70 100644 --- a/app/views/users/_user.html.haml +++ b/app/views/users/_user.html.haml @@ -1,13 +1,13 @@ %tr %td - = link_to user.username, user + = link_to user.username, user %td - = user.created_at.strftime("%d %b, %Y, %H:%M") + = simple_date(user.created_at) %td - = user.updated_at.strftime("%d %b, %Y, %H:%M") + = simple_date(user.updated_at) %td - if user.enabled - %button.btn.btn-default{:"data-toggle" => "modal", :"data-target" => "#user-form-#{user.id}", :type => "button"} + %button.btn.btn-sm.btn-default{:"data-toggle" => "modal", :"data-target" => "#user-form-#{user.id}", :type => "button"} = t("actions.disable_user") .modal.fade.hide{:id => "user-form-#{user.id}"} .modal-dialog @@ -19,7 +19,7 @@ = form_tag deactivate_user_path(user) do %input.btn.btn-default.btn-danger{:type => "submit", :value => "#{t("actions.disable_user")}"} - else - %button.btn.btn-default{:"data-toggle" => "modal", :"data-target" => "#user-form-#{user.id}", :type => "button"} + %button.btn.btn-sm.btn-default{:"data-toggle" => "modal", :"data-target" => "#user-form-#{user.id}", :type => "button"} = t("actions.enable_user") .modal.fade.hide{:id => "user-form-#{user.id}"} .modal-dialog diff --git a/app/views/users/index.html.haml b/app/views/users/index.html.haml index e1136d8..b49c854 100644 --- a/app/views/users/index.html.haml +++ b/app/views/users/index.html.haml @@ -1,5 +1,4 @@ - @show_navigation = false = search :users -= table @users, %w(username, created, updated, actions.toggle_user) - += table @users, %w(username created updated actions) -- cgit v1.2.3