Sha256: e5a75efeef9f5eda9d11a2401b3e1c556ad9fa8f1a96171799f0d050847dbe5c

Contents?: true

Size: 1.4 KB

Versions: 7

Compression:

Stored size: 1.4 KB

Contents

class Admin::Odania::LanguagesController < AdminController
	before_action :set_admin_language, only: [:show, :edit, :update, :destroy]

	# GET /admin/languages
	def index
		@admin_languages = Odania::Language.all
	end

	# GET /admin/languages/1
	def show
	end

	# GET /admin/languages/new
	def new
		@admin_language = Odania::Language.new
	end

	# GET /admin/languages/1/edit
	def edit
	end

	# POST /admin/languages
	def create
		@admin_language = Odania::Language.new(admin_language_params)

		if @admin_language.save
			redirect_to admin_odania_languages_path, notice: 'Language was successfully created.'
		else
			render action: 'new'
		end
	end

	# PATCH/PUT /admin/languages/1
	def update
		if @admin_language.update(admin_language_params)
			redirect_to admin_odania_languages_path, notice: 'Language was successfully updated.'
		else
			render action: 'edit'
		end
	end

	# DELETE /admin/languages/1
	def destroy
		@admin_language.destroy
		redirect_to admin_odania_languages_url, notice: 'Language was successfully destroyed.'
	end

	private
	# Use callbacks to share common setup or constraints between actions.
	def set_admin_language
		@admin_language = Odania::Language.where(id: params[:id]).first
		redirect_to admin_odania_languages_path if @admin_language.nil?
	end

	# Only allow a trusted parameter "white list" through.
	def admin_language_params
		params.require(:odania_language).permit(:name, :iso_639_1)
	end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
odania_core-0.0.7 app/controllers/admin/odania/languages_controller.rb
odania_core-0.0.6 app/controllers/admin/odania/languages_controller.rb
odania_core-0.0.5 app/controllers/admin/odania/languages_controller.rb
odania_core-0.0.4 app/controllers/admin/odania/languages_controller.rb
odania_core-0.0.3 app/controllers/admin/odania/languages_controller.rb
odania_core-0.0.2 app/controllers/admin/odania/languages_controller.rb
odania_core-0.0.1 app/controllers/admin/odania/languages_controller.rb