Skip to content
This repository was archived by the owner on Aug 23, 2021. It is now read-only.

Commit

Permalink
[#94091132] Admin can render help text on search.digitalgov.gov
Browse files Browse the repository at this point in the history
- also upgrade jekyll
  • Loading branch information
dgsearchdev committed May 19, 2015
1 parent cbf73aa commit f091cd2
Show file tree
Hide file tree
Showing 22 changed files with 275 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--color
--require spec_helper
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: ruby
rvm:
- 2.0.0
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
source 'https://rubygems.org'

gem 'rake'
gem 'jekyll'
gem 'sass'
gem 'compass'
gem 'jekyll'
gem 'rake'
gem 'rdiscount'
gem 'RedCloth'
gem 'rspec'
gem 'sass', '~> 3.2.19'
100 changes: 76 additions & 24 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,45 +1,97 @@
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
blankslate (2.1.2.4)
celluloid (0.16.0)
timers (~> 4.0.0)
chunky_png (1.2.7)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
classifier-reborn (2.0.3)
fast-stemmer (~> 1.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
colorator (0.1)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
directory_watcher (1.4.1)
diff-lcs (1.2.5)
execjs (2.5.2)
fast-stemmer (1.0.2)
ffi (1.9.8)
fssm (0.2.10)
jekyll (0.12.1)
classifier (~> 1.3)
directory_watcher (~> 1.1)
kramdown (~> 0.14)
liquid (~> 2.3)
maruku (~> 0.5)
pygments.rb (~> 0.3.2)
kramdown (0.14.2)
liquid (2.5.0)
maruku (0.6.1)
syntax (>= 1.0.0)
posix-spawn (0.3.6)
pygments.rb (0.3.7)
hitimes (1.2.2)
jekyll (2.5.3)
classifier-reborn (~> 2.0)
colorator (~> 0.1)
jekyll-coffeescript (~> 1.0)
jekyll-gist (~> 1.0)
jekyll-paginate (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 2.6.1)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
safe_yaml (~> 1.0)
toml (~> 0.1.0)
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
jekyll-gist (1.2.1)
jekyll-paginate (1.1.0)
jekyll-sass-converter (1.3.0)
sass (~> 3.2)
jekyll-watch (1.2.1)
listen (~> 2.7)
kramdown (1.7.0)
liquid (2.6.2)
listen (2.10.0)
celluloid (~> 0.16.0)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
mercenary (0.3.5)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.11)
pygments.rb (0.6.3)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
yajl-ruby (~> 1.2.0)
rake (10.0.3)
rdiscount (2.0.7.1)
sass (3.2.7)
syntax (1.0.0)
yajl-ruby (1.1.0)
rb-fsevent (0.9.4)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdiscount (2.1.7)
redcarpet (3.2.3)
rspec (3.2.0)
rspec-core (~> 3.2.0)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
safe_yaml (1.0.4)
sass (3.2.19)
timers (4.0.1)
hitimes
toml (0.1.2)
parslet (~> 1.5.0)
yajl-ruby (1.2.1)

PLATFORMS
ruby

DEPENDENCIES
RedCloth
compass
jekyll
rake
rdiscount
sass
rspec
sass (~> 3.2.19)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ We use bundler to manage gems. Install bundler and other required gems.
Start a server and try it out.

$ bundle exec compass watch (ctrl+c to stop)
$ bundle exec jekyll
$ bundle exec jekyll serve

Go to <http://localhost:4000>.

Expand Down
15 changes: 14 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ task :generate do
if !current_sha.empty? && previous_sha != current_sha
system 'bundle exec compass clean'
system 'bundle exec compass compile'
system 'bundle exec jekyll --no-auto --no-server'
system 'bundle exec jekyll build'
File.open('last_commit.yml', 'w') { |f| f.write({ sha: current_sha }.to_yaml) }
end
end

task :deploy => :generate do
cd("#{deploy_dir}") do
system 'git fetch origin gh-pages'
system 'git reset --hard origin/gh-pages'
end
rm_r Dir.glob("#{deploy_dir}/*")
cp_r '_site/.', "#{deploy_dir}"
cd "#{deploy_dir}" do
Expand All @@ -44,3 +48,12 @@ task :deploy => :generate do
end
end

begin
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task :default => :spec
rescue LoadError
# no rspec available
end
4 changes: 1 addition & 3 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
auto: true
author: DigitalGov Search
title: DigitalGov Search
url: http://search.digitalgov.gov
permalink: /:categories/:title.html
lsi: false
pygments: true
highlighter: pygments
markdown: rdiscount
exclude: [.gitignore, .rvmrc, Gemfile, Gemfile.lock, README.md, Rakefile, config.rb, sass, vendor]
server: true

# plugin config
paginate_per_page: 10
Expand Down
20 changes: 20 additions & 0 deletions _data/hints.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# DO NOT MODIFY KEYS

# https://search.usa.gov/sites/1/collections/new
# https://search.usa.gov/sites/1/collections/8/edit
document_collection:
name:
url_prefixes:
prefix: Enter the folder where the files to be searched are stored. Don't add an index page.


# https://search.usa.gov/sites/1/domains/8/new
# https://search.usa.gov/sites/1/domains/8/edit
site_domain:
domain: Leave off www to include all subdomains. Use www for results from www.agency.gov only.


# https://search.usa.gov/sites/1/users/new
user:
contact_name: Please enter first and last name.
email: Users you add will receive an email to complete their registration.
15 changes: 15 additions & 0 deletions _plugins/hash_filter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module HashFilter
def concat_hash_keys(input, current_parent = '', hash = {})
return hash[current_parent] = input unless input.is_a? Hash

input.each do |key, value|
parent = current_parent.clone
parent << '.' unless parent.empty?
parent << key
concat_hash_keys value, parent, hash
end
hash
end
end

Liquid::Template.register_filter HashFilter
16 changes: 16 additions & 0 deletions _plugins/hint_tag.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Jekyll
class HintTag < Liquid::Tag

def initialize(tag_name, markup, tokens)
super
@keys = markup.split('.').map(&:strip).freeze
end

def render(context)
hints = context.registers[:site].data['hints'].freeze
@keys.inject(hints) { |h, key| h[key] }
end
end
end

Liquid::Template.register_tag('hint', Jekyll::HintTag)
1 change: 0 additions & 1 deletion all.atom
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: nil
---
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
Expand Down
2 changes: 1 addition & 1 deletion drafts/2013-12-31-feature-CTR-top-queries.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /feature/ctr-top-queries.html
permalink: /drafts/feature/ctr-top-queries.html
layout: feature
title: Find out Which Queries Trigger Your Best Bets
tags: features bestbets
Expand Down
2 changes: 1 addition & 1 deletion drafts/2013-12-31-feature-analytics-best-bets.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /feature/best-bets-trigger.html
permalink: /drafts/feature/best-bets-trigger.html
layout: feature
title: Find out Which Queries Trigger Your Best Bets
tags: features bestbets
Expand Down
4 changes: 2 additions & 2 deletions drafts/2013-12-31-feature-improved-BB-relevancy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /feature/ctr-top-queries.html
permalink: /drafts/feature/ctr-top-queries.html
layout: feature
title: Improved Phrases
tags: features relevancy
Expand All @@ -8,4 +8,4 @@ tags: features relevancy

##"Best Bets" are a good way to guide your users to the appropriate content based their keywords. We have implemented improved handling of phrases, so you only show results based on the user's entire query.

![Improved Best Best Phrase Handling](https://9fddeb862c037f6d2190-f1564c64756a8cfee25b6b19953b1d23.ssl.cf2.rackcdn.com/feature-improved-phrasing.png "Improved Best Best Phrase Handling")
![Improved Best Best Phrase Handling](https://9fddeb862c037f6d2190-f1564c64756a8cfee25b6b19953b1d23.ssl.cf2.rackcdn.com/feature-improved-phrasing.png "Improved Best Best Phrase Handling")
4 changes: 2 additions & 2 deletions drafts/2014-01-31-feature-responsive-results-pages.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /feature/mobile-responsive.html
permalink: /drafts/feature/mobile-responsive.html
layout: feature
title: Improved Phrases
tags: features serp
Expand All @@ -8,4 +8,4 @@ tags: features serp

##We offer different search results automatically optimized for tablets and phones. With our customizable template, you can easily match your results pages to your own look and feel.

![Mobile Responsive Search Results Pages](https://9fddeb862c037f6d2190-f1564c64756a8cfee25b6b19953b1d23.ssl.cf2.rackcdn.com/feature-mobile-results-pages.png "Mobile Responsive Search Results Pages")
![Mobile Responsive Search Results Pages](https://9fddeb862c037f6d2190-f1564c64756a8cfee25b6b19953b1d23.ssl.cf2.rackcdn.com/feature-mobile-results-pages.png "Mobile Responsive Search Results Pages")
2 changes: 1 addition & 1 deletion drafts/customers.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /customers/index.html
permalink: /drafts/customers/index.html
layout: feature
title: City of West Palm Beach, Florida
tags: city-customers
Expand Down
12 changes: 12 additions & 0 deletions drafts/hints.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
layout: default
---
# Hints

Syntax | Output
:------------------------------------------------------------------------------------- | :-----
{% raw %}`{% hint document_collection.name %}`{% endraw %} &nbsp;&nbsp; | {% hint document_collection.name %}
{% raw %}`{% hint document_collection.url_prefixes.prefix %}`{% endraw %} &nbsp;&nbsp; | {% hint document_collection.url_prefixes.prefix %}
{% raw %}`{% hint site_domain.domain %}`{% endraw %} &nbsp;&nbsp; | {% hint site_domain.domain %}
{% raw %}`{% hint user.contact_name %}`{% endraw %} &nbsp;&nbsp; | {% hint user.contact_name %}
{% raw %}`{% hint user.email %}`{% endraw %} &nbsp;&nbsp; | {% hint user.email %}
10 changes: 3 additions & 7 deletions hints.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"document_collection.name": null,
"document_collection.url_prefixes.prefix": "Enter the folder where the files to be searched are stored. Don't add an index page.",
"site_domain.domain": "Leave off www to include all subdomains. Use www for results from www.agency.gov only.",
"user.contact_name": "Please enter first and last name.",
"user.email": "Users you add will receive an email to complete their registration."
}
---
---
{{ site.data.hints | concat_hash_keys | jsonify }}
19 changes: 0 additions & 19 deletions index.json

This file was deleted.

3 changes: 1 addition & 2 deletions sitemap.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
layout: nil
---
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
Expand All @@ -15,4 +14,4 @@ layout: nil
<changefreq>monthly</changefreq>
</url>
{% endfor %}
</urlset>
</urlset>
9 changes: 9 additions & 0 deletions spec/hint_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require 'yaml'

RSpec.describe "hints file" do
let(:filename) { File.absolute_path('_data/hints.yml') }

it 'contains valid YAML' do
expect(YAML.load_file(filename)).not_to be_empty
end
end
Loading

0 comments on commit f091cd2

Please sign in to comment.