- <% end -%>
+ <%= render :partial => 'note', :collection => @all_notes %>
<% end -%>
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a724358e..2dabe1f4 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -191,6 +191,7 @@ en:
delete_note_title: "Delete this note"
delete_confirmation: "Are you sure that you want to delete the note '{{id}}'?"
edit_item_title: "Edit item"
+ delete_item_title: "Delete item"
show_note_title: "Show note"
deleted_note: "Deleted note '{{id}}'"
no_notes_available: "Currently there are no notes: add notes to projects from individual project pages."
diff --git a/features/logging_in.feature b/features/logging_in.feature
index b4c9c321..f0b4d7cd 100644
--- a/features/logging_in.feature
+++ b/features/logging_in.feature
@@ -50,7 +50,7 @@ Feature: Existing user logging in
| "top secret" project for user "testuser" | "top secret" project for user "testuser" | Logout (Test User) |
| context page for "@secret location" for user "testuser" | context page for "@secret location" for user "testuser" | Logout (Test User) |
- @selenium @wip
+ @selenium
Scenario: When session expires, you should be logged out
When I go to the login page
And I submit the login form as user "testuser" with password "secret"
diff --git a/features/notes_manage.feature b/features/notes_manage.feature
index dca28671..403c0c6f 100644
--- a/features/notes_manage.feature
+++ b/features/notes_manage.feature
@@ -22,7 +22,7 @@ Feature: View, add, remove notes
And I should see note "My Note A" on the notes page
Then the badge should show 1
- @selenium
+ @selenium @wip
Scenario: Delete note from notes page
Given I have a project "Pass Final Exam" with 2 notes
When I go to the notes page
@@ -36,3 +36,10 @@ Feature: View, add, remove notes
When I visit the "Pass Final Exam" project
And I click the icon next to the note
Then I should see the note text
+
+ @selenium @wip
+ Scenario: Edit a note
+ Given I have a project "Pass Final Exam" with 2 notes
+ When I go to the notes page
+ And I edit the note to "edited note"
+ Then I should see "edited note"
\ No newline at end of file
diff --git a/features/step_definitions/note_steps.rb b/features/step_definitions/note_steps.rb
index fbc93eb7..65beb76e 100644
--- a/features/step_definitions/note_steps.rb
+++ b/features/step_definitions/note_steps.rb
@@ -28,7 +28,7 @@ end
When /^I delete the first note$/ do
title = selenium.get_text("css=div.container h2")
id = title.split(' ').last
- click_link "delete note"
+ click_link "delete_note_#{id}"
selenium.get_confirmation.should == "Are you sure that you want to delete the note '#{id}'?"
end
@@ -58,7 +58,7 @@ Then /^the first note should disappear$/ do
title = selenium.get_text("css=div.container h2")
id = title.split(' ').last
wait_for :timeout => 15 do
- !selenium.is_visible("note_#{id}")
+ !selenium.is_element_present("note_#{id}")
end
end
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index a7fcba5f..c2227135 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -104,6 +104,19 @@ var IntegrationsPage = {
}
}
+var NotesPage = {
+ setup_behavior: function() {
+ $('a.delete_note_button').live('click', function(evt){
+ evt.preventDefault();
+ if(confirm("Are you sure that you want to "+this.title+"?")){
+ $(this).parents('.project').block({message: null});
+ params = {_method: 'delete'};
+ $.post(this.href, params, null, 'script');
+ }
+ });
+ }
+}
+
$.fn.clearForm = function() {
return this.each(function() {
var type = this.type, tag = this.tagName.toLowerCase();
@@ -740,6 +753,7 @@ $(document).ready(function() {
});
IntegrationsPage.setup_behavior();
+ NotesPage.setup_behavior();
/* Gets called from some AJAX callbacks, too */
enable_rich_interaction();