FEATURE: Uploaded images to categories are shown when browsing

This commit is contained in:
Robin Ward
2014-06-27 17:06:59 -04:00
parent e22688a204
commit 952426d358
14 changed files with 68 additions and 13 deletions

View File

@@ -45,6 +45,21 @@ class DiscourseSassImporter < Sass::Importers::Filesystem
end
def find(name, options)
if name == "category_backgrounds"
contents = ""
Category.where('background_url IS NOT NULL').each do |c|
if c.background_url.present?
contents << "#main-outlet.category-#{c.id} { background-image: url(#{c.background_url}) }\n"
end
end
return Sass::Engine.new(contents, options.merge(
filename: "#{name}.scss",
importer: self,
syntax: :scss
))
end
if special_imports.has_key? name
if name == "theme_variables"
contents = ""

View File

@@ -107,7 +107,8 @@ class DiscourseStylesheets
def digest
@digest ||= begin
theme = (cs = ColorScheme.enabled) ? "#{cs.id}-#{cs.version}" : 0
Digest::SHA1.hexdigest("#{RailsMultisite::ConnectionManagement.current_db}-#{theme}-#{DiscourseStylesheets.last_file_updated}")
category_updated = Category.last_updated_at
Digest::SHA1.hexdigest("#{RailsMultisite::ConnectionManagement.current_db}-#{theme}-#{DiscourseStylesheets.last_file_updated}-#{category_updated}")
end
end
end