Commit 7b07a28a21020955cc7bf77252043e925acb8d1a

Authored by Antonio Terceiro
1 parent f32d1d5b

ActionItem1165: sharing user menu

app/controllers/public/account_controller.rb
... ... @@ -227,6 +227,10 @@ class AccountController < ApplicationController
227 227 render :partial => 'identifier_status'
228 228 end
229 229  
  230 + def user_menu
  231 + # nothing
  232 + end
  233 +
230 234 protected
231 235  
232 236 def redirect?
... ...
app/views/account/user_menu.rjs 0 → 100644
... ... @@ -0,0 +1 @@
  1 +page.replace_html 'user_box', :file => 'shared/user_menu'
... ...
app/views/layouts/application.rhtml
... ... @@ -102,7 +102,12 @@
102 102 </div>
103 103  
104 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 111 </div><!-- id='user_box' -->
107 112  
108 113 <a href="#" id="btShowHelp" class="icon-help32on help-on icon-help-on"
... ...
db/schema.rb
... ... @@ -89,8 +89,8 @@ ActiveRecord::Schema.define(:version =&gt; 69) do
89 89 t.boolean "virtual", :default => false
90 90 end
91 91  
92   - add_index "articles_categories", ["category_id"], :name => "index_articles_categories_on_category_id"
93 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 95 create_table "blocks", :force => true do |t|
96 96 t.string "title"
... ... @@ -284,6 +284,10 @@ ActiveRecord::Schema.define(:version =&gt; 69) do
284 284 t.integer "environment_id"
285 285 end
286 286  
  287 + create_table "schema_info", :id => false, :force => true do |t|
  288 + t.integer "version"
  289 + end
  290 +
287 291 create_table "taggings", :force => true do |t|
288 292 t.integer "tag_id"
289 293 t.integer "taggable_id"
... ... @@ -291,8 +295,8 @@ ActiveRecord::Schema.define(:version =&gt; 69) do
291 295 t.datetime "created_at"
292 296 end
293 297  
294   - add_index "taggings", ["taggable_id", "taggable_type"], :name => "index_taggings_on_taggable_id_and_taggable_type"
295 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 301 create_table "tags", :force => true do |t|
298 302 t.string "name"
... ...
test/integration/categories_menu_test.rb
... ... @@ -35,7 +35,7 @@ class CategoriesMenuTest &lt; ActionController::IntegrationTest
35 35 end
36 36  
37 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 39 get '/'
40 40 end
41 41  
... ...
test/integration/user_registers_at_the_application_test.rb
... ... @@ -10,10 +10,6 @@ class UserRegistersAtTheApplicationTest &lt; ActionController::IntegrationTest
10 10  
11 11 get '/account/signup'
12 12  
13   - # going SSL
14   - assert_response :redirect
15   - follow_redirect!
16   -
17 13 assert_response :success
18 14  
19 15 post '/account/signup', :user => { :login => 'mylogin', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }
... ... @@ -36,10 +32,6 @@ class UserRegistersAtTheApplicationTest &lt; ActionController::IntegrationTest
36 32  
37 33 get '/account/signup'
38 34  
39   - # going SSL
40   - assert_response :redirect
41   - follow_redirect!
42   -
43 35 assert_response :success
44 36  
45 37 post '/account/signup', :user => { :login => 'ze', :password => 'mypassword', :password_confirmation => 'mypassword', :email => 'mylogin@example.com' }
... ...