diff options
author | 2015-12-13 13:29:59 +0100 | |
---|---|---|
committer | 2015-12-13 13:29:59 +0100 | |
commit | 1f4743f2ae61a7f443980359303d6d631b2426fc (patch) | |
tree | db1a8aafc861eb8fcbf15993090784fa86a55eea /ag-web.rb | |
parent | Use protocol-relative URI for the favicon (diff) | |
download | frontend-1f4743f2ae61a7f443980359303d6d631b2426fc.tar.gz frontend-1f4743f2ae61a7f443980359303d6d631b2426fc.tar.bz2 frontend-1f4743f2ae61a7f443980359303d6d631b2426fc.zip |
Style fixes
Diffstat (limited to 'ag-web.rb')
-rw-r--r-- | ag-web.rb | 41 |
1 files changed, 27 insertions, 14 deletions
@@ -1,7 +1,8 @@ -# /usr/bin/env ruby -# AgWeb -- displaying all the 'golden' flamewars on -dev -# Alex Legler <a3li@gentoo.org> -# AGPLv3 +#!/usr/bin/env ruby +# archives.gentoo.org: web frontend +# +# Copyright 2015 Alex Legler <a3li@gentoo.org> +# Licensed under the terms of the AGPLv3. require 'bundler/setup' require 'yaml' @@ -36,12 +37,12 @@ get '/:list/report/:msgid' do if result['hits']['total'] == 0 status 404 - body "Message not found." + body 'Message not found.' return end result_data = result['hits']['hits'].first - @title = "Report %s - %s" % [h(result_data['_source']['subject']), params[:list]] + @title = 'Report %s - %s' % [h(result_data['_source']['subject']), params[:list]] erb :report, locals: { message: result_data, list: params[:list] } rescue Exception => e @@ -58,12 +59,12 @@ post '/report' do if result['hits']['total'] == 0 status 404 - body "Message not found." + body 'Message not found.' return end result_data = result['hits']['hits'].first - @title = "Report %s - %s" % [h(result_data['_source']['subject']), params[:list]] + @title = 'Report %s - %s' % [h(result_data['_source']['subject']), params[:list]] msg = '' if params[:captcha] == $config['report_captcha'] @@ -110,11 +111,17 @@ get '/:list/threads/:year-:month/:page?' do max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil if result['hits']['total'] == 0 - redirect "/%s/messages/%s-%s/?no_threads=1" % [params[:list], params[:year], params[:month]] + redirect '/%s/messages/%s-%s/?no_threads=1' % [params[:list], params[:year], params[:month]] return end - erb :listmonth, locals: { results: result, list: params[:list], current_page: current_page, max_pages: max_pages, mode: :threads } + erb :listmonth, locals: { + results: result, + list: params[:list], + current_page: current_page, + max_pages: max_pages, + mode: :threads + } rescue => e $stderr.puts e.to_s status 500 @@ -131,11 +138,17 @@ get '/:list/messages/:year-:month/:page?' do max_pages = (result['hits']['total'].to_f / PER_PAGE).ceil if result['hits']['total'] == 0 - redirect "/%s/?no_messages=1" % params[:list] + redirect '/%s/?no_messages=1' % params[:list] return end - erb :listmonth, locals: { results: result, list: params[:list], current_page: current_page, max_pages: max_pages, mode: :messages } + erb :listmonth, locals: { + results: result, + list: params[:list], + current_page: current_page, + max_pages: max_pages, + mode: :messages + } rescue => e $stderr.puts e.to_s status 500 @@ -150,12 +163,12 @@ get '/:list/message/:msgid' do if result['hits']['total'] == 0 status 404 - body "Message not found." + body 'Message not found.' return end result_data = result['hits']['hits'].first - @title = "%s - %s" % [h(result_data['_source']['subject']), params[:list]] + @title = '%s - %s' % [h(result_data['_source']['subject']), params[:list]] parent_data = get_parent_data(params[:list], result_data['_source']['parent']) child_data = get_child_data(params[:list], params[:msgid]) |