Skip to content

Commit

Permalink
allow more customizations to widgets.
Browse files Browse the repository at this point in the history
  • Loading branch information
aesmail committed Sep 7, 2023
1 parent 35fcd6d commit 133c68e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions lib/kaffy_web/templates/home/_progress.html.eex
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<div class="col-md-<%= @widget.width %> grid-margin stretch-card">
<% color = Map.get(@widget, :color, "danger") %>
<% width = Map.get(@widget, :width, 6) %>
<div class="col-md-<%= width %> grid-margin stretch-card">
<div class="card shadow">
<div class="card-header">
<h4><%= @widget.title %></h4>
</div>
<div class="card-body">
<p class="font-weight-bold text-black"><%= @widget.content %> <span class="float-right"><%= @widget.percentage %>%</span></p>
<div class="progress">
<div class="progress-bar bg-danger" role="progressbar" style="width: <%= @widget.percentage %>%" aria-valuenow="<%= @widget.percentage %>" aria-valuemin="0" aria-valuemax="100"></div>
<div class="progress-bar bg-<%= color %>" role="progressbar" style="width: <%= @widget.percentage %>%" aria-valuenow="<%= @widget.percentage %>" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion lib/kaffy_web/templates/home/_text.html.eex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<div class="col-md-<%= @widget.width %> grid-margin stretch-card">
<% width = Map.get(@widget, :width, 6) %>
<div class="col-md-<%= width %> grid-margin stretch-card">
<div class="card shadow">
<div class="card-header py-3">
<h4><%= @widget.title %></h4>
Expand Down
9 changes: 6 additions & 3 deletions lib/kaffy_web/templates/home/_tidbit.html.eex
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div class="col-md-<%= @widget.width %> grid-margin stretch-card">
<div class="card shadow border-left-success">
<% color = Map.get(@widget, :color, "success") %>
<% width = Map.get(@widget, :width, 3) %>

<div class="col-md-<%= width %> grid-margin stretch-card">
<div class="card shadow border-left-<%= color %>">
<div class="card-body">
<p class="font-weight-normal mb-1 text-success"><strong><%= @widget.title %></strong> <i class="<%= if @widget[:full_icon] do %><%= @widget.full_icon %><% else %>fas fa-<%= @widget.icon %><% end %> float-right"></i></p>
<p class="font-weight-normal mb-1 text-<%= color %>"><strong><%= @widget.title %></strong> <i class="<%= if @widget[:full_icon] do %><%= @widget.full_icon %><% else %>fas fa-<%= @widget.icon %><% end %> float-right"></i></p>
<h2 class="mt-1"><%= @widget.content %></h2>
</div>
</div>
Expand Down

0 comments on commit 133c68e

Please sign in to comment.