Skip to content

Commit

Permalink
Merge pull request #163 from CDRH/release/3.0.0
Browse files Browse the repository at this point in the history
Release 3.0.0
  • Loading branch information
jduss4 authored Oct 25, 2019
2 parents b37dcd7 + bcdd94b commit 9d9a873
Show file tree
Hide file tree
Showing 79 changed files with 2,972 additions and 621 deletions.
3 changes: 1 addition & 2 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
ruby-2.5.1

ruby-2.6.5
122 changes: 61 additions & 61 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,120 +1,120 @@
PATH
remote: .
specs:
orchid (1.1.1)
orchid (2.1.0)
rails (~> 5.2.0)

GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.0)
actionpack (= 5.2.0)
actioncable (5.2.3)
actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
actionmailer (5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.0)
actionview (= 5.2.0)
activesupport (= 5.2.0)
actionpack (5.2.3)
actionview (= 5.2.3)
activesupport (= 5.2.3)
rack (~> 2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.0)
activesupport (= 5.2.0)
actionview (5.2.3)
activesupport (= 5.2.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (5.2.0)
activesupport (= 5.2.0)
activejob (5.2.3)
activesupport (= 5.2.3)
globalid (>= 0.3.6)
activemodel (5.2.0)
activesupport (= 5.2.0)
activerecord (5.2.0)
activemodel (= 5.2.0)
activesupport (= 5.2.0)
activemodel (5.2.3)
activesupport (= 5.2.3)
activerecord (5.2.3)
activemodel (= 5.2.3)
activesupport (= 5.2.3)
arel (>= 9.0)
activestorage (5.2.0)
actionpack (= 5.2.0)
activerecord (= 5.2.0)
activestorage (5.2.3)
actionpack (= 5.2.3)
activerecord (= 5.2.3)
marcel (~> 0.3.1)
activesupport (5.2.0)
activesupport (5.2.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
arel (9.0.0)
builder (3.2.3)
concurrent-ruby (1.0.5)
concurrent-ruby (1.1.5)
crass (1.0.4)
erubi (1.7.1)
globalid (0.4.1)
erubi (1.8.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.0.1)
i18n (1.6.0)
concurrent-ruby (~> 1.0)
loofah (2.2.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.0)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.2)
marcel (0.3.3)
mimemagic (~> 0.3.2)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.0)
mini_portile2 (2.3.0)
method_source (0.9.2)
mimemagic (0.3.3)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.11.3)
nio4r (2.3.1)
nokogiri (1.8.3)
mini_portile2 (~> 2.3.0)
rack (2.0.5)
rack-test (1.0.0)
nio4r (2.5.1)
nokogiri (1.10.4)
mini_portile2 (~> 2.4.0)
rack (2.0.7)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (5.2.0)
actioncable (= 5.2.0)
actionmailer (= 5.2.0)
actionpack (= 5.2.0)
actionview (= 5.2.0)
activejob (= 5.2.0)
activemodel (= 5.2.0)
activerecord (= 5.2.0)
activestorage (= 5.2.0)
activesupport (= 5.2.0)
rails (5.2.3)
actioncable (= 5.2.3)
actionmailer (= 5.2.3)
actionpack (= 5.2.3)
actionview (= 5.2.3)
activejob (= 5.2.3)
activemodel (= 5.2.3)
activerecord (= 5.2.3)
activestorage (= 5.2.3)
activesupport (= 5.2.3)
bundler (>= 1.3.0)
railties (= 5.2.0)
railties (= 5.2.3)
sprockets-rails (>= 2.0.0)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.0.4)
rails-html-sanitizer (1.2.0)
loofah (~> 2.2, >= 2.2.2)
railties (5.2.0)
actionpack (= 5.2.0)
activesupport (= 5.2.0)
railties (5.2.3)
actionpack (= 5.2.3)
activesupport (= 5.2.3)
method_source
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (12.3.1)
thor (>= 0.19.0, < 2.0)
rake (12.3.3)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.13)
thor (0.20.0)
sqlite3 (1.4.1)
thor (0.20.3)
thread_safe (0.3.6)
tzinfo (1.2.5)
thread_safe (~> 0.1)
websocket-driver (0.7.0)
websocket-driver (0.7.1)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.3)
websocket-extensions (0.1.4)

PLATFORMS
ruby
Expand All @@ -124,4 +124,4 @@ DEPENDENCIES
sqlite3

BUNDLED WITH
1.16.2
1.17.2
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# Orchid

Orchid is a generator which can be used to create a new CDRH API template site. The new site can either connect to the entire API's contents or filter by "type," meaning that the new site can be used for a specific collection.

**Orchid Documentation can be found [in our documentation repository](https://github.com/CDRH/sneezewort/blob/master/docs/orchid/README.md)**

**Documentation for entire publishing system can be found here: ([https://github.com/CDRH/sneezewort](https://github.com/CDRH/sneezewort))**

Documentation on migration can be found [on the Migration page](migration.md)
Orchid is a multi-lingual Rails engine which handles common functionality across
Rails apps which rely on the CDRH API. It includes a generator for configuring
new Rails apps, which can primarily connect to the endpoint for the entire API's
contents, or connect to an endpoint that only searches a specific collection's
contents. Apps can also configure additional "sections" which use independent
API configurations and search filtering UI, as well as the ability to granularly
overrides templates without the need to copy or create additional Rails
controllers.

**[Orchid Documentation](docs/README.md)**

[Migration instructions](migration.md) are provided for upgrading after new
releases.
9 changes: 7 additions & 2 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// Compatible with Sprockets 3.x defaults to avoid breaking existing apps
// https://github.com/rails/sprockets/blob/master/UPGRADING.md#manifestjs
//= link_tree ../images
//= link_directory ../javascripts .js
//= link_directory ../stylesheets .css
//= link application.css
//= link application.js

// Orchid engine's manifest: orchid/app/assets/config/orchid/manifest.js
//= link orchid/manifest.js
5 changes: 5 additions & 0 deletions app/assets/config/orchid/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Declare Orchid's assets for auto and pre-compilation
// which can't be declared with portable relative paths from the generated app
//= link_tree ../../images/orchid
//= link_tree ../../javascripts/orchid .js
//= link_tree ../../stylesheets/orchid .css
5 changes: 1 addition & 4 deletions app/assets/stylesheets/bootstrap-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ $bootstrap-sass-asset-helper: false !default;
// Variables
// --------------------------------------------------

@import url(https://fonts.googleapis.com/css?family=Alice);
@import url(https://fonts.googleapis.com/css?family=Josefin+Sans:300);


//== Colors
//
Expand Down Expand Up @@ -51,7 +48,7 @@ $link-hover-decoration: underline !default;
//
//## Font, line-height, and color for body text, headings, and more.

$font-family-sans-serif: "Josefin Sans", "Helvetica Neue", Helvetica, Arial, sans-serif !default;
$font-family-sans-serif: Helvetica, Arial, sans-serif !default;
$font-family-serif: Georgia, "Times New Roman", Times, serif !default;
//** Default monospace fonts for `<code>`, `<kbd>`, and `<pre>`.
$font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace !default;
Expand Down
12 changes: 12 additions & 0 deletions app/assets/stylesheets/orchid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,15 @@
display: block;
}
}

// Search Results

.search_results_highlights {
p:before {
content: "";
}

p:after {
content: "";
}
}
58 changes: 52 additions & 6 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception

before_action :set_locale
before_action :set_locale, :set_section

def set_locale
I18n.locale = params["locale"] || APP_OPTS["language_default"] || "en"
Expand All @@ -11,10 +11,56 @@ def default_url_options
params["locale"] ? { locale: I18n.locale } : {}
end

if API_PATH
$api = ApiBridge::Query.new(API_PATH, Facets.facet_list, API_OPTS)
logger.info("Connecting to API at #{API_PATH}")
else
raise "No API path found for project, please make sure the config file is correctly filled out"
private

# Render section overrides
# View name does not include the locale or extensions
# Example:
# render_overridable("explore/pages", "index")
# Looks for in order:
# If @section defined & no locale, "@section/index.html.erb"
# If no @section or locale, "explore/pages/index.html.erb"
# If no view found, render an error message with missing view path
def render_overridable(path="", view="", **kwargs)
# Only one arg will be passed if replacing a simple `render "template"` call
# In that case, set view to arg value assigned to path and empty path
if view == ""
view = path
# template_exists? still needs a path to search; lookup_context.prefixes
# is what render code uses when only one arg, so assign it to path here
path = lookup_context.prefixes
end

# If view still empty (no args), use controller action as view name
if view == ""
view = params[:action]
end

# False when looking for views rather than partials
is_partial = false

if @section.present? && lookup_context.template_exists?(view,
"#{@section}/#{path}", is_partial)
path = "#{@section}/#{path}"
elsif !lookup_context.template_exists?(view, path, is_partial)
# Log error and display 404 view if view is missing
path << "/" if path.present?
logger.error("render_overridable unable to find view: #{path}#{view}")

return render "errors/not_found", status: 404
end

# Revert earlier assignment of lookup_context.prefixes so render args are
# same as simple call `render "template"` being overridden
path = "" if path == lookup_context.prefixes

path << "/" if path.present?
render "#{path}#{view}", kwargs
end

def set_section
@section = params[:section]
@section.chomp!("_") if @section.present?
params.delete :section
end
end
4 changes: 2 additions & 2 deletions app/controllers/errors_controller.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class ErrorsController < ApplicationController

def not_found
render :status => 404
render(status: 404)
end

def server_error
render :status => 500
render(status: 500)
end

end
3 changes: 3 additions & 0 deletions app/controllers/general_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
class GeneralController < ApplicationController
def about
@title = t "about.title"
render_overridable("general", "about")
end

def index
render_overridable("general", "index")
end
end
Loading

0 comments on commit 9d9a873

Please sign in to comment.