aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb13
-rw-r--r--app/models/public_body.rb20
2 files changed, 32 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index aed651ad3..d0052603a 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1048,6 +1048,19 @@ public
File.join(Rails.root, "cache", "zips", "#{Rails.env}")
end
+ def foi_fragment_cache_directories
+ # return stub path so admin can expire it
+ directories = []
+ path = File.join("request", request_dirs)
+ foi_cache_path = File.expand_path(File.join(Rails.root, 'cache', 'views'))
+ directories << File.join(foi_cache_path, path)
+ I18n.available_locales.each do |locale|
+ directories << File.join(foi_cache_path, locale.to_s, path)
+ end
+
+ directories
+ end
+
def request_dirs
first_three_digits = id.to_s()[0..2]
File.join(first_three_digits.to_s, id.to_s)
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index b22482541..87b5c2227 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -60,6 +60,21 @@ class PublicBody < ActiveRecord::Base
translates :name, :short_name, :request_email, :url_name, :notes, :first_letter, :publication_scheme
+ # Default fields available for importing from CSV, in the format
+ # [field_name, 'short description of field (basic html allowed)']
+ cattr_accessor :csv_import_fields do
+ [
+ ['name', '(i18n)<strong>Existing records cannot be renamed</strong>'],
+ ['short_name', '(i18n)'],
+ ['request_email', '(i18n)'],
+ ['notes', '(i18n)'],
+ ['publication_scheme', '(i18n)'],
+ ['disclosure_log', '(i18n)'],
+ ['home_page', ''],
+ ['tag_string', '(tags separated by spaces)'],
+ ]
+ end
+
# Public: Search for Public Bodies whose name, short_name, request_email or
# tags contain the given query
#
@@ -477,7 +492,10 @@ class PublicBody < ActiveRecord::Base
next
end
- field_list = ['name', 'short_name', 'request_email', 'notes', 'publication_scheme', 'disclosure_log', 'home_page', 'tag_string']
+ field_list = []
+ self.csv_import_fields.each do |field_name, field_notes|
+ field_list.push field_name
+ end
if public_body = bodies_by_name[name] # Existing public body
available_locales.each do |locale|