Sha256: e80f1427bbc9837a2a6dc0ae5264c2914e32b29b9f9884961b90f8cd3ae5bdca

Contents?: true

Size: 1.6 KB

Versions: 48

Compression:

Stored size: 1.6 KB

Contents

class IshManager::MarkersController < IshManager::ApplicationController

  before_action :set_map, except: [ :destroy, :edit, :update ]
  before_action :set_marker, only: [ :edit, :update ]

=begin
  def index
    authorize! :markers, ::Gameui::Map
  end
=end

  def new
    authorize! :new_marker, ::Gameui::Map
    @marker = ::Gameui::Marker.new
  end

  def edit
    authorize! :edit_marker, @map
  end

  def create
    @marker = ::Gameui::Marker.new(marker_params)
    @marker.map = @map
    authorize! :create_marker, @map
    @map_id = @map.id

    respond_to do |format|
      if @marker.save
        format.html { redirect_to map_path(@map), notice: 'Marker was successfully created.' }
      else
        format.html { render :new }
      end
    end
  end

  def update
    authorize! :update_marker, @map
    respond_to do |format|
      if @marker.update(marker_params)
        format.html { redirect_to maps_path(@map), notice: 'Marker was successfully updated.' }
      else
        format.html { render :edit }
      end
    end
  end

  def destroy
    @marker = ::Gameui::Marker.find params[:id]
    @map = @marker.map
    authorize! :destroy_marker, @map
    @marker.destroy
    respond_to do |format|
      format.html { redirect_to map_path(@map), notice: 'Marker was successfully destroyed.' }
    end
  end

  private

    def set_map
      @map = ::Gameui::Map.find(params[:map_id] || params[:gameui_marker][:map_id])
    end

    def set_marker
      @marker = ::Gameui::Marker.find params[:id]
      @map = @marker.map
    end

    def marker_params
      params.require(:gameui_marker).permit!
    end

end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
ish_manager-0.1.8.246 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.245 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.244 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.243 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.242 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.241 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.239 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.238 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.237 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.236 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.235 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.234 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.233 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.232 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.231 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.230 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.229 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.228 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.227 app/controllers/ish_manager/markers_controller.rb
ish_manager-0.1.8.226 app/controllers/ish_manager/markers_controller.rb