Amélioration visuelle

master
Norore 2018-12-09 21:35:50 +01:00 committed by aeris
parent cbfdbc2f66
commit fce3be6d85
11 changed files with 260 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 975 B

View File

@ -0,0 +1,92 @@
//= require_self
//= require_tree .
@import "knacss"
$navbar-height: 3.25rem
body
padding-top: $navbar-height
a
color: $link-color-base
text-decoration: underline dashed
&:hover
color: $link-color-base-hover
text-decoration: underline dashed
header
position: fixed
top: 0
width: 100%
//height: $navbar-height
background-color: $header-bg-color
color: $background-base
h1
font-size: 1em
font-weight: bold
padding: 14px 16px
margin: 0
float: left
border-right: 1px solid $border-color-base
nav
ul
padding: 0
margin: 0
li
float: left
padding: 14px 16px
list-style-type: none
border-right: 1px solid $border-color-base
&:last-child
border-right: none
&:hover
background-color: darken($header-bg-color-contrast, 25%)
&.active
// background-color: $color-success
background-color: $header-bg-color-contrast
a
color: $background-base
text-decoration: none
&:hover, &:active, &:visited
color: $background-base
text-decoration: none
main
h1
color: $h1-text-color
h2
color: $h2-text-color
h3
color: $h3-text-color
h4
color: $h4-text-color
h5
color: $h5-text-color
h6
color: $h6-text-color
div.current
font-weight: 900
background-color: lighten($header-bg-color-contrast, 20%)
border: 1px solid lighten($header-bg-color-contrast, 20%)
&:hover
background-color: inherit
border-color: $link-color-base-hover
div.nodata
font-style: oblique
a
color: $link-color

View File

@ -0,0 +1,60 @@
@import "knacss"
.diff
overflow: auto
font-size: 0.75em
padding: 0.4em
border: 1px solid darken($border-color-base, 40%)
border-radius: .8em
box-shadow: 0px 0px 4px $border-color-base
.diff ul
background: #fff
overflow: auto
font-size: 0.75em
list-style: none
margin: 0
padding: 0
display: table
width: 100%
.diff del, .diff ins
display: block
text-decoration: none
.diff li
padding: 0
display: table-row
margin: 0
height: 1em
.diff li.ins
background: #dfd
color: #080
.diff li.del
background: #fee
color: #b00
.diff li:hover
background: #ffc
/* try 'whitespace:pre;' if you don't want lines to wrap */
.diff del, .diff ins, .diff span
white-space: pre-wrap
font-family: courier
.diff del strong
font-weight: normal
background: #fcc
.diff ins strong
font-weight: normal
background: #9f9
.diff li.diff-comment
display: none
.diff li.diff-block-info
background: none repeat scroll 0 0 gray

View File

@ -0,0 +1,16 @@
class DiffsController < ApplicationController
def index
last = Diff.order(created_at: :desc).limit(1).first
return redirect_to action: :show, id: last.created_at.to_date if last
end
def show
@dates = Diff.select(:created_at).distinct
@all_dates = []
@dates.each do |d|
@all_dates.push(d.created_at.to_date)
end
@date = Date.parse params[:id]
@diffs = Diff.where created_at: @date..@date+1
end
end

View File

@ -0,0 +1,3 @@
<h1 id="top">Changes for <%= l last.created_at.to_date %></h1>
<div class="alert--info">No changes found!</div>

View File

@ -0,0 +1,49 @@
<div class="autogrid txtcenter">
<% (-3..3).each do |n|
date = @date + n %>
<% if @all_dates.include?(date) %>
<%= content_tag :div, class: (:current if @date == date) do %>
<%= link_to l(date), diff_path(date) %>
<% end %>
<% else %>
<%= content_tag :div, class: (:nodata) do %>
<%= link_to l(date), diff_path(date) %>
<%end %>
<% end %>
<% end %>
</div>
<h1 id="top">Changes for <%= l @date %></h1>
<% if @diffs.empty? %>
<div class="alert--info">No changes found!</div>
<% end %>
<% @diffs.each do |diff|
site = diff.site %>
<div class="grid-10">
<div class="col-9">
<h3><%= link_to (site.name || site.url), site.url %></h3>
</div>
<div class="txtright">
<%= link_to "↑ Top ↑", diffs_path(anchor: :top) %>
</div>
</div>
<ul class="unstyled mls">
<% diff.content.each do |chunk| %>
<li>
<%=
target = chunk['target']
if target
target = Target.from_h target
content_tag :h4, target
end
%>
<%=
chunk = chunk['diff']
raw Diffy::Diff.load(chunk).to_s :html
%>
</li>
<% end %>
</ul>
<% end %>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<%= favicon_link_tag 'pulse.png', type: 'image/png', rel: 'icon' %>
<title>WebMon</title>
<%= stylesheet_link_tag 'application', media: 'all' %>
<%= csrf_meta_tags %>
<%= yield :head %>
</head>
<body>
<%= render partial: 'headers' %>
<main role="main" class="pam">
<%= yield %>
</main>
<%= javascript_include_tag 'application' %>
</body>
</html>

View File

@ -1,3 +1,3 @@
Rails.application.routes.draw do
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
resources :diffs, only: %i[index show]
end

View File

@ -0,0 +1,19 @@
$main-color: #080024; // colorname Black Russian
$main-color-contrast: #b34edc; //colorname Heliotrope
$header-bg-color: $main-color;
$header-bg-color-contrast: $main-color-contrast;
$border-color-base: darken($main-color-contrast, 25%);
$link-color-base: lighten($main-color, 15%);
$link-color-base-hover: darken($main-color-contrast, 25%);
// titres
$h1-text-color: darken($main-color-contrast, 30%);
$h2-text-color: darken($main-color-contrast, 40%);
$h3-text-color: darken($main-color-contrast, 50%);
$h4-text-color: darken($main-color-contrast, 60%);
$h5-text-color: darken($main-color-contrast, 70%);
$h6-text-color: darken($main-color-contrast, 80%);

View File

@ -1,5 +1,5 @@
// Config file and project variables
@import "custom";
// ----------------
// Breakpoints zone
// ----------------