Sha256: 8dacce7424fd30c7432d86ea3b273fd18a616a38c07fe284edeea59f3dfbd6ad

Contents?: true

Size: 1.28 KB

Versions: 8

Compression:

Stored size: 1.28 KB

Contents

class Muck::ProfilesController < ApplicationController
  unloadable

  def index
    respond_to do |format|
      format.html { render :template => 'profiles/index' }
    end
  end

  # show a given user's public profile information
  def show
    @user = User.find(params[:id])
    @profile = @user.profile
    @page_title = @user.display_name
    respond_to do |format|
      format.html { render :template => 'profiles/show' }
    end
  end

  def edit
    @page_title = t('muck.profiles.edit_profile')
    @user = User.find(params[:user_id])
    @profile = @user.profile
    respond_to do |format|
      format.pjs do
        render_as_html do
          render :template => 'profiles/edit', :layout => false # fancybox request
        end
      end
      format.html { render :template => 'profiles/edit' }
    end
  end
  
  def update
    @page_title = t('muck.profiles.edit_profile')
    @user = User.find(params[:user_id])
    @profile = @user.profile
    @profile.update_attributes!(params[:profile])
    respond_to do |format|
      flash[:notice] = t('muck.profiles.edit_success')
      format.html { redirect_back_or_default edit_user_profile_path(@user) }
    end
  rescue ActiveRecord::RecordInvalid => ex
    flash[:error] = t('muck.profiles.edit_failure')
    render :action => :edit
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
muck-profiles-0.1.13 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.12 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.11 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.10 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.7 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.8 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.9 app/controllers/muck/profiles_controller.rb
muck-profiles-0.1.6 app/controllers/muck/profiles_controller.rb