Cross Reference: proofs_controller.rb
xref
: /
ontohub
/
app
/
controllers
/
proofs_controller.rb
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
proofs_controller.rb revision 4e0724b6358960a5e8394dbfd6e0c2d15a6061d5
class
ProofsController
<
InheritedResources
::
Base
defaults
resource_class
:
Proof
before_filter
:
check_write_permissions
helper_method
:
ontology
def
new
render
template
:
'
proofs
/
new
'
end
def
create
if
resource.valid
?
resource.save
!
flash
[:
success
] = t
(
'
proofs.create.starting
_jobs'
)
redirect_to
(
overview_url
)
else
flash
[:
alert
] = t
(
'
proofs.create.invalid
_resource'
)
redirect_to
(
action
: :
new
,
params
: {
proof
:
params
[:
proof
]})
end
end
protected
def
resource
@
resource
||=
resource_class.new
(
params
)
end
def
ontology
resource.ontology
end
def
overview_url
if
resource.theorem
?
url_for
([
resource.proof
_obligation
, :
proof_attempts
])
else
url_for
([
resource.proof_obligation.ontology
, :
theorems
])
end
end
def
check_write_permissions
authorize
! :
write
,
ontology.repository
end
end