Created auto-download ability
This commit is contained in:
		
							parent
							
								
									152d6e4e03
								
							
						
					
					
						commit
						dc0586045f
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
class DoorLogsController < ApplicationController
 | 
					class DoorLogsController < ApplicationController
 | 
				
			||||||
  authorize_resource
 | 
					  authorize_resource :except => :auto_download
 | 
				
			||||||
  before_filter :authenticate_user!
 | 
					  before_filter :authenticate_user!, :except => :auto_download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # GET /door_logs
 | 
					  # GET /door_logs
 | 
				
			||||||
  # GET /door_logs.json
 | 
					  # GET /door_logs.json
 | 
				
			||||||
@ -13,8 +13,7 @@ class DoorLogsController < ApplicationController
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  # GET /door_logs/1
 | 
					  # GET /door_logs/download
 | 
				
			||||||
  # GET /door_logs/1.json
 | 
					 | 
				
			||||||
  def download
 | 
					  def download
 | 
				
			||||||
    @results = DoorLog.download_from_door
 | 
					    @results = DoorLog.download_from_door
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -24,4 +23,15 @@ class DoorLogsController < ApplicationController
 | 
				
			|||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  # GET /door_logs/auto_download
 | 
				
			||||||
 | 
					  def auto_download
 | 
				
			||||||
 | 
					    @results = DoorLog.download_from_door
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    respond_to do |format|
 | 
				
			||||||
 | 
					      format.html # show.html.erb
 | 
				
			||||||
 | 
					      format.json { render :json => @results }
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								app/views/door_logs/auto_download.html.erb
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								app/views/door_logs/auto_download.html.erb
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					<p>
 | 
				
			||||||
 | 
					  <b>Download results:</b>
 | 
				
			||||||
 | 
					  <%= !@results.nil? %>
 | 
				
			||||||
 | 
					</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -6,8 +6,9 @@ Dooraccess::Application.routes.draw do
 | 
				
			|||||||
  resources :users
 | 
					  resources :users
 | 
				
			||||||
  match 'users/:id/upload' => 'users#upload', :as => :upload
 | 
					  match 'users/:id/upload' => 'users#upload', :as => :upload
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  match 'door_logs' => 'door_logs#index', :as => :door_logs
 | 
				
			||||||
  match 'door_logs/download' => 'door_logs#download', :as => :download
 | 
					  match 'door_logs/download' => 'door_logs#download', :as => :download
 | 
				
			||||||
  resources :door_logs
 | 
					  match 'door_logs/auto_download' => 'door_logs#auto_download', :as => :auto_download
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  root :to => "home#index"
 | 
					  root :to => "home#index"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user