Sha256: 27f260781ff9447406e91986de6fca7bc3b9ae3ff7f69551f4075e9bfaf0997d
Contents?: true
Size: 1.21 KB
Versions: 22
Compression:
Stored size: 1.21 KB
Contents
module Concerns module Backend module ContentTypeController extend ActiveSupport::Concern included do layout 'backend/lightbox' before_action :find_model helper_method :content_path end module ClassMethods def model(value) define_method(:model) { value } end def allowed_params(*args) define_method(:allowed_params) do params.require(model.name.tableize.singularize).permit(*args) end end end def find_model @model = model.find(params[:id]).decorate end def content_path column = @model.column path = "edit_translation_backend_#{column.row.rowable.class.to_s.downcase}_path" # TODO this needs to be the locale that you were editing, not the interface locale. # You can reproduce this by editing flexible content in NL when your interface is english. send(path, column.row.rowable, @model.column.row.locale, anchor: "content-row-#{column.row.id}") end def update if @model.update_attributes allowed_params redirect_to content_path else render :edit end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems