diff --git a/tracks/app/controllers/login_controller.rb b/tracks/app/controllers/login_controller.rb index fb16be66..f2621303 100644 --- a/tracks/app/controllers/login_controller.rb +++ b/tracks/app/controllers/login_controller.rb @@ -3,6 +3,7 @@ class LoginController < ApplicationController layout 'login' skip_before_filter :set_session_expiration skip_before_filter :login_required + before_filter :get_current_user open_id_consumer if Tracks::Config.auth_schemes.include?('open_id') def login diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/projects_controller.rb similarity index 90% rename from tracks/app/controllers/project_controller.rb rename to tracks/app/controllers/projects_controller.rb index 03f60a2f..f0f75431 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/projects_controller.rb @@ -1,7 +1,7 @@ -class ProjectController < ApplicationController +class ProjectsController < ApplicationController helper :todo - before_filter :init, :except => [:create, :destroy, :order, :toggle_project_done] + before_filter :init, :except => [:create, :destroy, :order] def index init_project_hidden_todo_counts @@ -12,9 +12,6 @@ class ProjectController < ApplicationController end end - # Filter the projects to show just the one passed in the URL - # e.g. /project/show/ shows just . - # def show check_user_set_project @page_title = "TRACKS::Project: #{@project.name}" @@ -27,7 +24,7 @@ class ProjectController < ApplicationController # Example XML usage: curl -H 'Accept: application/xml' -H 'Content-Type: application/xml' # -u username:password # -d 'new project_name' - # http://our.tracks.host/project/create + # http://our.tracks.host/projects # def create if params[:format] == 'application/xml' && params['exception'] @@ -90,17 +87,6 @@ class ProjectController < ApplicationController end end - # Toggles the 'done' status of a project - # - def toggle_project_done - check_user_set_project - - @project.toggle!('done') - if @project.save - redirect_to :action => 'index' - end - end - # Delete a project # def destroy @@ -129,8 +115,10 @@ class ProjectController < ApplicationController def check_user_set_project if params["url_friendly_name"] @project = @user.projects.find_by_url_friendly_name(params["url_friendly_name"]) - elsif params['id'] + elsif params['id'] && params['id'] =~ /\d+/ @project = @user.projects.find(params["id"]) + elsif params['id'] + @project = @user.projects.find_by_url_friendly_name(params["id"]) else redirect_to :action => 'index' end diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index 6d7fbda8..a9e14903 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -133,7 +133,7 @@ module ApplicationHelper end def link_to_project(project, descriptor = sanitize(project.name)) - link_to( descriptor, { :controller => "project", :action => "show", :url_friendly_name => project.url_friendly_name }, :title => "View project: #{project.name}" ) + link_to( descriptor, project_url(project), :title => "View project: #{project.name}" ) end def item_link_to_context(item) diff --git a/tracks/app/helpers/project_helper.rb b/tracks/app/helpers/projects_helper.rb similarity index 66% rename from tracks/app/helpers/project_helper.rb rename to tracks/app/helpers/projects_helper.rb index 336f7a32..f91d8a61 100644 --- a/tracks/app/helpers/project_helper.rb +++ b/tracks/app/helpers/projects_helper.rb @@ -1,11 +1,11 @@ -module ProjectHelper +module ProjectsHelper def get_listing_sortable_options { :tag => 'div', :handle => 'handle', :complete => visual_effect(:highlight, 'list-projects'), - :url => {:controller => 'project', :action => 'order'} + :url => order_projects_path } end diff --git a/tracks/app/models/project.rb b/tracks/app/models/project.rb index c742ddd9..20d9eb3e 100644 --- a/tracks/app/models/project.rb +++ b/tracks/app/models/project.rb @@ -37,6 +37,10 @@ class Project < ActiveRecord::Base NullProject.new end + def to_param + url_friendly_name + end + def description_present? attribute_present?("description") end diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index dee99240..4fad9c15 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -42,7 +42,7 @@