diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/about_controller.rb | 6 | ||||
-rw-r--r-- | app/lib/settings/extend.rb | 6 | ||||
-rw-r--r-- | app/lib/settings/scoped_settings.rb | 4 | ||||
-rw-r--r-- | app/models/account.rb | 1 | ||||
-rw-r--r-- | app/models/setting.rb | 5 | ||||
-rw-r--r-- | app/models/web.rb | 2 | ||||
-rw-r--r-- | app/views/about/more.html.haml | 8 | ||||
-rw-r--r-- | app/views/admin/settings/index.html.haml | 18 |
8 files changed, 39 insertions, 11 deletions
diff --git a/app/controllers/about_controller.rb b/app/controllers/about_controller.rb index 84e5fbbd9..b69c8e790 100644 --- a/app/controllers/about_controller.rb +++ b/app/controllers/about_controller.rb @@ -7,6 +7,12 @@ class AboutController < ApplicationController @description = Setting.site_description end + def more + @extended_description = Setting.site_extended_description + @contact_account = Account.find_local(Setting.site_contact_username) + @contact_email = Setting.site_contact_email + end + def terms; end private diff --git a/app/lib/settings/extend.rb b/app/lib/settings/extend.rb index 7241a1221..407c3480f 100644 --- a/app/lib/settings/extend.rb +++ b/app/lib/settings/extend.rb @@ -1,9 +1,11 @@ +# frozen_string_literal: true + module Settings module Extend - extend ActiveSupport::Concern + extend ActiveSupport::Concern def settings ScopedSettings.for_thing(self) end end -end \ No newline at end of file +end diff --git a/app/lib/settings/scoped_settings.rb b/app/lib/settings/scoped_settings.rb index f8f22a91b..82b70d128 100644 --- a/app/lib/settings/scoped_settings.rb +++ b/app/lib/settings/scoped_settings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Settings class ScopedSettings < ::Setting def self.for_thing(object) @@ -9,4 +11,4 @@ module Settings unscoped.where(thing_type: @object.class.base_class.to_s, thing_id: @object.id) end end -end \ No newline at end of file +end diff --git a/app/models/account.rb b/app/models/account.rb index ec0e81f7c..5f07615fc 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -159,6 +159,7 @@ class Account < ApplicationRecord end def find_remote!(username, domain) + return if username.blank? where(arel_table[:username].matches(username.gsub(/[%_]/, '\\\\\0'))).where(domain.nil? ? { domain: nil } : arel_table[:domain].matches(domain.gsub(/[%_]/, '\\\\\0'))).take! end diff --git a/app/models/setting.rb b/app/models/setting.rb index f3c65c054..3796253d4 100644 --- a/app/models/setting.rb +++ b/app/models/setting.rb @@ -9,10 +9,9 @@ class Setting < RailsSettings::Base end class << self - def [](key) return super(key) unless rails_initialized? - + val = Rails.cache.fetch(cache_key(key, @object)) do db_val = object(key) @@ -25,7 +24,7 @@ class Setting < RailsSettings::Base default_settings[key] end end - + val end diff --git a/app/models/web.rb b/app/models/web.rb index 3c6eebbe2..58654fd77 100644 --- a/app/models/web.rb +++ b/app/models/web.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Web def self.table_name_prefix 'web_' diff --git a/app/views/about/more.html.haml b/app/views/about/more.html.haml new file mode 100644 index 000000000..49a3a0c95 --- /dev/null +++ b/app/views/about/more.html.haml @@ -0,0 +1,8 @@ +- content_for :page_title do + #{Rails.configuration.x.local_domain} + +.wrapper + = @extended_description.html_safe + + - if @contact_account + = render partial: 'authorize_follow/card', locals: { account: @contact_account } \ No newline at end of file diff --git a/app/views/admin/settings/index.html.haml b/app/views/admin/settings/index.html.haml index 4f9ad2fde..5b482213b 100644 --- a/app/views/admin/settings/index.html.haml +++ b/app/views/admin/settings/index.html.haml @@ -10,6 +10,12 @@ %th Click to edit %tbody %tr + %td{ rowspan: 2 } + %strong Contact information + %td= best_in_place @settings['site_contact_username'], :value, url: admin_setting_path(@settings['site_contact_username']), place_holder: 'Enter a username' + %tr + %td= best_in_place @settings['site_contact_email'], :value, url: admin_setting_path(@settings['site_contact_email']), place_holder: 'Enter a public e-mail address' + %tr %td %strong Site description %br/ @@ -21,8 +27,10 @@ %code= '<em>' %td= best_in_place @settings['site_description'], :value, as: :textarea, url: admin_setting_path(@settings['site_description']) %tr - %td{ rowspan: 2 } - %strong Contact information - %td= best_in_place @settings['site_contact_username'], :value, url: admin_setting_path(@settings['site_contact_username']), place_holder: 'Enter a username' - %tr - %td= best_in_place @settings['site_contact_email'], :value, url: admin_setting_path(@settings['site_contact_email']), place_holder: 'Enter a public e-mail address' + %td + %strong Extended site description + %br/ + Displayed on extended information page + %br/ + You can use HTML tags + %td= best_in_place @settings['site_extended_description'], :value, as: :textarea, url: admin_setting_path(@settings['site_extended_description']) \ No newline at end of file |