From 89a16b101f1cd35e6ba7458496de5957e5ff6b23 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 13 Jan 2021 19:12:57 -0500 Subject: [PATCH] Updated admin dashboard for ChatConversationAccounts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - admin dashboard for ChatConversationAccounts --- ... chat_conversation_accounts_controller.rb} | 4 +-- app/views/admin/accounts/show.html.haml | 2 +- .../_chat_conversation_account.html.haml | 12 ++++++++ .../index.html.haml | 24 ++++++++++++++++ .../admin/chat_conversations/index.html.haml | 28 ------------------- config/routes.rb | 2 +- 6 files changed, 40 insertions(+), 32 deletions(-) rename app/controllers/admin/{chat_conversations_controller.rb => chat_conversation_accounts_controller.rb} (57%) create mode 100644 app/views/admin/chat_conversation_accounts/_chat_conversation_account.html.haml create mode 100644 app/views/admin/chat_conversation_accounts/index.html.haml delete mode 100644 app/views/admin/chat_conversations/index.html.haml diff --git a/app/controllers/admin/chat_conversations_controller.rb b/app/controllers/admin/chat_conversation_accounts_controller.rb similarity index 57% rename from app/controllers/admin/chat_conversations_controller.rb rename to app/controllers/admin/chat_conversation_accounts_controller.rb index 087f1d7a..ad80bb7c 100644 --- a/app/controllers/admin/chat_conversations_controller.rb +++ b/app/controllers/admin/chat_conversation_accounts_controller.rb @@ -1,14 +1,14 @@ # frozen_string_literal: true module Admin - class ChatConversationsController < BaseController + class ChatConversationAccountsController < BaseController before_action :set_account PER_PAGE = 20 def index authorize :account, :index? - @chatConversationAccounts = ChatConversationAccount.where(account: @account).page(params[:page]).per(PER_PAGE) + @chat_conversation_accounts = ChatConversationAccount.where(account: @account).page(params[:page]).per(PER_PAGE) end def set_account diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index 142dabe7..12f00c7a 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -47,7 +47,7 @@ .dashboard__counters__num= number_with_delimiter @account.groups.count .dashboard__counters__label Joined Groups %div - = link_to admin_account_chat_conversations_path(@account.id) do + = link_to admin_account_chat_conversation_accounts_path(@account.id) do .dashboard__counters__num= number_with_delimiter @account.chat_conversation_accounts_count .dashboard__counters__label Chat Conversations %div diff --git a/app/views/admin/chat_conversation_accounts/_chat_conversation_account.html.haml b/app/views/admin/chat_conversation_accounts/_chat_conversation_account.html.haml new file mode 100644 index 00000000..a387e215 --- /dev/null +++ b/app/views/admin/chat_conversation_accounts/_chat_conversation_account.html.haml @@ -0,0 +1,12 @@ +%tr + %td + = admin_account_link_to(chat_conversation_account.account) + %td + - chat_conversation_account.participant_account_ids.each do |a| + %a{href: "/admin/accounts/#{a}"}= a + %td + %span= chat_conversation_account.is_approved ? "Y" : "N" + %td + %span= chat_conversation_account.is_hidden ? "Y" : "N" + %td + %span= chat_conversation_account.is_muted ? "Y" : "N" \ No newline at end of file diff --git a/app/views/admin/chat_conversation_accounts/index.html.haml b/app/views/admin/chat_conversation_accounts/index.html.haml new file mode 100644 index 00000000..de7f3bf1 --- /dev/null +++ b/app/views/admin/chat_conversation_accounts/index.html.haml @@ -0,0 +1,24 @@ +- content_for :page_title do + %span= "Chat conversations including: @#{@account.acct}" + +.filters + .back-link{ style: 'flex: 1 1 auto; text-align: left' } + = link_to admin_account_path(@account.id) do + = fa_icon 'chevron-left fw' + = t('admin.followers.back_to_account') + +%hr.spacer/ + +.table-wrapper + %table.table + %thead + %tr + %th Account + %th Members + %th Approved? + %th Hidden? + %th Muted? + %tbody + = render @chat_conversation_accounts + += paginate @chat_conversation_accounts diff --git a/app/views/admin/chat_conversations/index.html.haml b/app/views/admin/chat_conversations/index.html.haml deleted file mode 100644 index 25f1f290..00000000 --- a/app/views/admin/chat_conversations/index.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -- content_for :page_title do - = t('admin.followers.title', acct: @account.acct) - -.filters - .filter-subset - %strong= t('admin.accounts.location.title') - %ul - %li= link_to t('admin.accounts.location.local'), admin_account_followers_path(@account.id), class: 'selected' - .back-link{ style: 'flex: 1 1 auto; text-align: right' } - = link_to admin_account_path(@account.id) do - = fa_icon 'chevron-left fw' - = t('admin.followers.back_to_account') - -%hr.spacer/ - -.table-wrapper - %table.table - %thead - %tr - %th= t('admin.accounts.username') - %th= t('admin.accounts.role') - %th= t('admin.accounts.most_recent_ip') - %th= t('admin.accounts.most_recent_activity') - %th - %tbody - = render partial: 'admin/accounts/account', collection: @followers - -= paginate @followers diff --git a/config/routes.rb b/config/routes.rb index 23b3ab2c..53b367bb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -142,7 +142,7 @@ Rails.application.routes.draw do resources :statuses, only: [:index, :show, :create, :update, :destroy] resources :followers, only: [:index] resources :joined_groups, only: [:index] - resources :chat_conversations, only: [:index] + resources :chat_conversation_accounts, only: [:index] resources :chat_messages, only: [:index, :show, :create, :update, :destroy] resource :confirmation, only: [:create] do