aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorLuc Donnet2015-05-18 12:41:13 +0200
committerLuc Donnet2015-05-18 12:41:13 +0200
commit3a997856387b2d50178c29c5bd728b133f2dcd84 (patch)
treeff0af160b83933dc42aafc593cfa4f31befd0a0b /app/assets/javascripts
parent1ee52cce4c325a58368f3e28e8070f7b3bb4f4f2 (diff)
downloadchouette-core-3a997856387b2d50178c29c5bd728b133f2dcd84.tar.bz2
Fix bugs Refs #0035525 #0035531 #0035523
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/application.js1
-rw-r--r--app/assets/javascripts/compliance_checks/show.js.coffee43
2 files changed, 44 insertions, 0 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index e3a32bf6b..b8e391129 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -24,6 +24,7 @@
//= require_directory ./vehicle_journeys
//= require_directory ./import_tasks
//= require_directory ./compliance_check_tasks
+//= require_directory ./compliance_checks
//= require_directory ./export_tasks
//= require_directory ./exports
//= require_directory ./lines
diff --git a/app/assets/javascripts/compliance_checks/show.js.coffee b/app/assets/javascripts/compliance_checks/show.js.coffee
new file mode 100644
index 000000000..8b3c2d6ca
--- /dev/null
+++ b/app/assets/javascripts/compliance_checks/show.js.coffee
@@ -0,0 +1,43 @@
+$(".compliance_checks.show, .imports.compliance_check").ready ->
+
+ get_compliance_check_results = (html_container, css_class) ->
+ html_container.each ->
+ if( $( this ).hasClass(css_class) )
+ $( this ).show()
+ else
+ $( this ).hide()
+
+ Morris.Donut({
+ element: 'error',
+ data: [
+ { label: $(".table").data('title-nok'), value: $("tr.nok_error").size() },
+ { label: $(".table").data('title-uncheck'), value: $("tr.uncheck_error").size() },
+ { label: $(".table").data('title-ok'), value: $("tr.ok_error").size() }
+ ],
+ colors: [ "#e22b1b", "#898e7f", "#8fc861" ]
+ }).on('click', update = (i, row) ->
+ switch i
+ when 0 then get_compliance_check_results( $(".report tbody tr"), "nok_error")
+ when 1 then get_compliance_check_results( $(".report tbody tr"), "uncheck_error")
+ when 2 then get_compliance_check_results( $(".report tbody tr"), "ok_error") )
+
+ Morris.Donut({
+ element: 'warning',
+ data: [
+ { label: $(".table").data('title-nok'), value: $("tr.nok_warning").size() },
+ { label: $(".table").data('title-uncheck'), value: $("tr.uncheck_warning").size() },
+ { label: $(".table").data('title-ok'), value: $("tr.ok_warning").size() }
+ ],
+ colors: [ "#ffbd2b", "#898e7f", "#8fc861" ]
+ }).on('click', update = (i, row) ->
+ switch i
+ when 0 then get_compliance_check_results( $(".report tbody tr"), "nok_warning")
+ when 1 then get_compliance_check_results( $(".report tbody tr"), "uncheck_warning")
+ when 2 then get_compliance_check_results( $(".report tbody tr"), "ok_warning") )
+
+ $(".notice").popover({ container: "body", html: false, trigger: "focus", placement: "bottom" })
+ # Hide and show error details
+ $(".title_error").each ->
+ $( this ).click ->
+ $(this).next(".details_error").toggle()
+ $(this).children("i").toggleClass("fa-plus-square fa-minus-square")