|
Revision 1, 0.8 KB
(checked in by dema, 8 years ago)
|
|
Initial import
|
| Line | |
|---|
| 1 | require 'controller_helper' |
|---|
| 2 | require 'crud_controller' |
|---|
| 3 | |
|---|
| 4 | # The filters added to this controller will be run for all controllers in the application. |
|---|
| 5 | # Likewise will all the methods added be available for all controllers. |
|---|
| 6 | class ApplicationController < ActionController::Base |
|---|
| 7 | observer :model_observer |
|---|
| 8 | prepend_before_filter :verify_repo, :except => :select_repo |
|---|
| 9 | before_filter :set_return_to |
|---|
| 10 | |
|---|
| 11 | include ReturnTo |
|---|
| 12 | |
|---|
| 13 | def goto_application |
|---|
| 14 | do_return_to(:controller => "navigation") |
|---|
| 15 | end |
|---|
| 16 | |
|---|
| 17 | def verify_repo |
|---|
| 18 | if @session['repo'].nil? or @session['repo'].blank? |
|---|
| 19 | redirect_to :controller => 'repository', :action => 'select_repo' |
|---|
| 20 | else |
|---|
| 21 | set_repo |
|---|
| 22 | end |
|---|
| 23 | end |
|---|
| 24 | |
|---|
| 25 | def set_repo |
|---|
| 26 | if @session['repo'] != SemanticRecord::Base::repository |
|---|
| 27 | SemanticRecord::Base::repository = @session['repo'] |
|---|
| 28 | NavModelGenerator.new.generate |
|---|
| 29 | end |
|---|
| 30 | end |
|---|
| 31 | end |
|---|