Skip to content

Commit

Permalink
editar_home
Browse files Browse the repository at this point in the history
  • Loading branch information
mvbvieira committed Jul 27, 2018
1 parent 6ee425d commit 8ca4b94
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 58 deletions.
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,5 @@ group :development do
gem 'spring-watcher-listen', '~> 2.0.0'
end


# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby]
111 changes: 57 additions & 54 deletions app/views/home/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
<div class="row">
<div class="col-6">
<h2 class="text-center">Gastos segregados por tipo</h2>
<canvas id="myChart" width="300px" height="300px"></canvas>
</div>

<div class="col-6">
<h2 class="text-center ">Ganhos segregados por tipo</h2>
<canvas id="myChart2" width="300" height="300"></canvas>
</div>
</div>
<script>
var ctx = $("#myChart");
data = {
datasets: [{
data: <%= @chart_data.values %>,

backgroundColor: ['#007bff', '#6610f2', '#6f42c1', '#e83e8c', '#dc3545', '#fd7e14', '#ffc107', '#28a745', '#20c997', '#17a2b8', '#343a40', '#00fdff']
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: <%= raw @chart_data.keys %>

};


var myPieChart = new Chart(ctx,{
type: 'doughnut',
data: data
});

</script>


<script>
var ctx = $("#myChart2");
data = {
datasets: [{
data: <%= @chart_data2.values %>,

backgroundColor: ['#3c9250', '#28a745', '#20c997', '#4879ad', '#007bff', '#6610f2', '#6f42c1']
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: <%= raw @chart_data2.keys %>

};


var myPieChart = new Chart(ctx,{
type: 'doughnut',
data: data
});


</script>
<% if user_signed_in?%>
<div class="row">
<div class="col-6">
<h2 class="text-center">Gastos segregados por tipo</h2>
<canvas id="myChart" width="300px" height="300px"></canvas>
</div>

<div class="col-6">
<h2 class="text-center ">Ganhos segregados por tipo</h2>
<canvas id="myChart2" width="300" height="300"></canvas>
</div>
</div>
<script>
var ctx = $("#myChart");
data = {
datasets: [{
data: <%= @chart_data.values %>,

backgroundColor: ['#007bff', '#6610f2', '#6f42c1', '#e83e8c', '#dc3545', '#fd7e14', '#ffc107', '#28a745', '#20c997', '#17a2b8', '#343a40', '#00fdff']
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: <%= raw @chart_data.keys %>

};


var myPieChart = new Chart(ctx,{
type: 'doughnut',
data: data
});

</script>


<script>
var ctx = $("#myChart2");
data = {
datasets: [{
data: <%= @chart_data2.values %>,

backgroundColor: ['#3c9250', '#28a745', '#20c997', '#4879ad', '#007bff', '#6610f2', '#6f42c1']
}],
// These labels appear in the legend and in the tooltips when hovering different arcs
labels: <%= raw @chart_data2.keys %>

};


var myPieChart = new Chart(ctx,{
type: 'doughnut',
data: data
});


</script>
<% else %>
<% end %>
7 changes: 4 additions & 3 deletions app/views/layouts/_navbar.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@

</div>
<% elsif !user_signed_in? %>
<li><%= link_to I18n.t(:sign_in), new_user_registration_path %></li>
<li><%= link_to I18n.t(:login), new_user_session_path %></li>

<div>
<%= link_to I18n.t(:sign_in), new_user_registration_path %> |
<%= link_to I18n.t(:login), new_user_session_path %>
</div>
<% elsif user_signed_in?%>
<form class="nav-item my-2 my-lg-0">
<%= current_user.email%>
Expand Down

0 comments on commit 8ca4b94

Please sign in to comment.