mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-26 12:08:47 +01:00
adds selenium test for badge count in notes view. Also fixes a bug in badge counting in notes view.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@753 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
ca04f32cb8
commit
b21128576f
4 changed files with 52 additions and 34 deletions
|
|
@ -27,13 +27,24 @@ class NotesController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
note = current_user.notes.find(params['id'])
|
||||
if note.destroy
|
||||
render :text => ''
|
||||
else
|
||||
notify :warning, "Couldn't delete note \"#{note.id}\""
|
||||
render :text => ''
|
||||
@note = current_user.notes.find(params['id'])
|
||||
|
||||
@note.destroy
|
||||
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.js do
|
||||
@count = current_user.notes.size
|
||||
render
|
||||
end
|
||||
end
|
||||
|
||||
# if note.destroy
|
||||
# render :text => ''
|
||||
# else
|
||||
# notify :warning, "Couldn't delete note \"#{note.id}\""
|
||||
# render :text => ''
|
||||
# end
|
||||
end
|
||||
|
||||
def update
|
||||
|
|
|
|||
|
|
@ -1,35 +1,39 @@
|
|||
<% note = notes -%>
|
||||
<div id="<%= dom_id(note, 'container') %>">
|
||||
<h2><%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %></h2>
|
||||
<h2><%= link_to("Note #{note.id}", note_path(note), :title => "Show note #{note.id}" ) %></h2>
|
||||
<div id="<%= dom_id(note) %>">
|
||||
<%= sanitize(textilize(note.body)) %>
|
||||
|
||||
<div class="note_footer">
|
||||
<%= link_to_remote( image_tag("blank.png", :title =>"Delete this note", :class=>"delete_item"),
|
||||
:update => dom_id(note),
|
||||
:loading => visual_effect(:fade, dom_id(note, 'container')),
|
||||
:complete => "Element.remove('#{dom_id(note, 'container')}');",
|
||||
:url => note_path(note),
|
||||
:method => :delete,
|
||||
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" ) + " " -%>
|
||||
<%= sanitize(textilize(note.body)) %>
|
||||
|
||||
<div class="note_footer">
|
||||
<%= link_to_remote(
|
||||
image_tag("blank.png",
|
||||
:title =>"Delete this note",
|
||||
:class=>"delete_item",
|
||||
:id => "delete_note_"+note.id.to_s),
|
||||
:update => dom_id(note),
|
||||
:loading => visual_effect(:fade, dom_id(note, 'container')),
|
||||
:complete => "Element.remove('#{dom_id(note, 'container')}');",
|
||||
:url => note_path(note),
|
||||
:method => :delete,
|
||||
:confirm => "Are you sure that you want to delete the note \'#{note.id.to_s}\'?" ) + " " -%>
|
||||
<%= link_to_function(image_tag( "blank.png", :title => "Edit item", :class=>"edit_item"),
|
||||
"Element.toggle('#{dom_id(note)}'); Element.toggle('#{dom_id(note, 'edit')}'); Effect.Appear('#{dom_id(note, 'edit')}'); Form.focusFirstElement('#{dom_id(note, 'edit_form')}');" ) + " | " %>
|
||||
<%= link_to("In: " + note.project.name, project_path(note.project), :class=>"footer_link" ) %> |
|
||||
Created: <%= format_date(note.created_at) %>
|
||||
<% if note.updated_at? -%>
|
||||
| Modified: <%= format_date(note.updated_at) %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="<%= dom_id(note, 'edit') %>" class="edit-form" style="display:none;">
|
||||
<% form_remote_tag :url => note_path(note),
|
||||
:method => :put,
|
||||
:html => { :id => dom_id(note, 'edit_form'), :class => "inline-form" },
|
||||
:update => dom_id(note, 'container'),
|
||||
:complete => visual_effect(:appear, dom_id(note, 'container')) do -%>
|
||||
<%= render :partial => "note_edit_form", :object => note %>
|
||||
<%= link_to("In: " + note.project.name, project_path(note.project), :class=>"footer_link" ) %> |
|
||||
Created: <%= format_date(note.created_at) %>
|
||||
<% if note.updated_at? -%>
|
||||
| Modified: <%= format_date(note.updated_at) %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="<%= dom_id(note, 'edit') %>" class="edit-form" style="display:none;">
|
||||
<% form_remote_tag :url => note_path(note),
|
||||
:method => :put,
|
||||
:html => { :id => dom_id(note, 'edit_form'), :class => "inline-form" },
|
||||
:update => dom_id(note, 'container'),
|
||||
:complete => visual_effect(:appear, dom_id(note, 'container')) do -%>
|
||||
<%= render :partial => "note_edit_form", :object => note %>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
<% note = nil -%>
|
||||
|
|
|
|||
3
tracks/app/views/notes/destroy.rjs
Normal file
3
tracks/app/views/notes/destroy.rjs
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
page.notify :notice, "Deleted note '#{@note.id}'", 5.0
|
||||
page['badge_count'].replace_html @count
|
||||
page.hide "busy"
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<div class="container">
|
||||
<div id="notes">
|
||||
<div class="add_note_link"><%= link_to_function( "Add a note", "Element.toggle('new-note'); Form.focusFirstElement('form-new-note');") %></div>
|
||||
<div class="add_note_link"><%= link_to_function( "Add a note", "Element.toggle('new-note'); Form.focusFirstElement('form-new-note');", :id=>"add_note_href") %></div>
|
||||
<h2>Notes</h2>
|
||||
<div id="empty-n" style="display:<%= @project.notes.empty? ? 'block' : 'none'%>;">
|
||||
<%= render :partial => "shared/empty",
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
<%= hidden_field( "new_note", "project_id", "value" => "#{@project.id}" ) %>
|
||||
<%= text_area( "new_note", "body", "cols" => 50, "rows" => 3, "tabindex" => 1 ) %>
|
||||
<br /><br />
|
||||
<input type="submit" value="Add note" tabindex="2" />
|
||||
<input type="submit" value="Add note" name="add-new-note" tabindex="2" />
|
||||
<% end -%>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue