Sha256: ba9f8c1bb1918f3fafaf1efb8beb47ad2801a01e05c26360be1b0e66d367fb67

Contents?: true

Size: 1.26 KB

Versions: 1

Compression:

Stored size: 1.26 KB

Contents

class <%= camelcased_class_name %> < Hancock::Catalog::Category

  embeds_many :category_images, cascade_callbacks: true, class_name: "<%= camelcased_class_name %>Image"
  alias :<%= underscored_class_name %>_images :category_images
  accepts_nested_attributes_for :category_images, allow_destroy: true

  # # after_save :image_auto_rails_admin_jcrop
  # def image_auto_rails_admin_jcrop
  #   auto_rails_admin_jcrop(:image) # or nil for cancel autocrop
  # end

  # # hancock_cms_attached_file(:image)
  # def image_styles
  #   super
  # end

  # def image_jcrop_options
  #   super
  # end

  def self.item_class
    <%= camelcased_item_class_name %>
  end


  ############# rails_admin ##############
  def self.rails_admin_add_fields
    [] #super
  end

  def self.rails_admin_add_config(config)
    #super(config)
  end

  def self.admin_can_user_defined_actions
    [].freeze
  end
  def self.admin_cannot_user_defined_actions
    [].freeze
  end
  def self.manager_can_user_defined_actions
    [].freeze
  end
  def self.manager_cannot_user_defined_actions
    [].freeze
  end
  def self.rails_admin_user_defined_visible_actions
    [].freeze
  end

  rails_admin(&Hancock::Catalog::Admin::Category.config(rails_admin_add_fields) { |config|
    rails_admin_add_config(config)
  })
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hancock_cms_catalog-1.0.2 lib/generators/hancock/catalog/models/templates/category.erb