-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin.rb
48 lines (36 loc) · 1.56 KB
/
plugin.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true
# name: ConferencePlugin
# about: OE Global 2020 Conference
# version: 0.1
# authors: ocwc
# url: https://github.com/ocwc
register_asset 'stylesheets/common/conference-plugin.scss'
register_asset 'stylesheets/desktop/conference-plugin.scss', :desktop
register_asset 'stylesheets/mobile/conference-plugin.scss', :mobile
enabled_site_setting :conference_plugin_enabled
DiscoursePluginRegistry.serialized_current_user_fields << 'oeg20_faves'
PLUGIN_NAME ||= 'ConferencePlugin'
load File.expand_path('lib/conference-plugin/engine.rb', __dir__)
after_initialize do
# https://github.com/discourse/discourse/blob/master/lib/plugin/instance.rb
User.register_custom_field_type 'oeg20_faves', :array
register_editable_user_custom_field [ :oeg20_faves, oeg20_faves: [] ]
User.register_custom_field_type 'oeg20_tz', :string
register_editable_user_custom_field [ :oeg20_tz, oeg20_tz: '' ]
# TODO Drop after Discourse 2.6.0 release
if respond_to?(:allow_public_user_custom_field)
allow_public_user_custom_field :oeg20_faves
allow_public_user_custom_field :oeg20_tz
else
whitelist_public_user_custom_field :oeg20_faves
whitelist_public_user_custom_field :oeg20_tz
end
# add_to_serializer(:user, :oeg20_faves) {
# object.user.custom_fields['oeg20_faves'] if object.user
# }
# load File.expand_path('../app/controllers/conference_plugin/conference_plugin_controller.rb', __FILE__ )
#
# Discourse::Application.routes.append do
# get '/conference/schedule' => 'conference_plugin/conference_schedule#index'
# end
end