Class: IshManager::MarkersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/ish_manager/markers_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#home

Instance Method Details

#createObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/ish_manager/markers_controller.rb', line 22

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

#destroyObject



48
49
50
51
52
53
54
55
56
# File 'app/controllers/ish_manager/markers_controller.rb', line 48

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

#editObject



18
19
20
# File 'app/controllers/ish_manager/markers_controller.rb', line 18

def edit
  authorize! :edit_marker, @map
end

#newObject

def index

  authorize! :markers, ::Gameui::Map
end


13
14
15
16
# File 'app/controllers/ish_manager/markers_controller.rb', line 13

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

#updateObject



37
38
39
40
41
42
43
44
45
46
# File 'app/controllers/ish_manager/markers_controller.rb', line 37

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