48 lines
1.1 KiB
Ruby
48 lines
1.1 KiB
Ruby
# -*- encoding : utf-8 -*-
|
|
class Admin::ImageActuAlbumsController < ApplicationController
|
|
|
|
def new
|
|
@image_actu_album = ImageActuAlbum.new()
|
|
LangSite.all.each do |ls|
|
|
@image_actu_album.image_actu_album_langs << ImageActuAlbumLang.new(:lang_site_id => ls.id)
|
|
end
|
|
|
|
end
|
|
|
|
def create
|
|
@image_actu_album = ImageActuAlbum.new(params.require(:image_actu_album).permit!)
|
|
@image_actu_album_create = true
|
|
|
|
if @image_actu_album.save
|
|
@image_actu_albums = ImageActuAlbum.all.order(:name)
|
|
else
|
|
render :action => :new
|
|
|
|
end
|
|
end
|
|
|
|
def edit
|
|
@image_actu_album = ImageActuAlbum.find(params[:id])
|
|
end
|
|
|
|
def update
|
|
@image_actu_album = ImageActuAlbum.find(params[:id])
|
|
@image_actu_album_update = true
|
|
|
|
if @image_actu_album.update_attributes(params.require(:image_actu_album).permit!)
|
|
@image_actu_albums = ImageActuAlbum.all()
|
|
else
|
|
render :action => :edit
|
|
|
|
end
|
|
end
|
|
|
|
def destroy
|
|
@image_actu_album = ImageActuAlbum.find(params[:id])
|
|
if @image_actu_album.id != 1
|
|
@image_actu_album.destroy
|
|
end
|
|
end
|
|
|
|
end
|