aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2010-09-25 17:04:39 +0200
committerAlex Legler <alex@a3li.li>2010-09-25 17:04:39 +0200
commitd6160290e41f4a4c52fa606e86849b01383e95e0 (patch)
treeaff82b4cd21d9b927f730f0c25cee09e4a8e5d72 /app/helpers
parentCVEController: Various fixes (diff)
downloadglsamaker-d6160290e41f4a4c52fa606e86849b01383e95e0.tar.gz
glsamaker-d6160290e41f4a4c52fa606e86849b01383e95e0.tar.bz2
glsamaker-d6160290e41f4a4c52fa606e86849b01383e95e0.zip
CVETool: Major UI update
* Split list.erb into single templates * Add colorize method to a CVE * Filter said colorization in JS (cvepopup()) * Use full window width (resizing TBD) * Make quicksearch search cve_id and description fields
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/cve_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/cve_helper.rb b/app/helpers/cve_helper.rb
index 54daa5d..381f923 100644
--- a/app/helpers/cve_helper.rb
+++ b/app/helpers/cve_helper.rb
@@ -3,4 +3,17 @@ module CveHelper
def make_js_safe(str)
str.gsub("'", "\'")
end
+
+ # Converts a bit mask to a condition usable by AR
+ def view_mask_to_condition(mask)
+ conditions = []
+
+ conditions << 'state = "NEW"' if mask & 1 == 1
+ conditions << 'state = "ASSIGNED"' if mask & 2 == 2
+ conditions << 'state = "LATER"' if mask & 4 == 4
+ conditions << 'state = "NFU"' if mask & 8 == 8
+ conditions << 'state = "INVALID"' if mask & 16 == 16
+
+ conditions.join(' OR ')
+ end
end