quick_search-core 0.0.1.test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +168 -0
- data/Rakefile +6 -0
- data/app/assets/images/quick_search/askus.gif +0 -0
- data/app/assets/images/quick_search/favicon.ico +0 -0
- data/app/assets/images/quick_search/greybox.png +0 -0
- data/app/assets/images/quick_search/homescreen-icon-64x64.png +0 -0
- data/app/assets/images/quick_search/ncsu-library-logo-white.png +0 -0
- data/app/assets/javascripts/quick_search/appstats.js +8 -0
- data/app/assets/javascripts/quick_search/event_tracking.js.erb +257 -0
- data/app/assets/javascripts/quick_search/google_analytics.js.erb +8 -0
- data/app/assets/javascripts/quick_search/opensearch.js +2 -0
- data/app/assets/javascripts/quick_search/pages.js.coffee +3 -0
- data/app/assets/javascripts/quick_search/quicksearch.js +33 -0
- data/app/assets/javascripts/quick_search/realtime.js.erb +12 -0
- data/app/assets/javascripts/quick_search/search.js +3 -0
- data/app/assets/javascripts/quick_search/xhr_search.js +82 -0
- data/app/assets/javascripts/quick_search.js.erb +20 -0
- data/app/assets/stylesheets/foundation_and_overrides.scss +1327 -0
- data/app/assets/stylesheets/quick_search/appstats.css.scss +7 -0
- data/app/assets/stylesheets/quick_search/opensearch.css.scss +3 -0
- data/app/assets/stylesheets/quick_search/pages.css.scss +3 -0
- data/app/assets/stylesheets/quick_search/quick_search.css.scss +248 -0
- data/app/assets/stylesheets/quick_search/search.css.scss +3 -0
- data/app/assets/stylesheets/quick_search.css.scss.erb +7 -0
- data/app/controllers/concerns/quick_search/auth.rb +22 -0
- data/app/controllers/concerns/quick_search/doi_trap.rb +43 -0
- data/app/controllers/concerns/quick_search/encode_utf8.rb +12 -0
- data/app/controllers/concerns/quick_search/on_campus.rb +43 -0
- data/app/controllers/concerns/quick_search/query_filter.rb +25 -0
- data/app/controllers/concerns/quick_search/query_parser.rb +54 -0
- data/app/controllers/concerns/quick_search/searcher_concern.rb +101 -0
- data/app/controllers/concerns/quick_search/searcher_config.rb +16 -0
- data/app/controllers/quick_search/application_controller.rb +7 -0
- data/app/controllers/quick_search/appstats_controller.rb +210 -0
- data/app/controllers/quick_search/opensearch_controller.rb +9 -0
- data/app/controllers/quick_search/pages_controller.rb +18 -0
- data/app/controllers/quick_search/search_controller.rb +250 -0
- data/app/helpers/quick_search/application_helper.rb +68 -0
- data/app/helpers/quick_search/appstats_helper.rb +2 -0
- data/app/helpers/quick_search/opensearch_helper.rb +2 -0
- data/app/helpers/quick_search/pages_helper.rb +2 -0
- data/app/helpers/quick_search/search_helper.rb +2 -0
- data/app/models/event.rb +2 -0
- data/app/models/search.rb +11 -0
- data/app/searchers/quick_search/best_bets_searcher.rb +102 -0
- data/app/searchers/quick_search/searcher.rb +43 -0
- data/app/views/layouts/quick_search/_best_bets.html.erb +18 -0
- data/app/views/layouts/quick_search/_common_searches.html.erb +15 -0
- data/app/views/layouts/quick_search/_found_types.html.erb +13 -0
- data/app/views/layouts/quick_search/_google_analytics.html.erb +24 -0
- data/app/views/layouts/quick_search/_more_options.html.erb +10 -0
- data/app/views/layouts/quick_search/_page_title.html.erb +8 -0
- data/app/views/layouts/quick_search/_related_topics.html.erb +8 -0
- data/app/views/layouts/quick_search/_search_form.html.erb +19 -0
- data/app/views/layouts/quick_search/_spelling_suggestion.html.erb +13 -0
- data/app/views/layouts/quick_search/_topic_snippet.html.erb +5 -0
- data/app/views/layouts/quick_search/application.html.erb +40 -0
- data/app/views/quick_search/appstats/_click_count_table.html.erb +23 -0
- data/app/views/quick_search/appstats/_datatables.html.erb +12 -0
- data/app/views/quick_search/appstats/_date_range.html.erb +15 -0
- data/app/views/quick_search/appstats/_menu.html.erb +16 -0
- data/app/views/quick_search/appstats/_top_spot_report_table.html.erb +33 -0
- data/app/views/quick_search/appstats/clicks_overview.html.erb +20 -0
- data/app/views/quick_search/appstats/index.html.erb +31 -0
- data/app/views/quick_search/appstats/module_click_detail.html.erb +32 -0
- data/app/views/quick_search/appstats/realtime.html.erb +15 -0
- data/app/views/quick_search/appstats/top_searches.html.erb +38 -0
- data/app/views/quick_search/appstats/top_spot.html.erb +14 -0
- data/app/views/quick_search/appstats/top_spot_detail.html.erb +35 -0
- data/app/views/quick_search/kaminari/_first_page.html.erb +12 -0
- data/app/views/quick_search/kaminari/_gap.html.erb +11 -0
- data/app/views/quick_search/kaminari/_last_page.html.erb +12 -0
- data/app/views/quick_search/kaminari/_next_page.html.erb +12 -0
- data/app/views/quick_search/kaminari/_page.html.erb +13 -0
- data/app/views/quick_search/kaminari/_paginator.html.erb +25 -0
- data/app/views/quick_search/kaminari/_prev_page.html.erb +11 -0
- data/app/views/quick_search/opensearch/opensearch.xml.builder +11 -0
- data/app/views/quick_search/pages/about.html.erb +9 -0
- data/app/views/quick_search/pages/home.html.erb +6 -0
- data/app/views/quick_search/pages/realtime.html.erb +15 -0
- data/app/views/quick_search/search/_citation.html.erb +18 -0
- data/app/views/quick_search/search/_module.html.erb +37 -0
- data/app/views/quick_search/search/_module_with_paging.html.erb +14 -0
- data/app/views/quick_search/search/_no_results.html.erb +11 -0
- data/app/views/quick_search/search/_result.html.erb +17 -0
- data/app/views/quick_search/search/_result_details.html.erb +45 -0
- data/app/views/quick_search/search/_result_no_thumbnail.html.erb +3 -0
- data/app/views/quick_search/search/_result_title.html.erb +4 -0
- data/app/views/quick_search/search/_result_with_thumbnail.html.erb +21 -0
- data/app/views/quick_search/search/_search_error.html.erb +9 -0
- data/app/views/quick_search/search/_see_all.html.erb +11 -0
- data/app/views/quick_search/search/_xhr_response.html.erb +15 -0
- data/app/views/quick_search/search/_xhr_response.json.erb +14 -0
- data/app/views/quick_search/search/_xhr_response_with_paging.html.erb +1 -0
- data/app/views/quick_search/search/index.html.erb +100 -0
- data/config/application.rb +25 -0
- data/config/best_bets.yml +86 -0
- data/config/boot.rb +4 -0
- data/config/database.yml.example +31 -0
- data/config/locales/en.yml +30 -0
- data/config/quicksearch_config.yml.example +69 -0
- data/config/routes.rb +81 -0
- data/db/migrate/20140130202859_create_events.rb +11 -0
- data/db/migrate/20140130202944_create_searches.rb +9 -0
- data/db/migrate/20140225145441_add_page_to_searches.rb +5 -0
- data/db/schema.rb +31 -0
- data/db/seeds.rb +7 -0
- data/lib/benchmark_logger.rb +2 -0
- data/lib/capistrano/tasks/access_check.cap +10 -0
- data/lib/generators/quick_search/install_generator.rb +49 -0
- data/lib/generators/quick_search/templates/kaminari.rb +5 -0
- data/lib/generators/quick_search/templates/post_install.txt +8 -0
- data/lib/generators/quick_search/templates/quick_search_config.yml +58 -0
- data/lib/quick_search/engine.rb +16 -0
- data/lib/quick_search/version.rb +3 -0
- data/lib/quick_search.rb +12 -0
- data/lib/tasks/best_bets.rake +29 -0
- data/test/controllers/appstats_controller_test.rb +7 -0
- data/test/controllers/concerns/doi_trap_test.rb +19 -0
- data/test/controllers/concerns/on_campus_test.rb +19 -0
- data/test/controllers/concerns/query_parser_test.rb +47 -0
- data/test/controllers/opensearch_controller_test.rb +13 -0
- data/test/controllers/pages_controller_test.rb +7 -0
- data/test/controllers/search_controller_test.rb +15 -0
- data/test/fixtures/events.yml +11 -0
- data/test/fixtures/searches.yml +7 -0
- data/test/helpers/appstats_helper_test.rb +4 -0
- data/test/helpers/opensearch_helper_test.rb +4 -0
- data/test/helpers/pages_helper_test.rb +4 -0
- data/test/helpers/search_helper_test.rb +4 -0
- data/test/integration/catalog_search_test.rb +8 -0
- data/test/integration/google_analytics_test.rb +23 -0
- data/test/integration/landing_page_test.rb +8 -0
- data/test/integration/searching_test.rb +40 -0
- data/test/integration/smart_subjects_test.rb +8 -0
- data/test/integration/website_search_test.rb +8 -0
- data/test/models/event_test.rb +7 -0
- data/test/models/search_test.rb +7 -0
- data/test/searcher/best_bets_test.rb +35 -0
- data/test/searcher/catalog_test.rb +35 -0
- data/test/searcher/ematrix_database_test.rb +27 -0
- data/test/searcher/ematrix_journal_test.rb +27 -0
- data/test/searcher/faq_test.rb +27 -0
- data/test/searcher/smart_subjects_test.rb +27 -0
- data/test/searcher/summon_test.rb +13 -0
- data/test/searcher/website_test.rb +34 -0
- data/test/support/vcr_test.rb +40 -0
- data/test/test_helper.rb +42 -0
- metadata +366 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
module QuickSearch
|
|
2
|
+
class Searcher
|
|
3
|
+
attr_accessor :response, :results_list, :total, :http, :q, :per_page, :loaded_link, :offset, :page, :scope
|
|
4
|
+
|
|
5
|
+
include QueryFilter
|
|
6
|
+
|
|
7
|
+
# TODO: What should the method signature be?
|
|
8
|
+
def initialize(http_client, q, per_page, offset = 0, page = 1, on_campus = false, scope = '', params = {})
|
|
9
|
+
@http = http_client
|
|
10
|
+
@q = q
|
|
11
|
+
@per_page = per_page
|
|
12
|
+
@page = page
|
|
13
|
+
@offset = offset
|
|
14
|
+
@on_campus = on_campus
|
|
15
|
+
@scope = scope
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# a search must
|
|
19
|
+
def search
|
|
20
|
+
raise # FIXME: pick some good error
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# results must create a @results_list attribute
|
|
24
|
+
def results
|
|
25
|
+
raise #FIXME: pick some good error
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def http_request_queries
|
|
31
|
+
query = @q.dup
|
|
32
|
+
queries = {}
|
|
33
|
+
|
|
34
|
+
query = filter_query(query)
|
|
35
|
+
|
|
36
|
+
queries['not_escaped'] = query
|
|
37
|
+
queries['uri_escaped'] = CGI.escape(query.to_str)
|
|
38
|
+
queries['mysql_escaped'] = Mysql2::Client.escape(query)
|
|
39
|
+
queries
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<% unless best_bets.blank? %>
|
|
2
|
+
<% if best_bets[:link].is_a?(String) %>
|
|
3
|
+
<div id="best-bets" class="row quicksearch-ga-serve-tracking quicksearch-ga-click-tracking">
|
|
4
|
+
<div class="small-12 columns best_bets module">
|
|
5
|
+
<h3 class='title'>
|
|
6
|
+
<%= link_to (best_bets[:link]),
|
|
7
|
+
:data => { :quicksearch_ga_action => best_bets[:id],
|
|
8
|
+
:quicksearch_ga_category => best_bets[:best_bets_type] } do %>
|
|
9
|
+
<i class='fa fa-angle-double-right'></i>
|
|
10
|
+
<%= best_bets[:title] %>
|
|
11
|
+
<% end %>
|
|
12
|
+
<span class='highlight'>Best Bet</span>
|
|
13
|
+
</h3>
|
|
14
|
+
<p><%= best_bets[:description] %></p>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
18
|
+
<% end %>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<div class="small-12 medium-7 columns">
|
|
3
|
+
<h2><%= @module_callout %></h2>
|
|
4
|
+
</div>
|
|
5
|
+
<% unless @common_searches.empty? %>
|
|
6
|
+
<div id="common-searches" class="small-12 medium-5 columns common-searches">
|
|
7
|
+
<h4><%= t('call_to_try_searches') %>:</h4>
|
|
8
|
+
<ul>
|
|
9
|
+
<% @common_searches.each do | search | %>
|
|
10
|
+
<li><%= link_to search, :q => search %></li>
|
|
11
|
+
<% end %>
|
|
12
|
+
</ul>
|
|
13
|
+
</div>
|
|
14
|
+
<% end %>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<ul class="inline-list">
|
|
2
|
+
<% for searcher in QuickSearch::Engine::APP_CONFIG['found_types'] %>
|
|
3
|
+
<% if @found_types.include? searcher %>
|
|
4
|
+
<li>
|
|
5
|
+
<a href="#<%= searcher.dasherize %>" data-quicksearch-ga-action="<%= searcher.dasherize %>">
|
|
6
|
+
<%= t("#{searcher}_search.display_name") %>
|
|
7
|
+
</a>
|
|
8
|
+
</li>
|
|
9
|
+
<% else %>
|
|
10
|
+
<li class="<%= searcher.dasherize %>"><span class="no-results-label"><%= t("#{searcher}_search.display_name") %></span></li>
|
|
11
|
+
<% end %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</ul>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<% if Rails.env == 'production' or Rails.env == 'staging' %>
|
|
2
|
+
<script>
|
|
3
|
+
//Univeral Analytics
|
|
4
|
+
// (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
5
|
+
// (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
6
|
+
// m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
7
|
+
// })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
8
|
+
|
|
9
|
+
// ga('create', "<%= APP_CONFIG['google_analytics_tracking_id'] %>", 'ncsu.edu'); //FIXME: Add id for quicksearch GA
|
|
10
|
+
// ga('send', 'pageview');
|
|
11
|
+
|
|
12
|
+
// Classic Analytics
|
|
13
|
+
var _gaq = _gaq || [];
|
|
14
|
+
_gaq.push(['_setAccount', "<%= QuickSearch::Engine::APP_CONFIG['google_analytics_tracking_id'] %>"]);
|
|
15
|
+
_gaq.push(['_trackPageview']);
|
|
16
|
+
|
|
17
|
+
(function() {
|
|
18
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
19
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
20
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
21
|
+
})();
|
|
22
|
+
|
|
23
|
+
</script>
|
|
24
|
+
<% end %>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<% if @query %>
|
|
2
|
+
<h4>More search options for <span class="query">"<%= display_query %>"</span></h4>
|
|
3
|
+
<% else %>
|
|
4
|
+
<h4>A few more places to try:</h4>
|
|
5
|
+
<% end %>
|
|
6
|
+
<ul>
|
|
7
|
+
<% @search_services_for_display.each do |link| %>
|
|
8
|
+
<li><%= link_to link['name'], link['link'] %></li>
|
|
9
|
+
<% end %>
|
|
10
|
+
</ul>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<div class="small-12 medium-6 large-9 columns">
|
|
3
|
+
<h1>Search <%= page_title %></h1>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="medium-6 large-3 columns show-for-medium-up">
|
|
6
|
+
<p><%= link_to 'About this search tool', about_path, class: 'about' %></p>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class="row main-search-form">
|
|
2
|
+
<div class="small-12 columns">
|
|
3
|
+
<%= form_for("search", method: :get, html: {id: 'main-search-form'}) do |f| %>
|
|
4
|
+
<div class="row collapse">
|
|
5
|
+
<div class="small-10 columns">
|
|
6
|
+
<% if @query %>
|
|
7
|
+
<input type="search" name="q" id="params-q" class="quicksearch-typeahead search-query" value="<%= @query %>" />
|
|
8
|
+
<% else %>
|
|
9
|
+
<input type="search" name="q" id="params-q" class="quicksearch-typeahead search-query" placeholder="<%= @search_form_placeholder %>" />
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="small-2 columns">
|
|
13
|
+
<button type="submit" class="button prefix show-for-small"><i class="fa fa-search"></i></button>
|
|
14
|
+
<button type="submit" class="button prefix show-for-medium-up">Search</button>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
<% end %>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<% unless spelling_suggestion.blank? %>
|
|
2
|
+
<% unless @query.size > 100 %>
|
|
3
|
+
<div id='spelling-suggestion' class="row quicksearch-ga-serve-tracking quicksearch-ga-click-tracking">
|
|
4
|
+
<div class="small-12 large-8 columns spelling-suggestion module">
|
|
5
|
+
<h3 class="title">
|
|
6
|
+
Did you mean <%= link_to spelling_suggestion, "?q=#{spelling_suggestion}",
|
|
7
|
+
:data => { :quicksearch_ga_action => spelling_suggestion,
|
|
8
|
+
:quicksearch_ga_label => @query } %>?
|
|
9
|
+
</h2>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
<% end %>
|
|
13
|
+
<% end %>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<% unless topic_snippet.blank? %>
|
|
2
|
+
<h2><a href="<%= topic_snippet['source_link'] %>"><%= topic_snippet['title'] %></a></h2>
|
|
3
|
+
<p><%= topic_snippet['snippet'] %></p>
|
|
4
|
+
<p>Source: <a href="<%= topic_snippet['source_link'] %>"><%= topic_snippet['source_name'] %></a></p>
|
|
5
|
+
<% end %>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<!--[if IE 8]><html class="no-js lt-ie9" lang="en"> <![endif]-->
|
|
3
|
+
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
|
|
4
|
+
<head>
|
|
5
|
+
<title><%= content_for(:title) %></title>
|
|
6
|
+
<meta content="ie=edge, chrome=1" http-equiv="x-ua-compatible" />
|
|
7
|
+
<link rel="search" type="application/opensearchdescription+xml" href="<%= opensearch_path %>" title="<%= t('opensearch_description') %>" />
|
|
8
|
+
<!-- css -->
|
|
9
|
+
<%= stylesheet_link_tag 'application' %>
|
|
10
|
+
|
|
11
|
+
<!-- js -->
|
|
12
|
+
<%= javascript_include_tag 'application' %>
|
|
13
|
+
<%= render '/layouts/quick_search/head' %>
|
|
14
|
+
<%= render '/layouts/quick_search/google_analytics' %>
|
|
15
|
+
</head>
|
|
16
|
+
<body class="<%= body_class %>" data-quicksearch-ga-query="<%= strip_tags(@log_query) %>">
|
|
17
|
+
<div class="off-canvas-wrap">
|
|
18
|
+
<div class="inner-wrap">
|
|
19
|
+
<%= render '/layouts/quick_search/header' %>
|
|
20
|
+
<div id="content" role="document" class="page">
|
|
21
|
+
<main id="main-content" role="main" class="row l-main">
|
|
22
|
+
<div class="medium-12 main columns">
|
|
23
|
+
<div class="skip-link">
|
|
24
|
+
<a href="#main-content"></a>
|
|
25
|
+
</div>
|
|
26
|
+
<!-- CONTENT: enter content below this line -->
|
|
27
|
+
<div id="quicksearch">
|
|
28
|
+
<%= yield %>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</main>
|
|
32
|
+
</div>
|
|
33
|
+
<%= render '/layouts/quick_search/footer' %>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
<script type="text/javascript">$(function() { $('body').hide().show(); });
|
|
37
|
+
window.I18n = <%= I18n.backend.send(:translations).to_json.html_safe %>
|
|
38
|
+
</script>
|
|
39
|
+
</body>
|
|
40
|
+
</html>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<table class="datatable">
|
|
2
|
+
<thead>
|
|
3
|
+
<tr>
|
|
4
|
+
<th>Rank</th>
|
|
5
|
+
<th>Category</th>
|
|
6
|
+
<th>Count</th>
|
|
7
|
+
<th>Percent</th>
|
|
8
|
+
</tr>
|
|
9
|
+
</thead>
|
|
10
|
+
<tbody>
|
|
11
|
+
<% iterations = 0 %>
|
|
12
|
+
<% clicks.each do |item, count| %>
|
|
13
|
+
<% iterations += 1 %>
|
|
14
|
+
<tr>
|
|
15
|
+
<td><%= iterations %></td>
|
|
16
|
+
<!-- <td><%# item %></td> -->
|
|
17
|
+
<td><%= link_to item, controller: "appstats", action: "detail", ga_scope: "category", ga_category: "#{item}" %></td>
|
|
18
|
+
<td><%= count %></td>
|
|
19
|
+
<td><%= number_to_percentage((count / total_clicks.to_f)*100, precision: 2) %></td>
|
|
20
|
+
</tr>
|
|
21
|
+
<% end %>
|
|
22
|
+
</tbody>
|
|
23
|
+
</table>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%= stylesheet_link_tag('//cdn.datatables.net/1.10.0/css/jquery.dataTables.css') %>
|
|
2
|
+
<%= stylesheet_link_tag('//cdn.datatables.net/plug-ins/28e7751dbec/integration/foundation/dataTables.foundation.css') %>
|
|
3
|
+
<%= javascript_include_tag('//cdn.datatables.net/1.10.0/js/jquery.dataTables.js') %>
|
|
4
|
+
<%= javascript_include_tag('//cdn.datatables.net/plug-ins/28e7751dbec/integration/foundation/dataTables.foundation.js') %>
|
|
5
|
+
<script>
|
|
6
|
+
$(document).ready (function() {
|
|
7
|
+
$('.datatable').dataTable({
|
|
8
|
+
"paging": false,
|
|
9
|
+
"filter": false
|
|
10
|
+
});
|
|
11
|
+
})
|
|
12
|
+
</script>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% title('Foo') %>
|
|
2
|
+
<div class="row">
|
|
3
|
+
<div class="small-12 columns">
|
|
4
|
+
<h1><%= @page_title %></h1>
|
|
5
|
+
<div id="appstats-date-filter">
|
|
6
|
+
<%= form_tag do %>
|
|
7
|
+
<p>Start Date: <%= select_date @start_date, prefix: :start_date %></p>
|
|
8
|
+
<p>End Date: <%= select_date @end_date, prefix: :end_date %></p>
|
|
9
|
+
<p><%= submit_tag("Update") %></p>
|
|
10
|
+
<% end %>
|
|
11
|
+
</div>
|
|
12
|
+
<p><%= "#{@start_date.to_formatted_s(:long) } to #{@end_date.to_formatted_s(:long)}" %> <a id="appstats-date-showhide">(Change start/end dates)</a></p>
|
|
13
|
+
<p><%= "#{@days_in_sample} days in sample" %></p>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<aside id="subnav" role="complementary" class="medium-3 columns sidebar">
|
|
2
|
+
<section class="block block-menu">
|
|
3
|
+
<h3>External Services</h2>
|
|
4
|
+
<ul class="side-nav">
|
|
5
|
+
<li><%= link_to "Google Analytics", "https://www.google.com/analytics/web/", :target => "_blank" %></li>
|
|
6
|
+
</ul>
|
|
7
|
+
<h3>Internal Reports</h2>
|
|
8
|
+
<ul class="side-nav">
|
|
9
|
+
<li><%= link_to "General Statistics", appstats_path(:start_date => params[:start_date], :end_date => params[:end_date]) %></li>
|
|
10
|
+
<li><%= link_to "Clicks Overview", clicks_overview_path(:start_date => params[:start_date], :end_date => params[:end_date]) %></li>
|
|
11
|
+
<li><%= link_to "Top Searches", top_searches_path(:start_date => params[:start_date], :end_date => params[:end_date]) %></li>
|
|
12
|
+
<li><%= link_to "Best Bets", top_spot_path(:start_date => params[:start_date], :end_date => params[:end_date], :ga_top_spot_module => 'best-bets-regular') %></li>
|
|
13
|
+
<li><%= link_to "Spelling Suggestions", top_spot_path(:start_date => params[:start_date], :end_date => params[:end_date], :ga_top_spot_module => 'spelling-suggestion') %></li>
|
|
14
|
+
</ul>
|
|
15
|
+
</section>
|
|
16
|
+
</aside>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
<h3><%= report[:category_title] %></h3>
|
|
2
|
+
<table class="datatable">
|
|
3
|
+
<thead>
|
|
4
|
+
<tr>
|
|
5
|
+
<th>Rank</th>
|
|
6
|
+
<th>Action</th>
|
|
7
|
+
<th>Serve Count</th>
|
|
8
|
+
<th>Click Count</th>
|
|
9
|
+
<th>Click/Serve Ratio</th>
|
|
10
|
+
</tr>
|
|
11
|
+
</thead>
|
|
12
|
+
<tbody>
|
|
13
|
+
<% total_serves = 0 %>
|
|
14
|
+
<% total_clicks = 0 %>
|
|
15
|
+
<% iterations = 0 %>
|
|
16
|
+
<% report[:report].each do |row| %>
|
|
17
|
+
<% break if iterations > 99 %>
|
|
18
|
+
<% if row['clickcount'].nil? %>
|
|
19
|
+
<% row['clickcount'] = 0 %>
|
|
20
|
+
<% end %>
|
|
21
|
+
<% total_serves += row["servecount"] %>
|
|
22
|
+
<% total_clicks += row["clickcount"] %>
|
|
23
|
+
<% iterations += 1 %>
|
|
24
|
+
<tr>
|
|
25
|
+
<td><%= iterations %></td>
|
|
26
|
+
<td><%= link_to row["action"], controller: "appstats", action: "detail", ga_scope: "action", ga_category: report[:category], ga_action: URI.encode(row["action"], "./") %></td>
|
|
27
|
+
<td><%= number_with_delimiter(row["servecount"]) %></td>
|
|
28
|
+
<td><%= number_with_delimiter(row["clickcount"]) %></td>
|
|
29
|
+
<td><%= number_to_percentage((row["clickcount"] / row["servecount"].to_f)*100, precision: 2) %></td>
|
|
30
|
+
</tr>
|
|
31
|
+
<% end %>
|
|
32
|
+
</tbody>
|
|
33
|
+
</table>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<% title("#{@page_title} | ") %>
|
|
2
|
+
<%= render partial: 'datatables' %>
|
|
3
|
+
<div class="row">
|
|
4
|
+
<%= render partial: 'menu' %>
|
|
5
|
+
<div class="medium-9 columns">
|
|
6
|
+
<%= render partial: "date_range" %>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="medium-9 columns">
|
|
9
|
+
<h2>Module Clicks</h2>
|
|
10
|
+
<%= render partial: 'click_count_table', locals: { :clicks => @module_clicks, :total_clicks => @module_click_total} %>
|
|
11
|
+
<h2>Result Types Guide Clicks</h2>
|
|
12
|
+
<%= render partial: 'click_count_table', locals: { :clicks => @result_types_clicks, :total_clicks => @result_types_click_total} %>
|
|
13
|
+
<table>
|
|
14
|
+
<tr>
|
|
15
|
+
<td>Result Type Guide Click/Search</td>
|
|
16
|
+
<td><%= number_to_percentage((@result_types_click_total / @searches_count.to_f)*100, precision: 2) %></td>
|
|
17
|
+
</tr>
|
|
18
|
+
</table>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<% title("#{@page_title} | ") %>
|
|
2
|
+
<%= render partial: 'datatables' %>
|
|
3
|
+
<div class="row">
|
|
4
|
+
<%= render partial: 'menu' %>
|
|
5
|
+
<div class="medium-8 columns">
|
|
6
|
+
<%= render partial: 'date_range' %>
|
|
7
|
+
<h2>General Statistics</h2>
|
|
8
|
+
<table>
|
|
9
|
+
<tr>
|
|
10
|
+
<td>Total Searches</td>
|
|
11
|
+
<td><%= number_with_delimiter(@searches_count) %></td>
|
|
12
|
+
</tr>
|
|
13
|
+
<tr>
|
|
14
|
+
<td>Total Clicks</td>
|
|
15
|
+
<td><%= number_with_delimiter(@clicks_count) %></td>
|
|
16
|
+
</tr>
|
|
17
|
+
<tr>
|
|
18
|
+
<td>Searches per Day</td>
|
|
19
|
+
<td><%= number_with_delimiter(@searches_count / @days_in_sample) %></td>
|
|
20
|
+
</tr>
|
|
21
|
+
<tr>
|
|
22
|
+
<td>Clicks per Day</td>
|
|
23
|
+
<td><%= number_with_delimiter(@clicks_count / @days_in_sample) %></td>
|
|
24
|
+
</tr>
|
|
25
|
+
<tr>
|
|
26
|
+
<td>Click/Search</td>
|
|
27
|
+
<td><%= number_to_percentage(@click_serve_ratio, precision: 2) %></td>
|
|
28
|
+
</tr>
|
|
29
|
+
</table>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<%= title("#{@page_title} | ") %>
|
|
2
|
+
<%= render partial: 'datatables' %>
|
|
3
|
+
<div class="row">
|
|
4
|
+
<%= render partial: "menu" %>
|
|
5
|
+
<div class="medium-9 columns">
|
|
6
|
+
<%= render partial: 'date_range' %>
|
|
7
|
+
<h2><%= @category %></h2>
|
|
8
|
+
<table class='datatable'>
|
|
9
|
+
<thead>
|
|
10
|
+
<tr>
|
|
11
|
+
<td>Rank</td>
|
|
12
|
+
<td>Link</td>
|
|
13
|
+
<td>Count</td>
|
|
14
|
+
<td>Percent</td>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<% count = 0 %>
|
|
19
|
+
<% @modules_clicks_report.each do |module_clicks| %>
|
|
20
|
+
<% count += 1 %>
|
|
21
|
+
<tr>
|
|
22
|
+
<td><%= count %></td>
|
|
23
|
+
<td><%= module_clicks[:module] %></td>
|
|
24
|
+
<td><%= module_clicks[:clicks] %></td>
|
|
25
|
+
<td><%= number_to_percentage(module_clicks[:percent], precision: 2) %></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<% end %>
|
|
28
|
+
</tbody>
|
|
29
|
+
</table>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<% title %>
|
|
2
|
+
<div class="row">
|
|
3
|
+
<div class="small-12 columns">
|
|
4
|
+
<h1>Realtime Searches</h1>
|
|
5
|
+
<p>What you see below is a stream of searches as they happen in real time.</p>
|
|
6
|
+
<div id="realtime_searches">
|
|
7
|
+
<ul class="disc">
|
|
8
|
+
|
|
9
|
+
</ul>
|
|
10
|
+
</div>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<%= javascript_include_tag File.join(QuickSearch::Engine::APP_CONFIG['realtime_url'], '/socket.io/socket.io.js') %>
|
|
15
|
+
<%= javascript_include_tag 'realtime' %>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<% title("#{@page_title} | ") %>
|
|
2
|
+
<%= render partial: 'datatables' %>
|
|
3
|
+
<div class="row">
|
|
4
|
+
<%= render partial: "menu" %>
|
|
5
|
+
<div class="small-9 columns">
|
|
6
|
+
<%= render partial: "date_range" %>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="small-9 columns">
|
|
9
|
+
<h2>Most Frequent Searches</h2>
|
|
10
|
+
<table class="datatable">
|
|
11
|
+
<thead>
|
|
12
|
+
<tr>
|
|
13
|
+
<th>Rank</th>
|
|
14
|
+
<th>Query</th>
|
|
15
|
+
<th>Total</th>
|
|
16
|
+
<th>Percent of Total</th>
|
|
17
|
+
<th>Cumulative Percent</th>
|
|
18
|
+
</tr>
|
|
19
|
+
</thead>
|
|
20
|
+
<tbody>
|
|
21
|
+
<% it_count = 0 %>
|
|
22
|
+
<% total_percent = 0 %>
|
|
23
|
+
<% @query_counts.each do |query, count| %>
|
|
24
|
+
<% it_count += 1 %>
|
|
25
|
+
<% term_percent = (count / @searches_count.to_f)*100 %>
|
|
26
|
+
<% total_percent += term_percent %>
|
|
27
|
+
<tr>
|
|
28
|
+
<td><%= it_count %></td>
|
|
29
|
+
<td><%= link_to query, root_path(q: query) %></td>
|
|
30
|
+
<td><%= number_with_delimiter(count) %></td>
|
|
31
|
+
<td><%= number_to_percentage(term_percent, precision: 2) %></td>
|
|
32
|
+
<td><%= number_to_percentage(total_percent, precision: 2)%></td>
|
|
33
|
+
</tr>
|
|
34
|
+
<% end %>
|
|
35
|
+
</tbody>
|
|
36
|
+
</table>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<% title("#{@page_title} | ") %>
|
|
2
|
+
<%= render partial: 'datatables' %>
|
|
3
|
+
<div class="row">
|
|
4
|
+
<%= render partial: "menu" %>
|
|
5
|
+
<div class="large-9 columns">
|
|
6
|
+
<%= render partial: "date_range" %>
|
|
7
|
+
</div>
|
|
8
|
+
<div class="large-9 columns">
|
|
9
|
+
<p>Displays top 100 in each category</p>
|
|
10
|
+
<% @top_spot_reporting.each do |report| %>
|
|
11
|
+
<%= render partial: 'top_spot_report_table', locals: { report: report } %>
|
|
12
|
+
<% end %>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<% title("#{@page_title} | ") %>
|
|
2
|
+
<%= render partial: 'datatables' %>
|
|
3
|
+
<div class="row">
|
|
4
|
+
<%= render partial: "menu" %>
|
|
5
|
+
<div class="medium-9 columns">
|
|
6
|
+
<%= render partial: 'date_range' %>
|
|
7
|
+
<table class='datatable'>
|
|
8
|
+
<thead>
|
|
9
|
+
<tr>
|
|
10
|
+
<th>Rank</th>
|
|
11
|
+
<th>Query</th>
|
|
12
|
+
<th>Serve Count</th>
|
|
13
|
+
<th>Click Count</th>
|
|
14
|
+
<th>Click/Serve %</th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<% count = 0 %>
|
|
19
|
+
<% @top_spot_detail.each do |key, action| %>
|
|
20
|
+
<% count += 1 %>
|
|
21
|
+
<tr>
|
|
22
|
+
<td><%= count %></td>
|
|
23
|
+
<td><%= key %></td>
|
|
24
|
+
<td><%= action[0] %></td>
|
|
25
|
+
<td><%= action[1] %></td>
|
|
26
|
+
<td><%= number_to_percentage(action[2], precision: 2) %></td>
|
|
27
|
+
</tr>
|
|
28
|
+
<% end %>
|
|
29
|
+
</tbody>
|
|
30
|
+
</table>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<!-- FIXME: Should this be used to report Module Click details as well? -->
|
|
34
|
+
<!-- Remove reference to Best Bet here. Make more generic. -->
|
|
35
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# Link to the "First" page
|
|
2
|
+
- available local variables
|
|
3
|
+
url: url to the first page
|
|
4
|
+
current_page: a page object for the currently displayed page
|
|
5
|
+
total_pages: total number of pages
|
|
6
|
+
per_page: number of items to fetch per page
|
|
7
|
+
remote: data-remote
|
|
8
|
+
-%>
|
|
9
|
+
|
|
10
|
+
<li>
|
|
11
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.first'), url, :remote => remote %>
|
|
12
|
+
</li>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%# Non-link tag that stands for skipped pages...
|
|
2
|
+
- available local variables
|
|
3
|
+
current_page: a page object for the currently displayed page
|
|
4
|
+
total_pages: total number of pages
|
|
5
|
+
per_page: number of items to fetch per page
|
|
6
|
+
remote: data-remote
|
|
7
|
+
-%>
|
|
8
|
+
|
|
9
|
+
<li class="unavailable">
|
|
10
|
+
<%= link_to raw(t 'views.pagination.truncate'), '#' %>
|
|
11
|
+
</li>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# Link to the "Last" page
|
|
2
|
+
- available local variables
|
|
3
|
+
url: url to the last page
|
|
4
|
+
current_page: a page object for the currently displayed page
|
|
5
|
+
total_pages: total number of pages
|
|
6
|
+
per_page: number of items to fetch per page
|
|
7
|
+
remote: data-remote
|
|
8
|
+
-%>
|
|
9
|
+
|
|
10
|
+
<li>
|
|
11
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.last'), url, {:remote => remote} %>
|
|
12
|
+
</li>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<%# Link to the "Next" page
|
|
2
|
+
- available local variables
|
|
3
|
+
url: url to the next page
|
|
4
|
+
current_page: a page object for the currently displayed page
|
|
5
|
+
total_pages: total number of pages
|
|
6
|
+
per_page: number of items to fetch per page
|
|
7
|
+
remote: data-remote
|
|
8
|
+
-%>
|
|
9
|
+
|
|
10
|
+
<li>
|
|
11
|
+
<%= link_to_unless current_page.last?, raw(t 'views.pagination.next'), url, :rel => 'next', :remote => remote %>
|
|
12
|
+
</li>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<%# Link showing page number
|
|
2
|
+
- available local variables
|
|
3
|
+
page: a page object for "this" page
|
|
4
|
+
url: url to this page
|
|
5
|
+
current_page: a page object for the currently displayed page
|
|
6
|
+
total_pages: total number of pages
|
|
7
|
+
per_page: number of items to fetch per page
|
|
8
|
+
remote: data-remote
|
|
9
|
+
-%>
|
|
10
|
+
|
|
11
|
+
<li class="<%= 'current' if page.current? %>">
|
|
12
|
+
<%= link_to page, page.current? ? '#' : url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
|
|
13
|
+
</li>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<%# The container tag
|
|
2
|
+
- available local variables
|
|
3
|
+
current_page: a page object for the currently displayed page
|
|
4
|
+
total_pages: total number of pages
|
|
5
|
+
per_page: number of items to fetch per page
|
|
6
|
+
remote: data-remote
|
|
7
|
+
paginator: the paginator that renders the pagination tags inside
|
|
8
|
+
-%>
|
|
9
|
+
<%= paginator.render do -%>
|
|
10
|
+
<div class="pagination-centered">
|
|
11
|
+
<ul class="pagination">
|
|
12
|
+
<%= first_page_tag unless current_page.first? %>
|
|
13
|
+
<%= prev_page_tag unless current_page.first? %>
|
|
14
|
+
<% each_page do |page| -%>
|
|
15
|
+
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
|
|
16
|
+
<%= page_tag page %>
|
|
17
|
+
<% elsif !page.was_truncated? -%>
|
|
18
|
+
<%= gap_tag %>
|
|
19
|
+
<% end -%>
|
|
20
|
+
<% end -%>
|
|
21
|
+
<%= next_page_tag unless current_page.last? %>
|
|
22
|
+
<%= last_page_tag unless current_page.last? %>
|
|
23
|
+
</ul>
|
|
24
|
+
</div>
|
|
25
|
+
<% end -%>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<%# Link to the "Previous" page
|
|
2
|
+
- available local variables
|
|
3
|
+
url: url to the previous page
|
|
4
|
+
current_page: a page object for the currently displayed page
|
|
5
|
+
total_pages: total number of pages
|
|
6
|
+
per_page: number of items to fetch per page
|
|
7
|
+
remote: data-remote
|
|
8
|
+
-%>
|
|
9
|
+
<li>
|
|
10
|
+
<%= link_to_unless current_page.first?, raw(t 'views.pagination.previous'), url, :rel => 'prev', :remote => remote %>
|
|
11
|
+
</li>
|