Sha256: a4a7ad641c09b02b91912b0df7b3460783ba7f1a8009d9d5e627a35955341d38

Contents?: true

Size: 1.17 KB

Versions: 62

Compression:

Stored size: 1.17 KB

Contents

module Workarea
  class Admin::NavigationRedirectsController < Admin::ApplicationController
    required_permissions :settings

    def index
      @redirect = Navigation::Redirect.new
      @redirects = Navigation::Redirect.search(params[:q])
        .page(params[:page])
        .order_by(find_sort(Navigation::Redirect))
    end

    def show
      @redirect = Navigation::Redirect.find(params[:id])
      redirect_to navigation_redirects_path(q: @redirect.path)
    end

    def create
      @redirect = Navigation::Redirect.new(params[:redirect])

      if @redirect.save
        flash[:success] = t('workarea.admin.navigation_redirects.flash_messages.created')
        redirect_to navigation_redirects_path
      else
        flash[:error] = @redirect.errors.full_messages.join(', ')
        redirect_to navigation_redirects_path, status: :unprocessable_entity
      end
    end

    def edit
      redirect_to navigation_redirects_path
    end

    def destroy
      @redirect = Navigation::Redirect.find(params[:id])
      @redirect.destroy

      flash[:success] = t('workarea.admin.navigation_redirects.flash_messages.removed')
      redirect_to navigation_redirects_path
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-admin-3.4.13 app/controllers/workarea/admin/navigation_redirects_controller.rb
workarea-admin-3.4.12 app/controllers/workarea/admin/navigation_redirects_controller.rb