Sha256: 6c82a7f48bc0b00c019ceb8ef1205b997bacca3394c195ea4d7cdb9c7ff773ee

Contents?: true

Size: 837 Bytes

Versions: 21

Compression:

Stored size: 837 Bytes

Contents

class TagsController < ApplicationController

  before_filter :authenticate
  before_filter :authenticate_with_admin

  def index
    @tags = Tag.alphabetically
    switch_to_admin_layout
  end

  def edit
    @tag = Tag.find(params[:id])
    switch_to_admin_layout
  end

  def update
    @tag = Tag.find(params[:id])
    if @tag.update_attributes(tag_params)
      redirect_to tags_path, notice: t('tags.update.notice')
    else
      flash[:warning] = t('tags.update.warning')
      render action: "edit", layout: 'admin'
    end
  end

  def destroy
    @tag = Tag.find(params[:id])
    @tag.destroy
    redirect_to tags_url, notice: 'The tag has been removed'
  end

  private

  # Never trust parameters from the scary internet, only allow the white list through.
  def tag_params
    params.require(:tag).permit(:name)
  end

end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
tkh_content-0.10.10 app/controllers/tags_controller.rb
tkh_content-0.10.9 app/controllers/tags_controller.rb
tkh_content-0.10.8 app/controllers/tags_controller.rb
tkh_content-0.10.7 app/controllers/tags_controller.rb
tkh_content-0.10.6 app/controllers/tags_controller.rb
tkh_content-0.10.5.1 app/controllers/tags_controller.rb
tkh_content-0.10.5 app/controllers/tags_controller.rb
tkh_content-0.10.4 app/controllers/tags_controller.rb
tkh_content-0.10.3 app/controllers/tags_controller.rb
tkh_content-0.10.2 app/controllers/tags_controller.rb
tkh_content-0.10.1 app/controllers/tags_controller.rb
tkh_content-0.10 app/controllers/tags_controller.rb
tkh_content-0.9.20 app/controllers/tags_controller.rb
tkh_content-0.9.19 app/controllers/tags_controller.rb
tkh_content-0.9.18 app/controllers/tags_controller.rb
tkh_content-0.9.17 app/controllers/tags_controller.rb
tkh_content-0.9.16 app/controllers/tags_controller.rb
tkh_content-0.9.15 app/controllers/tags_controller.rb
tkh_content-0.9.14 app/controllers/tags_controller.rb
tkh_content-0.9.13 app/controllers/tags_controller.rb