Class: ClientsController

Inherits:
ApplicationController
  • Object
show all
Includes:
ControllerMixins::Generic
Defined in:
app/controllers/clients_controller.rb

Instance Method Summary collapse

Instance Method Details

#create ⇒ Object



74
75
76
# File 'app/controllers/clients_controller.rb', line 74

def create
  generic_save_and_redirect(:client, :create)
end

#edit ⇒ Object



88
89
# File 'app/controllers/clients_controller.rb', line 88

def edit
end

#inactive_clients ⇒ Object



53
54
55
# File 'app/controllers/clients_controller.rb', line 53

def inactive_clients
  @clients = authorized_clients.inactive
end

#index ⇒ Object



49
50
51
# File 'app/controllers/clients_controller.rb', line 49

def index
  @clients = authorized_clients.active
end

#new ⇒ Object



71
72
# File 'app/controllers/clients_controller.rb', line 71

def new
end

#show ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'app/controllers/clients_controller.rb', line 61

def show
  @bucket = Project.order("name").for_client(@client)
  @bucket = @bucket.for_user(current_user) unless admin?

  @work_units = WorkUnit.for_client(@client).order("work_units.created_at DESC").limit(100)

  @incompleted_projects = @bucket.incomplete
  @completed_projects = @bucket.complete
end

#suspended_clients ⇒ Object



57
58
59
# File 'app/controllers/clients_controller.rb', line 57

def suspended_clients
  @clients = authorized_clients.suspended
end

#update ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'app/controllers/clients_controller.rb', line 78

def update
  if @client.update_attributes(params[:client])
    flash[:notice] = t(:client_updated_successfully)
    redirect_to client_path(@client)
  else
    flash.now[:error] = t(:client_updated_unsuccessfully)
    render :edit
  end
end