mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-09 18:58:51 +01:00
Add a bold state to emphasize the project status on the project detail page.
The bold state changes once the ajax operation is complete. Project status changes now also show a flash notice when the ajax operation completes. Add a selenium test to confirm this behavior. Fixed a bug where hiding a project would make deferred items hidden. Now we leave them deferred. Added a little breathing room between the project status options. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@395 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
f73401a850
commit
ead9a4cfe9
7 changed files with 38 additions and 4 deletions
|
|
@ -79,6 +79,8 @@ class ProjectController < ApplicationController
|
|||
@project_not_done_counts[@project.id] = @project.reload().not_done_todo_count(:include_project_hidden_todos => true)
|
||||
end
|
||||
render
|
||||
elsif params['update_status']
|
||||
render :action => 'update_status'
|
||||
else
|
||||
render :text => success_text || 'Success'
|
||||
end
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Project < ActiveRecord::Base
|
|||
|
||||
def hide_todos
|
||||
todos.each do |t|
|
||||
t.hide! unless t.completed?
|
||||
t.hide! unless t.completed? || t.deferred?
|
||||
t.save
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<td width="150"><label for="project_done">Project status:</label></td>
|
||||
<td width="300">
|
||||
<% ['active', 'hidden', 'completed'].each do | state | %>
|
||||
<%= radio_button(:project, 'state', state, {:class => 'project-done'}) %> <%= state.titlecase %>
|
||||
<%= radio_button(:project, 'state', state) %> <%= state.titlecase %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -35,8 +35,10 @@
|
|||
<h2>Status</h2>
|
||||
<div>
|
||||
<% ['active', 'hidden', 'completed'].each do | state | %>
|
||||
<% js = "new Ajax.Request('#{ url_for :controller => 'project', :action => 'update', :id => @project.id, :wants_render => false, 'project[state]' => state }', {asynchronous:true, evalScripts:true});" %>
|
||||
<%= radio_button(:project, 'state', state, {:class => 'project-done', :onclick => js}) %> <%= state.titlecase %>
|
||||
<% js = "new Ajax.Request('#{ url_for :controller => 'project', :action => 'update', :id => @project.id, :wants_render => false, :update_status => true, 'project[state]' => state }', {asynchronous:true, evalScripts:true});"
|
||||
span_class = @project.current_state.to_s == state ? 'active_state' : 'inactive_state'
|
||||
%>
|
||||
<span class="<%= state %>"><%= radio_button(:project, 'state', state, {:onclick => js}) %> <span class="<%= span_class %>"><%= state.titlecase %></span></span>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
10
tracks/app/views/project/update_status.rjs
Normal file
10
tracks/app/views/project/update_status.rjs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
page.select('#project_status .active span').each do |element|
|
||||
element.className = @project.current_state == :active ? 'active_state' : 'inactive_state'
|
||||
end
|
||||
page.select('#project_status .hidden span').each do |element|
|
||||
element.className = @project.current_state == :hidden ? 'active_state' : 'inactive_state'
|
||||
end
|
||||
page.select('#project_status .completed span').each do |element|
|
||||
element.className = @project.current_state == :completed ? 'active_state' : 'inactive_state'
|
||||
end
|
||||
page.notify :notice, "Set project status to #{@project.current_state}", 5.0
|
||||
|
|
@ -308,6 +308,12 @@ div.add_note_link {
|
|||
div#project_status > div {
|
||||
padding: 10px;
|
||||
}
|
||||
#project_status span {
|
||||
margin-right:5px;
|
||||
}
|
||||
#project_status .active_state {
|
||||
font-weight:bold;
|
||||
}
|
||||
a.footer_link {color: #cc3334; font-style: normal;}
|
||||
a.footer_link:hover {color: #fff; background-color: #cc3334 !important;}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
setup :fixtures => :all
|
||||
include_partial 'login/login', :username => 'admin', :password => 'abracadabra'
|
||||
open '/project/Build_a_working_time_machine'
|
||||
assert_checked 'project_state_active', 'ignored'
|
||||
assert_attribute 'css=#project_status .active span', 'class', 'active_state'
|
||||
assert_attribute 'css=#project_status .hidden span', 'class', 'inactive_state'
|
||||
assert_text 'badge_count', '2'
|
||||
click 'project_state_hidden'
|
||||
wait_for_attribute 'css=#project_status .active span', 'class', 'inactive_state'
|
||||
wait_for_attribute 'css=#project_status .hidden span', 'class', 'active_state'
|
||||
assert_text 'badge_count', '2'
|
||||
open '/project/Build_a_working_time_machine'
|
||||
assert_text 'badge_count', '2'
|
||||
assert_checked 'project_state_hidden', 'ignored'
|
||||
Loading…
Add table
Add a link
Reference in a new issue