diff --git a/tracks/app/controllers/note_controller.rb b/tracks/app/controllers/notes_controller.rb similarity index 95% rename from tracks/app/controllers/note_controller.rb rename to tracks/app/controllers/notes_controller.rb index 46c6bbbd..03447eb7 100644 --- a/tracks/app/controllers/note_controller.rb +++ b/tracks/app/controllers/notes_controller.rb @@ -1,4 +1,4 @@ -class NoteController < ApplicationController +class NotesController < ApplicationController def index @all_notes = @user.notes @@ -27,7 +27,7 @@ class NoteController < ApplicationController end end - def delete + def destroy note = check_user_return_note if note.destroy render :text => '' diff --git a/tracks/app/controllers/projects_controller.rb b/tracks/app/controllers/projects_controller.rb index b3f3dd8f..f38f4a46 100644 --- a/tracks/app/controllers/projects_controller.rb +++ b/tracks/app/controllers/projects_controller.rb @@ -1,6 +1,6 @@ class ProjectsController < ApplicationController - helper :todo + helper :todo, :notes before_filter :init, :except => [:create, :destroy, :order] def index diff --git a/tracks/app/helpers/note_helper.rb b/tracks/app/helpers/note_helper.rb deleted file mode 100644 index d27337d4..00000000 --- a/tracks/app/helpers/note_helper.rb +++ /dev/null @@ -1,2 +0,0 @@ -module NoteHelper -end diff --git a/tracks/app/helpers/notes_helper.rb b/tracks/app/helpers/notes_helper.rb new file mode 100644 index 00000000..6216f08b --- /dev/null +++ b/tracks/app/helpers/notes_helper.rb @@ -0,0 +1,5 @@ +module NotesHelper + def truncated_note(note, characters = 50) + sanitize(textilize(truncate(note.body, characters, "..."))) + end +end diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index 9f50b126..ac2a673c 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -45,7 +45,7 @@
  • <%= navigation_link( "Projects", projects_path, {:accesskey=>"p", :title=>"Projects"} ) %>
  • <%= navigation_link( "Tickler", {:controller => "todo", :action => "tickler"}, :title => "Tickler" ) %>
  • <%= navigation_link( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %>
  • -
  • <%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "o", :title => "Show all notes"} ) %>
  • +
  • <%= navigation_link( "Notes", notes_path, {:accesskey => "o", :title => "Show all notes"} ) %>
  • <%= navigation_link( "Preferences", {:controller => "preferences", :action => "index"}, {:accesskey => "u", :title => "Show my preferences"} ) %>
  • <%= navigation_link( "Import/Export", {:controller => "data", :action => "index"}, {:accesskey => "i", :title => "Import and export data"} ) %>
  • <% if @user.is_admin? -%> diff --git a/tracks/app/views/note/_notes.rhtml b/tracks/app/views/note/_notes.rhtml deleted file mode 100644 index ea37d093..00000000 --- a/tracks/app/views/note/_notes.rhtml +++ /dev/null @@ -1,34 +0,0 @@ -<% note = notes -%> -
    -

    <%= link_to("Note #{note.id.to_s}", {:action => "show", :id => note.id}, :title => "Show note #{note.id.to_s}" ) %>

    - -
    - <%= sanitize(textilize(note.body)) %> - - -
    - - - -
    -<% note = nil -%> diff --git a/tracks/app/views/note/_notes_summary.rhtml b/tracks/app/views/note/_notes_summary.rhtml deleted file mode 100644 index 66e76dff..00000000 --- a/tracks/app/views/note/_notes_summary.rhtml +++ /dev/null @@ -1,7 +0,0 @@ -<% note = notes_summary -%> -
    -<%= link_to( image_tag("blank.png", :border => 0), { :controller => "note", :action => "show", - :id => note.id}, :title => "Show note", :class => "show_notes icon") %>  -<%= sanitize(textilize(truncate(note.body, 50, "..."))) %> -
    -<% note = nil -%> diff --git a/tracks/app/views/note/_note_edit_form.rhtml b/tracks/app/views/notes/_note_edit_form.rhtml similarity index 100% rename from tracks/app/views/note/_note_edit_form.rhtml rename to tracks/app/views/notes/_note_edit_form.rhtml diff --git a/tracks/app/views/notes/_notes.rhtml b/tracks/app/views/notes/_notes.rhtml new file mode 100644 index 00000000..3a329481 --- /dev/null +++ b/tracks/app/views/notes/_notes.rhtml @@ -0,0 +1,35 @@ +<% note = notes -%> +
    +

    <%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %>

    +
    + <%= sanitize(textilize(note.body)) %> + + +
    + + +
    +<% note = nil -%> diff --git a/tracks/app/views/notes/_notes_summary.rhtml b/tracks/app/views/notes/_notes_summary.rhtml new file mode 100644 index 00000000..25373930 --- /dev/null +++ b/tracks/app/views/notes/_notes_summary.rhtml @@ -0,0 +1,6 @@ +<% note = notes_summary -%> +
    +<%= link_to( image_tag("blank.png", :border => 0), note_path(note), :title => "Show note", :class => "show_notes icon") %>  +<%= truncated_note(note) %> +
    +<% note = nil -%> diff --git a/tracks/app/views/note/index.rhtml b/tracks/app/views/notes/index.rhtml similarity index 100% rename from tracks/app/views/note/index.rhtml rename to tracks/app/views/notes/index.rhtml diff --git a/tracks/app/views/note/show.rhtml b/tracks/app/views/notes/show.rhtml similarity index 100% rename from tracks/app/views/note/show.rhtml rename to tracks/app/views/notes/show.rhtml diff --git a/tracks/app/views/projects/show.rhtml b/tracks/app/views/projects/show.rhtml index ff54f877..266c7447 100644 --- a/tracks/app/views/projects/show.rhtml +++ b/tracks/app/views/projects/show.rhtml @@ -12,17 +12,18 @@ <%= render :partial => "shared/empty", :locals => { :message => "Currently there are no notes attached to this project"} %> - <%= render :partial => "note/notes_summary", :collection => @project.notes %> + <%= render :partial => "notes/notes_summary", :collection => @project.notes %>