From 1734b8bfd647cd7d0bb729e1519248def78287ce Mon Sep 17 00:00:00 2001 From: Joerg Reichert Date: Sat, 26 Mar 2016 10:00:04 +0100 Subject: [PATCH 1/5] Login button entfernt --- app/assets/javascripts/application.js | 15 ------------ app/views/application/_login_button.html.slim | 9 ------- app/views/layouts/application.html.slim | 3 --- test/integration/authentication_test.rb | 24 ------------------- 4 files changed, 51 deletions(-) delete mode 100644 app/views/application/_login_button.html.slim delete mode 100644 test/integration/authentication_test.rb diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index c66d63d..02c7405 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -17,18 +17,3 @@ //= require_tree . $(function(){ $(document).foundation(); }); - -$('[data-persona-login]').click(function(e) { - e.preventDefault(); - navigator.id.get(function(assertion) { - if (assertion) { - if (assertion) { - var form = $('#browser-id-form'); - form.find('input[name=assertion]').val(assertion); - form.submit(); - } else { - // TODO: Handle failure - } - } - }); -}); diff --git a/app/views/application/_login_button.html.slim b/app/views/application/_login_button.html.slim deleted file mode 100644 index d7e8879..0000000 --- a/app/views/application/_login_button.html.slim +++ /dev/null @@ -1,9 +0,0 @@ -= form_tag '/auth/browser_id/callback', id: 'browser-id-form' - = hidden_field_tag(:assertion) - -- if signed_in? - = link_to session_path, data: { method: :delete, logout: true } - | Abmelden -- else - = link_to session_path, data: { 'persona-login' => true } - | Anmelden diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim index 6526e49..9d19b35 100644 --- a/app/views/layouts/application.html.slim +++ b/app/views/layouts/application.html.slim @@ -11,11 +11,8 @@ html .row .small-12.columns .clearfix - .right = render 'login_button' h1#title = link_to 'Stadtratmonitor Leipzig', root_path - flash.each do |name, msg| = content_tag :div, msg, class: name = yield - script src="https://login.persona.org/include.js" - = javascript_include_tag 'application', 'data-turbolinks-track' => true diff --git a/test/integration/authentication_test.rb b/test/integration/authentication_test.rb deleted file mode 100644 index e208374..0000000 --- a/test/integration/authentication_test.rb +++ /dev/null @@ -1,24 +0,0 @@ -require 'test_helper' - -class AuthenticationTest < ActionDispatch::IntegrationTest - test 'register via first time sign in and sign out' do - visit '/auth/developer' - fill_in 'Name', with: 'me' - fill_in 'Email', with: 'user@example.com' - click_button 'Sign In' - assert_equal '/leipzig', current_path - assert_is_signed_in - - click_link 'Abmelden' - assert_equal '/leipzig', current_path - assert_is_signed_out - end - - def assert_is_signed_in - assert_equal 'Abmelden', find('[data-logout]').text - end - - def assert_is_signed_out - assert_equal 'Anmelden', find('[data-persona-login]').text - end -end From 0718e86f074c362485bad6c3916f318aa1fa570b Mon Sep 17 00:00:00 2001 From: Joerg Reichert Date: Sat, 26 Mar 2016 13:33:27 +0100 Subject: [PATCH 2/5] added mapping for attribute published_at to fix sorting by date. Note this requires rebuilding the elasticsearch index --- app/models/paper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/models/paper.rb b/app/models/paper.rb index d84fb51..77ab1d3 100644 --- a/app/models/paper.rb +++ b/app/models/paper.rb @@ -27,6 +27,7 @@ class Paper < ActiveRecord::Base indexes :content, type: :string, analyzer: "german" indexes :resolution, type: :string, analyzer: "german" indexes :paper_type, type: :string, index: :not_analyzed + indexes :published_at, type: :date, index: :not_analyzed indexes :originator, type: :string, index: :not_analyzed end end From 5ef5975ad70409e8f9d35b7a9d762de74787a38a Mon Sep 17 00:00:00 2001 From: Joerg Reichert Date: Sat, 26 Mar 2016 13:40:39 +0100 Subject: [PATCH 3/5] by default sort by published date, as initial web site shows all papers and thus there is no query yet that can be sorted by relevance --- app/models/paper_search.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/paper_search.rb b/app/models/paper_search.rb index 1f99a1c..96a40d1 100644 --- a/app/models/paper_search.rb +++ b/app/models/paper_search.rb @@ -9,10 +9,10 @@ class PaperSearch < ActiveRecord::Base Elasticsearch::DSL::Search.search do sort do - if options[:sort_by] == 'date' - by :published_at, order: 'desc' + if options[:sort_by] == 'score' + by '_score' end - by '_score' + by :published_at, order: 'desc' end query do From 2139ccae04dce9715e93efd674b8aebf2ad84406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Reichert?= Date: Sat, 26 Mar 2016 14:39:27 +0100 Subject: [PATCH 4/5] Update README.md some usage documentation --- README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/README.md b/README.md index 4a8a6e6..fba2e15 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,27 @@ # Stadtratmonitor +## Usage / Features + +The Stadtratmonitor Leipzig is a lightweight user interface for performing full text searches against paper contents issued to the city council of Leipzig. Note, this solution uses the data from [Ratsinformationssystem Leipzig](https://ratsinfo.leipzig.de/bi/allris.net.asp) that also offers [text search capabilities](https://ratsinfo.leipzig.de/bi/yw010.asp). + +### Sorting + * Sort by date, paper was issued +![Papers sorted by publishing date](https://cloud.githubusercontent.com/assets/994131/14060246/b29c0356-f35e-11e5-837a-2106dd274694.JPG) + * Sort by relevance, e.g. how often the search keyword appears inside the title resp. the content of the paper +![Papers sorted by relevance](https://cloud.githubusercontent.com/assets/994131/14060257/f7491002-f35e-11e5-9d39-f36b81c35c33.JPG) +### Filtering + * By paper type +![Filter by paper type](https://cloud.githubusercontent.com/assets/994131/14060263/28c9d800-f35f-11e5-8c56-e8d208d85916.JPG) + * By originator +![Filter by originator](https://cloud.githubusercontent.com/assets/994131/14060267/4fa539a6-f35f-11e5-981e-2467daf2dee2.JPG) +### Staying up-to-date + * Subscribing + * [Firefox RSS extension](https://addons.mozilla.org/en-US/firefox/addon/rss-feed-icon-in-navbar/) + * [Google Chrome RSS extension](https://chrome.google.com/webstore/detail/rss-subscription-extensio/nlbjncdgjeocebhnmkbbbdekmmmcbfjd?hl=de) + * Reading + * [Google Chrome Extension](https://chrome.google.com/webstore/detail/rss-feed-reader/pnjaodmkngahhkoihejjehlcdlnohgmp) + * ... + [![Build Status](https://travis-ci.org/CodeforLeipzig/stadtratmonitor.png?branch=master)](https://travis-ci.org/CodeforLeipzig/stadtratmonitor) [![Coverage Status](https://coveralls.io/repos/github/CodeforLeipzig/stadtratmonitor/badge.svg?branch=master)](https://coveralls.io/github/CodeforLeipzig/stadtratmonitor?branch=master) [![Code Climate](https://codeclimate.com/github/CodeforLeipzig/stadtratmonitor/badges/gpa.svg)](https://codeclimate.com/github/CodeforLeipzig/stadtratmonitor) ## Setup From 29d879fee2bbc2a4316346bb94efc3096bc6e6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Reichert?= Date: Sat, 26 Mar 2016 15:32:45 +0100 Subject: [PATCH 5/5] Update README.md added RSSOWL example --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fba2e15..e0e9bcd 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,43 @@ The Stadtratmonitor Leipzig is a lightweight user interface for performing full ### Sorting * Sort by date, paper was issued + ![Papers sorted by publishing date](https://cloud.githubusercontent.com/assets/994131/14060246/b29c0356-f35e-11e5-837a-2106dd274694.JPG) + * Sort by relevance, e.g. how often the search keyword appears inside the title resp. the content of the paper + ![Papers sorted by relevance](https://cloud.githubusercontent.com/assets/994131/14060257/f7491002-f35e-11e5-9d39-f36b81c35c33.JPG) + ### Filtering * By paper type + ![Filter by paper type](https://cloud.githubusercontent.com/assets/994131/14060263/28c9d800-f35f-11e5-8c56-e8d208d85916.JPG) + * By originator + ![Filter by originator](https://cloud.githubusercontent.com/assets/994131/14060267/4fa539a6-f35f-11e5-981e-2467daf2dee2.JPG) + ### Staying up-to-date +#### General * Subscribing - * [Firefox RSS extension](https://addons.mozilla.org/en-US/firefox/addon/rss-feed-icon-in-navbar/) * [Google Chrome RSS extension](https://chrome.google.com/webstore/detail/rss-subscription-extensio/nlbjncdgjeocebhnmkbbbdekmmmcbfjd?hl=de) + * [Firefox RSS extension](https://addons.mozilla.org/en-US/firefox/addon/rss-feed-icon-in-navbar/) * Reading * [Google Chrome Extension](https://chrome.google.com/webstore/detail/rss-feed-reader/pnjaodmkngahhkoihejjehlcdlnohgmp) - * ... + * [Firefox Extension](https://addons.mozilla.org/en-US/firefox/addon/simple-rss-reader-srr) + * [RSSOWL](http://www.rssowl.org/) + +#### Example using Firefox and RSSOWL +Click on the newsfeed icon in the address bar +![Abonnieren mit Firefox](https://cloud.githubusercontent.com/assets/994131/14060508/fe7f4514-f366-11e5-85ae-2fa2e50b91ea.JPG) + +Copy the URL from the address bar +![RSS URL in Firefox](https://cloud.githubusercontent.com/assets/994131/14060515/30140e98-f367-11e5-9c77-86ba626e3c1b.JPG) + +Create a new Feed in RSSOWL and paste the just copied URL in the form +![RSSOWL Feed](https://cloud.githubusercontent.com/assets/994131/14060522/6c4a88ce-f367-11e5-8e0b-9d9f266306e2.JPG) + +When updating the feed in RSSOWL (or any other RSS reader of your choice) time after time all new papers matching the search query criteria will appear. [![Build Status](https://travis-ci.org/CodeforLeipzig/stadtratmonitor.png?branch=master)](https://travis-ci.org/CodeforLeipzig/stadtratmonitor) [![Coverage Status](https://coveralls.io/repos/github/CodeforLeipzig/stadtratmonitor/badge.svg?branch=master)](https://coveralls.io/github/CodeforLeipzig/stadtratmonitor?branch=master) [![Code Climate](https://codeclimate.com/github/CodeforLeipzig/stadtratmonitor/badges/gpa.svg)](https://codeclimate.com/github/CodeforLeipzig/stadtratmonitor)