diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-15 00:22:58 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-15 00:22:58 +0100 |
commit | 5426f06ac29b9ef4d302d3f2d13b315dcf89e079 (patch) | |
tree | d4a3c2b1e5cefc544748e46ed34471a3da345a14 /app | |
parent | 0a2427f79b90f82100b3a4ebe95ceb488cbb5a1d (diff) |
Fix admin UI for accounts somewhat
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/admin.scss | 1 | ||||
-rw-r--r-- | app/controllers/admin/accounts_controller.rb | 23 | ||||
-rw-r--r-- | app/views/admin/accounts/index.html.haml | 14 | ||||
-rw-r--r-- | app/views/admin/accounts/show.html.haml | 46 |
4 files changed, 54 insertions, 30 deletions
diff --git a/app/assets/stylesheets/admin.scss b/app/assets/stylesheets/admin.scss index d834096f4..7d056bc06 100644 --- a/app/assets/stylesheets/admin.scss +++ b/app/assets/stylesheets/admin.scss @@ -76,6 +76,7 @@ .content-wrapper { flex: 2; + overflow: auto; } .content { diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index 95107b3dc..df2c7bebf 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -19,19 +19,26 @@ class Admin::AccountsController < ApplicationController def show; end - def update - if @account.update(account_params) - redirect_to admin_accounts_path - else - render :show - end - end - def suspend Admin::SuspensionWorker.perform_async(@account.id) redirect_to admin_accounts_path end + def unsuspend + @account.update(suspended: false) + redirect_to admin_accounts_path + end + + def silence + @account.update(silenced: true) + redirect_to admin_accounts_path + end + + def unsilence + @account.update(silenced: false) + redirect_to admin_accounts_path + end + private def set_account diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index a93aa9143..f8ed4ef97 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -25,9 +25,7 @@ %tr %th Username %th Domain - %th Subscribed - %th Silenced - %th Suspended + %th= fa_icon 'paper-plane-o' %th %tbody - @accounts.each do |account| @@ -44,16 +42,6 @@ - else %i.fa.fa-times %td - - if account.silenced? - %i.fa.fa-check - - else - %i.fa.fa-times - %td - - if account.suspended? - %i.fa.fa-check - - else - %i.fa.fa-times - %td = table_link_to 'circle', 'Web', web_path("accounts/#{account.id}") = table_link_to 'globe', 'Public', TagManager.instance.url_for(account) = table_link_to 'pencil', 'Edit', admin_account_path(account.id) diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index 7d3f449e5..206d6f81e 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -18,8 +18,11 @@ %th E-mail %td= @account.user.email %tr - %th Current IP + %th Most recent IP %td= @account.user.current_sign_in_ip + %tr + %th Most recent activity + %td= l @account.user.current_sign_in_at - else %tr %th Profile URL @@ -27,14 +30,39 @@ %tr %th Feed URL %td= link_to @account.remote_url + %tr + %th PuSH subscription expires + %td + - if @account.subscribed? + = l @account.subscription_expires_at + - else + Not subscribed + %tr + %th Salmon URL + %td= link_to @account.salmon_url -= simple_form_for @account, url: admin_account_path(@account.id) do |f| - = render 'shared/error_messages', object: @account - - = f.input :silenced, as: :boolean, wrapper: :with_label - = f.input :suspended, as: :boolean, wrapper: :with_label + %tr + %th Follows + %td= @account.following.count + %tr + %th Followers + %td= @account.followers.count + %tr + %th Statuses + %td= @account.statuses.count + %tr + %th Media attachments + %td + = @account.media_attachments.count + = surround '(', ')' do + = number_to_human_size @account.media_attachments.sum('file_file_size') - .actions - = f.button :button, t('generic.save_changes'), type: :submit +- if @account.silenced? + = link_to 'Undo silence', unsilence_admin_account_path(@account.id), method: :post, class: 'button' +- else + = link_to 'Silence', silence_admin_account_path(@account.id), method: :post, class: 'button' -= link_to 'Perform full suspension', suspend_admin_account_path(@account.id), method: :post, data: { confirm: 'Are you sure?' }, class: 'button' +- if @account.suspended? + = link_to 'Undo suspension', unsuspend_admin_account_path(@account.id), method: :post, class: 'button' +- else + = link_to 'Perform full suspension', suspend_admin_account_path(@account.id), method: :post, data: { confirm: 'Are you sure?' }, class: 'button' |