publish_my_data 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/app/models/publish_my_data/dataset.rb +2 -2
- data/lib/publish_my_data/paginator.rb +3 -2
- data/lib/publish_my_data/version.rb +1 -1
- data/spec/dummy/log/test.log +6199 -0
- metadata +14 -14
@@ -23,7 +23,7 @@ module PublishMyData
|
|
23
23
|
field :data_dump, RDF::VOID.dataDump, :is_uri => true # full download URI
|
24
24
|
|
25
25
|
# what the data is about
|
26
|
-
field :theme, RDF::DCAT.theme
|
26
|
+
field :theme, RDF::DCAT.theme, :is_uri => true
|
27
27
|
field :tags, RDF::DCAT.keyword, :multivalued => true # values are string literals
|
28
28
|
|
29
29
|
# field :spatial_coverage, RDF::DC.spatial # value is a URI for region covered, e.g. England.
|
@@ -56,7 +56,7 @@ module PublishMyData
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def theme_obj
|
59
|
-
Theme.find(self.theme) rescue nil
|
59
|
+
Theme.find(self.theme.to_s) rescue nil
|
60
60
|
end
|
61
61
|
|
62
62
|
class << self
|
@@ -59,9 +59,10 @@ module PublishMyData
|
|
59
59
|
# returns a Kaminari paginatable array, or a plain old array
|
60
60
|
# Note that this uses the :return_graph => false option for criteria execution to avoid duplicate graphs in the results
|
61
61
|
# (which could mess with the pagination counts)
|
62
|
-
|
62
|
+
# optionally pass an integer to use for the total count.
|
63
|
+
def paginate(total_count=nil)
|
63
64
|
if self.pagination_params.format == :html && pagination_params.per_page && pagination_params.page
|
64
|
-
count = criteria.count #this has to happen first, before we modify the criteria with limit/offset
|
65
|
+
count = total_count || criteria.count #this has to happen first, before we modify the criteria with limit/offset
|
65
66
|
add_limit_and_offset_criteria(criteria)
|
66
67
|
paginatable = Kaminari.paginate_array(criteria.resources(:return_graph => false).to_a, total_count: count).page(self.pagination_params.page).per(self.pagination_params.per_page)
|
67
68
|
else
|