Sha256: 9f82b72150d283063794d37860f999351255939b17b3cc19342e16cd89344134

Contents?: true

Size: 995 Bytes

Versions: 5

Compression:

Stored size: 995 Bytes

Contents

# Handles file uploads for content pictures.
require_dependency "lines/admin/application_controller"

module Lines
  module Admin

    class PicturesController < ApplicationController
      def create
        @picture = Lines::Picture.create(picture_params)
      end

      # PUT /admin/pictures/1
      def update
        @picture = Lines::Picture.find(params[:id])

        respond_to do |format|
          if @picture.update_attributes(picture_params[:picture])
            format.html { redirect_to @picture }
          else
            format.html { render action: "edit" }
          end
        end
      end

      # Deletes a picture. Only responds to JS requests.
      def destroy
        @picture = Lines::Picture.find(params[:id])
        @picture.destroy

        respond_to do |format|
          format.js
        end
      end

      private

        # strong_params
        def picture_params
          params.fetch(:picture, {}).permit(:image)
        end
    end
  
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
jeygeethanmedia-inkpen-1.2.6.2 app/controllers/lines/admin/pictures_controller.rb
jeygeethanmedia-inkpen-1.2.6.1 app/controllers/lines/admin/pictures_controller.rb
lines-engine-1.2.6.1 app/controllers/lines/admin/pictures_controller.rb
lines-engine-1.2.6 app/controllers/lines/admin/pictures_controller.rb
lines-engine-1.2.5 app/controllers/lines/admin/pictures_controller.rb