|
Revision 92, 1.0 KB
(checked in by dema, 6 years ago)
|
|
Fixed application start-up sequence. Closes #56. Also, the app now hides the meta-toolbar when in production mode (for that, start the server with 'script/server -e production').
|
| 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, :set] |
|---|
| 9 | before_filter :set_return_to |
|---|
| 10 | before_filter :set_charset |
|---|
| 11 | |
|---|
| 12 | include ReturnTo |
|---|
| 13 | |
|---|
| 14 | def goto_application |
|---|
| 15 | do_return_to(:controller => "navigation") |
|---|
| 16 | end |
|---|
| 17 | |
|---|
| 18 | def verify_repo |
|---|
| 19 | session['repo'] ||= SemanticRecord::Base::repository['repository'] |
|---|
| 20 | if session['repo'].nil? or session['repo'].blank? |
|---|
| 21 | redirect_to :controller => 'repository', :action => 'select' and return false |
|---|
| 22 | else |
|---|
| 23 | set_repo |
|---|
| 24 | end |
|---|
| 25 | end |
|---|
| 26 | |
|---|
| 27 | def set_repo |
|---|
| 28 | if session['repo'] != SemanticRecord::Base::repository['repository'] |
|---|
| 29 | SemanticRecord::Base::change_repository(session['repo']) |
|---|
| 30 | end |
|---|
| 31 | end |
|---|
| 32 | |
|---|
| 33 | def set_charset |
|---|
| 34 | @headers["Content-Type"] = "text/html; charset=utf-8" |
|---|
| 35 | end |
|---|
| 36 | end |
|---|