Sha256: e35b2f61a56023d012a89f2e43e982c44dd99e148058164099a1714308096be6

Contents?: true

Size: 754 Bytes

Versions: 56

Compression:

Stored size: 754 Bytes

Contents

module Tenon
  class RedirectsController < Tenon::ResourcesController
    def resource_params
      params.require(:redirect).permit!
    end

    def toggle_active
      respond_to do |format|
        if @redirect.toggle_active!
          format.json { render json: @redirect.to_json }
          format.html { flash[:notice] = 'redirect approved.' and redirect_to redirects_path }
        else
          format.json { render status: 500, nothing: true }
          format.html { flash[:warning] = 'Error approving redirect.' and redirect_to redirects_path }
        end
      end
    end

    private

    def search_args
      ["#{klass.table_name}.in ILIKE ? OR #{klass.table_name}.out ILIKE ?", "%#{params[:q]}%", "%#{params[:q]}%"]
    end
  end
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
tenon-1.1.8 app/controllers/tenon/redirects_controller.rb
tenon-1.1.7 app/controllers/tenon/redirects_controller.rb
tenon-1.1.6 app/controllers/tenon/redirects_controller.rb
tenon-1.1.5 app/controllers/tenon/redirects_controller.rb
tenon-1.1.4 app/controllers/tenon/redirects_controller.rb
tenon-1.1.3 app/controllers/tenon/redirects_controller.rb
tenon-1.1.2 app/controllers/tenon/redirects_controller.rb
tenon-1.1.1 app/controllers/tenon/redirects_controller.rb
tenon-1.0.76 app/controllers/tenon/redirects_controller.rb
tenon-1.0.75 app/controllers/tenon/redirects_controller.rb
tenon-1.0.74 app/controllers/tenon/redirects_controller.rb
tenon-1.0.73 app/controllers/tenon/redirects_controller.rb
tenon-1.0.72 app/controllers/tenon/redirects_controller.rb
tenon-1.0.71 app/controllers/tenon/redirects_controller.rb
tenon-1.0.70 app/controllers/tenon/redirects_controller.rb
tenon-1.0.69 app/controllers/tenon/redirects_controller.rb
tenon-1.0.68 app/controllers/tenon/redirects_controller.rb
tenon-1.0.67 app/controllers/tenon/redirects_controller.rb
tenon-1.0.66 app/controllers/tenon/redirects_controller.rb
tenon-1.0.65 app/controllers/tenon/redirects_controller.rb