mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-03 10:06:05 +08:00
We currently only show JS files in a theme's "extra files" section, but we can show SCSS here too Before: <img width="385" height="114" alt="image" src="https://github.com/user-attachments/assets/081e323b-f341-4dba-bff4-99367150a392" /> After: <img width="424" height="185" alt="image" src="https://github.com/user-attachments/assets/0c5a68d8-8b72-455b-9d1f-468f483084da" />
54 lines
857 B
Ruby
54 lines
857 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ThemeFieldSerializer < ApplicationSerializer
|
|
attributes :name,
|
|
:target,
|
|
:value,
|
|
:error,
|
|
:type_id,
|
|
:upload_id,
|
|
:url,
|
|
:filename,
|
|
:migrated,
|
|
:file_path
|
|
|
|
def include_url?
|
|
object.upload
|
|
end
|
|
|
|
def include_upload_id?
|
|
object.upload
|
|
end
|
|
|
|
def include_filename?
|
|
object.upload
|
|
end
|
|
|
|
def url
|
|
object.upload&.url
|
|
end
|
|
|
|
def filename
|
|
object.upload&.original_filename
|
|
end
|
|
|
|
def include_value?
|
|
@options[:include_value] || false
|
|
end
|
|
|
|
def target
|
|
Theme.lookup_target(object.target_id)&.to_s
|
|
end
|
|
|
|
def include_error?
|
|
object.error.present?
|
|
end
|
|
|
|
def migrated
|
|
!!object.theme_settings_migration
|
|
end
|
|
|
|
def include_migrated?
|
|
target == "migrations"
|
|
end
|
|
end
|