Sha256: b6c7d339692a6cf7552444dccbe85cb6498a9fd249bf2c0a260849d378ea04fe

Contents?: true

Size: 1.23 KB

Versions: 9

Compression:

Stored size: 1.23 KB

Contents

module Spina
  module Admin
    class MediaFoldersController < AdminController
      layout "spina/admin/media_library"

      def new
        @media_folder = MediaFolder.new
      end

      def edit
        @media_folder = MediaFolder.find(params[:id])
      end

      def show
        add_breadcrumb I18n.t('spina.website.media_library'), admin_media_library_path
        add_breadcrumb I18n.t('spina.website.images'), spina.admin_images_path
        @media_folder = MediaFolder.find(params[:id])
        add_breadcrumb @media_folder.name
        @images = @media_folder.images.sorted.page(params[:page])
      end

      def create
        @media_folder = MediaFolder.new(media_folder_params)
        @media_folder.save
        redirect_to spina.admin_images_path
      end

      def update
        @media_folder = MediaFolder.find(params[:id])
        @media_folder.update(media_folder_params)
        redirect_to spina.admin_media_folder_path(@media_folder)
      end

      def destroy
        @media_folder = MediaFolder.find(params[:id])
        @media_folder.destroy
        redirect_to spina.admin_images_path
      end

      private

        def media_folder_params
          params.require(:media_folder).permit(:name)
        end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spina-2.0.2 app/controllers/spina/admin/media_folders_controller.rb
spina-2.0.1 app/controllers/spina/admin/media_folders_controller.rb
spina-2.0.0 app/controllers/spina/admin/media_folders_controller.rb
spina-2.0.0.beta app/controllers/spina/admin/media_folders_controller.rb
spina-2.0.0.alpha app/controllers/spina/admin/media_folders_controller.rb
spina-1.2.0 app/controllers/spina/admin/media_folders_controller.rb
spina-1.1.4 app/controllers/spina/admin/media_folders_controller.rb
spina-1.1.3 app/controllers/spina/admin/media_folders_controller.rb
spina-1.1.2 app/controllers/spina/admin/media_folders_controller.rb