mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
parent
2a6b8f1cd9
commit
b2e82ea6b6
9 changed files with 38 additions and 3 deletions
|
|
@ -83,10 +83,14 @@ class ContextsController < ApplicationController
|
||||||
end
|
end
|
||||||
@context.attributes = params["context"]
|
@context.attributes = params["context"]
|
||||||
if @context.save
|
if @context.save
|
||||||
if params['wants_render']
|
if boolean_param('wants_render')
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
elsif boolean_param('update_context_name')
|
||||||
|
@contexts = current_user.projects
|
||||||
|
render :template => 'contexts/update_context_name.js.rjs'
|
||||||
|
return
|
||||||
else
|
else
|
||||||
render :text => success_text || 'Success'
|
render :text => success_text || 'Success'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -136,6 +136,10 @@ class ProjectsController < ApplicationController
|
||||||
@initial_context_name = @project.default_context.name
|
@initial_context_name = @project.default_context.name
|
||||||
render :template => 'projects/update_default_context.js.rjs'
|
render :template => 'projects/update_default_context.js.rjs'
|
||||||
return
|
return
|
||||||
|
elsif boolean_param('update_project_name')
|
||||||
|
@projects = current_user.projects
|
||||||
|
render :template => 'projects/update_project_name.js.rjs'
|
||||||
|
return
|
||||||
else
|
else
|
||||||
render :text => success_text || 'Success'
|
render :text => success_text || 'Success'
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ class TodosController < ApplicationController
|
||||||
@contexts = current_user.contexts.find(:all) if @new_context_created
|
@contexts = current_user.contexts.find(:all) if @new_context_created
|
||||||
@projects = current_user.projects.find(:all) if @new_project_created
|
@projects = current_user.projects.find(:all) if @new_project_created
|
||||||
@initial_context_name = params['default_context_name']
|
@initial_context_name = params['default_context_name']
|
||||||
|
@initial_project_name = params['default_project_name']
|
||||||
render :action => 'create'
|
render :action => 'create'
|
||||||
end
|
end
|
||||||
format.xml do
|
format.xml do
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,9 @@
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<% if source_view_is :context %>
|
<% if source_view_is :context %>
|
||||||
<span class="in_place_editor_field" id="context_name_in_place_editor"><%= context.name %></span>
|
<span class="in_place_editor_field" id="context_name_in_place_editor"><%= context.name %></span>
|
||||||
<%= in_place_editor 'context_name_in_place_editor', { :url => { :controller => 'contexts', :action => 'update', :id => context.id, :field => 'name', :wants_render => false, :escape => false} , :options=>"{method:'put'}" } %>
|
<%= in_place_editor 'context_name_in_place_editor', {
|
||||||
|
:url => { :controller => 'contexts', :action => 'update', :id => context.id, :field => 'name', :update_context_name => true, :escape => false},
|
||||||
|
:options=>"{method:'put'}", :script => true } %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to_context( context ) %>
|
<%= link_to_context( context ) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
10
app/views/contexts/update_context_name.js.rjs
Normal file
10
app/views/contexts/update_context_name.js.rjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
page['context_name_in_place_editor'].replace_html @context.name
|
||||||
|
|
||||||
|
page['default_context_name_id'].value = @context.name
|
||||||
|
page['todo_context_name'].value = @context.name
|
||||||
|
|
||||||
|
# renew context auto complete array
|
||||||
|
page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true"
|
||||||
|
|
||||||
|
status_message = "Name of context was changed"
|
||||||
|
page.notify :notice, status_message, 5.0
|
||||||
|
|
@ -6,7 +6,9 @@
|
||||||
<a href="#" class="container_toggle" id="toggle_p<%= project.id %>"><%= image_tag("collapse.png") %></a>
|
<a href="#" class="container_toggle" id="toggle_p<%= project.id %>"><%= image_tag("collapse.png") %></a>
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="in_place_editor_field" id="project_name_in_place_editor"><%= project.name %></span>
|
<span class="in_place_editor_field" id="project_name_in_place_editor"><%= project.name %></span>
|
||||||
<%= in_place_editor 'project_name_in_place_editor', { :url => { :controller => 'projects', :action => 'update', :id => project.id, :field => 'name', :wants_render => false, :escape => false} , :options=>"{method:'put'}" } %>
|
<%= in_place_editor 'project_name_in_place_editor', {
|
||||||
|
:url => { :controller => 'projects', :action => 'update', :id => project.id, :field => 'name', :update_project_name => true, :escape => false} ,
|
||||||
|
:options=>"{method:'put'}", :script => true} %>
|
||||||
</h2>
|
</h2>
|
||||||
<% unless project.description.blank? -%>
|
<% unless project.description.blank? -%>
|
||||||
<div class="project_description"><%= sanitize(project.description) %></div>
|
<div class="project_description"><%= sanitize(project.description) %></div>
|
||||||
|
|
|
||||||
10
app/views/projects/update_project_name.js.rjs
Normal file
10
app/views/projects/update_project_name.js.rjs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
page['project_name_in_place_editor'].replace_html @project.name
|
||||||
|
|
||||||
|
page['default_project_name_id'].value = @project.name
|
||||||
|
page['todo_project_name'].value = @project.name
|
||||||
|
|
||||||
|
# renew project auto complete array
|
||||||
|
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true"
|
||||||
|
|
||||||
|
status_message = "Name of project was changed"
|
||||||
|
page.notify :notice, status_message, 5.0
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
<label for="todo_notes">Notes</label>
|
<label for="todo_notes">Notes</label>
|
||||||
<%= text_area( "todo", "notes", "cols" => 29, "rows" => 6, "tabindex" => 2) %>
|
<%= text_area( "todo", "notes", "cols" => 29, "rows" => 6, "tabindex" => 2) %>
|
||||||
|
|
||||||
|
<input id="default_project_name_id" name="default_project_name" type="hidden" value="<%=@initial_project_name-%>" />
|
||||||
<label for="todo_project_name">Project</label>
|
<label for="todo_project_name">Project</label>
|
||||||
<input id="todo_project_name" name="project_name" autocomplete="off" tabindex="3" size="30" type="text" value="<%= @initial_project_name %>" />
|
<input id="todo_project_name" name="project_name" autocomplete="off" tabindex="3" size="30" type="text" value="<%= @initial_project_name %>" />
|
||||||
<div class="page_name_auto_complete" id="project_list" style="display:none"></div>
|
<div class="page_name_auto_complete" id="project_list" style="display:none"></div>
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ if @saved
|
||||||
page['badge_count'].replace_html @down_count
|
page['badge_count'].replace_html @down_count
|
||||||
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
|
||||||
page['todo_context_name'].value = @initial_context_name
|
page['todo_context_name'].value = @initial_context_name
|
||||||
|
page['todo_project_name'].value = @initial_project_name
|
||||||
page << "updateContextNamesForAutoComplete(#{context_names_for_autocomplete})" if @new_context_created
|
page << "updateContextNamesForAutoComplete(#{context_names_for_autocomplete})" if @new_context_created
|
||||||
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}" if @new_project_created
|
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}" if @new_project_created
|
||||||
if should_show_new_item()
|
if should_show_new_item()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue