diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-27 00:15:00 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-02-27 00:15:00 +0100 |
commit | 175a9b9caa92ad90bf2e8b68c299a00adb1f9751 (patch) | |
tree | ac9ee673567dd8661fce0644193377af5818b08e /app | |
parent | 2826e6dada94da4508ab89f137b456145656d2d9 (diff) |
Fix #104 - Style OAuth authorized applications page
Add ability to search accounts by display name
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/settings/exports_controller.rb | 16 | ||||
-rw-r--r-- | app/models/account.rb | 2 | ||||
-rw-r--r-- | app/services/search_service.rb | 1 | ||||
-rw-r--r-- | app/views/doorkeeper/authorized_applications/index.html.haml | 23 | ||||
-rw-r--r-- | app/views/settings/exports/show.html.haml | 2 |
5 files changed, 43 insertions, 1 deletions
diff --git a/app/controllers/settings/exports_controller.rb b/app/controllers/settings/exports_controller.rb new file mode 100644 index 000000000..d4ecb6e8a --- /dev/null +++ b/app/controllers/settings/exports_controller.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +class Settings::ExportsController < ApplicationController + layout 'admin' + + before_action :authenticate_user! + before_action :set_account + + def show; end + + private + + def set_account + @account = current_user.account + end +end diff --git a/app/models/account.rb b/app/models/account.rb index 469695acd..a93a0668a 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -52,7 +52,7 @@ class Account < ApplicationRecord # PuSH subscriptions has_many :subscriptions, dependent: :destroy - pg_search_scope :search_for, against: { username: 'A', domain: 'B' }, + pg_search_scope :search_for, against: { display_name: 'A', username: 'B', domain: 'C' }, using: { tsearch: { prefix: true } } scope :remote, -> { where.not(domain: nil) } diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 04de8a134..6f740e149 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -5,6 +5,7 @@ class SearchService < BaseService return if query.blank? || query.start_with?('#') username, domain = query.gsub(/\A@/, '').split('@') + domain = nil if TagManager.instance.local_domain?(domain) if domain.nil? exact_match = Account.find_local(username) diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml new file mode 100644 index 000000000..d4719881c --- /dev/null +++ b/app/views/doorkeeper/authorized_applications/index.html.haml @@ -0,0 +1,23 @@ +- content_for :page_title do + = t('doorkeeper.authorized_applications.index.title') + +%table.table + %thead + %tr + %th= t('doorkeeper.authorized_applications.index.application') + %th= t('doorkeeper.authorized_applications.index.scopes') + %th= t('doorkeeper.authorized_applications.index.created_at') + %th + %tbody + - @applications.each do |application| + %tr + %td + - if application.website.blank? + = application.name + - else + = link_to application.name, application.website + %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('<br />').html_safe + %td= l application.created_at + %td + - unless application.superapp? + = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } diff --git a/app/views/settings/exports/show.html.haml b/app/views/settings/exports/show.html.haml new file mode 100644 index 000000000..d9006efdb --- /dev/null +++ b/app/views/settings/exports/show.html.haml @@ -0,0 +1,2 @@ +- content_for :page_title do + = t('settings.export') |