Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Add warning if feature teaser missing for version

Oliver Güntherac782a6a0f34
diff --git a/app/components/homescreen/blocks/new_features.html.erb b/app/components/homescreen/blocks/new_features.html.erb
index f3276de7f14..a24830ee2ec 100644
--- a/app/components/homescreen/blocks/new_features.html.erb
+++ b/app/components/homescreen/blocks/new_features.html.erb
@@ -1,24 +1,32 @@
<%= widget_wrapper do %>
- <div class="op-new-features">
- <p class="widget-box--additional-info">
- <%= new_features_header %>
- </p>
- <div class="widget-box--description">
- <div>
- <p><%= new_features_title %></p>
- <ul>
- <% new_features.values.each do |line| %>
- <li><%= line %></li>
- <% end %>
- </ul>
+ <% if teaser_exists? %>
+ <div class="op-new-features">
+ <p class="widget-box--additional-info">
+ <%= new_features_header %>
+ </p>
+ <div class="widget-box--description">
+ <div>
+ <p><%= new_features_title %></p>
+ <ul>
+ <% new_features.each do |line| %>
+ <li><%= line %></li>
+ <% end %>
+ </ul>
+ </div>
+ <img
+ class="widget-box--teaser-image op-new-features--teaser-image"
+ role="presentation"
+ src="<%= asset_path(feature_teaser_image) %>"
+ alt="">
</div>
- <img
- class="widget-box--teaser-image op-new-features--teaser-image"
- role="presentation"
- src="<%= asset_path(feature_teaser_image) %>"
- alt="">
- </div>
- <%= helpers.static_link_to :current_release_notes, label: learn_more_link_text %>
- </div>
+ <%= helpers.static_link_to :current_release_notes, label: learn_more_link_text %>
+ </div>
+ <% else %>
+ <%=
+ render(Primer::Alpha::Banner.new(mb: 3, icon: :stop, scheme: :danger)) do
+ "Missing teaser data for the next release. Please add it to #{base_i18n_key}"
+ end
+ %>
+ <% end %>
<% end %>
diff --git a/app/components/homescreen/blocks/new_features.rb b/app/components/homescreen/blocks/new_features.rb
index 1644e6a4a9a..ad0989747df 100644
--- a/app/components/homescreen/blocks/new_features.rb
+++ b/app/components/homescreen/blocks/new_features.rb
@@ -48,15 +48,20 @@ module Homescreen
end
def new_features_title
- I18n.t("homescreen.blocks.new_features.#{feature_version}.new_features_title")
+ I18n.t("#{base_i18n_key}.new_features_title",
+ default: "Missing feature title")
end
def new_features
- I18n.t("homescreen.blocks.new_features.#{feature_version}.new_features_list")
+ I18n.t("#{base_i18n_key}.new_features_list")
end
- def render?
- I18n.exists?("homescreen.blocks.new_features.#{feature_version}")
+ def teaser_exists?
+ I18n.exists?(base_i18n_key)
+ end
+
+ def base_i18n_key
+ "homescreen.blocks.new_features.#{feature_version}"
end
private