mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-25 18:36:21 +00:00
70 lines
3 KiB
Text
70 lines
3 KiB
Text
.row
|
|
.col
|
|
%h1= t('.title')
|
|
%p.lead= t('.help')
|
|
- if @last_stat
|
|
%p
|
|
%small
|
|
= t('.last_update')
|
|
%time{ datetime: @last_stat.updated_at }
|
|
#{time_ago_in_words @last_stat.updated_at}.
|
|
|
|
%form.mb-5.form-inline{ method: 'get' }
|
|
- Stat::INTERVALS.each do |interval|
|
|
= link_to t(".#{interval}"), site_stats_path(interval: interval, urls: params[:urls], period_start: params[:period_start].to_date.try(:"beginning_of_#{interval}").to_date, period_end: params[:period_end]), class: "mb-0 btn #{'btn-primary active' if @interval == interval}"
|
|
|
|
%input.form-control{ type: 'date', name: :period_start, value: params[:period_start] }
|
|
%input.form-control{ type: 'date', name: :period_end, value: params[:period_end] }
|
|
%button.btn.mb-0{ type: 'submit' }= t('.filter')
|
|
|
|
.mb-5
|
|
%h2= t('.host.title', count: @hostnames.size)
|
|
%p.lead= t('.host.description')
|
|
= line_chart site_stats_host_path(@chart_params), **@chart_options
|
|
|
|
#custom-urls.mb-5
|
|
%h2= t('.urls.title')
|
|
%p.lead= t('.urls.description')
|
|
%form{ method: 'get', action: '#custom-urls' }
|
|
%input{ type: 'hidden', name: 'interval', value: @interval }
|
|
%input{ type: 'hidden', name: 'period_start', value: params[:period_start] }
|
|
%input{ type: 'hidden', name: 'period_end', value: params[:period_end] }
|
|
.form-group
|
|
%label{ for: 'urls' }= t('.urls.label')
|
|
%textarea#urls.form-control{ name: 'urls', autocomplete: 'on', required: true, rows: @normalized_urls.size + 1, aria_describedby: 'help-urls' }= @normalized_urls.join("\n")
|
|
%small#help-urls.feedback.form-text.text-muted= t('.urls.help')
|
|
.form-group
|
|
%button.btn{ type: 'submit' }= t('.urls.submit')
|
|
- if @normalized_urls.present?
|
|
= line_chart site_stats_uris_path(urls: @normalized_urls, **@chart_params), **@chart_options
|
|
|
|
.row.mb-5.row-cols-1.row-cols-md-2
|
|
- @columns.each_pair do |column, values|
|
|
- next if values.blank?
|
|
.col.mb-5
|
|
%h2= t(".columns.#{column}.title")
|
|
%p.lead= t(".columns.#{column}.description")
|
|
|
|
%table.table
|
|
%colgroup
|
|
%col
|
|
%col
|
|
%thead
|
|
%tr.sticky-top
|
|
%th{ scope: 'col' }= t(".columns.#{column}.column")
|
|
%th{ scope: 'col' }= t('.columns.visits')
|
|
%tfoot
|
|
%tbody
|
|
- values.each_pair do |col, val|
|
|
%tr
|
|
%th{ scope: 'row', style: 'word-break: break-all' }= col.blank? ? t(".columns.#{column}.empty") : col
|
|
%td= val
|
|
.mb-5
|
|
%h2= t('.resources.title')
|
|
%p.lead= t('.resources.description')
|
|
|
|
- Stat::RESOURCES.each do |resource|
|
|
.mb-5
|
|
%h3= t(".resources.#{resource}.title")
|
|
%p.lead= t(".resources.#{resource}.description")
|
|
= line_chart site_stats_resources_path(resource: resource, **@chart_params), **@chart_options.merge(StatsController::EXTRA_OPTIONS[resource])
|