mirror of https://github.com/Siphonay/mastodon
Adding more to admin accounts UI
This commit is contained in:
parent
d236dcded2
commit
9d9f796130
|
@ -3,6 +3,7 @@
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
th, td {
|
th, td {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
|
@ -18,8 +19,39 @@
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
& > tbody > tr > th {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #2b90d9;
|
||||||
|
text-decoration: underline;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
samp {
|
samp {
|
||||||
font-family: 'Roboto Mono', monospace;
|
font-family: 'Roboto Mono', monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.filters {
|
||||||
|
list-style: none;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
|
||||||
|
li {
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #2b90d9;
|
||||||
|
text-decoration: underline;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,14 +2,37 @@
|
||||||
|
|
||||||
class Admin::AccountsController < ApplicationController
|
class Admin::AccountsController < ApplicationController
|
||||||
before_action :require_admin!
|
before_action :require_admin!
|
||||||
|
before_action :set_account, except: :index
|
||||||
|
|
||||||
layout 'public'
|
layout 'public'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@accounts = Account.order('domain ASC, username ASC').paginate(page: params[:page], per_page: 40)
|
@accounts = Account.order('domain ASC, username ASC').paginate(page: params[:page], per_page: 40)
|
||||||
|
|
||||||
|
@accounts = @accounts.local if params[:local].present?
|
||||||
|
@accounts = @accounts.remote if params[:remote].present?
|
||||||
|
@accounts = @accounts.where(domain: params[:by_domain]) if params[:by_domain].present?
|
||||||
|
@accounts = @accounts.where(silenced: true) if params[:silenced].present?
|
||||||
|
@accounts = @accounts.reorder('id desc') if params[:recent].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show; end
|
||||||
|
|
||||||
|
def update
|
||||||
|
if @account.update(account_params)
|
||||||
|
redirect_to admin_accounts_path
|
||||||
|
else
|
||||||
|
render :show
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_account
|
||||||
@account = Account.find(params[:id])
|
@account = Account.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def account_params
|
||||||
|
params.require(:account).permit(:silenced)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,20 +1,36 @@
|
||||||
|
%ul.filters
|
||||||
|
%li= link_to 'Local', admin_accounts_path(local: '1')
|
||||||
|
%li= link_to 'Remote', admin_accounts_path(remote: '1')
|
||||||
|
%li= link_to 'Silenced', admin_accounts_path(silenced: '1')
|
||||||
|
%li= link_to 'Most recent', admin_accounts_path(recent: '1')
|
||||||
|
|
||||||
%table.table
|
%table.table
|
||||||
%thead
|
%thead
|
||||||
%tr
|
%tr
|
||||||
%th Username
|
%th Username
|
||||||
%th Domain
|
%th Domain
|
||||||
%th Subscribed
|
%th Subscribed
|
||||||
|
%th Silenced
|
||||||
|
%th
|
||||||
%tbody
|
%tbody
|
||||||
- @accounts.each do |account|
|
- @accounts.each do |account|
|
||||||
%tr
|
%tr
|
||||||
%td= account.username
|
%td= account.username
|
||||||
%td= account.domain
|
%td
|
||||||
%th
|
- unless account.local?
|
||||||
|
= link_to account.domain, admin_accounts_path(by_domain: account.domain)
|
||||||
|
%td
|
||||||
- if account.local?
|
- if account.local?
|
||||||
Local
|
Local
|
||||||
- elsif account.subscribed?
|
- elsif account.subscribed?
|
||||||
%i.fa.fa-check
|
%i.fa.fa-check
|
||||||
- else
|
- else
|
||||||
%i.fa.fa-times
|
%i.fa.fa-times
|
||||||
|
%td
|
||||||
|
- if account.silenced?
|
||||||
|
%i.fa.fa-check
|
||||||
|
- else
|
||||||
|
%i.fa.fa-times
|
||||||
|
%td= link_to 'Edit', admin_account_path(account.id)
|
||||||
|
|
||||||
= will_paginate @accounts, pagination_options
|
= will_paginate @accounts, pagination_options
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
%table.table
|
||||||
|
%tbody
|
||||||
|
%tr
|
||||||
|
%th Username
|
||||||
|
%td= @account.username
|
||||||
|
%tr
|
||||||
|
%th Domain
|
||||||
|
%td= @account.domain
|
||||||
|
%tr
|
||||||
|
%th Display name
|
||||||
|
%td= @account.display_name
|
||||||
|
|
||||||
|
- if @account.local?
|
||||||
|
%tr
|
||||||
|
%th E-mail
|
||||||
|
%td= @account.user.email
|
||||||
|
%tr
|
||||||
|
%th Current IP
|
||||||
|
%td= @account.user.current_sign_in_ip
|
||||||
|
- else
|
||||||
|
%tr
|
||||||
|
%th Profile URL
|
||||||
|
%td= link_to @account.url
|
||||||
|
%tr
|
||||||
|
%th Feed URL
|
||||||
|
%td= link_to @account.remote_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
|
||||||
|
|
||||||
|
.actions
|
||||||
|
= f.button :button, t('generic.save_changes'), type: :submit
|
|
@ -46,7 +46,7 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
namespace :admin do
|
namespace :admin do
|
||||||
resources :pubsubhubbub, only: [:index]
|
resources :pubsubhubbub, only: [:index]
|
||||||
resources :accounts, only: [:index, :show]
|
resources :accounts, only: [:index, :show, :update]
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :api do
|
namespace :api do
|
||||||
|
|
Loading…
Reference in New Issue