Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug 938132: need to be able to delete rules from admin ui. r=nthomas
- Loading branch information
Showing
10 changed files
with
130 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ test.done | |
admin.ini | ||
.coverage | ||
htmlcov | ||
cef.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
$.fn.dataTableExt.oApi.fnAddTr = function ( oSettings, nTr, bRedraw ) { | ||
if ( typeof bRedraw == 'undefined' ) | ||
{ | ||
bRedraw = true; | ||
} | ||
|
||
var nTds = nTr.getElementsByTagName('td'); | ||
if ( nTds.length != oSettings.aoColumns.length ) | ||
{ | ||
alert( 'Warning: not adding new TR - columns and TD elements must match' ); | ||
return; | ||
} | ||
|
||
var aData = []; | ||
var aInvisible = []; | ||
for ( var i=0 ; i<nTds.length ; i++ ) | ||
{ | ||
aData.push( nTds[i].innerHTML ); | ||
if (!oSettings.aoColumns[i].bVisible) | ||
{ | ||
aInvisible.push( i ); | ||
} | ||
} | ||
|
||
/* Add the data and then replace DataTable's generated TR with ours */ | ||
var iIndex = this.oApi._fnAddData( oSettings, aData ); | ||
nTr._DT_RowIndex = iIndex; | ||
oSettings.aoData[ iIndex ].nTr = nTr; | ||
|
||
oSettings.aiDisplay = oSettings.aiDisplayMaster.slice(); | ||
|
||
// Hidding invisible columns | ||
for ( var i = (aInvisible.length - 1) ; i >= 0 ; i-- ) | ||
{ | ||
oSettings.aoData[iIndex]._anHidden[ i ] = nTds[aInvisible[i]]; | ||
nTr.removeChild( nTds[aInvisible[i]] ); | ||
} | ||
|
||
// Redraw | ||
if ( bRedraw ) | ||
{ | ||
this.oApi._fnReDraw( oSettings ); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,20 @@ | ||
{% if rule and form %} | ||
<tr> | ||
{% set rule_id = rule['rule_id'] %} | ||
{% set suffix = '_r'~rule_id %} | ||
{% set rule_id = rule['rule_id'] %} | ||
{% set suffix = '_r'~rule_id %} | ||
<tr id='rule_{{ rule_id }}'> | ||
{% include 'fragments/rule_form_row.html' %} | ||
<td id='Update{{ suffix }}' name='Update{{ suffix }}'> | ||
<input type='submit' name='submit' value='Update' onclick='submitRuleForm({{ rule_id }}); return false;' /> | ||
</td> | ||
<td id='Delete{{ suffix }}' name='Delete{{ suffix }}'> | ||
<input type='submit' name='submit' value='Delete' onclick='deleteRule({{ rule_id }}); return false;' /> | ||
</td> | ||
<td id='Clone{{ suffix }}' name='Clone{{ suffix }}'> | ||
<input type='button' name='clone' value='Clone' onclick='cloneRule($("#rules_form"), $("#new_rule_form"), "{{ rule_id }}")' /> | ||
</td> | ||
<td id='Revisions{{ suffix }}'> | ||
<input type='button' name='revisions' value='Revisions' | ||
onclick="location.href='/rules/{{ rule_id }}/revisions/'" /> | ||
</td> | ||
</tr> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters