mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 22:41:48 +01:00
* After project or context was edited in listing page, it could not be dragged. This is now fixed.
* Added in-place editing of to project and context detail pages git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@356 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
e96d91c5c0
commit
b243e0d393
8 changed files with 32 additions and 11 deletions
|
|
@ -66,10 +66,19 @@ class ContextController < ApplicationController
|
|||
def update
|
||||
self.init
|
||||
check_user_set_context
|
||||
params['context'] ||= {}
|
||||
success_text = if params['field'] == 'name' && params['value']
|
||||
params['context']['id'] = params['id']
|
||||
params['context']['name'] = params['value']
|
||||
end
|
||||
@context.attributes = params["context"]
|
||||
@context.name = deurlize(@context.name)
|
||||
if @context.save
|
||||
render :partial => 'context_listing', :object => @context
|
||||
if params['wants_render']
|
||||
render
|
||||
else
|
||||
render :text => success_text || 'Success'
|
||||
end
|
||||
else
|
||||
notify :warning, "Couldn't update new context"
|
||||
render :text => ""
|
||||
|
|
|
|||
|
|
@ -91,8 +91,15 @@ class ProjectController < ApplicationController
|
|||
def update
|
||||
self.init
|
||||
check_user_set_project
|
||||
@project.transition_to(params['project']['state'])
|
||||
params['project'].delete('state')
|
||||
params['project'] ||= {}
|
||||
if params['project']['state']
|
||||
@project.transition_to(params['project']['state'])
|
||||
params['project'].delete('state')
|
||||
end
|
||||
success_text = if params['field'] == 'name' && params['value']
|
||||
params['project']['id'] = params['id']
|
||||
params['project']['name'] = params['value']
|
||||
end
|
||||
@project.attributes = params['project']
|
||||
@project.name = deurlize(@project.name)
|
||||
if @project.save
|
||||
|
|
@ -103,9 +110,9 @@ class ProjectController < ApplicationController
|
|||
else
|
||||
@project_not_done_counts[@project.id] = @project.reload().not_done_todo_count(:include_project_hidden_todos => true)
|
||||
end
|
||||
render :partial => 'project_listing', :object => @project
|
||||
render
|
||||
else
|
||||
render :text => 'Success'
|
||||
render :text => success_text || 'Success'
|
||||
end
|
||||
else
|
||||
notify :warning, "Couldn't update project"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,11 @@
|
|||
<% if collapsible -%>
|
||||
<a href="#" class="container_toggle" id="toggle_c<%= context.id %>"><%= image_tag("collapse.png") %></a>
|
||||
<% end -%>
|
||||
<%= link_to( sanitize("#{context.name}"), { :controller => "context", :action => "show", :name => urlize(context.name) }, { :title => "Go to the #{context.name} context page" } ) %>
|
||||
<% if source_view_is :context %>
|
||||
<%= in_place_editor_field :context, :name, {}, { :url => url_for(:controller => 'context', :action => 'update', :id => context.id, :field => 'name', :wants_render => false) } %>
|
||||
<% else %>
|
||||
<%= link_to( sanitize("#{context.name}"), { :controller => "context", :action => "show", :name => urlize(context.name) }, { :title => "Go to the #{context.name} context page" } ) %>
|
||||
<% end %>
|
||||
</h2>
|
||||
<div id="c<%= context.id %>items" class="items toggle_target">
|
||||
<div id="c<%= context.id %>empty-nd" style="display:<%= @not_done.empty? ? 'block' : 'none'%>;">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
<% end %>
|
||||
|
||||
<%= link_to_remote( image_tag("blank", :title =>"Delete context", :class=>"delete_item"),
|
||||
:update => "container_#{context.id}",
|
||||
:loading => visual_effect(:fade, "container_#{context.id}"),
|
||||
:url => { :controller => "context", :action => "destroy", :id => context.id },
|
||||
:confirm => "Are you sure that you want to delete the context \'#{context.name}\'?" ) + " " +
|
||||
|
|
@ -29,12 +28,11 @@
|
|||
<div id="context-<%= context.id %>-edit-form" class="edit-form" style="display:none;">
|
||||
<%= form_remote_tag :url => { :controller => 'context', :action => 'update', :id => context.id },
|
||||
:html => { :id => "form-context-#{context.id}", :class => "inline-form" },
|
||||
:update => "container_#{context.id}",
|
||||
:complete => visual_effect(:appear, 'container_#{context.id}') %>
|
||||
<table style="table-layout: fixed;" width="450">
|
||||
<%= render :partial => 'context_form', :object => context %>
|
||||
<tr>
|
||||
<td width="150"> </td>
|
||||
<td width="150"> <input type="hidden" name="wants_render" value="false" /></td>
|
||||
<td width="300"><input type="submit" value="Update" /> <a href="javascript:void(0);" onclick="Element.toggle('context-<%= context.id %>','context-<%= context.id %>-edit-form');Form.reset('form-context-<%= context.id %>');">Cancel</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
|||
2
tracks/app/views/context/update.rjs
Normal file
2
tracks/app/views/context/update.rjs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
page.replace_html "container_#{@context.id}", :partial => 'context_listing', :object => @context
|
||||
page.sortable "list-contexts", get_listing_sortable_options
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<% if collapsible %>
|
||||
<a href="#" class="container_toggle" id="toggle_p<%= project.id %>"><%= image_tag("collapse.png") %></a>
|
||||
<% end %>
|
||||
<%= sanitize("#{project.name}") %>
|
||||
<%= in_place_editor_field :project, :name, {}, { :url => url_for(:controller => 'project', :action => 'update', :id => project.id, :field => 'name', :wants_render => false) } %>
|
||||
</h2>
|
||||
<% if @project.description -%>
|
||||
<div class="project_description"><%= sanitize(@project.description) %></div>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@
|
|||
<div id="project-<%= project.id %>-edit-form" class="edit-form" style="display:none;">
|
||||
<%= form_remote_tag :url => { :controller => 'project', :action => 'update', :id => project.id },
|
||||
:html => { :id => "form-project-#{project.id}", :class => "form" },
|
||||
:update => "container_#{project.id}",
|
||||
:complete => visual_effect(:appear, 'container_#{project.id}') %>
|
||||
<table style="table-layout: fixed;" width="450">
|
||||
<%= render :partial => 'project_form', :object => project %>
|
||||
|
|
|
|||
2
tracks/app/views/project/update.rjs
Normal file
2
tracks/app/views/project/update.rjs
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
page.replace_html "container_#{@project.id}", :partial => 'project_listing', :object => @project
|
||||
page.sortable "list-projects", get_listing_sortable_options
|
||||
Loading…
Add table
Add a link
Reference in a new issue