mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 22:41:48 +01:00
Test and fix issue preventing editing the same context twice on the context listing page. Fixes #442
Remove unused edit_context partial. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@448 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
341e1fa603
commit
4c7d27004d
4 changed files with 39 additions and 26 deletions
|
|
@ -15,7 +15,7 @@
|
|||
<span class="grey">VISIBLE</span>
|
||||
<% end %>
|
||||
<a class="delete_context_button" href="<%= formatted_context_path(context, :js) %>" title="delete the context '<%= context.name %>'"><%= image_tag( "blank.png", :title => "Delete context", :class=>"delete_item") %></a>
|
||||
<% apply_behavior "a.delete_context_button:click", :prevent_default => true do |page|
|
||||
<%= apply_behavior "a.delete_context_button:click", :prevent_default => true do |page|
|
||||
page << "if (confirm('Are you sure that you want to ' + this.title + '?')) {"
|
||||
page << " new Ajax.Updater(this.up('.list'),"
|
||||
page << " this.href, {asynchronous:true,"
|
||||
|
|
@ -23,7 +23,7 @@
|
|||
page << " onLoading:function(request){ Effect.Fade(this.up('.list'));}}); };"
|
||||
end -%>
|
||||
<a class="edit_context_button" href="#"><%= image_tag( "blank.png", :title => "Edit context", :class=>"edit_item") %></a>
|
||||
<% apply_behavior 'a.edit_context_button:click', {:prevent_default => true } do |page, element|
|
||||
<%= apply_behavior 'a.edit_context_button:click', :prevent_default => true do |page, element|
|
||||
element.up('.context').toggle
|
||||
editform = element.up('.list').down('.edit-form')
|
||||
editform.toggle
|
||||
|
|
@ -38,13 +38,13 @@
|
|||
<table style="table-layout: fixed;" width="450">
|
||||
<%= render :partial => 'context_form', :object => context %>
|
||||
<tr>
|
||||
<td width="150"> <input type="hidden" name="wants_render" value="true" /></td>
|
||||
<td width="150"> <input type="hidden" name="wants_render" value="true" /> </td>
|
||||
<td width="300"><input type="submit" value="Update" /> <a href="#" class="form_reset">Cancel</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end -%>
|
||||
<% apply_behavior ".edit-context-form", make_remote_form(:complete => "Effect.Appear($(this).up('.list'));" ) %>
|
||||
<% apply_behavior "a.form_reset:click", :prevent_default => true do |page, element|
|
||||
<%= apply_behavior ".edit-context-form", make_remote_form(:complete => "Effect.Appear($(this).up('.list'));" ), :external => true %>
|
||||
<%= apply_behavior "a.form_reset:click", :prevent_default => true do |page, element|
|
||||
element.up('.list').down('.context').toggle
|
||||
element.up('.edit-form').toggle
|
||||
element.up('form').reset
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<%= hidden_field( "context", "id" ) %>
|
||||
<label for="context_name">Context name</label><br />
|
||||
<%= text_field( "context", "name" ) %>
|
||||
<br />
|
||||
<label for="new_context_on_front">Hide from front page?</label>
|
||||
<%= check_box( "context", "hide" ) %>
|
||||
<br />
|
||||
<br />
|
||||
|
|
@ -5,14 +5,15 @@
|
|||
ActiveRecord::Schema.define(:version => 28) do
|
||||
|
||||
create_table "contexts", :force => true do |t|
|
||||
t.column "name", :string, :default => "", :null => false
|
||||
t.column "position", :integer, :default => 0, :null => false
|
||||
t.column "hide", :boolean, :default => false
|
||||
t.column "user_id", :integer, :default => 1
|
||||
t.column "name", :string, :default => "", :null => false
|
||||
t.column "hide", :integer, :limit => 4, :default => 0, :null => false
|
||||
t.column "position", :integer, :default => 0, :null => false
|
||||
t.column "user_id", :integer, :default => 0, :null => false
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
end
|
||||
|
||||
add_index "contexts", ["user_id"], :name => "index_contexts_on_user_id"
|
||||
add_index "contexts", ["user_id", "name"], :name => "index_contexts_on_user_id_and_name"
|
||||
|
||||
create_table "notes", :force => true do |t|
|
||||
|
|
@ -64,13 +65,14 @@ ActiveRecord::Schema.define(:version => 28) do
|
|||
create_table "projects", :force => true do |t|
|
||||
t.column "name", :string, :default => "", :null => false
|
||||
t.column "position", :integer, :default => 0, :null => false
|
||||
t.column "user_id", :integer, :default => 1
|
||||
t.column "user_id", :integer, :default => 0, :null => false
|
||||
t.column "description", :text
|
||||
t.column "state", :string, :limit => 20, :default => "active", :null => false
|
||||
t.column "created_at", :datetime
|
||||
t.column "updated_at", :datetime
|
||||
end
|
||||
|
||||
add_index "projects", ["user_id"], :name => "index_projects_on_user_id"
|
||||
add_index "projects", ["user_id", "name"], :name => "index_projects_on_user_id_and_name"
|
||||
|
||||
create_table "sessions", :force => true do |t|
|
||||
|
|
@ -99,16 +101,16 @@ ActiveRecord::Schema.define(:version => 28) do
|
|||
add_index "tags", ["name"], :name => "index_tags_on_name"
|
||||
|
||||
create_table "todos", :force => true do |t|
|
||||
t.column "context_id", :integer, :default => 0, :null => false
|
||||
t.column "project_id", :integer
|
||||
t.column "description", :string, :default => "", :null => false
|
||||
t.column "context_id", :integer, :default => 0, :null => false
|
||||
t.column "description", :string, :limit => 100, :default => "", :null => false
|
||||
t.column "notes", :text
|
||||
t.column "created_at", :datetime
|
||||
t.column "due", :date
|
||||
t.column "completed_at", :datetime
|
||||
t.column "user_id", :integer, :default => 1
|
||||
t.column "project_id", :integer
|
||||
t.column "user_id", :integer, :default => 0, :null => false
|
||||
t.column "show_from", :date
|
||||
t.column "state", :string, :limit => 20, :default => "immediate", :null => false
|
||||
t.column "state", :string, :limit => 20, :default => "immediate", :null => false
|
||||
end
|
||||
|
||||
add_index "todos", ["user_id", "state"], :name => "index_todos_on_user_id_and_state"
|
||||
|
|
@ -118,10 +120,10 @@ ActiveRecord::Schema.define(:version => 28) do
|
|||
add_index "todos", ["user_id", "context_id"], :name => "index_todos_on_user_id_and_context_id"
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.column "login", :string, :limit => 80, :default => "", :null => false
|
||||
t.column "password", :string, :limit => 40, :default => "", :null => false
|
||||
t.column "login", :string, :limit => 80
|
||||
t.column "password", :string, :limit => 40
|
||||
t.column "word", :string
|
||||
t.column "is_admin", :boolean, :default => false, :null => false
|
||||
t.column "is_admin", :integer, :limit => 4, :default => 0, :null => false
|
||||
t.column "first_name", :string
|
||||
t.column "last_name", :string
|
||||
t.column "auth_type", :string, :default => "database", :null => false
|
||||
|
|
|
|||
19
tracks/test/selenium/context_listing/edit_twice.rsel
Normal file
19
tracks/test/selenium/context_listing/edit_twice.rsel
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
setup :fixtures => :all
|
||||
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
|
||||
open "/contexts"
|
||||
click "css=#context_3 .buttons img.edit_item"
|
||||
wait_for_visible "edit_context_3"
|
||||
wait_for_not_visible "context_3"
|
||||
type "//div[@id='edit_context_3'] //input[@name='context[name]']", "telegraph"
|
||||
click "//div[@id='edit_context_3'] //input[@value='Update']"
|
||||
wait_for_not_visible "edit_context_3"
|
||||
wait_for_visible "context_3"
|
||||
assert_text 'css=#context_3 .data a', 'telegraph'
|
||||
click "css=#context_3 .buttons img.edit_item"
|
||||
wait_for_visible "edit_context_3"
|
||||
wait_for_not_visible "context_3"
|
||||
type "//div[@id='edit_context_3'] //input[@name='context[name]']", "email"
|
||||
click "//div[@id='edit_context_3'] //input[@value='Update']"
|
||||
wait_for_not_visible "edit_context_3"
|
||||
wait_for_visible "context_3"
|
||||
assert_text 'css=#context_3 .data a', 'email'
|
||||
Loading…
Add table
Add a link
Reference in a new issue