major restructuring/refactoring of application.js. finally scratched that itch. Some tests are failing to be fixed later.

This commit is contained in:
Reinier Balt 2010-11-25 23:29:32 +01:00
parent 88a524a8d6
commit 879fbc99e2
12 changed files with 606 additions and 642 deletions

View file

@ -1,9 +1,12 @@
class NotesController < ApplicationController
before_filter :set_source_view
def index
@all_notes = current_user.notes.all
@count = @all_notes.size
@page_title = "TRACKS::All notes"
@source_view = 'note_list'
respond_to do |format|
format.html
format.xml { render :xml => @all_notes.to_xml( :except => :user_id ) }
@ -66,4 +69,11 @@ class NotesController < ApplicationController
end
end
protected
def set_source_view
@source_view = params['_source_view'] || 'note'
end
end

View file

@ -1,11 +1,11 @@
<% if @saved -%>
hide_empty_message();
TracksForm.hide_errors();
TracksPages.hide_errors();
set_page_badge(<%= @down_count %>);
add_context("<%=@context.hidden? ? 'hidden' : 'active'%>");
clear_form();
<% else -%>
TracksForm.show_errors(html_for_error_messages());
TracksPages.show_errors(html_for_error_messages());
<% end -%>
function hide_empty_message() {

View file

@ -2,7 +2,7 @@
<% form_for(note_edit_form, :html => {
:id => dom_id(note_edit_form, 'edit_form'),
:class => "inline-form edit-note-form",
:method => :post }) do |f|
:method => :put }) do |f|
-%>
<div id="error_status"><%= error_messages_for("note") %></div>

View file

@ -1,9 +1,9 @@
<% if @saved -%>
TracksForm.hide_errors();
TracksPages.hide_errors();
add_note();
clear_form();
<% else -%>
TracksForm.show_errors(html_for_error_messages());
TracksPages.show_errors(html_for_error_messages());
<% end -%>
function add_note() {

View file

@ -1,5 +1,3 @@
<div id="display_box_projects">
<div class="container" id="note-<%= @note.id %>-wrapper">
<%= render :partial => 'note', :object => @note %>
</div>
<%= render :partial => 'note', :object => @note %>
</div>

View file

@ -1,10 +1,11 @@
<% if @saved -%>
TracksPages.hide_errors();
page_notify('notice', 'Note <%=@note.id %> saved', 5);
replace_note_form_with_updated_note();
<% else -%>
TracksForm.show_errors(html_for_error_messages());
TracksPages.show_errors(html_for_error_messages());
<% end %>
function replace_note_form_with_updated_note() {

View file

@ -2,7 +2,7 @@
<% if @go_to_project -%>
redirect_to ("<%= project_path(@project) -%>")
<% else -%>
TracksForm.hide_errors();
TracksPages.hide_errors();
hide_empty_message();
set_page_badge(<%= @down_count %>);
update_active_projects_container();
@ -10,7 +10,7 @@
clear_form();
<% end -%>
<% else -%>
TracksForm.show_errors(html_for_error_messages());
TracksPages.show_errors(html_for_error_messages());
<% end -%>
function hide_empty_message() {

View file

@ -11,11 +11,7 @@ ActionController::Routing::Routes.draw do |map|
contexts.resources :todos, :name_prefix => "context_"
end
map.resources :projects, :collection => {:order => :post, :alphabetize => :post} do |projects|
projects.resources :todos, :name_prefix => "project_"
end
map.resources :projects, :collection => {:order => :post, :actionize => :post} do |projects|
map.resources :projects, :collection => {:order => :post, :alphabetize => :post, :actionize => :post} do |projects|
projects.resources :todos, :name_prefix => "project_"
end

View file

@ -22,6 +22,12 @@ Feature: View, add, remove notes
And I should see note "My Note A" on the notes page
Then the badge should show 1
Scenario: Link to note
Given I have a project "Pass Final Exam" with 1 note
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
Scenario: Delete note from notes page
Given I have a project "Pass Final Exam" with 2 notes
@ -30,16 +36,9 @@ Feature: View, add, remove notes
Then the first note should disappear
And the badge should show 1
@selenium
Scenario: Link to note
Given I have a project "Pass Final Exam" with 1 note
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
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 first note to "edited note"
Then I should see "edited note"
Then I should see "edited note"

View file

@ -21,7 +21,6 @@ Feature: Integrate Tracks in various ways
Then I should see a message that you need a context to see scripts
Scenario: I can see scripts when I have one or more contexts
Given I have a context called "@pc"
When I go to the integrations page
Then I should see scripts

View file

@ -7,7 +7,7 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password
if response.respond_to? :selenium
selenium.wait_for_page_to_load(5000)
end
response.should contain(/Login successful/)
response.should contain(/Logout \(#{username}\)/)
@current_user = User.find_by_login(username)
end

File diff suppressed because it is too large Load diff