diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/stylesheets/application.scss | 1 | ||||
-rw-r--r-- | app/assets/stylesheets/tables.scss | 25 | ||||
-rw-r--r-- | app/controllers/admin/pubsubhubbub_controller.rb | 11 | ||||
-rw-r--r-- | app/controllers/application_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/admin/pubsubhubbub_helper.rb | 2 | ||||
-rw-r--r-- | app/views/admin/pubsubhubbub/index.html.haml | 20 |
6 files changed, 63 insertions, 0 deletions
diff --git a/app/assets/stylesheets/application.scss b/app/assets/stylesheets/application.scss index 05a309365..bbbeafefe 100644 --- a/app/assets/stylesheets/application.scss +++ b/app/assets/stylesheets/application.scss @@ -234,3 +234,4 @@ body { @import 'stream_entries'; @import 'components'; @import 'about'; +@import 'tables'; diff --git a/app/assets/stylesheets/tables.scss b/app/assets/stylesheets/tables.scss new file mode 100644 index 000000000..89b35891d --- /dev/null +++ b/app/assets/stylesheets/tables.scss @@ -0,0 +1,25 @@ +.table { + width: 100%; + max-width: 100%; + border-spacing: 0; + border-collapse: collapse; + + th, td { + padding: 8px; + line-height: 1.42857143; + vertical-align: top; + border-top: 1px solid #ddd; + text-align: left; + } + + & > thead > tr > th { + vertical-align: bottom; + border-bottom: 2px solid #ddd; + border-top: 0; + font-weight: 500; + } +} + +samp { + font-family: 'Roboto Mono', monospace; +} diff --git a/app/controllers/admin/pubsubhubbub_controller.rb b/app/controllers/admin/pubsubhubbub_controller.rb new file mode 100644 index 000000000..fae05bf9d --- /dev/null +++ b/app/controllers/admin/pubsubhubbub_controller.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class Admin::PubsubhubbubController < ApplicationController + before_action :require_admin! + + layout 'public' + + def index + @subscriptions = Subscription.includes(:account).paginate(page: params[:page], per_page: 40) + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 847763c65..b03a2cdea 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -31,6 +31,10 @@ class ApplicationController < ActionController::Base I18n.locale = I18n.default_locale end + def require_admin! + redirect_to root_path unless current_user&.admin? + end + protected def not_found diff --git a/app/helpers/admin/pubsubhubbub_helper.rb b/app/helpers/admin/pubsubhubbub_helper.rb new file mode 100644 index 000000000..41c874a62 --- /dev/null +++ b/app/helpers/admin/pubsubhubbub_helper.rb @@ -0,0 +1,2 @@ +module Admin::PubsubhubbubHelper +end diff --git a/app/views/admin/pubsubhubbub/index.html.haml b/app/views/admin/pubsubhubbub/index.html.haml new file mode 100644 index 000000000..bb897eb89 --- /dev/null +++ b/app/views/admin/pubsubhubbub/index.html.haml @@ -0,0 +1,20 @@ +%table.table + %thead + %tr + %th Topic + %th Callback URL + %th Confirmed + %th Expires in + %tbody + - @subscriptions.each do |subscription| + %tr + %td + %samp= subscription.account.acct + %td + %samp= subscription.callback_url + %td + - if subscription.confirmed? + %i.fa.fa-check + %td= distance_of_time_in_words(Time.now, subscription.expires_at) + += will_paginate @subscriptions, pagination_options |