Class: IshManager::MarkersController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::MarkersController
- Defined in:
- app/controllers/ish_manager/markers_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
-
#new ⇒ Object
def index authorize! :markers, ::Gameui::Map end.
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/ish_manager/markers_controller.rb', line 22 def create @marker = ::Gameui::Marker.new(marker_params) @marker.map = @map :create_marker, @map @map_id = @map.id if params[:image] @marker.image = ::Ish::ImageAsset.new :image => params[:image] @marker.image.save end if params[:title_image] @marker.title_image = ::Ish::ImageAsset.new :image => params[:title_image] @marker.title_image.save end respond_to do |format| if @marker.save @marker.map.touch format.html { redirect_to map_path(@map), notice: 'Marker was successfully created.' } else format.html { render :new } end end end |
#destroy ⇒ Object
69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/ish_manager/markers_controller.rb', line 69 def destroy @marker = ::Gameui::Marker.find params[:id] @map = @marker.map :destroy_marker, @map @marker.map.touch @marker.destroy respond_to do |format| format.html { redirect_to map_path(@map), notice: 'Marker was successfully destroyed.' } end end |
#edit ⇒ Object
18 19 20 |
# File 'app/controllers/ish_manager/markers_controller.rb', line 18 def edit :edit_marker, @map end |
#new ⇒ Object
def index
authorize! :markers, ::Gameui::Map
end
13 14 15 16 |
# File 'app/controllers/ish_manager/markers_controller.rb', line 13 def new :new_marker, ::Gameui::Map @marker = ::Gameui::Marker.new end |
#update ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'app/controllers/ish_manager/markers_controller.rb', line 47 def update :update_marker, @map if params[:image] @marker.image = ::Ish::ImageAsset.new :image => params[:image] @marker.image.save end if params[:title_image] @marker.title_image = ::Ish::ImageAsset.new :image => params[:title_image] @marker.title_image.save end respond_to do |format| if @marker.update(marker_params) @marker.map.touch format.html { redirect_to maps_path(@map), notice: 'Marker was successfully updated.' } else format.html { render :edit } end end end |