Sha256: e3a52d1e1b53496c585c24fb85888df5fe216fd67d4f405cb7e5104221d3f9f6
Contents?: true
Size: 1.16 KB
Versions: 5
Compression:
Stored size: 1.16 KB
Contents
class UsersController < ApplicationController include Applicat::Mvc::Controller::Resource before_filter :find_resource, only: [:show, :edit, :preferences, :update, :destroy] respond_to :html, :js, :json def index parent = find_parent User::PARENT_TYPES @users = parent ? parent.users : User.all end def languages render json: User.languages(params[:q]).to_json and return end def show end def edit @presenter = Resources::User::FormPresenter.new(self.view_context, resource: resource) end def preferences if params[:user] && current_user.update_attributes(params[:user]) redirect_to preferences_user_path(current_user), notice: t('general.form.successfully_updated') and return end end def update if current_user.update_attributes(params[:user]) redirect_to edit_user_path(current_user), notice: t('general.form.successfully_updated') else render :edit end end def destroy current_user.destroy redirect_to users_url, notice: t('general.form.destroyed') end def resource @user end private def find_resource @user = User.find(params[:id]) end end
Version data entries
5 entries across 5 versions & 1 rubygems