Skip to content

Commit

Permalink
Move the field slip prefix display and PDF button to field slip tab
Browse files Browse the repository at this point in the history
  • Loading branch information
mo-nathan committed Dec 20, 2024
1 parent 0cbdf85 commit 57e1fb5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
10 changes: 5 additions & 5 deletions app/helpers/tabs/projects_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ def observation_tabs(project)
tabs << build_tab("#{project.location_count} #{:LOCATIONS.l}",
project_locations_path(project_id: project.id),
"locations")
if project.field_slips.any?
tabs << build_tab("#{project.field_slips.length} #{:FIELD_SLIPS.l}",
field_slips_path(project: project.id),
"field_slips")
end
end
if project.field_slip_prefix
tabs << build_tab("#{project.field_slips.length} #{:FIELD_SLIPS.l}",
field_slips_path(project: project.id),
"field_slips")
end
tabs
end
Expand Down
13 changes: 12 additions & 1 deletion app/views/controllers/field_slips/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,18 @@ end
<%= tag.p(notice, class: "alert alert-success") %>
<% end %>

<% unless @project %>
<% if @project %>
<% if @project.field_slip_prefix %>
<div class="mt-3">
<b><%= :show_project_field_slip_prefix.t %>:</b> <%= @project.field_slip_prefix %>
<% if @project.member?(User.current) %>
<%= link_to(:show_project_field_slip_create.t,
new_project_field_slip_path(project_id: @project.id),
{ class: "btn btn-default" }) %>
<% end %>
</div>
<% end %>
<% else %>
<%= form_with(method: :get, url: field_slips_path) do |form| %>
<%= autocompleter_field(form:, field: :project_name, type: :project,
hidden_name: :project, inline: true,
Expand Down
12 changes: 0 additions & 12 deletions app/views/controllers/projects/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,8 @@ add_project_banner(@project)
<% end %>

<p><b><%= :show_project_created_at.t %>:</b> <%= @project.created_at.web_date %></p>
<% if @project.field_slip_prefix %>
<p>
<b><%= :show_project_field_slip_prefix.t %>:</b> <%= @project.field_slip_prefix %>
<% if @project.member?(User.current) %>
<%= link_to(:show_project_field_slip_create.t,
new_project_field_slip_path(project_id: @project.id),
{ class: "btn btn-default" }) %>
<% end %>
</p>
<% end %>
<% end %>

<br />

<p id="project_join_trust_edit">
<% if @project.can_join?(@user) %>
<%= post_button(name: :show_project_join.t,
Expand Down

0 comments on commit 57e1fb5

Please sign in to comment.