mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-10 03:08:50 +01:00
Minor refactor to preare for arRESTing NoteController.
Also fixed a recently introduced bug that caused projects or contexts with numbers in the name to fail to resolve properly by URL git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@401 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
36fcfe5c59
commit
ce2a9e2279
5 changed files with 5 additions and 5 deletions
|
|
@ -100,7 +100,7 @@ class ContextsController < ApplicationController
|
|||
def check_user_set_context
|
||||
if params['url_friendly_name']
|
||||
@context = @user.contexts.find_by_url_friendly_name(params['url_friendly_name'])
|
||||
elsif params['id'] && params['id'] =~ /\d+/
|
||||
elsif params['id'] && params['id'] =~ /^\d+$/
|
||||
@context = @user.contexts.find(params['id'])
|
||||
elsif params['id']
|
||||
@context = @user.contexts.find_by_url_friendly_name(params['id'])
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ class NoteController < ApplicationController
|
|||
|
||||
# Add a new note to this project
|
||||
#
|
||||
def add
|
||||
def create
|
||||
note = @user.notes.build
|
||||
note.attributes = params["new_note"]
|
||||
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ class ProjectsController < 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'] && params['id'] =~ /\d+/
|
||||
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"])
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
<div>
|
||||
|
||||
<div id="new-note" style="display:none;">
|
||||
<% form_remote_tag :url => { :controller => "note", :action => "add" },
|
||||
<% form_remote_tag :url => { :controller => "note", :action => "create" },
|
||||
:update => "notes",
|
||||
:position => "bottom",
|
||||
:complete => "new Effect.Highlight('notes');$('empty-n').hide();",
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ ActionController::Routing::Routes.draw do |map|
|
|||
map.connect 'projects/feed/:feedtype/:login/:token', :controller => 'feed', :action => 'list_projects_only'
|
||||
|
||||
# Notes Routes
|
||||
map.connect 'note/add', :controller => 'note', :action => 'add'
|
||||
map.connect 'note/create', :controller => 'note', :action => 'create'
|
||||
map.connect 'note/update/:id', :controller => 'note', :action => 'update', :id => 'id'
|
||||
map.connect 'note/:id', :controller => 'note', :action => 'show', :id => 'id'
|
||||
map.connect 'notes', :controller => 'note', :action => 'index'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue