diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index a5ca04e1..3606f37e 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -102,7 +102,7 @@ class StatsController < ApplicationController next u unless u.end_with? '/' "#{u}index.html" - end&.uniq || [] + end&.uniq || [@site.url, @site.urls].flatten.uniq end def normalized_paths diff --git a/app/views/stats/index.haml b/app/views/stats/index.haml index e69c2546..fb5c0d52 100644 --- a/app/views/stats/index.haml +++ b/app/views/stats/index.haml @@ -18,15 +18,13 @@ = line_chart site_stats_host_path(@chart_params), **@chart_options .mb-5 - - original_urls = params[:urls]&.split("\n")&.map(&:strip) - - rows = original_urls.size.zero? ? 3 : original_urls.size %h2= t('.urls.title') %p.lead= t('.urls.description') %form %input{ type: 'hidden', name: 'interval', value: @interval } .form-group %label{ for: 'urls' }= t('.urls.label') - %textarea#urls.form-control{ name: 'urls', autocomplete: 'on', required: true, rows: rows, aria_describedby: 'help-urls' }= params[:urls] + %textarea#urls.form-control{ name: 'urls', autocomplete: 'on', required: true, rows: @normalized_urls.size, 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')