mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-10 01:24:19 +01:00
migrate editing project settings from project page from jrails to jquery
This commit is contained in:
parent
c834403340
commit
6416ff112e
8 changed files with 884 additions and 66 deletions
69
app/views/projects/update.js.erb
Normal file
69
app/views/projects/update.js.erb
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<% if @saved -%>
|
||||
pageNotify('notice', '<%=t('projects.project_saved_status')%>', 5);
|
||||
<% if source_view_is :project_list -%>
|
||||
<% if @state_changed -%>
|
||||
<% else -%>
|
||||
<% end -%>
|
||||
<% else # source_view must be :project %>
|
||||
$('#<%=dom_id(@project, 'edit')%>').hide();
|
||||
$('#<%=dom_id(@project, 'container')%>').html("<%= escape_javascript(render(:partial => 'project_settings', :locals => { :project => @project })) %> ");
|
||||
$('#<%=dom_id(@project)%>').show();
|
||||
$('input#todo_project_name').val("<%= escape_javascript(@project.name)%>");
|
||||
<% if @project.default_context %>
|
||||
$('input#todo_context_name').val("<%= escape_javascript(@project.default_context.name)%>");
|
||||
$('input[name=default_context_name]').val('<%= escape_javascript(@project.default_context.name)%>');
|
||||
<% end %>
|
||||
<% if @project.default_tags %>
|
||||
$('input#tag_list').val("<%= escape_javascript(@project.default_tags)%>");
|
||||
<% end %>
|
||||
<% end %>
|
||||
$('#default_project_name_id').val('<%= escape_javascript(@project.name)%>');
|
||||
$('input#todo_project_name').val("<%= escape_javascript(@project.name)%>");
|
||||
$('#project_name').html("<%= escape_javascript(@project.name)%>");
|
||||
$('#sidebar').html("<%= escape_javascript(render(:file => 'sidebar/sidebar.html.erb')) %>");
|
||||
<% else -%>
|
||||
$('div#error_status').html("<%= escape_javascript(error_messages_for('project')) %>");
|
||||
$('div#error_status').show();
|
||||
<% end %>
|
||||
enable_rich_interaction();
|
||||
|
||||
<%# *page << "console.log(\"hello\");"%>
|
||||
<%# *if @saved%>
|
||||
<%# *status_message = 'Project saved'%>
|
||||
<%# *page.notify :notice, status_message, 5.0%>
|
||||
<%# *if source_view_is :project_list%>
|
||||
<%# *if @state_changed%>
|
||||
<%#*page[dom_id(@project, 'container')].remove%>
|
||||
<%#*page.insert_html :bottom, "list-#{@project.state}-projects", :partial => 'project_listing', :object => @project%>
|
||||
<%# *else%>
|
||||
<%#*page.replace_html dom_id(@project, 'container'), :partial => 'project_listing', :object => @project%>
|
||||
<%# *end%>
|
||||
<%#*page.sortable "list-#{@project.state}-projects", get_listing_sortable_options("list-#{@project.state}-projects")%>
|
||||
<%#*page.replace_html "active-projects-count", @active_projects_count%>
|
||||
<%#*page.replace_html "hidden-projects-count", @hidden_projects_count%>
|
||||
<%#*page.replace_html "completed-projects-count", @completed_projects_count%>
|
||||
|
||||
<%#*page.set_element_visible("list-hidden-projects-container", @hidden_projects_count > 0)%>
|
||||
<%#*page.set_element_visible("list-active-projects-container", @active_projects_count > 0)%>
|
||||
<%#*page.set_element_visible("list-completed-projects-container", @completed_projects_count > 0)%>
|
||||
<%# *else%>
|
||||
<%# *page[dom_id(@project, 'edit')].hide%>
|
||||
<%# *page.replace_html dom_id(@project, 'container'), :partial => 'project_settings', :locals => { :project => @project }%>
|
||||
<%# *page[dom_id(@project)].show%>
|
||||
|
||||
<%# *page['todo_context_name'].value = @project.default_context.name if @project.default_context%>
|
||||
<%# *page['#todo_project_name'].value = @project.name%>
|
||||
<%# *page['tag_list'].value = @project.default_tags if @project.default_tags%>
|
||||
<%# *page << "$('input[name=default_context_name]').val('#{@project.default_context.name}');" if @project.default_context%>
|
||||
<%# *end%>
|
||||
|
||||
<%# *page['default_project_name_id'].value = @project.name%>
|
||||
<%# *page['todo_project_name'].value = @project.name%>
|
||||
<%# *page.replace_html "project_name", @project.name%>
|
||||
|
||||
<%# *page.replace_html "sidebar", :file => 'sidebar/sidebar.html.erb'%>
|
||||
<%# *else%>
|
||||
<%# *page.show 'error_status'%>
|
||||
<%# *page.replace_html 'error_status', "#{error_messages_for('project')}"%>
|
||||
<%# *end%>
|
||||
<%# *page << "enable_rich_interaction();"%>
|
||||
Loading…
Add table
Add a link
Reference in a new issue