Sha256: 14c6813c6ac36745e160bd7cfca4ae00e6e340144d31373c0ee1e3042dee169f

Contents?: true

Size: 984 Bytes

Versions: 5

Compression:

Stored size: 984 Bytes

Contents

class ProjectsController < ApplicationController

  before_filter :load_project, :except => [:new, :index, :create]
  def new
    @project = Project.new
    render :layout => 'application'
  end
  
  def index
    redirect_to new_project_path and return if Project.count == 0 
    @projects = Project.all
    render :layout => 'application'
  end
  
  def create
    @project = Project.new(params[:project])
    if @project.save
      redirect_to @project
    else
      render :action => 'new'
    end
  end
  
  def show
    # @this_week = @project.commits_between_dates(Time.current.beginning_of_week, Time.current.end_of_week)
    # @last_week = @project.commits_between_dates(1.week.ago.beginning_of_week, Time.current.beginning_of_week)
    redirect_to project_commits_path(@project)
  end
  
  def update
    if @project.update_attributes(params[:project])
      redirect_to :back
    else
      redirect_to project_edit_path(@project)
    end
  end
  
  def edit
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ginst-2009.12.8 app/controllers/projects_controller.rb
ginst-2009.11.24 app/controllers/projects_controller.rb
ginst-2009.11.23 app/controllers/projects_controller.rb
ginst-2.0.1 app/controllers/projects_controller.rb
ginst-2.0.0 app/controllers/projects_controller.rb