From: <zn...@us...> - 2009-04-30 04:03:30
|
Revision: 872 http://crackerjack.svn.sourceforge.net/crackerjack/?rev=872&view=rev Author: znz Date: 2009-04-30 04:03:21 +0000 (Thu, 30 Apr 2009) Log Message: ----------- add removed item to select Modified Paths: -------------- trunk/viewsite/app/views/compare_results/index.html.erb trunk/viewsite/public/javascripts/application.js Modified: trunk/viewsite/app/views/compare_results/index.html.erb =================================================================== --- trunk/viewsite/app/views/compare_results/index.html.erb 2009-04-30 04:02:53 UTC (rev 871) +++ trunk/viewsite/app/views/compare_results/index.html.erb 2009-04-30 04:03:21 UTC (rev 872) @@ -23,7 +23,7 @@ <tr> <th>A \ B</th> <%- @cols.each do |col| -%> - <th class="col_<%= col.id %>"> + <th class="col_<%= col.id %>" id="col_name_<%= col.id %>"> <%=h col.display_name %> </th> <%- end -%> @@ -31,7 +31,7 @@ <%- @rows.each do |row| -%> <tr id="row_<%= row.id %>"> - <th> + <th id="row_name_<%= row.id %>"> <%=h row.display_name %> </th> <%- @cols.each do |col| -%> @@ -44,7 +44,7 @@ <%- end -%> <%- end -%> <td> - <button onclick="$('row_<%= row.id %>').remove()">Delete</button> + <button onclick="App.removeRow(<%= row.id %>)">Delete</button> </td> </tr> <%- end -%> @@ -53,7 +53,7 @@ <th></th> <%- @cols.each do |col| -%> <th class="col_<%= col.id %>"> - <button onclick="$$('.col_<%= col.id %>').each(function(e){e.remove();})">Delete</button> + <button onclick="App.removeCol(<%= col.id %>)">Delete</button> </th> <%- end -%> </tr> Modified: trunk/viewsite/public/javascripts/application.js =================================================================== --- trunk/viewsite/public/javascripts/application.js 2009-04-30 04:02:53 UTC (rev 871) +++ trunk/viewsite/public/javascripts/application.js 2009-04-30 04:03:21 UTC (rev 872) @@ -1,2 +1,17 @@ // Place your application-specific JavaScript functions and classes here // This file is automatically included by javascript_include_tag :defaults + +App = {}; +App.removeRow = function(row_id) { + var row_name = $('row_name_' + row_id).innerHTML.strip(); + $("row_add").insert("<option value='" + row_id+">" + row_name + "</option>"); + var row = $('row_' + row_id); + row.remove(); +}; +App.removeCol = function(col_id) { + var col_name = $('col_name_' + col_id).innerHTML.strip(); + $("col_add").insert("<option value='" + col_id+">" + col_name + "</option>"); + $$('.col_' + col_id).each(function(e){ + e.remove(); + }) +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |