forked from discourse/discourse-simple-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.rb
More file actions
executable file
·77 lines (63 loc) · 3.36 KB
/
plugin.rb
File metadata and controls
executable file
·77 lines (63 loc) · 3.36 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# name: discourse-theme
# about: sitepoint.com/forum theme
# authors: Jude Aakjaer, James Hunter, Kelle-Lee Connolly
# version: 0.1.0
# When styles are not working or are not updating, try:
# - stopping server
# - sitepoint/discourse rm -rf tmp
# - delete sitepoint/discourse/public/uploads/stylesheet-cache
# - restart server
# If styles are still not updating, there is probably a syntax error in the SCSS causing a silent failure and causing the file not being processed.
# To be 100% sure you can also enable Chrome Dev Tools -> Settings -> General -> Disable cache (while DevTools is open), but note it leads to 30s onload times.
after_initialize do
# Add custom fields to the admin user serializer
add_to_serializer(:admin_detailed_user, :custom_fields) { object.custom_fields }
# Track log-out timestamps
DiscourseEvent.on(:user_logged_out) do |user|
user.custom_fields["last_logged_out_at"] = Time.now
user.save
end
module SitepointDesign
class Engine < ::Rails::Engine
engine_name "sitepoint_design"
isolate_namespace SitepointDesign
end
Rails.application.config.assets.paths.unshift File.expand_path('../assets', __FILE__)
end
# app/models/topic_posters_summary.rb
TopicPostersSummary.class_eval do
def user_ids_with_descriptions
user_ids.zip([
:original_poster,
:most_recent_poster
].map { |description| I18n.t(description) })
end
def top_posters
user_ids.map { |id| avatar_lookup[id] }.compact.uniq.take(2)
end
end
end
## Adding To Discourse
register_asset "stylesheets/common/foundation/variables.scss", :variables # other things need these variables
## General Changes
register_asset "stylesheets/common/components/banner.css.scss" # Make the banner grey
register_asset "stylesheets/common/components/badges.css.scss" # category dropdown badges
register_asset "stylesheets/common/components/navs.scss" # Navigation at top of list pages and to the side of profile pages
register_asset "stylesheets/common/components/buttons.scss" # Button Colors and radius
register_asset "stylesheets/common/components/Button.scss" # standard SitePoint style Buttons
register_asset "stylesheets/common/components/tags.scss" # Tag Styling
register_asset "stylesheets/common/base/bsa.scss" # BSA outlets
register_asset "stylesheets/common/base/header.scss" # Custom Header
register_asset "stylesheets/common/base/topic-list.scss" # Category Page Table
register_asset "stylesheets/common/base/discourse.scss" # Blockquote styles
register_asset "stylesheets/common/base/topic-post.scss" # Coloring usernames based on role
register_asset "stylesheets/common/base/category.scss" # Category Styling
register_asset "stylesheets/common/base/about-page.scss" # About Page - Hide Admins
## Desktop Only
register_asset "stylesheets/desktop/header.scss", :desktop # Links in navbar
register_asset "stylesheets/desktop/topic-post.scss", :desktop # General Post styles
register_asset "stylesheets/desktop/topic.scss", :desktop # Post Progress meter styles
register_asset "stylesheets/common/base/topic-admin-menu.scss" # yeah i dunno why this is needed but...
## Mobile Only
register_asset "stylesheets/mobile/header.scss", :mobile # Hide Header links on Mobile
register_asset "stylesheets/mobile/topic-list.scss", :mobile # Hide Tags from Topic List