Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide 'View Published' for published records in unpublished repositories #2727

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 16 additions & 12 deletions frontend/app/views/shared/_view_published_button.html.erb
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
<% if record.publish %>

<% record_type = record.jsonmodel_type %>
<% if current_repo.publish || !record.repository %>

<div class="btn-group">
<% record_type = record.jsonmodel_type %>

<% if AppConfig[:use_human_readable_urls] && !record['slug'].nil? && !record['slug'].empty? %>
<% if ['agent_person', 'agent_family', 'agent_corporate_entity', 'agent_software'].include?(record_type) %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], 'agents', @agent['slug']).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<% elsif AppConfig[:repo_name_in_slugs] %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], 'repositories', session[:repo_slug], "#{record_type}" + 's', record['slug']).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<div class="btn-group">

<% if AppConfig[:use_human_readable_urls] && !record['slug'].nil? && !record['slug'].empty? %>
<% if ['agent_person', 'agent_family', 'agent_corporate_entity', 'agent_software'].include?(record_type) %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], 'agents', @agent['slug']).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<% elsif AppConfig[:repo_name_in_slugs] %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], 'repositories', session[:repo_slug], "#{record_type}" + 's', record['slug']).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<% else %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], "#{record_type}" + 's', record['slug']).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<% end %>
<% else %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], "#{record_type}" + 's', record['slug']).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], record.uri).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<% end %>
<% else %>
<%= link_to I18n.t("actions.view_published"), File.join(AppConfig[:public_proxy_url], record.uri).to_s, :target => "_blank", :class => "btn btn-sm btn-default" %>
<% end %>

</div>
</div>

<% end %>

<% end %>

Expand Down