Show More
Commit Description:
submission report
Commit Description:
submission report
File last commit:
Show/Diff file:
Action:
app/controllers/sites_controller.rb | 97 lines | 2.1 KiB | text/x-ruby | RubyLexer |
jittat
[web] added site and time out basic functionality...
r85 class SitesController < ApplicationController
jittat
[web] disable sites_controller from normal users...
r119
change depricated before_filter to before_action
r745 before_action :admin_authorization
jittat
[web] disable sites_controller from normal users...
r119
jittat
[web] added site and time out basic functionality...
r85 # GET /sites
# GET /sites.xml
def index
change find(:xxx) to correct syntax for rails 4
r619 @sites = Site.order(:country_id)
jittat
[web] added site and time out basic functionality...
r85
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @sites }
end
end
# GET /sites/1
# GET /sites/1.xml
def show
@site = Site.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @site }
end
end
# GET /sites/new
# GET /sites/new.xml
def new
@site = Site.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @site }
end
end
# GET /sites/1/edit
def edit
@site = Site.find(params[:id])
end
# POST /sites
# POST /sites.xml
def create
@site = Site.new(params[:site])
@site.clear_start_time_if_not_started
respond_to do |format|
if @site.save
flash[:notice] = 'Site was successfully created.'
format.html { redirect_to(@site) }
format.xml { render :xml => @site, :status => :created, :location => @site }
else
format.html { render :action => "new" }
format.xml { render :xml => @site.errors, :status => :unprocessable_entity }
end
end
end
# PUT /sites/1
# PUT /sites/1.xml
def update
@site = Site.find(params[:id])
@site.clear_start_time_if_not_started
respond_to do |format|
switch to strong parameter for mass update (have not finished the problem controller yet)
r617 if @site.update_attributes(site_params)
jittat
[web] added site and time out basic functionality...
r85 flash[:notice] = 'Site was successfully updated.'
format.html { redirect_to(@site) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @site.errors, :status => :unprocessable_entity }
end
end
end
# DELETE /sites/1
# DELETE /sites/1.xml
def destroy
@site = Site.find(params[:id])
@site.destroy
respond_to do |format|
format.html { redirect_to(sites_url) }
format.xml { head :ok }
end
end
jittat
[web] site start/stop supports...
r123
switch to strong parameter for mass update (have not finished the problem controller yet)
r617 private
def site_params
params.require(:site).permit(:name,:started,:start_time,:country_id,:password)
end
jittat
[web] added site and time out basic functionality...
r85 end