|
|
@ -1,4 +1,8 @@
|
|
|
|
class SoftapplicationsController < ApplicationController
|
|
|
|
class SoftapplicationsController < ApplicationController
|
|
|
|
|
|
|
|
before_filter :find_softapplication, only: [:edit, :update, :destroy]
|
|
|
|
|
|
|
|
before_filter :editable, only: [:edit, :update]
|
|
|
|
|
|
|
|
before_filter :destroyable, only: :destroy
|
|
|
|
|
|
|
|
|
|
|
|
# GET /softapplications
|
|
|
|
# GET /softapplications
|
|
|
|
# GET /softapplications.json
|
|
|
|
# GET /softapplications.json
|
|
|
|
def index
|
|
|
|
def index
|
|
|
@ -71,7 +75,7 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
# PUT /softapplications/1
|
|
|
|
# PUT /softapplications/1
|
|
|
|
# PUT /softapplications/1.json
|
|
|
|
# PUT /softapplications/1.json
|
|
|
|
def update
|
|
|
|
def update
|
|
|
|
@softapplication = Softapplication.find(params[:id])
|
|
|
|
# @softapplication = Softapplication.find(params[:id])
|
|
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
if @softapplication.update_attributes(params[:softapplication])
|
|
|
|
if @softapplication.update_attributes(params[:softapplication])
|
|
|
@ -92,11 +96,11 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
# DELETE /softapplications/1
|
|
|
|
# DELETE /softapplications/1
|
|
|
|
# DELETE /softapplications/1.json
|
|
|
|
# DELETE /softapplications/1.json
|
|
|
|
def destroy
|
|
|
|
def destroy
|
|
|
|
@softapplication = Softapplication.find(params[:id])
|
|
|
|
# @softapplication = Softapplication.find(params[:id])
|
|
|
|
@softapplication.destroy
|
|
|
|
@softapplication.destroy
|
|
|
|
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { redirect_to softapplications_url }
|
|
|
|
format.html { redirect_to :back }
|
|
|
|
format.json { head :no_content }
|
|
|
|
format.json { head :no_content }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -192,4 +196,24 @@ class SoftapplicationsController < ApplicationController
|
|
|
|
#format.api { render_api_ok }
|
|
|
|
#format.api { render_api_ok }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def find_softapplication
|
|
|
|
|
|
|
|
@softapplication = Softapplication.find_by_id(params[:id])
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def editable
|
|
|
|
|
|
|
|
unless @softapplication.editable_by? User.current
|
|
|
|
|
|
|
|
render_403
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def destroyable
|
|
|
|
|
|
|
|
unless @softapplication.destroyable_by? User.current
|
|
|
|
|
|
|
|
render_403
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|