Sha256: 5189a25a84f7a38b122197c31f38434637141e45eac0c9c9c00d0160d7b57be3
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module ChirrinChirrionAdmin module Concerns module Controllers module Toggles extend ActiveSupport::Concern def index @toggles = ChirrinChirrion.list end def new end def create ChirrinChirrion.add_toggle(params[:name], {description: params[:description], active: params[:active].present?}) flash[:success] = 'Toggle has been created with success' redirect_to(action: :index) rescue ChirrinChirrion::Errors::ToggleIsRequired flash.now[:error] = 'Toggle name must be filled.' render(action: :new) end def chirrin ChirrinChirrion.chirrin!(params[:id]) flash[:success] = 'Toggle has been activated with success' redirect_to(action: :index) end def chirrion ChirrinChirrion.chirrion!(params[:id]) flash[:success] = 'Toggle has been inactivated with success' redirect_to(action: :index) end def destroy ChirrinChirrion.remove_toggle(params[:id]) flash[:success] = 'Toggle has been removed with success' redirect_to(action: :index) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chirrin-chirrion-admin-0.0.3 | lib/concerns/controllers/toggles.rb |
chirrin-chirrion-admin-0.0.2 | lib/concerns/controllers/toggles.rb |