diff --git a/app/controllers/my_profile/cms_controller.rb b/app/controllers/my_profile/cms_controller.rb index bd3dc23..461ba67 100644 --- a/app/controllers/my_profile/cms_controller.rb +++ b/app/controllers/my_profile/cms_controller.rb @@ -142,20 +142,17 @@ class CmsController < MyProfileController render :action => 'edit' end - def home_page - profile.home_page - end - post_only :set_home_page def set_home_page - @article = params[:id] != nil ? profile.articles.find(params[:id]) : nil - profile.home_page = @article - profile.save(false) - if @article != nil - session[:notice] = _('"%s" configured as home page.') % @article.name - else + article = params[:id].nil? ? nil : profile.articles.find(params[:id]) + profile.update_attribute(:home_page, article) + + if @article.nil? session[:notice] = _('home page reseted.') + else + session[:notice] = _('"%s" configured as home page.') % article.name end + redirect_to (request.referer || profile.url) end -- libgit2 0.21.2