mirror of
https://github.com/discourse/discourse-signatures.git
synced 2025-12-12 01:45:34 +00:00
First Commit
This commit is contained in:
commit
abdb17f080
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
.idea/*
|
||||
*.iml
|
||||
17
README.md
Normal file
17
README.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Discourse Signatures
|
||||
|
||||
Felling nostalgic of old VBulletin days? Wanna spam and flame like it's 2000?
|
||||
|
||||
**Install Discourse Signatures!**
|
||||
|
||||
|
||||
## How to install
|
||||
|
||||
Since this is an early MVP the installation process is a bit, complicated.
|
||||
|
||||
First you need to create 2 Custom User Fields. This is easy as follow:
|
||||
|
||||
- Go to Admin -> Customize -> User Fields
|
||||
|
||||
- Make then look like this:
|
||||
|
||||
@ -0,0 +1,8 @@
|
||||
{{#if Discourse.SiteSettings.signatures_enabled}}
|
||||
{{#if user_show_signatures}}
|
||||
{{#if user_signature}}
|
||||
<hr>
|
||||
<img src="{{user_signature}}">
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
5
config/locales/server.en.yml
Normal file
5
config/locales/server.en.yml
Normal file
@ -0,0 +1,5 @@
|
||||
en:
|
||||
site_settings:
|
||||
signatures_enabled: "Enable user-made signatures below posts?"
|
||||
signatures_user_optin: "User field that contains the show signatures user option, like: signatures-view"
|
||||
signatures_user_signature: "User field that contains the signature URL, like: signatures-image-url"
|
||||
10
config/settings.yml
Normal file
10
config/settings.yml
Normal file
@ -0,0 +1,10 @@
|
||||
plugins:
|
||||
signatures_enabled:
|
||||
default: true
|
||||
client: true
|
||||
signatures_user_optin:
|
||||
default: signatures-view
|
||||
client: true
|
||||
signatures_user_signature:
|
||||
default: signatures-image-url
|
||||
client: true
|
||||
17
plugin.rb
Normal file
17
plugin.rb
Normal file
@ -0,0 +1,17 @@
|
||||
# name: discourse-signatures
|
||||
# about: A plugin to get that nostalgia signatures in Discourse Foruns
|
||||
# version: 0.0.1
|
||||
# author: Rafael Silva <xfalcox@gmail.com>
|
||||
# url: https://github.com/xfalcox/discourse-signatures
|
||||
|
||||
enabled_site_setting :signatures_enabled
|
||||
|
||||
|
||||
after_initialize do
|
||||
|
||||
|
||||
if SiteSetting.signatures_enabled && SiteSetting.signatures_user_signature.present? && SiteSetting.signatures_user_optin.present? then
|
||||
add_to_serializer(:post, :user_signature, false) { user_custom_fields["user_field_#{(UserField.find_by name: SiteSetting.signatures_user_signature).id}"] }
|
||||
add_to_serializer(:post, :user_show_signatures, false) { user_custom_fields["user_field_#{(UserField.find_by name: SiteSetting.signatures_user_optin).id}"] }
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user