# Produces:
# -----------------------------
#  cc_template                               <-- belongs to organisation: cc
#  cc_template_unpublished                   <-- belongs to organisation: cc
#
#  funder_template_1                         <-- belongs to organisation: funder
#  funder_template_2                         <-- belongs to organisation: funder
#  funder_template_unpublished               <-- belongs to organisation: funder
#
#  complete_template                         <-- belongs to organisation: complete
#
#  institution_[1..2]_template               <-- belongs to organisation: institution_X
#  institution_[1..2]_template_unpublished   <-- belongs to organisation: institution_X
#
#  school_[1..2]_template                    <-- belongs to organisation: school_X
#  school_[1..2]_template_unpublished        <-- belongs to organisation: school_X
#
#  project_[1..2]_template                   <-- belongs to organisation: project_X
#  project_[1..2]_template_unpublished       <-- belongs to organisation: project_X
#

# Import organisation_types.yml so that we can dynamically generate organisations
<% organisation_types = YAML::load(ERB.new(File.read('./test/fixtures/organisation_types.yml')).result) %>

cc_template:
  title: "Curation Centre Default Template"
  description: "The default template"
  published: true
  organisation: curation_center
  locale: en-UK
  is_default: true

cc_template_unpublished:
  title: "Curation Centre Default Template"
  description: "The default template"
  published: false
  organisation: curation_center
  locale: en-UK
  is_default: true

<% 3.times do |n| %>
<% nbr = (n + 1) %>
funder_template_<%= (n == 1 ? 'unpublished' : nbr) %>:
  title: <%= "Funder Template #{(n == 1 ? 'unpublished' : nbr)}" %>
  published: <%= (n != 1) %>
  organisation: funder
  locale: en-UK
<% end %>

complete_template:
  title: "Complete Organisation's Template"
  description: "The template for the complete organisation"
  published: true
  organisation: complete
  locale: en-UK

<% organisation_types.each do |lbl, obj| %>
  <% unless ['funder', 'organisation'].include?(lbl) %>
    <% 2.times do |x| %>
      <% 2.times do |y| %>

<%= lbl %>_<%= x + 1 %>_template<%= (y == 0 ? '' : '_unpublished') %>:
  title: <%= "#{obj['name']} #{x + 1} Template #{(y == 0 ? '' : 'Unpublished')}" %>
  published: <%= (y == 0) %>
  organisation: <%= lbl %>_<%= x + 1 %>
  locale: en-UK

      <% end %>
    <% end %>
  <% end %>
<% end %>