artk 0.1.0 → 0.2.0
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.
@@ -10,5 +10,14 @@ class ComponentsController < Artk::ApplicationController
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
def show
|
14
|
+
@results = Resource.find_by_ead_id(params[:resource_id]).component(params[:id])
|
15
|
+
respond_to do |format|
|
16
|
+
format.html { render :layout => false, :text => @results.to_json }
|
17
|
+
format.json { render :layout => false, :text => @results.to_json }
|
18
|
+
format.js { render :layout => false, :text => @results.to_json }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
13
22
|
end
|
14
23
|
end
|
@@ -2,7 +2,7 @@ module Artk
|
|
2
2
|
class ResourcesController < Artk::ApplicationController
|
3
3
|
|
4
4
|
def index
|
5
|
-
@results =
|
5
|
+
@results = return_resource_results.collect { |fa| fa.pid_and_title }
|
6
6
|
respond_to do |format|
|
7
7
|
format.html { render :layout => false, :text => @results.to_json }
|
8
8
|
format.json { render :layout => false, :text => @results.to_json }
|
@@ -24,5 +24,15 @@ class ResourcesController < Artk::ApplicationController
|
|
24
24
|
|
25
25
|
end
|
26
26
|
|
27
|
+
private
|
28
|
+
|
29
|
+
def return_resource_results
|
30
|
+
if params[:q]
|
31
|
+
Resource.where("title like ?", "%"+params[:q]+"%")
|
32
|
+
else
|
33
|
+
Resource.finding_aids
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
27
37
|
end
|
28
38
|
end
|
data/app/models/artk/resource.rb
CHANGED
@@ -20,7 +20,7 @@ class Resource < Artk::Base
|
|
20
20
|
self.where("eadFaUniqueIdentifier = '#{id}'").first
|
21
21
|
end
|
22
22
|
|
23
|
-
# Returns all Artk::
|
23
|
+
# Returns all Artk::Component objects that have children components attached to them
|
24
24
|
# and are not just the first level of <c> nodes in the finding aid
|
25
25
|
def all_series
|
26
26
|
first = retrieve_initial_series
|
@@ -40,8 +40,13 @@ class Resource < Artk::Base
|
|
40
40
|
return first + second + third + fourth + fifth + sixth
|
41
41
|
end
|
42
42
|
|
43
|
+
# Returns a single Artk::Component for a given ref id
|
44
|
+
def component ref
|
45
|
+
self.all_series.collect { |c| c if c.persistentId == ref }.first
|
46
|
+
end
|
47
|
+
|
43
48
|
def pid_and_title
|
44
|
-
{self.eadFaUniqueIdentifier => self.findingAidTitle}
|
49
|
+
{ :pid => self.eadFaUniqueIdentifier, :title => self.findingAidTitle }
|
45
50
|
end
|
46
51
|
|
47
52
|
private
|
data/config/routes.rb
CHANGED
data/lib/artk/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash:
|
136
|
+
hash: -2669443078563737161
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
segments:
|
144
144
|
- 0
|
145
|
-
hash:
|
145
|
+
hash: -2669443078563737161
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
148
|
rubygems_version: 1.8.23
|