lib/alchemy/resources_helper.rb in alchemy_cms-4.6.7 vs lib/alchemy/resources_helper.rb in alchemy_cms-5.0.0.beta1

- old
+ new

@@ -102,34 +102,28 @@ # Returns a options hash for simple_form input fields. def resource_attribute_field_options(attribute) options = {hint: resource_handler.help_text_for(attribute)} input_type = attribute[:type].to_s case input_type - when 'boolean' + when "boolean" options - when 'date', 'time', 'datetime' + when "date", "time", "datetime" date = resource_instance_variable.send(attribute[:name]) || Time.current options.merge( - as: 'string', + as: "string", input_html: { - 'data-datepicker-type' => input_type, - value: date ? date.iso8601 : nil - } + "data-datepicker-type" => input_type, + value: date ? date.iso8601 : nil, + }, ) - when 'text' - options.merge(as: 'text', input_html: {rows: 4}) + when "text" + options.merge(as: "text", input_html: {rows: 4}) else - options.merge(as: 'string') + options.merge(as: "string") end end - # Renders the human model name with a count as h1 header - def resources_header - Alchemy::Deprecation.warn "resources_header is deprecated. Render 'alchemy/admin/resources/table_header' partial instead." - render 'alchemy/admin/resources/table_header' - end - # Returns true if the resource contains any relations def contains_relations? resource_handler.resource_relations.present? end @@ -169,11 +163,11 @@ # NOTE: Alchemy gives you a local variable named like your resource # def render_resources render partial: resource_name, collection: resources_instance_variable rescue ActionView::MissingTemplate - render partial: 'resource', collection: resources_instance_variable + render partial: "resource", collection: resources_instance_variable end def resource_has_tags resource_model.respond_to?(:tag_counts) && resource_model.tag_counts.any? end @@ -183,11 +177,11 @@ end def resource_filter_select resource_model.alchemy_resource_filters.map do |filter_scope| [ - Alchemy.t(filter_scope.to_sym, scope: ['resources', resource_name, 'filters']), - filter_scope + Alchemy.t(filter_scope.to_sym, scope: ["resources", resource_name, "filters"]), + filter_scope, ] end end end end