Class: Workarea::Admin::UsersController
Instance Method Summary
collapse
Methods included from UserParams
#user_params
#current_user, #find_sort, #wrap_in_view_model, wrap_in_view_model
Methods included from Publishing
#allow_publishing!, #allow_publishing?, #set_publishing_options
Methods included from Visiting
#most_visited
Instance Method Details
#addresses ⇒ Object
54
55
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 54
def addresses
end
|
#edit ⇒ Object
33
34
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 33
def edit
end
|
#index ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 11
def index
search_params = params.merge(autocomplete: request.xhr?)
respond_to do |format|
format.html do
search = Search::AdminUsers.new(search_params)
@search = Admin::UserSearchViewModel.new(search, view_model_options)
end
format.json do
search = Search::AdminUsers.new(search_params.merge(role: ['Administrator']))
@results =
Admin::UserSearchViewModel.new(search, view_model_options).results.reject do |result|
result.id == current_user.id && params[:exclude_current_user]
end
end
end
end
|
#insights ⇒ Object
57
58
59
60
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 57
def insights
models = Workarea::Insights::Base.by_customer(@user.email)
@insights = InsightViewModel.wrap(models, view_model_options)
end
|
#orders ⇒ Object
47
48
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 47
def orders
end
|
#permissions ⇒ Object
50
51
52
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 50
def permissions
unauthorized_user and return unless current_user.permissions_manager?
end
|
#show ⇒ Object
30
31
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 30
def show
end
|
#update ⇒ Object
36
37
38
39
40
41
42
43
44
45
|
# File 'app/controllers/workarea/admin/users_controller.rb', line 36
def update
if @user.update_attributes(user_params)
update_email_signup
@user.payment_profile.update_attributes(params[:payment])
flash[:success] = t('workarea.admin.users.flash_messages.saved')
redirect_to user_path(@user)
else
render :edit, status: :unprocessable_entity
end
end
|