diff options
| -rw-r--r-- | app/controllers/admin_controller.rb | 12 | ||||
| -rw-r--r-- | app/helpers/admin_helper.rb | 11 | ||||
| -rw-r--r-- | app/views/admin/index.html.erb | 5 | ||||
| -rw-r--r-- | app/views/layouts/admin.html.erb | 8 | ||||
| -rw-r--r-- | test/functional/admin_controller_test.rb | 8 | ||||
| -rw-r--r-- | test/unit/helpers/admin_helper_test.rb | 4 |
6 files changed, 47 insertions, 1 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb new file mode 100644 index 0000000..e672e3b --- /dev/null +++ b/app/controllers/admin_controller.rb | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | class AdminController < ApplicationController | ||
| 2 | |||
| 3 | def index | ||
| 4 | end | ||
| 5 | |||
| 6 | def switch_locale | ||
| 7 | I18n.locale = params[:id].to_sym | ||
| 8 | |||
| 9 | render :controller => 'nodes', :action => 'index' | ||
| 10 | end | ||
| 11 | |||
| 12 | end | ||
diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb new file mode 100644 index 0000000..7122584 --- /dev/null +++ b/app/helpers/admin_helper.rb | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | module AdminHelper | ||
| 2 | |||
| 3 | def language_selector | ||
| 4 | case I18n.locale | ||
| 5 | when :de | ||
| 6 | link_to 'Deutsch', edit_node_path(@node, :locale => :en) | ||
| 7 | when :en | ||
| 8 | link_to 'Deutsch', :locale => :de, :controller => params[:controller], :action => params[:action] | ||
| 9 | end | ||
| 10 | end | ||
| 11 | end \ No newline at end of file | ||
diff --git a/app/views/admin/index.html.erb b/app/views/admin/index.html.erb new file mode 100644 index 0000000..0a9874f --- /dev/null +++ b/app/views/admin/index.html.erb | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | <h1>Admin#index</h1> | ||
| 2 | <p>Find me in app/views/admin/index.html.erb</p> | ||
| 3 | |||
| 4 | |||
| 5 | <%= link_to 'nodes', :controller => :nodes, :action => :index %> \ No newline at end of file | ||
diff --git a/app/views/layouts/admin.html.erb b/app/views/layouts/admin.html.erb index df5b014..deebc66 100644 --- a/app/views/layouts/admin.html.erb +++ b/app/views/layouts/admin.html.erb | |||
| @@ -24,6 +24,12 @@ | |||
| 24 | </head> | 24 | </head> |
| 25 | 25 | ||
| 26 | <body> | 26 | <body> |
| 27 | <%= yield :layout %> | 27 | <div id="navigation"> |
| 28 | <p><%= I18n.locale %></p> | ||
| 29 | <%= language_selector %> | ||
| 30 | </div> | ||
| 31 | <div id="content"> | ||
| 32 | <%= yield :layout %> | ||
| 33 | </div> | ||
| 28 | </body> | 34 | </body> |
| 29 | </html> | 35 | </html> |
diff --git a/test/functional/admin_controller_test.rb b/test/functional/admin_controller_test.rb new file mode 100644 index 0000000..9bbf29b --- /dev/null +++ b/test/functional/admin_controller_test.rb | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class AdminControllerTest < ActionController::TestCase | ||
| 4 | # Replace this with your real tests. | ||
| 5 | test "the truth" do | ||
| 6 | assert true | ||
| 7 | end | ||
| 8 | end | ||
diff --git a/test/unit/helpers/admin_helper_test.rb b/test/unit/helpers/admin_helper_test.rb new file mode 100644 index 0000000..23d9f40 --- /dev/null +++ b/test/unit/helpers/admin_helper_test.rb | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | require 'test_helper' | ||
| 2 | |||
| 3 | class AdminHelperTest < ActionView::TestCase | ||
| 4 | end | ||
