From de4681b2be0b0efa1dede092445a53d4a593c140 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Wed, 31 May 2017 14:39:35 -0400 Subject: Move admin/pubsubhubbub controller to admin/subscriptions (#3442) --- app/controllers/admin/pubsubhubbub_controller.rb | 9 --------- app/controllers/admin/subscriptions_controller.rb | 19 +++++++++++++++++++ app/views/admin/pubsubhubbub/_subscription.html.haml | 16 ---------------- app/views/admin/pubsubhubbub/index.html.haml | 15 --------------- app/views/admin/subscriptions/_subscription.html.haml | 16 ++++++++++++++++ app/views/admin/subscriptions/index.html.haml | 15 +++++++++++++++ 6 files changed, 50 insertions(+), 40 deletions(-) delete mode 100644 app/controllers/admin/pubsubhubbub_controller.rb create mode 100644 app/controllers/admin/subscriptions_controller.rb delete mode 100644 app/views/admin/pubsubhubbub/_subscription.html.haml delete mode 100644 app/views/admin/pubsubhubbub/index.html.haml create mode 100644 app/views/admin/subscriptions/_subscription.html.haml create mode 100644 app/views/admin/subscriptions/index.html.haml (limited to 'app') diff --git a/app/controllers/admin/pubsubhubbub_controller.rb b/app/controllers/admin/pubsubhubbub_controller.rb deleted file mode 100644 index 2677a59e4..000000000 --- a/app/controllers/admin/pubsubhubbub_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -module Admin - class PubsubhubbubController < BaseController - def index - @subscriptions = Subscription.order(id: :desc).includes(:account).page(params[:page]) - end - end -end diff --git a/app/controllers/admin/subscriptions_controller.rb b/app/controllers/admin/subscriptions_controller.rb new file mode 100644 index 000000000..624a475a3 --- /dev/null +++ b/app/controllers/admin/subscriptions_controller.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +module Admin + class SubscriptionsController < BaseController + def index + @subscriptions = ordered_subscriptions.page(requested_page) + end + + private + + def ordered_subscriptions + Subscription.order(id: :desc).includes(:account) + end + + def requested_page + params[:page].to_i + end + end +end diff --git a/app/views/admin/pubsubhubbub/_subscription.html.haml b/app/views/admin/pubsubhubbub/_subscription.html.haml deleted file mode 100644 index 024788e13..000000000 --- a/app/views/admin/pubsubhubbub/_subscription.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%tr - %td - %samp= subscription.account.acct - %td - %samp= subscription.callback_url - %td - - if subscription.confirmed? - %i.fa.fa-check - %td{ style: "color: #{subscription.expired? ? 'red' : 'inherit'};" } - = precede subscription.expired? ? '-' : '' do - = time_ago_in_words(subscription.expires_at) - %td - - if subscription.last_successful_delivery_at? - = l subscription.last_successful_delivery_at - - else - %i.fa.fa-times diff --git a/app/views/admin/pubsubhubbub/index.html.haml b/app/views/admin/pubsubhubbub/index.html.haml deleted file mode 100644 index 066d9e5c6..000000000 --- a/app/views/admin/pubsubhubbub/index.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -- content_for :page_title do - = t('admin.pubsubhubbub.title') - -%table.table - %thead - %tr - %th= t('admin.pubsubhubbub.topic') - %th= t('admin.pubsubhubbub.callback_url') - %th= t('admin.pubsubhubbub.confirmed') - %th= t('admin.pubsubhubbub.expires_in') - %th= t('admin.pubsubhubbub.last_delivery') - %tbody - = render partial: 'subscription', collection: @subscriptions - -= paginate @subscriptions diff --git a/app/views/admin/subscriptions/_subscription.html.haml b/app/views/admin/subscriptions/_subscription.html.haml new file mode 100644 index 000000000..024788e13 --- /dev/null +++ b/app/views/admin/subscriptions/_subscription.html.haml @@ -0,0 +1,16 @@ +%tr + %td + %samp= subscription.account.acct + %td + %samp= subscription.callback_url + %td + - if subscription.confirmed? + %i.fa.fa-check + %td{ style: "color: #{subscription.expired? ? 'red' : 'inherit'};" } + = precede subscription.expired? ? '-' : '' do + = time_ago_in_words(subscription.expires_at) + %td + - if subscription.last_successful_delivery_at? + = l subscription.last_successful_delivery_at + - else + %i.fa.fa-times diff --git a/app/views/admin/subscriptions/index.html.haml b/app/views/admin/subscriptions/index.html.haml new file mode 100644 index 000000000..21b3238a6 --- /dev/null +++ b/app/views/admin/subscriptions/index.html.haml @@ -0,0 +1,15 @@ +- content_for :page_title do + = t('admin.subscriptions.title') + +%table.table + %thead + %tr + %th= t('admin.subscriptions.topic') + %th= t('admin.subscriptions.callback_url') + %th= t('admin.subscriptions.confirmed') + %th= t('admin.subscriptions.expires_in') + %th= t('admin.subscriptions.last_delivery') + %tbody + = render @subscriptions + += paginate @subscriptions -- cgit