Sha256: 2e65614677b51acddcae1efc9a740e1791f667147efc6cd935d398b82f0f234d
Contents?: true
Size: 864 Bytes
Versions: 12
Compression:
Stored size: 864 Bytes
Contents
module Spina module Admin class EmbedsController < AdminController def new @embeddable = (Spina::Embeds.constantize(embed_type) || embeddables.first).new end def create @embeddable = Spina::Embeds.constantize(embed_type).new(embed_params) if @embeddable.valid? render turbo_stream: turbo_stream.update(:trix_attachment_html, @embeddable.to_trix_attachment) else render :new, status: :unprocessable_entity end end private def embeddables @embeddables ||= current_theme.embeddables end helper_method :embeddables def embed_type params[:embed_type] end def embed_params params.require(:embeddable).permit! end end end end
Version data entries
12 entries across 12 versions & 1 rubygems