Add extended about page stub

This commit is contained in:
Eugen Rochko 2017-01-13 03:24:41 +01:00
parent 2939e9898b
commit e25170f960
10 changed files with 44 additions and 15 deletions

View File

@ -7,6 +7,12 @@ class AboutController < ApplicationController
@description = Setting.site_description @description = Setting.site_description
end 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 def terms; end
private private

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Settings module Settings
module Extend module Extend
extend ActiveSupport::Concern extend ActiveSupport::Concern

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Settings module Settings
class ScopedSettings < ::Setting class ScopedSettings < ::Setting
def self.for_thing(object) def self.for_thing(object)

View File

@ -159,6 +159,7 @@ class Account < ApplicationRecord
end end
def find_remote!(username, domain) 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! where(arel_table[:username].matches(username.gsub(/[%_]/, '\\\\\0'))).where(domain.nil? ? { domain: nil } : arel_table[:domain].matches(domain.gsub(/[%_]/, '\\\\\0'))).take!
end end

View File

@ -9,7 +9,6 @@ class Setting < RailsSettings::Base
end end
class << self class << self
def [](key) def [](key)
return super(key) unless rails_initialized? return super(key) unless rails_initialized?

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Web module Web
def self.table_name_prefix def self.table_name_prefix
'web_' 'web_'

View File

@ -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 }

View File

@ -9,6 +9,12 @@
%th Setting %th Setting
%th Click to edit %th Click to edit
%tbody %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 %tr
%td %td
%strong Site description %strong Site description
@ -21,8 +27,10 @@
%code= '<em>' %code= '<em>'
%td= best_in_place @settings['site_description'], :value, as: :textarea, url: admin_setting_path(@settings['site_description']) %td= best_in_place @settings['site_description'], :value, as: :textarea, url: admin_setting_path(@settings['site_description'])
%tr %tr
%td{ rowspan: 2 } %td
%strong Contact information %strong Extended site description
%td= best_in_place @settings['site_contact_username'], :value, url: admin_setting_path(@settings['site_contact_username']), place_holder: 'Enter a username' %br/
%tr Displayed on extended information page
%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' %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'])

View File

@ -143,8 +143,9 @@ Rails.application.routes.draw do
get '/web/(*any)', to: 'home#index', as: :web get '/web/(*any)', to: 'home#index', as: :web
get :about, to: 'about#index' get '/about', to: 'about#index'
get :terms, to: 'about#terms' get '/about/more', to: 'about#more'
get '/terms', to: 'about#terms'
root 'home#index' root 'home#index'

View File

@ -1,6 +1,7 @@
# config/app.yml for rails-settings-cached # config/app.yml for rails-settings-cached
defaults: &defaults defaults: &defaults
site_description: '' site_description: ''
site_extended_description: ''
site_contact_username: '' site_contact_username: ''
site_contact_email: '' site_contact_email: ''
notification_emails: notification_emails:
@ -12,7 +13,6 @@ defaults: &defaults
interactions: interactions:
must_be_follower: false must_be_follower: false
must_be_following: false must_be_following: false
development: development:
<<: *defaults <<: *defaults