Sha256: 368f17cb463fc08df8e50ef816ce6e0c7995e086bb79e8f40495f0f45f6abac8
Contents?: true
Size: 1.16 KB
Versions: 13
Compression:
Stored size: 1.16 KB
Contents
class Backend::TagsController < Backend::BaseController include Concerns::PaginationController before_action :find_model, only: [:show, :edit, :update, :destroy] before_action -> { breadcrumb.add t('b.tags'), backend_tags_path } def index @search = Tag.ransack params[:q] @tags = @search.result(distinct: true).order(:name).page(page_number).per_page(15) end def show redirect_to edit_backend_tag_path(@tag) end def new @tag = Tag.new end def create @tag = Tag.new(allowed_params) if @tag.save redirect_to backend_tags_path, notice: translate_notice(:added, :tag) else render :new end end def destroy @tag.destroy redirect_to backend_tags_path, notice: translate_notice(:deleted, :tag) end def update if @tag.update_attributes allowed_params redirect_to backend_tags_path, notice: translate_notice(:edited, :tag) else render :edit end end private def allowed_params params.require(:tag).permit( :locale, :name, :seo_slug, :seo_title, :seo_description, :seo_keywords, :seo_custom ) end def find_model @tag = Tag.find params[:id] end end
Version data entries
13 entries across 13 versions & 1 rubygems