Added a method to delete maps
also split the maps into diffrent pages. all map pages urls are now prefixed with .../exceptionhandler/maps... closes #18
This commit is contained in:
@@ -25,10 +25,7 @@ class MapsController < ApplicationController
|
|||||||
before_filter :require_user
|
before_filter :require_user
|
||||||
|
|
||||||
def index
|
def index
|
||||||
if session[:uploadSuccess]
|
|
||||||
flash.now[:notice] = "File has been uploaded successfully"
|
|
||||||
session[:uploadSuccess] = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def uploadFile
|
def uploadFile
|
||||||
@@ -36,5 +33,24 @@ class MapsController < ApplicationController
|
|||||||
session[:uploadSuccess] = post
|
session[:uploadSuccess] = post
|
||||||
redirect_to(:back)
|
redirect_to(:back)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def deleteMap
|
||||||
|
map = Map.find_by_map(params[:map])
|
||||||
|
if map != nil
|
||||||
|
map.destroy
|
||||||
|
directory = "public/maps"
|
||||||
|
File.delete("#{RAILS_ROOT}/public/maps/#{params[:map]}")
|
||||||
|
flash.now[:notice] = "Map deleted successfully"
|
||||||
|
else
|
||||||
|
flash.now[:error] = "No Map Found"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
if session[:uploadSuccess]
|
||||||
|
flash.now[:notice] = "File has been uploaded successfully"
|
||||||
|
session[:uploadSuccess] = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end #EOF
|
end #EOF
|
||||||
|
|||||||
@@ -62,8 +62,4 @@ class Map < ActiveRecord::Base
|
|||||||
map.map = sha1.hexdigest
|
map.map = sha1.hexdigest
|
||||||
map.save
|
map.save
|
||||||
end
|
end
|
||||||
|
|
||||||
def getMap()
|
|
||||||
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
2
app/views/maps/deleteMap.html.erb
Normal file
2
app/views/maps/deleteMap.html.erb
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
<strong>exterminate!</strong>
|
||||||
|
<%= params[:map] %>
|
||||||
@@ -1,29 +1,9 @@
|
|||||||
<h1>Exception Handler Maps</h1>
|
<h1>Exception Handler Maps</h1>
|
||||||
<br/>
|
<br/>
|
||||||
|
<br/>
|
||||||
<%= form_tag ({:action => 'uploadFile'}, :multipart => true) %>
|
<strong>Current Maps:</strong>
|
||||||
<label for="package">Package:</label>
|
<% Map.all.each do |map| %>
|
||||||
<br/>
|
|
||||||
<input name="package" id="package" type="text" maxlength="5555500" size=50%/>
|
|
||||||
<br/>
|
|
||||||
<label for="package">Build:</label>
|
|
||||||
<br/>
|
|
||||||
<input name="build" id="build" type="text" maxlength="5555500" size=50%/>
|
|
||||||
<br/>
|
|
||||||
<%= form_tag ({:action => 'uploadFile'}, :multipart => true) %>
|
|
||||||
<p><label for="upload_file">Select File</label> :
|
|
||||||
<br/>
|
|
||||||
<%= file_field 'upload', 'datafile' %></p>
|
|
||||||
<%= submit_tag "Upload" %>
|
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<%= map[:package] %> <%= map[:build] %> <%= link_to "Delete", "maps/delete/#{map[:map]}" %>
|
||||||
<strong>Current Maps:</strong>
|
<% end %>
|
||||||
|
|
||||||
<% Map.all.each do |map| %>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
<%= map[:package] %> <%= map[:build] %>
|
|
||||||
|
|
||||||
<% end %>
|
|
||||||
<%= form_tag %>
|
|
||||||
|
|||||||
16
app/views/maps/new.html.erb
Normal file
16
app/views/maps/new.html.erb
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<h1>Exception Handler Map Uploader</h1>
|
||||||
|
<%= form_tag ({:action => 'uploadFile'}, :multipart => true) %>
|
||||||
|
<label for="package">Package:</label>
|
||||||
|
<br/>
|
||||||
|
<input name="package" id="package" type="text" maxlength="5555500" size=50%/>
|
||||||
|
<br/>
|
||||||
|
<label for="package">Build:</label>
|
||||||
|
<br/>
|
||||||
|
<input name="build" id="build" type="text" maxlength="5555500" size=50%/>
|
||||||
|
<br/>
|
||||||
|
<%= form_tag ({:action => 'uploadFile'}, :multipart => true) %>
|
||||||
|
<p><label for="upload_file">Select File</label> :
|
||||||
|
<br/>
|
||||||
|
<%= file_field 'upload', 'datafile' %></p>
|
||||||
|
<%= submit_tag "Upload" %>
|
||||||
|
<%= form_tag %>
|
||||||
@@ -20,8 +20,10 @@
|
|||||||
# When a new exception report is recieved, it will be compared to existing bug issues.
|
# When a new exception report is recieved, it will be compared to existing bug issues.
|
||||||
# If there is a match, the existing issue will be updated
|
# If there is a match, the existing issue will be updated
|
||||||
# if not a new bug issue will be generated.
|
# if not a new bug issue will be generated.
|
||||||
ActionController::Routing::Routes.draw do |map|
|
ActionController::Routing::Routes.draw do |map|
|
||||||
map.connect '/exceptionhandler', :controller => 'exceptionhandler', :action => 'index'
|
map.connect '/exceptionhandler', :controller => 'exceptionhandler', :action => 'index'
|
||||||
map.connect '/maps', :controller => 'maps', :action => 'index'
|
map.connect '/exceptionhandler/maps', :controller => 'maps', :action => 'index'
|
||||||
map.connect '/uploadFile', :controller => 'maps', :action => 'uploadFile'
|
map.connect '/uploadFile', :controller => 'maps', :action => 'uploadFile'
|
||||||
|
map.connect '/exceptionhandler/maps/delete/:map', :controller => 'maps', :action => 'deleteMap'
|
||||||
|
map.connect '/exceptionhandler/maps/new', :controller => 'maps', :action => 'new'
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user