blacklight-spotlight 1.5.1 → 2.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -3
  3. data/app/assets/javascripts/spotlight/translation_progress.js +23 -0
  4. data/app/assets/stylesheets/spotlight/_spotlight.scss +2 -0
  5. data/app/assets/stylesheets/spotlight/_translations.scss +47 -0
  6. data/app/assets/stylesheets/spotlight/_utilities.scss +3 -0
  7. data/app/assets/stylesheets/spotlight/_variables.scss +5 -0
  8. data/app/controllers/concerns/spotlight/controller.rb +12 -1
  9. data/app/controllers/spotlight/about_pages_controller.rb +6 -0
  10. data/app/controllers/spotlight/browse_controller.rb +1 -1
  11. data/app/controllers/spotlight/catalog_controller.rb +6 -1
  12. data/app/controllers/spotlight/exhibits_controller.rb +10 -2
  13. data/app/controllers/spotlight/feature_pages_controller.rb +6 -0
  14. data/app/controllers/spotlight/filters_controller.rb +2 -2
  15. data/app/controllers/spotlight/home_pages_controller.rb +10 -0
  16. data/app/controllers/spotlight/languages_controller.rb +46 -0
  17. data/app/controllers/spotlight/pages_controller.rb +57 -3
  18. data/app/controllers/spotlight/solr_controller.rb +3 -3
  19. data/app/controllers/spotlight/translations_controller.rb +34 -0
  20. data/app/helpers/spotlight/application_helper.rb +1 -0
  21. data/app/helpers/spotlight/languages_helper.rb +33 -0
  22. data/app/helpers/spotlight/translations_helper.rb +13 -0
  23. data/app/models/concerns/spotlight/custom_translation_extension.rb +4 -0
  24. data/app/models/concerns/spotlight/translatables.rb +30 -0
  25. data/app/models/spotlight/ability.rb +5 -2
  26. data/app/models/spotlight/about_page.rb +1 -1
  27. data/app/models/spotlight/exhibit.rb +14 -6
  28. data/app/models/spotlight/feature_page.rb +1 -2
  29. data/app/models/spotlight/home_page.rb +1 -3
  30. data/app/models/spotlight/language.rb +24 -0
  31. data/app/models/spotlight/main_navigation.rb +12 -0
  32. data/app/models/spotlight/page.rb +53 -1
  33. data/app/models/spotlight/resources/upload.rb +6 -1
  34. data/app/models/spotlight/search.rb +4 -0
  35. data/app/services/spotlight/clone_translated_page_from_locale.rb +32 -0
  36. data/app/views/_user_util_links.html.erb +1 -0
  37. data/app/views/devise/mailer/invitation_instructions.html.erb +2 -2
  38. data/app/views/layouts/spotlight/spotlight.html.erb +2 -2
  39. data/app/views/shared/_curated_features_navbar.html.erb +2 -2
  40. data/app/views/spotlight/about_pages/_sidebar.html.erb +1 -1
  41. data/app/views/spotlight/admin_users/index.html.erb +1 -1
  42. data/app/views/spotlight/catalog/_edit_default.html.erb +1 -1
  43. data/app/views/spotlight/exhibits/_export.html.erb +1 -1
  44. data/app/views/spotlight/exhibits/_form.html.erb +1 -1
  45. data/app/views/spotlight/exhibits/_import.html.erb +2 -1
  46. data/app/views/spotlight/exhibits/_languages.html.erb +56 -0
  47. data/app/views/spotlight/exhibits/edit.html.erb +11 -5
  48. data/app/views/spotlight/feature_pages/_sidebar.html.erb +1 -1
  49. data/app/views/spotlight/filters/_form.html.erb +2 -1
  50. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  51. data/app/views/spotlight/shared/_curation_sidebar.html.erb +5 -0
  52. data/app/views/spotlight/shared/_locale_picker.html.erb +14 -0
  53. data/app/views/spotlight/translations/_browse_categories.html.erb +67 -0
  54. data/app/views/spotlight/translations/_general.html.erb +176 -0
  55. data/app/views/spotlight/translations/_metadata.html.erb +67 -0
  56. data/app/views/spotlight/translations/_page.html.erb +45 -0
  57. data/app/views/spotlight/translations/_pages.html.erb +37 -0
  58. data/app/views/spotlight/translations/_pages_table.html.erb +15 -0
  59. data/app/views/spotlight/translations/_search_fields.html.erb +97 -0
  60. data/app/views/spotlight/translations/edit.html.erb +55 -0
  61. data/config/i18n-tasks.yml +81 -0
  62. data/config/locales/devise.en.yml +2 -1
  63. data/config/locales/spotlight.en.yml +657 -614
  64. data/config/routes.rb +19 -1
  65. data/db/migrate/20180308203409_create_spotlight_languages.rb +12 -0
  66. data/db/migrate/20180403130857_translation_uniqueness.rb +5 -0
  67. data/db/migrate/20180405044000_add_locale_to_pages.rb +6 -0
  68. data/db/migrate/20180406212516_add_default_locale_reference_to_spotlight_pages.rb +7 -0
  69. data/lib/generators/spotlight/templates/catalog_controller.rb +2 -2
  70. data/lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb +14 -4
  71. data/lib/generators/spotlight/templates/config/initializers/translation.rb +4 -2
  72. data/lib/migration/page_language.rb +27 -0
  73. data/lib/spotlight/engine.rb +32 -4
  74. data/lib/spotlight/upload_field_config.rb +27 -0
  75. data/lib/spotlight/version.rb +1 -1
  76. data/lib/tasks/spotlight_tasks.rake +6 -0
  77. data/spec/controllers/spotlight/about_pages_controller_spec.rb +67 -1
  78. data/spec/controllers/spotlight/feature_pages_controller_spec.rb +50 -0
  79. data/spec/controllers/spotlight/filters_controller_spec.rb +4 -4
  80. data/spec/controllers/spotlight/home_pages_controller_spec.rb +25 -0
  81. data/spec/controllers/spotlight/languages_controller_spec.rb +66 -0
  82. data/spec/controllers/spotlight/pages_controller_spec.rb +45 -0
  83. data/spec/controllers/spotlight/solr_controller_spec.rb +1 -1
  84. data/spec/controllers/spotlight/translations_controller_spec.rb +67 -0
  85. data/spec/examples.txt +1171 -1281
  86. data/spec/factories/exhibits.rb +1 -1
  87. data/spec/factories/language.rb +6 -0
  88. data/spec/factories/main_navigation.rb +7 -0
  89. data/spec/factories/searches.rb +1 -0
  90. data/spec/factories/tags.rb +1 -0
  91. data/spec/features/exhibits/language_create_edit_spec.rb +53 -0
  92. data/spec/features/exhibits/translation_editing_spec.rb +397 -0
  93. data/spec/features/javascript/locale_selector_spec.rb +61 -0
  94. data/spec/helpers/spotlight/languages_helper_spec.rb +73 -0
  95. data/spec/helpers/spotlight/translations_helper_spec.rb +16 -0
  96. data/spec/i18n_spec.rb +29 -0
  97. data/spec/lib/migration/page_language_spec.rb +21 -0
  98. data/spec/lib/spotlight/upload_field_config_spec.rb +24 -0
  99. data/spec/models/spotlight/ability_spec.rb +17 -4
  100. data/spec/models/spotlight/exhibit_spec.rb +49 -0
  101. data/spec/models/spotlight/language_spec.rb +41 -0
  102. data/spec/models/spotlight/page_spec.rb +109 -0
  103. data/spec/models/translation_spec.rb +11 -0
  104. data/spec/services/spotlight/clone_translated_page_from_locale_spec.rb +29 -0
  105. data/spec/spec_helper.rb +1 -13
  106. data/spec/support/disable_friendly_id_deprecation_warnings.rb +7 -6
  107. data/spec/test_app_templates/Gemfile.extra +3 -0
  108. data/spec/test_app_templates/catalog_controller.rb +31 -31
  109. data/spec/test_app_templates/lib/generators/test_app_generator.rb +9 -6
  110. data/spec/views/spotlight/contacts/edit.html.erb_spec.rb +13 -0
  111. data/spec/views/spotlight/exhibits/_form.html.erb_spec.rb +33 -0
  112. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +4 -1
  113. data/spec/views/spotlight/resources/_external_resources_form.html.erb_spec.rb +13 -0
  114. data/spec/views/spotlight/resources/new.html.erb_spec.rb +10 -4
  115. data/spec/views/spotlight/translations/_page.html.erb_spec.rb +75 -0
  116. metadata +88 -28
  117. data/app/assets/javascripts/spotlight/sir-trevor.js +0 -0
  118. data/app/views/shared/_share_follow.html.erb +0 -5
  119. data/config/locales/social_share_button.en.yml +0 -18
@@ -14,7 +14,12 @@ module Spotlight
14
14
  def self.fields(exhibit)
15
15
  @fields ||= {}
16
16
  @fields[exhibit] ||= begin
17
- title_field = Spotlight::Engine.config.upload_title_field || OpenStruct.new(field_name: exhibit.blacklight_config.index.title_field)
17
+ index_title_field = exhibit.blacklight_config.index.title_field
18
+ title_field = Spotlight::Engine.config.upload_title_field ||
19
+ Spotlight::UploadFieldConfig.new(
20
+ field_name: index_title_field,
21
+ label: I18n.t(:"spotlight.search.fields.#{index_title_field}")
22
+ )
18
23
  [title_field] + exhibit.uploaded_resource_fields
19
24
  end
20
25
  end
@@ -2,6 +2,7 @@ module Spotlight
2
2
  ##
3
3
  # Exhibit saved searches
4
4
  class Search < ActiveRecord::Base
5
+ include Spotlight::Translatables
5
6
  extend FriendlyId
6
7
  friendly_id :title, use: [:slugged, :scoped, :finders, :history], scope: :exhibit
7
8
 
@@ -11,6 +12,9 @@ module Spotlight
11
12
  default_scope { order('weight ASC') }
12
13
  scope :published, -> { where(published: true) }
13
14
  validates :title, presence: true
15
+
16
+ translates :title, :long_description
17
+
14
18
  has_paper_trail
15
19
 
16
20
  belongs_to :masthead, dependent: :destroy, optional: true
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spotlight
4
+ ##
5
+ # A service class to encapsulate business logic
6
+ # around cloning and destroying translated pages
7
+ class CloneTranslatedPageFromLocale
8
+ attr_reader :locale, :page
9
+
10
+ def initialize(locale:, page:)
11
+ @locale = locale
12
+ @page = page
13
+ end
14
+
15
+ def self.call(locale:, page:)
16
+ new(locale: locale, page: page).clone
17
+ end
18
+
19
+ def clone
20
+ @clone ||= begin
21
+ destroy
22
+ page.clone_for_locale(locale)
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def destroy
29
+ page.translated_page_for(locale).destroy if page.translated_page_for(locale).present?
30
+ end
31
+ end
32
+ end
@@ -7,6 +7,7 @@
7
7
  </ul>
8
8
 
9
9
  <ul class="nav navbar-nav">
10
+ <%= render '/spotlight/shared/locale_picker' %>
10
11
  <% if current_user %>
11
12
  <li class="dropdown">
12
13
  <a href="#" class="dropdown-toggle" data-toggle="dropdown"><%=current_user%> <b class="caret"></b></a>
@@ -9,6 +9,6 @@
9
9
 
10
10
  <p><%= t("spotlight.#{key}.invitation_instructions.someone_invited_you", role: @resource.roles.first.role, exhibit_name: @resource.roles.first.resource.title, url: spotlight.exhibit_home_page_url(@resource.roles.first.resource)) %></p>
11
11
 
12
- <p><%= link_to t("spotlight.#{key}.invitation_instructions.accept"), accept_invitation_url(@resource, :invitation_token => @token) %></p>
12
+ <p><%= link_to t("spotlight.#{key}.invitation_instructions.accept_invitation"), accept_invitation_url(@resource, :invitation_token => @token) %></p>
13
13
 
14
- <p><%= t("spotlight.#{key}.invitation_instructions.ignore_html") %></p>
14
+ <p><%= t("spotlight.#{key}.invitation_instructions.ignore") %></p>
@@ -13,8 +13,8 @@
13
13
  <meta http-equiv="cleartype" content="on">
14
14
  <![endif]-->
15
15
 
16
- <title><%= h(@page_title || application_name) %></title>
17
- <link href="<%= current_exhibit ? spotlight.opensearch_exhibit_catalog_url(current_exhibit, format: 'xml') : main_app.opensearch_catalog_url(format: 'xml') %>" title="<%= application_name %>" type="application/opensearchdescription+xml" rel="search"/>
16
+ <title><%= h(@page_title || application_name.to_s) %></title>
17
+ <link href="<%= current_exhibit ? spotlight.opensearch_exhibit_catalog_url(current_exhibit, format: 'xml') : main_app.opensearch_catalog_url(format: 'xml') %>" title="<%= h(@page_title || application_name.to_str) %>" type="application/opensearchdescription+xml" rel="search"/>
18
18
  <%= favicon_link_tag 'favicon.ico' %>
19
19
  <% if current_exhibit %>
20
20
  <%= exhibit_stylesheet_link_tag "application" %>
@@ -1,4 +1,4 @@
1
- <% published_top_level_feature_pages = current_exhibit.feature_pages.published.at_top_level -%>
1
+ <% published_top_level_feature_pages = current_exhibit.feature_pages.for_locale.published.at_top_level -%>
2
2
  <% if published_top_level_feature_pages.present? %>
3
3
  <% if published_top_level_feature_pages.many? %>
4
4
  <li class="dropdown">
@@ -12,4 +12,4 @@
12
12
  <% else %>
13
13
  <li class="<%= "active" if current_page?(url_for([spotlight, published_top_level_feature_pages.first.exhibit, published_top_level_feature_pages.first])) %>"><%= link_to published_top_level_feature_pages.first.title, [spotlight, published_top_level_feature_pages.first.exhibit, published_top_level_feature_pages.first] %></li>
14
14
  <% end %>
15
- <% end %>
15
+ <% end %>
@@ -2,7 +2,7 @@
2
2
  <div id="sidebar" class="col-md-3" role="complementary">
3
3
  <h4 class="nav-heading"><%= current_exhibit.main_navigations.about.label_or_default %></h4>
4
4
  <ul class="nav sidenav">
5
- <% current_exhibit.about_pages.published.each do |page| %>
5
+ <% current_exhibit.about_pages.for_locale.published.each do |page| %>
6
6
  <li class="<%= 'active' if current_page? [page.exhibit, page] %>">
7
7
  <%= link_to page.title, [page.exhibit, page] %>
8
8
  </li>
@@ -52,7 +52,7 @@
52
52
  <div id="all_users" class="well well-sm">
53
53
  <div class='btn-toolbar pull-right'>
54
54
  <button class="btn btn-xs btn-default copy-email-addresses" data-clipboard-target="#all_users">
55
- Copy
55
+ <%= t('.copy') %>
56
56
  </button>
57
57
  </div>
58
58
  <%= Spotlight::Engine.user_class.with_roles.pluck(:email).sort.join(', ') %>
@@ -14,7 +14,7 @@
14
14
  <% if document.uploaded_resource? %>
15
15
  <%= d.fields_for :configured_fields do |e| %>
16
16
  <% Spotlight::Resources::Upload.fields(current_exhibit).each do |config| %>
17
- <%= e.send((config.form_field_type || :text_field), config.field_name, value: (document.sidecar(current_exhibit).data["configured_fields"] || {})[config.field_name.to_s], label: uploaded_field_label(config)) %>
17
+ <%= e.send(config.form_field_type, config.field_name, value: (document.sidecar(current_exhibit).data["configured_fields"] || {})[config.field_name.to_s], label: uploaded_field_label(config)) %>
18
18
  <% end %>
19
19
  <% end %>
20
20
  <% end %>
@@ -1,4 +1,4 @@
1
- <div role="tabpanel" class="tab-pane" id="export">
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab == 'export' %>" id="export">
2
2
  <div class="row col-md-12">
3
3
  <p class="instructions"><%= t :'.instructions' %></p>
4
4
  <div class="primary-actions">
@@ -1,6 +1,6 @@
1
1
  <%= bootstrap_form_for @exhibit, url: ((spotlight.exhibit_path(@exhibit) if @exhibit.persisted?) || spotlight.exhibits_path), layout: :horizontal, label_col: 'col-md-2', control_col: 'col-md-10', html: {class: "row"} do |f| %>
2
2
  <div class="row col-md-12">
3
- <%= f.text_field :title %>
3
+ <%= f.text_field :title, disabled: !default_language?, help: !default_language? ? t('.uneditable_non_default_language') : '' %>
4
4
  <%= f.text_field :subtitle %>
5
5
  <%= f.text_area :description %>
6
6
  <%= f.text_field :tag_list, value: f.object.tag_list.to_s %>
@@ -1,9 +1,10 @@
1
- <div role="tabpanel" class="tab-pane" id="import">
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab == 'import' %>" id="import">
2
2
  <%= bootstrap_form_for [:import, current_exhibit], html: { class: 'clearfix', multipart: true } do |f| %>
3
3
  <div class="row col-md-12">
4
4
  <p class="instructions"><%= t :'.instructions' %></p>
5
5
  <div class="form-group">
6
6
  <%= file_field_tag :file, class: 'form-control' %>
7
+ <%= hidden_field_tag :tab, 'import' %>
7
8
  </div>
8
9
  <div class="form-actions">
9
10
  <div class="primary-actions">
@@ -0,0 +1,56 @@
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab == 'language' %>" id="language">
2
+ <p class="instructions"><%= t :'spotlight.exhibits.languages.selection_instructions' %></p>
3
+
4
+ <%= bootstrap_form_for [current_exhibit, Spotlight::Language.new], layout: :horizontal do |f| %>
5
+ <div class='col-md-6'>
6
+ <%= f.select('locale', add_exhibit_language_dropdown_options, prompt: t('.selection_prompt')) %>
7
+ <%= hidden_field_tag :tab, 'language' %>
8
+ </div>
9
+ <%= f.submit nil, class: 'btn btn-primary' %>
10
+ <% end %>
11
+
12
+ <h3><%= t :'spotlight.exhibits.languages.current_header' %></h3>
13
+ <p class="instructions"><%= t :'spotlight.exhibits.languages.current_instructions' %></p>
14
+
15
+ <% if current_exhibit.languages.any? && current_exhibit.languages.last.persisted? %>
16
+ <%= bootstrap_form_for current_exhibit, layout: :horizontal do |f| %>
17
+ <div class="row">
18
+ <div class="col-md-8">
19
+ <table class="table table-striped">
20
+ <thead>
21
+ <tr>
22
+ <th scope="col"><%= t('.table_heading.language') %></th>
23
+ <th scope="col" class='text-center'><%= t('.table_heading.public') %></th>
24
+ <th scope="col" class='text-center'><%= t('.table_heading.action') %></th>
25
+ </tr>
26
+ </thead>
27
+ <tbody>
28
+ <% current_exhibit.languages.each do |language| %>
29
+ <%= f.fields_for :languages, language do |languages| %>
30
+ <tr>
31
+ <td><%= t("locales.#{language.locale.downcase}") %></td>
32
+ <td class='text-center'>
33
+ <div class='checkbox'>
34
+ <%= languages.label :public, class: 'sr-only' %>
35
+ <%= languages.check_box_without_bootstrap :public %>
36
+ </div>
37
+ </td>
38
+ <td class='text-center'><%= link_to t('.remove'), exhibit_language_path(current_exhibit, language), method: :delete, data: { confirm: t('.modal.confirm') }, class: 'btn btn-sm btn-primary' %></td>
39
+ </tr>
40
+ <% end %>
41
+ <% end %>
42
+ </tbody>
43
+ </table>
44
+ </div>
45
+ </div>
46
+ <div class="form-actions">
47
+ <div class="primary-actions">
48
+ <%= hidden_field_tag :tab, 'language' %>
49
+ <%= f.submit nil, class: 'btn btn-primary' %>
50
+ </div>
51
+ </div>
52
+ <% end %>
53
+ <% else %>
54
+ <p><%= t('.no_languages_help_text') %></p>
55
+ <% end %>
56
+ </div>
@@ -3,21 +3,26 @@
3
3
  <%= configuration_page_title %>
4
4
  <div role="tabpanel">
5
5
  <ul class="nav nav-tabs" role="tablist">
6
- <li role="presentation" class="active">
6
+ <li role="presentation" class="<%= 'active' if @tab.blank? %>">
7
7
  <a href="#basic" aria-controls="basic" role="tab" data-toggle="tab"><%= t(:'.basic_settings.heading') %></a>
8
8
  </li>
9
+ <% if can? :manage, current_exhibit.languages.first_or_initialize %>
10
+ <li role="presentation" class="<%= 'active' if @tab == 'language' %>">
11
+ <a href="#language" aria-controls="language" role="tab" data-toggle="tab"><%= t(:'spotlight.exhibits.languages.heading') %></a>
12
+ </li>
13
+ <% end %>
9
14
  <% if can? :edit, current_exhibit.filters.first_or_initialize %>
10
- <li role="presentation">
15
+ <li role="presentation" class="<%= 'active' if @tab == 'filter' %>">
11
16
  <a href="#filter" aria-controls="filter" role="tab" data-toggle="tab"><%= t(:'spotlight.exhibits.filter.heading') %></a>
12
17
  </li>
13
18
  <% end %>
14
19
  <% if can? :import, current_exhibit %>
15
- <li role="presentation">
20
+ <li role="presentation" class="<%= 'active' if @tab == 'import' %>">
16
21
  <a href="#import" aria-controls="import" role="tab" data-toggle="tab"><%= t(:'spotlight.exhibits.import.heading') %></a>
17
22
  </li>
18
23
  <% end %>
19
24
  <% if can? :export, current_exhibit %>
20
- <li role="presentation">
25
+ <li role="presentation" class="<%= 'active' if @tab == 'export' %>">
21
26
  <a href="#export" aria-controls="export" role="tab" data-toggle="tab"><%= t(:'spotlight.exhibits.export.heading') %></a>
22
27
  </li>
23
28
  <% end %>
@@ -28,9 +33,10 @@
28
33
  <% end %>
29
34
  </ul>
30
35
  <div class="tab-content">
31
- <div role="tabpanel" class="tab-pane active" id="basic">
36
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab.blank? %>" id="basic">
32
37
  <%= render 'form' %>
33
38
  </div>
39
+ <%= render 'languages' if can? :manage, current_exhibit.languages.first_or_initialize %>
34
40
  <%= render 'spotlight/filters/form' if can? :edit, current_exhibit.filters.first_or_initialize %>
35
41
  <%= render 'import' if can? :import, current_exhibit %>
36
42
  <%= render 'export' if can? :export, current_exhibit %>
@@ -1,7 +1,7 @@
1
1
  <% cache_unless current_user, [current_exhibit, @page] do %>
2
2
  <div id="sidebar" class="col-md-3" role="complementary">
3
3
  <ol class="nav sidenav">
4
- <% @exhibit.feature_pages.published.at_top_level.each do |feature_section| %>
4
+ <% @exhibit.feature_pages.for_locale.published.at_top_level.each do |feature_section| %>
5
5
  <li class="<%= 'active' if current_page? [spotlight, @exhibit, feature_section] %>">
6
6
  <h4><%= link_to_unless_current feature_section.title, [spotlight, @exhibit, feature_section] %></h4>
7
7
  <ol class="subsection">
@@ -1,9 +1,10 @@
1
- <div role="tabpanel" class="tab-pane" id="filter">
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab == 'filter' %>" id="filter">
2
2
  <%= bootstrap_form_for [@exhibit, @exhibit.filters.first_or_initialize], layout: :horizontal, label_col: 'col-md-2', control_col: 'col-md-10', html: {class: "row"} do |f| %>
3
3
  <p class="instructions"><%= t :'spotlight.exhibits.filter.instructions' %></p>
4
4
 
5
5
  <%= f.text_field :field %>
6
6
  <%= f.text_field :value %>
7
+ <%= hidden_field_tag :tab, 'filter' %>
7
8
 
8
9
  <div class="form-actions">
9
10
  <div class="primary-actions">
@@ -2,7 +2,7 @@
2
2
  <%= f.url_field :url, type: "file", help: t('.url-field.help', extensions: Spotlight::Engine.config.allowed_upload_extensions.join(' ')), label: "File" %>
3
3
  <%= f.fields_for :data do |d| %>
4
4
  <% Spotlight::Resources::Upload.fields(current_exhibit).each do |config| %>
5
- <%= d.send((config.form_field_type || :text_field), config.field_name, label: uploaded_field_label(config)) %>
5
+ <%= d.send(config.form_field_type, config.field_name, label: uploaded_field_label(config)) %>
6
6
  <% end %>
7
7
  <% current_exhibit.custom_fields.each do |custom_field| %>
8
8
  <%= d.text_field custom_field.field, label: custom_field.label %>
@@ -13,4 +13,9 @@
13
13
  <% if can? :manage, Spotlight::AboutPage.new(exhibit: current_exhibit) %>
14
14
  <li><%= link_to t(:'spotlight.curation.sidebar.about_pages'), spotlight.exhibit_about_pages_path(current_exhibit), 'data-no-turbolink' => true %></li>
15
15
  <% end %>
16
+ <% if (can? :manage, current_exhibit.translations.first_or_initialize) && current_exhibit.languages.any? %>
17
+ <li>
18
+ <%= link_to t(:'spotlight.curation.sidebar.translations'), spotlight.edit_exhibit_translations_path(current_exhibit), 'data-no-turbolink' => true %>
19
+ </li>
20
+ <% end %>
16
21
  </ul>
@@ -0,0 +1,14 @@
1
+ <% if current_exhibit && current_exhibit.languages.accessible_by(current_ability).any? %>
2
+ <li class="dropdown">
3
+ <a class="dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
4
+ <%= Spotlight::Language.new(locale: I18n.locale).to_native %> <b class="caret"></b>
5
+ </a>
6
+ <ul class="dropdown-menu">
7
+ <% locale_selecter_dropown_options.each do |language| %>
8
+ <li>
9
+ <%= link_to language.to_native, (spotlight.url_for(locale: lanaguage.locale) rescue url_for(locale: language.locale)), class: 'dropdown-item' %>
10
+ </li>
11
+ <% end %>
12
+ </ul>
13
+ </li>
14
+ <% end %>
@@ -0,0 +1,67 @@
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab == 'browse' %>" id="browse">
2
+ <%= bootstrap_form_for current_exhibit, url: spotlight.exhibit_translations_path(current_exhibit), layout: :horizontal do |f| %>
3
+ <% # Add hidden fields for the language and tab so the redirect knows how to come back here %>
4
+ <%= hidden_field_tag :language, @language %>
5
+ <%= hidden_field_tag :tab, 'browse' %>
6
+ <div class="row">
7
+ <div class="col-xs-4 text-right">
8
+ <strong>
9
+ <%= t :'spotlight.exhibits.translations.browse_categories.default_language_column_label' %>
10
+ </strong>
11
+ </div>
12
+ <div class="col-xs-7">
13
+ <strong>
14
+ <%= t :'spotlight.exhibits.translations.browse_categories.translation_column_label', language: t("locales.#{@language.downcase}") %>
15
+ </strong>
16
+ </div>
17
+ </div>
18
+
19
+ <% current_exhibit.searches.each do |search| %>
20
+ <% title_translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{search.slug}.title", locale: @language) %>
21
+ <%= f.fields_for :translations, title_translation do |translation_fields| %>
22
+ <%= translation_fields.hidden_field :key %>
23
+ <%= translation_fields.hidden_field :locale %>
24
+ <div data-translation-progress-item="true" class="form-group">
25
+ <%= translation_fields.label :value, search[:title], class: 'control-label col-xs-4' %>
26
+ <div class="col-xs-7">
27
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
28
+ </div>
29
+ <div class="col-xs-1">
30
+ <% if title_translation.value.present? %>
31
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
32
+ <% end %>
33
+ </div>
34
+ </div>
35
+ <% end %>
36
+
37
+ <% description_translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{search.slug}.long_description", locale: @language) %>
38
+ <div data-translation-progress-item="true" class="form-group">
39
+ <div class="col-xs-7 col-xs-offset-4">
40
+ <%= f.fields_for :translations, description_translation do |translation_fields| %>
41
+ <%= button_tag 'type' => 'button', class: 'btn btn-text collapsed tanslation-description-toggle', 'data-toggle': 'collapse', 'data-target': "#browse_category_description_#{search.id}", 'aria-expanded': 'false', 'aria-controls': "#browse_category_description_#{search.id}" do %>
42
+ <%= translation_fields.label :value, t(:'spotlight.exhibits.translations.browse_categories.description_label') %>
43
+ <span class="caret"></span>
44
+ <% end %>
45
+ <%= translation_fields.hidden_field :key %>
46
+ <%= translation_fields.hidden_field :locale %>
47
+ <div id="browse_category_description_<%= search.id %>" class="panel panel-body collapse panel-translation">
48
+ <%= translation_fields.text_area_without_bootstrap :value, class: 'form-control' %>
49
+ <p class="help-block"><%= search[:long_description] %></p>
50
+ </div>
51
+ <% end %>
52
+ </div>
53
+ <div class="col-xs-1">
54
+ <% if description_translation.value.present? %>
55
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
56
+ <% end %>
57
+ </div>
58
+ </div>
59
+ <% end %>
60
+
61
+ <div class="form-actions">
62
+ <div class="primary-actions">
63
+ <%= f.submit nil, class: 'btn btn-primary' %>
64
+ </div>
65
+ </div>
66
+ <% end %>
67
+ </div>
@@ -0,0 +1,176 @@
1
+ <div role="tabpanel" class="tab-pane <%= 'active' if @tab.blank? %>" id="general">
2
+ <%= bootstrap_form_for current_exhibit, url: spotlight.exhibit_translations_path(current_exhibit), layout: :horizontal do |f| %>
3
+ <% # Add a hidden field for the language so the redirect knows how to come back here %>
4
+ <%= hidden_field_tag :language, @language %>
5
+
6
+ <div class='translation-basic-settings'>
7
+ <h2 class='translation-subheading'>
8
+ <%= t('spotlight.exhibits.translations.general.basic_settings.label') %>
9
+ </h2>
10
+
11
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{current_exhibit.slug}.title", locale: @language) %>
12
+ <%= f.fields_for :translations, translation do |translation_fields| %>
13
+ <%= translation_fields.hidden_field :key %>
14
+ <%= translation_fields.hidden_field :locale %>
15
+ <div data-translation-progress-item='true' class='form-group translation-form translation-basic-settings-title'>
16
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.basic_settings.title'), class: 'control-label col-xs-12 col-sm-2' %>
17
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
18
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
19
+ <p class="help-block">
20
+ <%= current_exhibit[:title] %>
21
+ </p>
22
+ </div>
23
+ <div class='col-xs-1'>
24
+ <% if translation.value.present? %>
25
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
26
+ <% end %>
27
+ </div>
28
+ </div>
29
+ <% end %>
30
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{current_exhibit.slug}.subtitle", locale: @language) %>
31
+ <%= f.fields_for :translations, translation do |translation_fields| %>
32
+ <%= translation_fields.hidden_field :key %>
33
+ <%= translation_fields.hidden_field :locale %>
34
+ <div data-translation-progress-item='true' class='form-group translation-form translation-basic-settings-subtitle'>
35
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.basic_settings.subtitle'), class: 'control-label col-xs-12 col-sm-2' %>
36
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
37
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
38
+ <p class="help-block">
39
+ <%= current_exhibit[:subtitle] %>
40
+ </p>
41
+ </div>
42
+ <div class='col-xs-1'>
43
+ <% if translation.value.present? %>
44
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
45
+ <% end %>
46
+ </div>
47
+ </div>
48
+ <% end %>
49
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "#{current_exhibit.slug}.description", locale: @language) %>
50
+ <%= f.fields_for :translations, translation do |translation_fields| %>
51
+ <%= translation_fields.hidden_field :key %>
52
+ <%= translation_fields.hidden_field :locale %>
53
+ <div data-translation-progress-item='true' class='form-group translation-form translation-basic-settings-description'>
54
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.basic_settings.description'), class: 'control-label col-xs-12 col-sm-2' %>
55
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
56
+ <%= translation_fields.text_area_without_bootstrap :value, class: 'form-control' %>
57
+ <p class="help-block">
58
+ <%= current_exhibit.description %>
59
+ </p>
60
+ </div>
61
+ <div class='col-xs-1'>
62
+ <% if translation.value.present? %>
63
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
64
+ <% end %>
65
+ </div>
66
+ </div>
67
+ <% end %>
68
+ </div>
69
+ <div class='translation-main-menu'>
70
+ <h2 class='translation-subheading'>
71
+ <%= t('spotlight.exhibits.translations.general.main_menu.label') %>
72
+ </h2>
73
+
74
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "spotlight.curation.nav.home", locale: @language) %>
75
+ <%= f.fields_for :translations, translation do |translation_fields| %>
76
+ <%= translation_fields.hidden_field :key %>
77
+ <%= translation_fields.hidden_field :locale %>
78
+ <div data-translation-progress-item='true' class='form-group translation-form translation-main-menu-home'>
79
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.main_menu.home'), class: 'control-label col-xs-12 col-sm-2' %>
80
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
81
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
82
+ <p class="help-block">
83
+ <%= t(:'spotlight.curation.nav.home', locale: I18n.default_locale) %>
84
+ </p>
85
+ </div>
86
+ <div class='col-xs-1'>
87
+ <% if translation.value.present? %>
88
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
89
+ <% end %>
90
+ </div>
91
+ </div>
92
+ <% end %>
93
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "main_navigation.browse.label", locale: @language) %>
94
+ <%= f.fields_for :translations, translation do |translation_fields| %>
95
+ <%= translation_fields.hidden_field :key %>
96
+ <%= translation_fields.hidden_field :locale %>
97
+ <div data-translation-progress-item='true' class='form-group translation-form translation-main-menu-browse'>
98
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.main_menu.browse'), class: 'control-label col-xs-12 col-sm-2' %>
99
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
100
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
101
+ <p class="help-block">
102
+ <%= current_exhibit.main_navigations.browse[:label].presence || current_exhibit.main_navigations.browse.default_label %>
103
+ </p>
104
+ </div>
105
+ <div class='col-xs-1'>
106
+ <% if translation.value.present? %>
107
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
108
+ <% end %>
109
+ </div>
110
+ </div>
111
+ <% end %>
112
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "main_navigation.curated_features.label", locale: @language) %>
113
+ <%= f.fields_for :translations, translation do |translation_fields| %>
114
+ <%= translation_fields.hidden_field :key %>
115
+ <%= translation_fields.hidden_field :locale %>
116
+ <div data-translation-progress-item='true' class='form-group translation-form translation-main-menu-curated-features'>
117
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.main_menu.curated_features'), class: 'control-label col-xs-12 col-sm-2' %>
118
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
119
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
120
+ <p class="help-block">
121
+ <%= current_exhibit.main_navigations.curated_features[:label].presence || current_exhibit.main_navigations.curated_features.default_label %>
122
+ </p>
123
+ </div>
124
+ <div class='col-xs-1'>
125
+ <% if translation.value.present? %>
126
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
127
+ <% end %>
128
+ </div>
129
+ </div>
130
+ <% end %>
131
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: "main_navigation.about.label", locale: @language) %>
132
+ <%= f.fields_for :translations, translation do |translation_fields| %>
133
+ <%= translation_fields.hidden_field :key %>
134
+ <%= translation_fields.hidden_field :locale %>
135
+ <div data-translation-progress-item='true' class='form-group translation-form translation-main-menu-about'>
136
+ <%= translation_fields.label :value, t('spotlight.exhibits.translations.general.main_menu.about'), class: 'control-label col-xs-12 col-sm-2' %>
137
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
138
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
139
+ <p class="help-block">
140
+ <%= current_exhibit.main_navigations.about[:label].presence || current_exhibit.main_navigations.about.default_label %>
141
+ </p>
142
+ </div>
143
+ <div class='col-xs-1'>
144
+ <% if translation.value.present? %>
145
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
146
+ <% end %>
147
+ </div>
148
+ </div>
149
+ <% end %>
150
+ <% translation = Translation.find_or_initialize_by(exhibit: current_exhibit, key: 'spotlight.catalog.breadcrumb.index', locale: @language) %>
151
+ <%= f.fields_for :translations, translation do |translation_fields| %>
152
+ <%= translation_fields.hidden_field :key %>
153
+ <%= translation_fields.hidden_field :locale %>
154
+ <div data-translation-progress-item='true' class='form-group translation-form translation-main-menu-search-results'>
155
+ <%= translation_fields.label :value, t('spotlight.catalog.breadcrumb.index'), class: 'control-label col-xs-12 col-sm-2' %>
156
+ <div class='col-xs-11 col-sm-9 panel panel-body panel-translation'>
157
+ <%= translation_fields.text_field_without_bootstrap :value, class: 'form-control' %>
158
+ <p class="help-block">
159
+ <%= t(:'spotlight.catalog.breadcrumb.index', locale: I18n.default_locale) %>
160
+ </p>
161
+ </div>
162
+ <div class='col-xs-1'>
163
+ <% if translation.value.present? %>
164
+ <span data-translation-present="true" class='glyphicon glyphicon-ok'></span>
165
+ <% end %>
166
+ </div>
167
+ </div>
168
+ <% end %>
169
+ </div>
170
+ <div class="form-actions">
171
+ <div class="primary-actions">
172
+ <%= f.submit nil, class: 'btn btn-primary' %>
173
+ </div>
174
+ </div>
175
+ <% end %>
176
+ </div>