2019-08-02 00:20:42 +00:00
|
|
|
.row
|
|
|
|
.col
|
|
|
|
%h1= t('.title')
|
|
|
|
%p.lead= t('.help')
|
2021-10-20 15:53:42 +00:00
|
|
|
- if @last_stat
|
|
|
|
%p
|
|
|
|
%small
|
|
|
|
= t('.last_update')
|
2022-04-30 17:07:34 +00:00
|
|
|
%time{ datetime: @last_stat.updated_at }
|
|
|
|
#{time_ago_in_words @last_stat.updated_at}.
|
2019-08-02 00:20:42 +00:00
|
|
|
|
2022-04-30 23:42:38 +00:00
|
|
|
%form.mb-5.form-inline{ method: 'get' }
|
2021-10-09 18:50:38 +00:00
|
|
|
- Stat::INTERVALS.each do |interval|
|
2024-06-04 15:49:37 +00:00
|
|
|
= 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 #{@interval == interval ? 'btn-primary active' : 'btn-secondary'}"
|
2022-04-30 23:42:38 +00:00
|
|
|
|
2024-06-04 15:49:37 +00:00
|
|
|
%input.form-control{ type: 'date',
|
|
|
|
name: :period_start,
|
|
|
|
value: params[:period_start] }
|
|
|
|
%input.form-control{ type: 'date',
|
|
|
|
name: :period_end,
|
|
|
|
value: params[:period_end] }
|
2024-01-12 17:11:29 +00:00
|
|
|
%button.btn.btn-secondary.mb-0{ type: 'submit' }= t('.filter')
|
2021-10-08 19:31:02 +00:00
|
|
|
|
2021-10-09 20:28:56 +00:00
|
|
|
.mb-5
|
2021-10-08 21:39:55 +00:00
|
|
|
%h2= t('.host.title', count: @hostnames.size)
|
|
|
|
%p.lead= t('.host.description')
|
|
|
|
= line_chart site_stats_host_path(@chart_params), **@chart_options
|
|
|
|
|
2024-06-04 15:49:37 +00:00
|
|
|
.mb-5#custom-urls
|
2021-10-09 20:27:45 +00:00
|
|
|
%h2= t('.urls.title')
|
|
|
|
%p.lead= t('.urls.description')
|
2022-06-11 22:33:02 +00:00
|
|
|
%form{ method: 'get', action: '#custom-urls' }
|
2024-06-04 15:49:37 +00:00
|
|
|
%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] }
|
2021-10-09 20:27:45 +00:00
|
|
|
.form-group
|
|
|
|
%label{ for: 'urls' }= t('.urls.label')
|
2024-06-04 15:49:37 +00:00
|
|
|
%textarea.form-control#urls{ name: 'urls',
|
|
|
|
autocomplete: 'on',
|
|
|
|
required: true,
|
|
|
|
rows: @normalized_urls.size + 1,
|
|
|
|
aria_describedby: 'help-urls' }= @normalized_urls.join("\n")
|
|
|
|
%small.feedback.form-text.text-muted#help-urls= t('.urls.help')
|
2021-10-09 20:27:45 +00:00
|
|
|
.form-group
|
2024-01-12 17:11:29 +00:00
|
|
|
%button.btn.btn-secondary{ type: 'submit' }= t('.urls.submit')
|
2021-10-09 20:27:45 +00:00
|
|
|
- if @normalized_urls.present?
|
2022-04-26 19:57:57 +00:00
|
|
|
= line_chart site_stats_uris_path(urls: @normalized_urls, **@chart_params), **@chart_options
|
2021-10-09 20:27:45 +00:00
|
|
|
|
2023-04-20 21:23:58 +00:00
|
|
|
.row.mb-5.row-cols-1.row-cols-lg-2
|
2022-04-30 20:55:53 +00:00
|
|
|
- @columns.each_pair do |column, values|
|
|
|
|
- next if values.blank?
|
2024-06-04 15:49:37 +00:00
|
|
|
|
2022-04-30 20:55:53 +00:00
|
|
|
.col.mb-5
|
|
|
|
%h2= t(".columns.#{column}.title")
|
|
|
|
%p.lead= t(".columns.#{column}.description")
|
|
|
|
|
|
|
|
%table.table
|
|
|
|
%colgroup
|
|
|
|
%col
|
|
|
|
%col
|
|
|
|
%thead
|
2022-04-30 21:42:50 +00:00
|
|
|
%tr.sticky-top
|
2022-04-30 20:55:53 +00:00
|
|
|
%th{ scope: 'col' }= t(".columns.#{column}.column")
|
|
|
|
%th{ scope: 'col' }= t('.columns.visits')
|
|
|
|
%tfoot
|
|
|
|
%tbody
|
|
|
|
- values.each_pair do |col, val|
|
|
|
|
%tr
|
2024-06-04 15:49:37 +00:00
|
|
|
%th.break-all{ scope: 'row' }
|
|
|
|
= col.blank? ? t(".columns.#{column}.empty") : col
|
2022-04-30 20:55:53 +00:00
|
|
|
%td= val
|
2021-10-09 21:25:43 +00:00
|
|
|
.mb-5
|
|
|
|
%h2= t('.resources.title')
|
|
|
|
%p.lead= t('.resources.description')
|
|
|
|
|
2021-10-09 18:50:38 +00:00
|
|
|
- Stat::RESOURCES.each do |resource|
|
2021-10-09 20:28:56 +00:00
|
|
|
.mb-5
|
2021-10-09 21:25:43 +00:00
|
|
|
%h3= t(".resources.#{resource}.title")
|
2021-10-08 21:39:55 +00:00
|
|
|
%p.lead= t(".resources.#{resource}.description")
|
2024-06-04 15:49:37 +00:00
|
|
|
= line_chart site_stats_resources_path(resource: resource, **@chart_params),
|
|
|
|
**@chart_options.merge(StatsController::EXTRA_OPTIONS[resource])
|