Commit 7b07a28a21020955cc7bf77252043e925acb8d1a
1 parent
f32d1d5b
Exists in
master
and in
22 other branches
ActionItem1165: sharing user menu
Showing
6 changed files
with
18 additions
and
12 deletions
Show diff stats
app/controllers/public/account_controller.rb
| @@ -227,6 +227,10 @@ class AccountController < ApplicationController | @@ -227,6 +227,10 @@ class AccountController < ApplicationController | ||
| 227 | render :partial => 'identifier_status' | 227 | render :partial => 'identifier_status' |
| 228 | end | 228 | end |
| 229 | 229 | ||
| 230 | + def user_menu | ||
| 231 | + # nothing | ||
| 232 | + end | ||
| 233 | + | ||
| 230 | protected | 234 | protected |
| 231 | 235 | ||
| 232 | def redirect? | 236 | def redirect? |
| @@ -0,0 +1 @@ | @@ -0,0 +1 @@ | ||
| 1 | +page.replace_html 'user_box', :file => 'shared/user_menu' |
app/views/layouts/application.rhtml
| @@ -102,7 +102,12 @@ | @@ -102,7 +102,12 @@ | ||
| 102 | </div> | 102 | </div> |
| 103 | 103 | ||
| 104 | <div id="user_box"> | 104 | <div id="user_box"> |
| 105 | - <%= render :file => 'shared/user_menu' %> | 105 | + <%# WARNING this is a horrible hack while we don't have an actual SSO system. %> |
| 106 | + <% if environment.enable_ssl && request.host != environment.default_hostname %> | ||
| 107 | + <%= content_tag 'script', '', :type => 'text/javascript', :src => environment.top_url(true) + '/account/user_menu' %> | ||
| 108 | + <% else %> | ||
| 109 | + <%= render :file => 'shared/user_menu' %> | ||
| 110 | + <% end %> | ||
| 106 | </div><!-- id='user_box' --> | 111 | </div><!-- id='user_box' --> |
| 107 | 112 | ||
| 108 | <a href="#" id="btShowHelp" class="icon-help32on help-on icon-help-on" | 113 | <a href="#" id="btShowHelp" class="icon-help32on help-on icon-help-on" |
db/schema.rb
| @@ -89,8 +89,8 @@ ActiveRecord::Schema.define(:version => 69) do | @@ -89,8 +89,8 @@ ActiveRecord::Schema.define(:version => 69) do | ||
| 89 | t.boolean "virtual", :default => false | 89 | t.boolean "virtual", :default => false |
| 90 | end | 90 | end |
| 91 | 91 | ||
| 92 | - add_index "articles_categories", ["category_id"], :name => "index_articles_categories_on_category_id" | ||
| 93 | add_index "articles_categories", ["article_id"], :name => "index_articles_categories_on_article_id" | 92 | add_index "articles_categories", ["article_id"], :name => "index_articles_categories_on_article_id" |
| 93 | + add_index "articles_categories", ["category_id"], :name => "index_articles_categories_on_category_id" | ||
| 94 | 94 | ||
| 95 | create_table "blocks", :force => true do |t| | 95 | create_table "blocks", :force => true do |t| |
| 96 | t.string "title" | 96 | t.string "title" |
| @@ -284,6 +284,10 @@ ActiveRecord::Schema.define(:version => 69) do | @@ -284,6 +284,10 @@ ActiveRecord::Schema.define(:version => 69) do | ||
| 284 | t.integer "environment_id" | 284 | t.integer "environment_id" |
| 285 | end | 285 | end |
| 286 | 286 | ||
| 287 | + create_table "schema_info", :id => false, :force => true do |t| | ||
| 288 | + t.integer "version" | ||
| 289 | + end | ||
| 290 | + | ||
| 287 | create_table "taggings", :force => true do |t| | 291 | create_table "taggings", :force => true do |t| |
| 288 | t.integer "tag_id" | 292 | t.integer "tag_id" |
| 289 | t.integer "taggable_id" | 293 | t.integer "taggable_id" |
| @@ -291,8 +295,8 @@ ActiveRecord::Schema.define(:version => 69) do | @@ -291,8 +295,8 @@ ActiveRecord::Schema.define(:version => 69) do | ||
| 291 | t.datetime "created_at" | 295 | t.datetime "created_at" |
| 292 | end | 296 | end |
| 293 | 297 | ||
| 294 | - add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type" | ||
| 295 | add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" | 298 | add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id" |
| 299 | + add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type" | ||
| 296 | 300 | ||
| 297 | create_table "tags", :force => true do |t| | 301 | create_table "tags", :force => true do |t| |
| 298 | t.string "name" | 302 | t.string "name" |
test/integration/categories_menu_test.rb
| @@ -35,7 +35,7 @@ class CategoriesMenuTest < ActionController::IntegrationTest | @@ -35,7 +35,7 @@ class CategoriesMenuTest < ActionController::IntegrationTest | ||
| 35 | end | 35 | end |
| 36 | 36 | ||
| 37 | should 'cache the categories menu' do | 37 | should 'cache the categories menu' do |
| 38 | - ActionView::Base.any_instance.expects(:cache).with(Environment.default.name + "_categories_menu") | 38 | + ActionView::Base.any_instance.expects(:cache).with(Environment.default.id.to_s + "_categories_menu") |
| 39 | get '/' | 39 | get '/' |
| 40 | end | 40 | end |
| 41 | 41 |
test/integration/user_registers_at_the_application_test.rb
| @@ -10,10 +10,6 @@ class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest | @@ -10,10 +10,6 @@ class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest | ||
| 10 | 10 | ||
| 11 | get '/account/signup' | 11 | get '/account/signup' |
| 12 | 12 | ||
| 13 | - # going SSL | ||
| 14 | - assert_response :redirect | ||
| 15 | - follow_redirect! | ||
| 16 | - | ||
| 17 | assert_response :success | 13 | assert_response :success |
| 18 | 14 | ||
| 19 | post '/account/signup', :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } | 15 | post '/account/signup', :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } |
| @@ -36,10 +32,6 @@ class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest | @@ -36,10 +32,6 @@ class UserRegistersAtTheApplicationTest < ActionController::IntegrationTest | ||
| 36 | 32 | ||
| 37 | get '/account/signup' | 33 | get '/account/signup' |
| 38 | 34 | ||
| 39 | - # going SSL | ||
| 40 | - assert_response :redirect | ||
| 41 | - follow_redirect! | ||
| 42 | - | ||
| 43 | assert_response :success | 35 | assert_response :success |
| 44 | 36 | ||
| 45 | post '/account/signup', :user => { :login => 'ze', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } | 37 | post '/account/signup', :user => { :login => 'ze', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' } |