mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
major restructuring/refactoring of application.js. finally scratched that itch. Some tests are failing to be fixed later.
This commit is contained in:
parent
88a524a8d6
commit
879fbc99e2
12 changed files with 606 additions and 642 deletions
|
|
@ -1,9 +1,12 @@
|
||||||
class NotesController < ApplicationController
|
class NotesController < ApplicationController
|
||||||
|
|
||||||
|
before_filter :set_source_view
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@all_notes = current_user.notes.all
|
@all_notes = current_user.notes.all
|
||||||
@count = @all_notes.size
|
@count = @all_notes.size
|
||||||
@page_title = "TRACKS::All notes"
|
@page_title = "TRACKS::All notes"
|
||||||
|
@source_view = 'note_list'
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.xml { render :xml => @all_notes.to_xml( :except => :user_id ) }
|
format.xml { render :xml => @all_notes.to_xml( :except => :user_id ) }
|
||||||
|
|
@ -66,4 +69,11 @@ class NotesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
protected
|
||||||
|
|
||||||
|
def set_source_view
|
||||||
|
@source_view = params['_source_view'] || 'note'
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<% if @saved -%>
|
<% if @saved -%>
|
||||||
hide_empty_message();
|
hide_empty_message();
|
||||||
TracksForm.hide_errors();
|
TracksPages.hide_errors();
|
||||||
set_page_badge(<%= @down_count %>);
|
set_page_badge(<%= @down_count %>);
|
||||||
add_context("<%=@context.hidden? ? 'hidden' : 'active'%>");
|
add_context("<%=@context.hidden? ? 'hidden' : 'active'%>");
|
||||||
clear_form();
|
clear_form();
|
||||||
<% else -%>
|
<% else -%>
|
||||||
TracksForm.show_errors(html_for_error_messages());
|
TracksPages.show_errors(html_for_error_messages());
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
function hide_empty_message() {
|
function hide_empty_message() {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<% form_for(note_edit_form, :html => {
|
<% form_for(note_edit_form, :html => {
|
||||||
:id => dom_id(note_edit_form, 'edit_form'),
|
:id => dom_id(note_edit_form, 'edit_form'),
|
||||||
:class => "inline-form edit-note-form",
|
:class => "inline-form edit-note-form",
|
||||||
:method => :post }) do |f|
|
:method => :put }) do |f|
|
||||||
-%>
|
-%>
|
||||||
|
|
||||||
<div id="error_status"><%= error_messages_for("note") %></div>
|
<div id="error_status"><%= error_messages_for("note") %></div>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<% if @saved -%>
|
<% if @saved -%>
|
||||||
TracksForm.hide_errors();
|
TracksPages.hide_errors();
|
||||||
add_note();
|
add_note();
|
||||||
clear_form();
|
clear_form();
|
||||||
<% else -%>
|
<% else -%>
|
||||||
TracksForm.show_errors(html_for_error_messages());
|
TracksPages.show_errors(html_for_error_messages());
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
function add_note() {
|
function add_note() {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,3 @@
|
||||||
<div id="display_box_projects">
|
<div id="display_box_projects">
|
||||||
<div class="container" id="note-<%= @note.id %>-wrapper">
|
<%= render :partial => 'note', :object => @note %>
|
||||||
<%= render :partial => 'note', :object => @note %>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
<% if @saved -%>
|
<% if @saved -%>
|
||||||
|
|
||||||
|
TracksPages.hide_errors();
|
||||||
page_notify('notice', 'Note <%=@note.id %> saved', 5);
|
page_notify('notice', 'Note <%=@note.id %> saved', 5);
|
||||||
replace_note_form_with_updated_note();
|
replace_note_form_with_updated_note();
|
||||||
|
|
||||||
<% else -%>
|
<% else -%>
|
||||||
TracksForm.show_errors(html_for_error_messages());
|
TracksPages.show_errors(html_for_error_messages());
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
function replace_note_form_with_updated_note() {
|
function replace_note_form_with_updated_note() {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<% if @go_to_project -%>
|
<% if @go_to_project -%>
|
||||||
redirect_to ("<%= project_path(@project) -%>")
|
redirect_to ("<%= project_path(@project) -%>")
|
||||||
<% else -%>
|
<% else -%>
|
||||||
TracksForm.hide_errors();
|
TracksPages.hide_errors();
|
||||||
hide_empty_message();
|
hide_empty_message();
|
||||||
set_page_badge(<%= @down_count %>);
|
set_page_badge(<%= @down_count %>);
|
||||||
update_active_projects_container();
|
update_active_projects_container();
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
clear_form();
|
clear_form();
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% else -%>
|
<% else -%>
|
||||||
TracksForm.show_errors(html_for_error_messages());
|
TracksPages.show_errors(html_for_error_messages());
|
||||||
<% end -%>
|
<% end -%>
|
||||||
|
|
||||||
function hide_empty_message() {
|
function hide_empty_message() {
|
||||||
|
|
|
||||||
|
|
@ -11,11 +11,7 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
contexts.resources :todos, :name_prefix => "context_"
|
contexts.resources :todos, :name_prefix => "context_"
|
||||||
end
|
end
|
||||||
|
|
||||||
map.resources :projects, :collection => {:order => :post, :alphabetize => :post} do |projects|
|
map.resources :projects, :collection => {:order => :post, :alphabetize => :post, :actionize => :post} do |projects|
|
||||||
projects.resources :todos, :name_prefix => "project_"
|
|
||||||
end
|
|
||||||
|
|
||||||
map.resources :projects, :collection => {:order => :post, :actionize => :post} do |projects|
|
|
||||||
projects.resources :todos, :name_prefix => "project_"
|
projects.resources :todos, :name_prefix => "project_"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,12 @@ Feature: View, add, remove notes
|
||||||
And I should see note "My Note A" on the notes page
|
And I should see note "My Note A" on the notes page
|
||||||
Then the badge should show 1
|
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
|
@selenium
|
||||||
Scenario: Delete note from notes page
|
Scenario: Delete note from notes page
|
||||||
Given I have a project "Pass Final Exam" with 2 notes
|
Given I have a project "Pass Final Exam" with 2 notes
|
||||||
|
|
@ -30,13 +36,6 @@ Feature: View, add, remove notes
|
||||||
Then the first note should disappear
|
Then the first note should disappear
|
||||||
And the badge should show 1
|
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
|
@selenium
|
||||||
Scenario: Edit a note
|
Scenario: Edit a note
|
||||||
Given I have a project "Pass Final Exam" with 2 notes
|
Given I have a project "Pass Final Exam" with 2 notes
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ Feature: Integrate Tracks in various ways
|
||||||
Then I should see a message that you need a context to see scripts
|
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
|
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
|
When I go to the integrations page
|
||||||
Then I should see scripts
|
Then I should see scripts
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ Given /^I have logged in as "(.*)" with password "(.*)"$/ do |username, password
|
||||||
if response.respond_to? :selenium
|
if response.respond_to? :selenium
|
||||||
selenium.wait_for_page_to_load(5000)
|
selenium.wait_for_page_to_load(5000)
|
||||||
end
|
end
|
||||||
response.should contain(/Login successful/)
|
response.should contain(/Logout \(#{username}\)/)
|
||||||
@current_user = User.find_by_login(username)
|
@current_user = User.find_by_login(username)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue