[Bps-public-commit] rt-extension-rightsdebugger branch, master, updated. 261bfdcf56f1e7be5e540e00db9594b1cac598ab

Shawn Moore shawn at bestpractical.com
Thu Mar 2 17:54:18 EST 2017


The branch, master has been updated
       via  261bfdcf56f1e7be5e540e00db9594b1cac598ab (commit)
      from  394e2b3fffa4722626d1834f9e1adfdf11f41196 (commit)

Summary of changes:
 html/Admin/RightsDebugger/index.html | 21 +++++++++++++++------
 lib/RT/Extension/RightsDebugger.pm   | 12 ++++++++++++
 static/css/rights-debugger.css       |  4 ++++
 3 files changed, 31 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 261bfdcf56f1e7be5e540e00db9594b1cac598ab
Author: Shawn M Moore <shawn at bestpractical.com>
Date:   Thu Mar 2 20:25:00 2017 +0000

    Render disabled records with a note and strikethru

diff --git a/html/Admin/RightsDebugger/index.html b/html/Admin/RightsDebugger/index.html
index 7ac11aa..38ebce1 100644
--- a/html/Admin/RightsDebugger/index.html
+++ b/html/Admin/RightsDebugger/index.html
@@ -13,13 +13,22 @@
 </form>
 
 <script type="text/x-template" id="debugger-record-template">
-  {{#if url}}
-      <a target="_blank" href="{{url}}">{{{label_highlighted}}}</a>
-  {{else}}
-      {{{label_highlighted}}}
-  {{/if}}
+  <span class="record {{#if disabled}}disabled{{/if}}">
+    <span class="name">
+      {{#if url}}
+        <a target="_blank" href="{{url}}">{{{label_highlighted}}}</a>
+      {{else}}
+        {{{label_highlighted}}}
+      {{/if}}
+    </span>
 
-  <span class="detail">{{{detail_highlighted}}}</span>
+    <span class="detail">
+      {{{detail_highlighted}}}
+      {{#if disabled}}
+        (disabled)
+      {{/if}}
+    </span>
+  </span>
 </script>
 
 <script type="text/x-template" id="debugger-result-template">
diff --git a/lib/RT/Extension/RightsDebugger.pm b/lib/RT/Extension/RightsDebugger.pm
index 9dd9925..099ea6a 100644
--- a/lib/RT/Extension/RightsDebugger.pm
+++ b/lib/RT/Extension/RightsDebugger.pm
@@ -74,6 +74,7 @@ sub SerializeRecord {
         label       => $self->LabelForRecord($record),
         detail      => $self->DetailForRecord($record),
         url         => $self->URLForRecord($record),
+        disabled    => $self->DisabledForRecord($record) ? JSON::true : JSON::false,
     };
 }
 
@@ -84,6 +85,17 @@ sub LabelForRecord {
     return $record->Name;
 }
 
+sub DisabledForRecord {
+    my $self = shift;
+    my $record = shift;
+
+    if ($record->can('Disabled')) {
+        return $record->Disabled;
+    }
+
+    return 0;
+}
+
 sub DetailForRecord {
     my $self = shift;
     my $record = shift;
diff --git a/static/css/rights-debugger.css b/static/css/rights-debugger.css
index 06898a6..53c94e4 100644
--- a/static/css/rights-debugger.css
+++ b/static/css/rights-debugger.css
@@ -47,3 +47,7 @@
     display: block;
 }
 
+#rights-debugger .results .result .record.disabled .name {
+    text-decoration: line-through;
+}
+

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list