lib/trestle/configuration.rb in trestle-0.9.8 vs lib/trestle/configuration.rb in trestle-0.10.0.pre
- old
+ new
@@ -20,14 +20,25 @@
option :footer, -> { I18n.t("trestle.footer", default: "Powered by Trestle") }
# Default timestamp precision
option :timestamp_precision, :minutes
- # Theme stylesheet compilation (requires Sass support)
- option :theme, defined?(Sass) || defined?(SassC)
+ # Theme colors
+ option :theme, {}
+ def theme=(colors)
+ if [true, false].include?(colors)
+ Trestle.deprecator.warn("Passing a boolean to config.theme is deprecated. Please pass primary and secondary theme colors as a hash.")
+ else
+ original = fetch(:colors) || {}
+ colors = colors.transform_values { |color| Trestle::Color.parse(color) }
+ assign(:theme, original.merge(colors))
+ end
+ end
+
+
## Mounting Options
# Path at which to mount the Trestle admin
option :path, "/admin"
@@ -66,12 +77,12 @@
def helper(*helpers, &block)
self.helpers << helpers
self.helper_module.module_eval(&block) if block_given?
end
- # Enable or disable Turbolinks within the Trestle admin
- option :turbolinks, defined?(Turbolinks)
+ # [DEPRECATED] Enable or disable Turbolinks within the Trestle admin
+ deprecated_option :turbolinks, "The config.turbolinks option is deprecated. Turbo is included and enabled by default within Trestle."
# List of parameters that should persist across requests when paginating or reordering
option :persistent_params, [:sort, :order, :scope]
# List of methods to try calling on an instance when displayed by the `display` helper
@@ -92,13 +103,10 @@
def hook(name, options={}, &block)
hooks.append(name, options, &block)
end
# List of i18n keys to pass into the Trestle.i18n JavaScript object
- option :javascript_i18n_keys, [
- "trestle.confirmation.title", "trestle.confirmation.delete", "trestle.confirmation.cancel", "trestle.dialog.error",
- "admin.buttons.ok", "admin.datepicker.formats.date", "admin.datepicker.formats.datetime", "admin.datepicker.formats.time"
- ]
+ option :javascript_i18n_keys, []
# List of load paths for where to find admin definitions
option :load_paths, [
-> { ActiveSupport::Dependencies.autoload_paths.grep(/\/app\/admin\Z/) }
]