diff options
author | jessib <jessib@riseup.net> | 2013-12-16 09:47:53 -0800 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2013-12-16 09:47:53 -0800 |
commit | e2638a3a91cb2c6a426f856c4d1919be1a852b6a (patch) | |
tree | 3679d9b29dacee6997e9744207e305e32fc3857d | |
parent | 82d0ff664c9d4f5740c09f6ead28ffc02716956a (diff) | |
parent | 496817bd512fe43c4cb80cc49a19dae3ed3eb165 (diff) |
Merge pull request #123 from azul/refactor/standartize-user-routes
refactor: remove Overview controller - we can use Users#show
-rw-r--r-- | app/controllers/home_controller.rb | 2 | ||||
-rw-r--r-- | app/views/layouts/_navigation.html.haml | 2 | ||||
-rw-r--r-- | help/app/views/tickets/_edit_form.html.haml | 4 | ||||
-rw-r--r-- | users/app/controllers/overviews_controller.rb | 9 | ||||
-rw-r--r-- | users/app/controllers/sessions_controller.rb | 4 | ||||
-rw-r--r-- | users/app/controllers/users_controller.rb | 2 | ||||
-rw-r--r-- | users/app/views/overviews/show.html.haml | 22 | ||||
-rw-r--r-- | users/app/views/users/_user.html.haml | 2 | ||||
-rw-r--r-- | users/app/views/users/show.html.haml | 23 | ||||
-rw-r--r-- | users/config/routes.rb | 3 |
10 files changed, 31 insertions, 42 deletions
diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index be26eb6..1d62178 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -3,7 +3,7 @@ class HomeController < ApplicationController def index if logged_in? - redirect_to user_overview_url(current_user) + redirect_to current_user end end end diff --git a/app/views/layouts/_navigation.html.haml b/app/views/layouts/_navigation.html.haml index 992aa46..6de567a 100644 --- a/app/views/layouts/_navigation.html.haml +++ b/app/views/layouts/_navigation.html.haml @@ -1,5 +1,5 @@ %ul.nav.sidenav - = link_to_navigation t(:overview), user_overview_path(@user), :active => controller?(:overviews) + = link_to_navigation t(:overview), @user, :active => controller?(:overviews) = link_to_navigation t(:account_settings), edit_user_path(@user), :active => controller?(:users) - # will want link for identity settings = link_to_navigation t(:support_tickets), auto_tickets_path, :active => controller?(:tickets) diff --git a/help/app/views/tickets/_edit_form.html.haml b/help/app/views/tickets/_edit_form.html.haml index fa0ab44..714f8ff 100644 --- a/help/app/views/tickets/_edit_form.html.haml +++ b/help/app/views/tickets/_edit_form.html.haml @@ -1,7 +1,7 @@ :ruby # created by user link if @ticket.created_by_user - created_by = link_to(@ticket.created_by_user.login, user_overview_path(@ticket.created_by_user)) + created_by = link_to @ticket.created_by_user.login, @ticket.created_by_user else created_by = t(:anonymous) end @@ -9,7 +9,7 @@ # regarding user link if admin? if @ticket.regarding_user_actual_user - regarding_user_link = link_to @ticket.regarding_user_actual_user.login, user_overview_path(@ticket.regarding_user_actual_user) + regarding_user_link = link_to @ticket.regarding_user_actual_user.login, @ticket.regarding_user_actual_user else regarding_user_link = "(#{t(:unknown)})" end diff --git a/users/app/controllers/overviews_controller.rb b/users/app/controllers/overviews_controller.rb deleted file mode 100644 index 52ce267..0000000 --- a/users/app/controllers/overviews_controller.rb +++ /dev/null @@ -1,9 +0,0 @@ -class OverviewsController < UsersBaseController - - before_filter :authorize - before_filter :fetch_user - - def show - end - -end diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb index 0494b51..85a022e 100644 --- a/users/app/controllers/sessions_controller.rb +++ b/users/app/controllers/sessions_controller.rb @@ -14,12 +14,12 @@ class SessionsController < ApplicationController end # - # this is a bad hack, but user_overview_url(user) is not available + # this is a bad hack, but user_url(user) is not available # also, this doesn't work because the redirect happens as a PUT. no idea why. # #Warden::Manager.after_authentication do |user, auth, opts| # response = Rack::Response.new - # response.redirect "/users/#{user.id}/overview" + # response.redirect "/users/#{user.id}" # throw :warden, response.finish #end diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb index 8b4715c..0b32ec7 100644 --- a/users/app/controllers/users_controller.rb +++ b/users/app/controllers/users_controller.rb @@ -13,7 +13,7 @@ class UsersController < UsersBaseController def index if params[:query] if @user = User.find_by_login(params[:query]) - redirect_to user_overview_url(@user) + redirect_to @user return else @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ) diff --git a/users/app/views/overviews/show.html.haml b/users/app/views/overviews/show.html.haml deleted file mode 100644 index 7bea370..0000000 --- a/users/app/views/overviews/show.html.haml +++ /dev/null @@ -1,22 +0,0 @@ -.overview - - %h2.first= t(:overview_welcome, :username => @user.login) - - - if admin? - %p - = t(:created) - = @user.created_at - %br - = t(:updated) - = @user.updated_at - %br - = t(:enabled) - = @user.enabled? - - %p= t(:overview_intro) - - %ul.unstyled - %li= icon('user') + link_to(t(:overview_account), edit_user_path(@user)) - - # %li= icon('envelope') + link_to(t(:overview_email), {insert path for user identities, presuambly} - %li= icon('question-sign') + link_to(t(:overview_tickets), user_tickets_path(@user)) - %li= icon('shopping-cart') + link_to(t(:overview_billing), billing_top_link(@user)) if APP_CONFIG[:payment].present? diff --git a/users/app/views/users/_user.html.haml b/users/app/views/users/_user.html.haml index 990d9cf..583d22f 100644 --- a/users/app/views/users/_user.html.haml +++ b/users/app/views/users/_user.html.haml @@ -1,4 +1,4 @@ %tr - %td= link_to user.login, user_overview_path(user) + %td= link_to user.login, user %td= l(user.created_at, :format => :short) %td= l(user.updated_at, :format => :short) diff --git a/users/app/views/users/show.html.haml b/users/app/views/users/show.html.haml index 434c025..7bea370 100644 --- a/users/app/views/users/show.html.haml +++ b/users/app/views/users/show.html.haml @@ -1 +1,22 @@ -= render 'edit' +.overview + + %h2.first= t(:overview_welcome, :username => @user.login) + + - if admin? + %p + = t(:created) + = @user.created_at + %br + = t(:updated) + = @user.updated_at + %br + = t(:enabled) + = @user.enabled? + + %p= t(:overview_intro) + + %ul.unstyled + %li= icon('user') + link_to(t(:overview_account), edit_user_path(@user)) + - # %li= icon('envelope') + link_to(t(:overview_email), {insert path for user identities, presuambly} + %li= icon('question-sign') + link_to(t(:overview_tickets), user_tickets_path(@user)) + %li= icon('shopping-cart') + link_to(t(:overview_billing), billing_top_link(@user)) if APP_CONFIG[:payment].present? diff --git a/users/config/routes.rb b/users/config/routes.rb index 69f9cf7..de2ff37 100644 --- a/users/config/routes.rb +++ b/users/config/routes.rb @@ -13,9 +13,8 @@ Rails.application.routes.draw do get "signup" => "users#new", :as => "signup" resources :users, :except => [:create, :update] do - resource :overview, :only => [:show] # resource :email_settings, :only => [:edit, :update] - resources :email_aliases, :only => [:destroy], :id => /.*/ + # resources :email_aliases, :only => [:destroy], :id => /.*/ post 'deactivate', on: :member post 'enable', on: :member end |