dbla 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -0
- data/app/assets/stylesheets/dbla/dbla.scss +9 -0
- data/lib/dbla/abstract_response.rb +4 -0
- data/lib/dbla/response.rb +6 -5
- data/lib/dbla/version.rb +1 -1
- data/lib/generators/dbla/assets_generator.rb +10 -0
- data/lib/generators/dbla/install_generator.rb +35 -0
- data/lib/generators/dbla/models_generator.rb +1 -1
- data/lib/generators/dbla/routes_generator.rb +1 -1
- data/lib/generators/dbla/templates/dbla.css.scss +1 -0
- data/lib/tasks/dbla_key.rake +1 -1
- metadata +6 -2
- data/app/assets/stylesheets/dbla/application.css +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb8fae248060253ada17d9cbc785ec9bef380173
|
4
|
+
data.tar.gz: f9c302e800a86a250dcbf215b16464e73e07f438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d86878a38f42a993afc633916a57e83a251f78dba365c28cccccaf2035e6528c663ac6bbcdacae8139684b68356bdc8117f5aeefcbc7876643e5bb1732450536
|
7
|
+
data.tar.gz: 37ad200951dfc84c7b99c005daa60465db099b5c4b3857115e402f74f9006ee2f9dee669d6750913f90bd9670bad5836cdd7ed3e3290b26a02a06c73cc1f471a
|
data/README.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
= Dbla
|
2
|
+
|
3
|
+
1. Generate a Blacklight app:
|
4
|
+
```
|
5
|
+
rails new search_app -m https://raw.github.com/projectblacklight/blacklight/master/template.demo.rb
|
6
|
+
cd search_app
|
7
|
+
```
|
8
|
+
|
9
|
+
2. Add the dbla gem to the Gemfile:
|
10
|
+
```
|
11
|
+
gem "dbla"
|
12
|
+
```
|
13
|
+
and bundle install.
|
14
|
+
|
15
|
+
3. Run the dbla generators:
|
16
|
+
```
|
17
|
+
rails g dbla:install
|
18
|
+
```
|
19
|
+
|
20
|
+
4. Create a config/dpla.yml file of the form:
|
21
|
+
```
|
22
|
+
api_key: 00000000
|
23
|
+
api_email: ab@dp.la
|
24
|
+
url: http://api.dp.la/v2/
|
25
|
+
```
|
26
|
+
This file can be stubbed out with a rake task:
|
27
|
+
```
|
28
|
+
rake dbla:key:get email=my.email@my.server.org
|
29
|
+
# get your email
|
30
|
+
rake dbla:key:config key=YOURKEY00000000
|
31
|
+
```
|
32
|
+
5. Configure the CatalogController
|
33
|
+
```
|
34
|
+
config.repository_class = Dbla::Repository
|
35
|
+
config.document_model = Item
|
36
|
+
config.response_model = Dbla::Response
|
37
|
+
config.document_presenter_class = Dbla::DocumentPresenter
|
38
|
+
# solr field configuration for search results/index views
|
39
|
+
config.index.title_field = 'sourceResource/title'
|
40
|
+
config.index.thumbnail_field = 'object'
|
41
|
+
config.index.display_type_field = 'format'
|
42
|
+
```
|
43
|
+
|
44
|
+
6. Fire it up!
|
45
|
+
``` rails s```
|
46
|
+
|
47
|
+
Go to localhost:3000
|
48
|
+
|
49
|
+
Search for kittens!
|
data/lib/dbla/response.rb
CHANGED
@@ -6,11 +6,12 @@ module Dbla
|
|
6
6
|
@request_params = request_params
|
7
7
|
self.document_model = options[:solr_document_model] || options[:document_model] || Item
|
8
8
|
self.blacklight_config = options[:blacklight_config]
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
9
|
+
if data
|
10
|
+
@total = data['count']
|
11
|
+
@documents = (data['docs'] || []).map {|d| document_model.new(d,self)}
|
12
|
+
@start = data['start']
|
13
|
+
@limit = data['limit']
|
14
|
+
end
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
data/lib/dbla/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
module Dbla
|
2
|
+
class Install < Rails::Generators::Base
|
3
|
+
|
4
|
+
source_root File.expand_path('../templates', __FILE__)
|
5
|
+
|
6
|
+
argument :controller_name, type: :string , default: "catalog"
|
7
|
+
argument :search_builder_name, type: :string , default: "search_builder"
|
8
|
+
|
9
|
+
desc """
|
10
|
+
This generator makes the following changes to your application:
|
11
|
+
1. Generates dbla:models
|
12
|
+
3. Creates a stylesheet
|
13
|
+
2. Adds Dbla routes to your ./config/routes.rb
|
14
|
+
"""
|
15
|
+
|
16
|
+
# Copy all files in templates/public/ directory to public/
|
17
|
+
# Call external generator in AssetsGenerator, so we can
|
18
|
+
# leave that callable seperately too.
|
19
|
+
def copy_public_assets
|
20
|
+
generate "dbla:assets"
|
21
|
+
end
|
22
|
+
|
23
|
+
def generate_search_builder
|
24
|
+
generate 'dbla:search_builder', search_builder_name
|
25
|
+
end
|
26
|
+
|
27
|
+
def generate_dbla_models
|
28
|
+
generate 'dbla:models'
|
29
|
+
end
|
30
|
+
|
31
|
+
def generate_dbla_routes
|
32
|
+
generate 'dbla:routes'
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -10,7 +10,7 @@ module Dbla
|
|
10
10
|
1. Adds routes for your controller
|
11
11
|
"""
|
12
12
|
|
13
|
-
def
|
13
|
+
def inject_dbla_routes
|
14
14
|
# These will end up in routes.rb file in reverse order
|
15
15
|
# we add em, since each is added at the top of file.
|
16
16
|
# we want "root" to be FIRST for optimal url generation.
|
@@ -0,0 +1 @@
|
|
1
|
+
@import 'dbla/dbla';
|
data/lib/tasks/dbla_key.rake
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Audrey Altman
|
@@ -90,9 +90,10 @@ extensions: []
|
|
90
90
|
extra_rdoc_files: []
|
91
91
|
files:
|
92
92
|
- LICENSE
|
93
|
+
- README.md
|
93
94
|
- Rakefile
|
94
95
|
- app/assets/javascripts/dbla/application.js
|
95
|
-
- app/assets/stylesheets/dbla/
|
96
|
+
- app/assets/stylesheets/dbla/dbla.scss
|
96
97
|
- app/controllers/dbla/application_controller.rb
|
97
98
|
- app/helpers/dbla/application_helper.rb
|
98
99
|
- app/views/layouts/dbla/application.html.erb
|
@@ -106,10 +107,13 @@ files:
|
|
106
107
|
- lib/dbla/routes.rb
|
107
108
|
- lib/dbla/search_builder_behavior.rb
|
108
109
|
- lib/dbla/version.rb
|
110
|
+
- lib/generators/dbla/assets_generator.rb
|
111
|
+
- lib/generators/dbla/install_generator.rb
|
109
112
|
- lib/generators/dbla/models_generator.rb
|
110
113
|
- lib/generators/dbla/routes_generator.rb
|
111
114
|
- lib/generators/dbla/search_builder_generator.rb
|
112
115
|
- lib/generators/dbla/templates/collection.rb
|
116
|
+
- lib/generators/dbla/templates/dbla.css.scss
|
113
117
|
- lib/generators/dbla/templates/item.rb
|
114
118
|
- lib/generators/dbla/templates/search_builder.rb
|
115
119
|
- lib/tasks/dbla_key.rake
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any styles
|
10
|
-
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
11
|
-
* file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|