app/controllers/user_controller.rb in kit_cms-2.3.20 vs app/controllers/user_controller.rb in kit_cms-2.3.22
- old
+ new
@@ -1,17 +1,14 @@
class UserController < KitController
- layout Preference.get_cached!(0,"user_profile_layout", "application")
- append_view_path Layout.resolver
+ before_filter :authenticate
- before_filter :authenticate_user!
-
def preferences
@page_title = 'Preferences'
@user = current_user
-
+ render "preferences", :layout=>profile_layout
end
def profile
@page_title = "Your Profile"
@user = current_user
@@ -26,13 +23,15 @@
def edit_profile
form = Preference.get_cached(_sid, 'user_profile_edit_form')
if form.not_blank?
- render :inline=>form, :layout=>Preference.get_cached!(0,"user_profile_layout", "application") #TODO sub in auth token
+ render :inline=>form, :layout=>profile_layout # Preference.get_cached!(0,"user_profile_layout", "application") #TODO sub in auth token
return
end
+
+ render "edit_profile", :layout=>profile_layout
end
def attribute
@user = current_user
@@ -133,22 +132,27 @@
redirect_to "/user/preferences", :notice=>"Preferences updated"
return
end
end
- kit_render "preferences", :layout=>Preference.get_cached!(_sid,"user_profile_layout", "application")
+ kit_render "preferences", :layout=>profile_layout
end
private
def show_profile(owner)
render :text=>"User not found" and return unless @user
form = Preference.get_cached(_sid, "user_profile_#{owner ? 'owner' : 'view'}_form")
+
if form.not_blank?
- render :inline=>form, :layout=>Preference.get_cached!(0,"user_profile_layout", "application")
+ render :inline=>form, :layout=>profile_layout
else
- render "user_profile"
+ render "user_profile", :layout=>profile_layout
end
end
-
+
+ def profile_layout
+ Layout.preference(_sid, 'user_profile_layout').path
+ end
+
end