[Pkg-mozext-commits] [requestpolicy] 13/100: Remove delete button for read only policies.
David Prévot
taffit at moszumanska.debian.org
Fri Dec 12 22:56:48 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 8af5dcbe0e505e83870749695c043331cd837661
Author: Christopher Bura <christopher.bura at gmail.com>
Date: Wed Sep 3 15:41:50 2014 -0400
Remove delete button for read only policies.
See
https://github.com/RequestPolicyContinued/requestpolicy/pull/459#issuecomment-54340418
---
src/content/settings/settings.css | 2 +-
src/content/settings/yourpolicy.js | 38 +++++++++++++++++++++-----------------
2 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/src/content/settings/settings.css b/src/content/settings/settings.css
index bebcbd2..933c01f 100644
--- a/src/content/settings/settings.css
+++ b/src/content/settings/settings.css
@@ -244,7 +244,7 @@ table.settings tr:not(:first-child) {
}
a.deleterule {
- color: rgba(255, 255, 255, 0);
+ color: #D0D0D0;
text-decoration: none;
font-weight: bold;
font-size: 1.2em;
diff --git a/src/content/settings/yourpolicy.js b/src/content/settings/yourpolicy.js
index 6c341aa..eec6dea 100644
--- a/src/content/settings/yourpolicy.js
+++ b/src/content/settings/yourpolicy.js
@@ -44,25 +44,25 @@ function populateRuleTable(filter) {
// Get and display user policies
var user = policyMgr._userPolicies['user'];
var entries = user.rawPolicy.toJSON()['entries'];
- addPolicies(entries, 'User', filter);
+ addPolicies(entries, 'User', filter, false);
// Get and display temorary policies
var temp = policyMgr._userPolicies['temp'];
var entries = temp.rawPolicy.toJSON()['entries'];
- addPolicies(entries, 'Temporary', filter);
+ addPolicies(entries, 'Temporary', filter, false);
// Get and display subscription policies
var subscription_lists = policyMgr._subscriptionPolicies;
for (subscription_list in subscription_lists) {
for (subscription in subscription_lists[subscription_list]) {
entries = subscription_lists[subscription_list][subscription].rawPolicy.toJSON()['entries'];
- addPolicies(entries, subscription, filter);
+ addPolicies(entries, subscription, filter, true);
}
}
}
-function addPolicies(entries, source, filter) {
+function addPolicies(entries, source, filter, read_only) {
var table = $('#rules');
for (var entry_type in entries) {
for (var i = 0; i < entries[entry_type].length; i++) {
@@ -74,7 +74,7 @@ function addPolicies(entries, source, filter) {
continue;
}
}
- addPolicyTableRow(table, entry_type, origin, dest, entry, source);
+ addPolicyTableRow(table, entry_type, origin, dest, entry, source, read_only);
}
}
}
@@ -87,7 +87,7 @@ function clearPolicyTable(table) {
}
}
-function addPolicyTableRow(table, type, origin, dest, ruleData, source) {
+function addPolicyTableRow(table, type, origin, dest, ruleData, source, read_only) {
var type_class = type == 'allow' ? 'allow' : 'block';
var rule_type = type == 'allow' ? _('allow') : _('block');
@@ -101,18 +101,22 @@ function addPolicyTableRow(table, type, origin, dest, ruleData, source) {
$('<td>').text(source)
);
- var anchor = $('<a>');
- anchor.text('x').addClass('deleterule');
- anchor.click(function () {
- if (type == 'allow') {
- rpService.removeAllowRule(ruleData);
- } else {
- rpService.removeDenyRule(ruleData);
- }
- row.remove();
- });
+ if (!read_only) {
+ var anchor = $('<a>');
+ anchor.text('x').addClass('deleterule');
+ anchor.click(function () {
+ if (type == 'allow') {
+ rpService.removeAllowRule(ruleData);
+ } else {
+ rpService.removeDenyRule(ruleData);
+ }
+ row.remove();
+ });
- row.append($('<td>').append(anchor));
+ row.append($('<td>').append(anchor));
+ } else {
+ row.append($('<td>'));
+ }
}
// TODO: remove code duplication with menu.js
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list