Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Make readme file required for datasets (HYLIBRA-327)

  • Loading branch information...
commit f79f1630fea8e38e7a789ff0a3e217f510602c25 1 parent 7022c3e
darthmolly authored
19 app/models/hydrangea_dataset.rb
@@ -42,7 +42,16 @@ def test_release_readiness
42 42 data_created_values = datastreams["descMetadata"].term_values(:origin_info, :date_created)
43 43 abstract_values = datastreams["descMetadata"].term_values(:abstract)
44 44 libra_location_values = datastreams["descMetadata"].term_values(:libra_location)
45   -
  45 +
  46 + # check for files
  47 + files = self.file_objects(:response_format=>:solr)
  48 + has_readme = false
  49 + has_dataset = false
  50 + files.each do |file|
  51 + type = file[solr_name("description", :text)].first
  52 + has_readme = true if type =~ /readme/i
  53 + has_dataset = true if type =~ /dataset/i
  54 + end
46 55 response = {:failures=>[]}
47 56
48 57 if author_entries.empty?
@@ -65,7 +74,13 @@ def test_release_readiness
65 74 response[:failures] << "Please provide Associated Open Access Work or Electronic Thesis/Dissertation."
66 75 end
67 76
68   -
  77 + if !has_readme
  78 + response[:failures] << "Please upload a Readme file for your submission"
  79 + end
  80 +
  81 + if !has_dataset
  82 + response[:failures] << "Please upload a dataset file for your submission"
  83 + end
69 84
70 85 if response[:failures].empty?
71 86 return true
2  app/views/file_assets/_result.html.haml
@@ -2,6 +2,8 @@
2 2 %td
3 3 =link_to result[solr_name("title", :text)], file_asset_path(result["id"])
4 4 %td
  5 + =result[solr_name("description", :text)]
  6 + %td
5 7 =result[solr_name("extent", :text)]
6 8 -if(!@document.nil? && @document.get(:released_facet) == "false" && editor?)
7 9 %td
1  app/views/file_assets/index.html.haml
@@ -33,6 +33,7 @@
33 33 %table#file_assets.multipleEdit
34 34 %thead
35 35 %th File Name
  36 + %th File Type
36 37 %th Size
37 38 %tbody
38 39 =render :partial=>'result', :collection=>@solr_result.hits
7 lib/hydra/file_assets_helper.rb
@@ -9,10 +9,17 @@ def create_and_save_file_asset_from_params
9 9 @file_asset = create_asset_from_params
10 10 add_posted_blob_to_asset
11 11 @file_asset.save
  12 +
  13 + # record if it's a readme, dataset, or other
  14 + if params.has_key?(:file_type_select)
  15 + @file_asset.datastreams_in_memory["descMetadata"].description_values = params[:file_type_select]
  16 + end
  17 +
12 18 return @file_asset
13 19 else
14 20 return false
15 21 end
16 22 end
17 23
  24 +
18 25 end

0 comments on commit f79f163

Please sign in to comment.
Something went wrong with that request. Please try again.