diff options
author | Christopher Long <indirecthit@gmail.com> | 2006-08-13 21:36:38 +0000 |
---|---|---|
committer | Christopher Long <indirecthit@gmail.com> | 2006-08-13 21:36:38 +0000 |
commit | 4f0118995c43fd3cb5f79ffcbaf10b1115d8e434 (patch) | |
tree | 2601b049abe8a716300b5c5b06d7c7fb6675517e /django | |
parent | 03e1b7f82136bf149adc9ee2ff629258c268f4e8 (diff) | |
download | django-4f0118995c43fd3cb5f79ffcbaf10b1115d8e434.tar.gz |
[per-object-permissions] Added "Apply Selected" button to RLP table that submits the selected row levle permissions to be changed.
git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
-rw-r--r-- | django/contrib/admin/media/js/row_level_permission.js | 26 | ||||
-rw-r--r-- | django/contrib/admin/templates/admin/row_level_permission.html | 60 |
2 files changed, 43 insertions, 43 deletions
diff --git a/django/contrib/admin/media/js/row_level_permission.js b/django/contrib/admin/media/js/row_level_permission.js index a99c36de92..23db14bf82 100644 --- a/django/contrib/admin/media/js/row_level_permission.js +++ b/django/contrib/admin/media/js/row_level_permission.js @@ -1,13 +1,31 @@ var row_level_permission = { - - copyToNew: function (id) { - var newForm = add_row_level_permission.form; + var newForm = document.getElementById("addRLPForm"); var form = document.getElementById("editRLPForm-"+id); newForm.owner.selectedIndex = form.owner.selectedIndex; newForm.perm.selectedIndex = form.perm.selectedIndex; newForm.negative.checked = form.negative.checked; - } + }, + + apply_selected: function () + { + var eleList = document.getElementsByName("apply_checkbox"); + var formList = []; + for(var i=0; eleList.length; i++) + { + var ele = eleList[i]; + if(ele.tagName == "INPUT") { + if(ele.checked) { + ele.form.submit(); + } + } + } + return false; + }, + + init: function() { + + } } diff --git a/django/contrib/admin/templates/admin/row_level_permission.html b/django/contrib/admin/templates/admin/row_level_permission.html index 8b44f07191..412a5da869 100644 --- a/django/contrib/admin/templates/admin/row_level_permission.html +++ b/django/contrib/admin/templates/admin/row_level_permission.html @@ -50,16 +50,17 @@ <h2>{% trans "Current Permissions" %}</h2> <table id="current-rlpTable"> <tr class="header"> -<th> + <th id="select_header"></th> +<th id="owner_header"> {% trans "Owner" %} </th> -<th> +<th id="perm_header"> {% trans "Permission" %} </th> -<th> +<th id="negative_header"> {% trans "Negative" %} </th> -<th> +<th id="options_header"> {% trans "Options" %} </th> </tr> @@ -68,10 +69,13 @@ {% load row_level_permission %} {% for o in rlp_form_list %} <tr id="editRLP-{{ o.rlp.id }}"> -<td colspan="4"> -<form id="editRLPForm-{{ o.rlp.id }}" class="editRLPForm" method="POST" name="editRLPForm-{{ rlp.id }}" action="../../../auth/row_level_permission/{% objref o.rlp %}/change/"> -<table> -<tr> +<!--<td colspan="5">--> +<form id="editRLPForm-{{ o.rlp.id }}" class="editRLPForm" method="POST" name="editRLPForm-{{ o.rlp.id }}" action="../../../auth/row_level_permission/{% objref o.rlp %}/change/"> +<!--<table> +<tr>--> + <td> + <input type="checkbox" name="apply_checkbox"> + </td> <td> {{ o.form.owner }} </td> @@ -89,43 +93,21 @@ <a href="../../../auth/row_level_permission/{% objref o.rlp %}/delete/" class="deleteLink">{% trans 'Delete' %}</a> | <a href="javascript:row_level_permission.copyToNew({{ o.rlp.id }})" class="copyToNewLink">{% trans 'Copy to New' %}</a> </td> -</tr> -</table> +<!--</tr> +</table>--> </form> </td> </tr> {% endfor %} +<tr align="right"> + <td colspan="5"> + <form id="apply_selected_form" method="POST" name="apply_selected_form" onsubmit="row_level_permission.apply_selected(); return false;"> + <input id="apply_selected_button" type="submit" value="{% trans 'Apply Selected' %}" /> + </form> + </td> +</tr> {% else %} <tr><td colspan=4><em>No row level permissions</em></td></tr> {% endif %} </TBODY> -</table> - -<table style="display: none"> -<tr id="empty_editRLP"> -<td colspan="4"> -<form id="empty_editRLPForm" method="POST" class="editRLPForm" name="empty-editRLPForm"> -<table> -<tr> - <td> - {{ empty_rlp_form.owner }} - </td> - <td> - {{ empty_rlp_form.perm }} - </td> - <td> - {{ empty_rlp_form.negative }} - </td> - <td> - <input id="applyButton" type="submit" value="{% trans 'Apply' %}" /> - <input id="cancelButton" type="reset" value="{% trans 'Reset' %}"/> - <br/> - <a class="deleteLink" >{% trans 'Delete' %}</a> | - <a class="copyToNewLink">{% trans 'Copy to New' %}</a> - </td> -</tr> -</table> -</form> -</td> -</tr> </table>
\ No newline at end of file |