mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-03-26 02:33:03 -04:00
* feat: Add version tracking to Crop model This commit introduces version tracking for the Crop model using the PaperTrail gem. Key changes include: - Integrating `has_paper_trail` into the `Crop` model. - Adding a "History" section to the crop show page to display a timeline of changes for that specific crop. - Creating a new admin page for users with the "crop_wrangler" role to view a log of all recent crop edits, creations, and deletions. - Fixing several N+1 query performance issues by eager-loading associated `Member` records in both the `CropsController` and the new `Admin::CropsController`. - Refactoring view logic into a shared partial to reduce code duplication. * Add papertrail * Admin UI * Add papertrail DB * Add papertrail DB * Rearrange * Fix permissions * Fix permissions * Fix UI * Fix UI --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
64 lines
2.1 KiB
Plaintext
64 lines
2.1 KiB
Plaintext
- content_for :title, "Crop Wrangling"
|
|
|
|
%h1 Crop Wrangling
|
|
|
|
%nav.nav
|
|
= link_to "Full crop hierarchy", hierarchy_crops_path, class: 'nav-link'
|
|
= link_to "Add Crop", new_crop_path, class: 'btn'
|
|
|
|
%section.crop_wranglers
|
|
%h2 Crop Wranglers
|
|
- @crop_wranglers.each do |crop_wrangler|
|
|
= render 'members/tiny', member: crop_wrangler
|
|
|
|
%hr/
|
|
|
|
%section
|
|
%h2 Crops
|
|
|
|
%ul#myTab.nav.nav-tabs{role: "tablist"}
|
|
%li.nav-item
|
|
%a#home-tab.nav-link{ href: admin_crops_path, role: "tab", class: ''}
|
|
Recently edited
|
|
%li.nav-item
|
|
%a#home-tab.nav-link{ href: wrangle_crops_path, role: "tab", class: @approval_status.blank? ? 'active' : ''}
|
|
Recently added
|
|
%li.nav-item
|
|
%a#profile-tab.nav-link{ href: wrangle_crops_path(approval_status: "pending"), role: "tab", class: @approval_status == "pending" ? 'active' : ''}
|
|
Pending approval
|
|
%li.nav-item
|
|
%a#contact-tab.nav-link{ href: wrangle_crops_path(approval_status: "rejected"), role: "tab", class: @approval_status == "rejected" ? 'active' : ''} Rejected
|
|
|
|
%table.table.table-striped.table-bordered.table-sm{id: @approval_status.blank? ? 'recently-added-crops' : "#{@approval_status}-crops" }
|
|
%tr
|
|
%th System name
|
|
%th English Wikipedia URL
|
|
%th Scientific names
|
|
%th Requested by
|
|
- if @approval_status == "rejected"
|
|
%th Rejected by
|
|
- if @approval_status != "rejected" && @approval_status != "pending"
|
|
%th Added by
|
|
%th When
|
|
- @crops.each do |c|
|
|
%tr
|
|
%td
|
|
= link_to edit_crop_path(c) do
|
|
= icon 'fas', 'seedling'
|
|
= c.name
|
|
%td= link_to c.en_wikipedia_url, c.en_wikipedia_url
|
|
%td
|
|
- c.scientific_names.each do |s|
|
|
= link_to s.name, s
|
|
%br/
|
|
%td= c.requester.present? ? (link_to c.requester, c.requester) : "N/A"
|
|
- unless @approval_status == "pending"
|
|
%td= c.creator.present? ? (link_to c.creator, c.creator) : "N/A"
|
|
%td
|
|
= distance_of_time_in_words(c.created_at, Time.zone.now)
|
|
ago.
|
|
|
|
= page_entries_info @crops
|
|
= will_paginate @crops
|
|
|