app/views/audit_rails/audits/analytics.html.erb in audit_rails-1.1.7 vs app/views/audit_rails/audits/analytics.html.erb in audit_rails-1.1.8

- old
+ new

@@ -1,61 +1,13 @@ -<br/> -<div> - <%= form_tag(analytics_audits_path) do %> - Begin: - <%= text_field_tag('analytics[range_begin]', @range_begin)%> - &nbsp;&nbsp;&nbsp;&nbsp; - End: - <%= text_field_tag('analytics[range_end]', @range_end)%> - <%= submit_tag('filter')%> - <% end %> +<div class="page-header"> + <h1>Analytics</h1> </div> + +<%= render partial: 'form' %> <br/> <br/> -<div class='left'> - <div id='analyticsByUser'>Total user clicks : <%= @total %></div> - <br/> - <canvas id="userViews" height="300" width="400"></canvas> - <script> - - var barChartData = { - labels : <%= "#{@analysis_by_user_name.keys}".html_safe %>, - datasets : [ - { - fillColor : "rgba(151,187,205,0.5)", - strokeColor : "rgba(220,220,220,1)", - pointColor : "rgba(220,220,220,1)", - pointStrokeColor : "#fff", - data : <%= @analysis_by_user_name.values %> - } - ] - - } - - var myBar = new Chart(document.getElementById("userViews").getContext("2d")).Bar(barChartData, {scaleLineWidth : 2, scaleLineColor : "rgba(0,0,0,.1)", scaleSteps : <%= @analysis_by_user_name.values.max/5 + 2%>, scaleOverride : true, scaleStepWidth: 5}); - - </script> -</div> -<div class='left'> - <div id='analyticsByPage'>Total page views: <%= @total %></div> - <br/> - <canvas id="pageViews" height="300" width="400"></canvas> - <script> - - var lineChartData = { - labels : <%= "#{@analysis_by_page_views.keys}".html_safe %>, - datasets : [ - { - fillColor : "rgba(151,187,205,0.5)", - strokeColor : "rgba(220,220,220,1)", - pointColor : "rgba(220,220,220,1)", - pointStrokeColor : "#fff", - data : <%= @analysis_by_page_views.values %> - } - ] - - } - - var myLine = new Chart(document.getElementById("pageViews").getContext("2d")).Line(lineChartData, {scaleLineWidth : 2, scaleLineColor : "rgba(0,0,0,.1)", scaleSteps : <%= @analysis_by_user_name.values.max/5 + 2%>, scaleOverride : true, scaleStepWidth: 5}); - - </script> -</div> +<% if @analysis_by_user_name == {} %> + <%= render partial: 'no_audits_available', locals: {no_audits: @no_audits} %> +<% else %> + <%= render partial: 'user_clicks' %> + <%= render partial: 'page_views' %> +<% end %> \ No newline at end of file