Method: IshManager::MapsController#index

Defined in:
app/controllers/ish_manager/maps_controller.rb

#indexObject

[View source]

130
131
132
133
134
135
136
137
138
139
140
141
142
143
# File 'app/controllers/ish_manager/maps_controller.rb', line 130

def index
  authorize! :index, ::Gameui::Map

  if params[:q]
    @maps = ::Gameui::Map.or({ slug: /#{params[:q]}/i }, { name: /#{params[:q]}/i })
    if @maps.length == 1
      redirect_to map_path(@maps[0])
      return
    end
  end

  @maps ||= ::Gameui::Map.unscoped.where( parent_slug: "" ).order( slug: :asc )
  @all_maps = Gameui::Map.all.order( slug: :asc )
end