36 Commits

Author SHA1 Message Date
google-labs-jules[bot]
460daf36f9 Add revert functionality to admin crops page (#4346)
* feat(admin): add revert functionality to crops page

This change adds a "Revert" button to the admin crops page, allowing crop wranglers to revert changes to a previous version.

It introduces a new `Admin::VersionsController` with a `revert` action that uses `paper_trail`'s `reify` method to restore a previous version of a `Crop` object.

The view is updated to include a "Revert" button, which is guarded by a `can?(:wrangle, Crop)` check to ensure only authorized users can see it.

The controller also includes an authorization check to prevent unauthorized users from accessing the revert action directly.

A feature spec is added to test the new functionality, including the authorization logic.

* Consistent UX

* Specs

---------

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>
2025-11-30 15:05:13 +10:30
google-labs-jules[bot]
13a8276313 Add version tracking to crops model (#4343)
* 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>
2025-11-30 14:47:46 +10:30
google-labs-jules[bot]
449ab1f6c0 Add ability to create companion plantings
This change adds the ability for crop wranglers to create and manage companion plantings for crops.

- Adds a `source_url` to the `CropCompanion` model to store an optional reference URL.
- Restricts the management of companion plantings to users with the `crop_wrangler` role.
- Creates a new admin interface for managing companion plantings for a specific crop.
- Updates the crop show page to display companions from both the crop and its parent crop.
2025-09-21 00:49:11 +00:00
Daniel O'Connor
b77df88df9 Issues/1475: Ensure we have pagination (#3193)
* Paginate, 100 at a time

* Limited i18n

* Paginate roles

* Pagination

* Pagination

* i18n and pagination

* Paginate alternate names

* Silence code climate

* Rewrite coverage as a feature

* Remove coverage in favour of crops/scientific_name_spec

* Add missing admin link

* Rewrite coverage as feature

* Rewrite coverage

---------

Co-authored-by: Brenda Wallace <brenda@wallace.net.nz>
2024-01-21 14:19:36 +10:30
Brenda Wallace
35c9b70bc9 Remove email from display in admin/members 2019-10-19 10:23:39 +13:00
Brenda Wallace
3422a0d899 Administer member's roles 2019-10-06 14:19:39 +13:00
Brenda Wallace
e3f32d8bb4 Updated specs 2019-08-20 15:09:39 +00:00
Brenda Wallace
ed4aaa1c9c Tidy up admin landing page 2019-08-20 15:09:39 +00:00
Brenda Wallace
b3520a1b3f Search for members in admin/members#index 2019-08-20 15:09:39 +00:00
Brenda Wallace
6144a7c065 tidy display of discard member on admin page 2019-07-21 17:26:45 +12:00
Brenda Wallace
91897273be Merge branch 'dev' into ban-hammer 2019-07-16 20:56:59 +12:00
Brenda Wallace
b2537638ed Move member banning to admin/members controller 2019-07-16 18:56:49 +12:00
Brenda Wallace
2162c11280 Couple breadcrumbs tidied 2019-07-16 03:15:04 +00:00
Brenda Wallace
dccbf440cb Breadcrumbs 2019-05-18 23:18:27 +12:00
Brenda Wallace
b446e44ac0 Moved garden types to admin menu 2019-03-26 21:02:48 +13:00
Brenda Wallace
f9d4e1d6ae Ancestry of food. Seeds -> Planting -> Seeds -> Planting (#1550)
* Add seed ancestry, and seeds.finished_at
* Plantings and seeds produce each other
* Permissions for seeds actions
* View update, for seed actions, and planting ancestry
* Routes for seeds
* Scopes for harvests
* Spec updates for seeds
* Removed in-line style
* Add seed ancestry, and seeds.finished_at
* Plantings and seeds produce each other
* Permissions for seeds actions
* View update, for seed actions, and planting ancestry
* Routes for seeds
* Scopes for harvests
* Spec updates for seeds
* Moved finishable to a concern
* Seeds.finished_at
* rubocop fixes
* Made seeds sown migration the most recent
* Specs for home page
* Only show current seeds on home page
* Seeds appear for logged in or not
* Buttons to mark seeds finished
* JS for marking seeds finished
* Some actions only appear if seed or planting is active
* Fixed up display of home page
* Fixed typo in admin members#index
* Tidying up actions on all the things
* Harvest description in #index
* Truncate garden description if long
* Updated link label in view spec
* Show planted_from always, becuase it might be a parent seed
* find correct link in spec adding photos to garden
* fixed spec finding link to edit garden
* Better harvest description truncation
* Helping spec find the edit button
* specs for the home page
* Re-instate crops js, but in the correct file now
* Fixed link to garden in actions
* Tweaking mobile view
2018-03-12 08:39:32 +13:00
Brenda Wallace
42de726405 Removing shop, products, accounts, orders 2018-02-09 10:53:05 +13:00
Brenda Wallace
99828c7c01 Updated spec for new admin#index 2017-12-17 17:54:13 +13:00
Brenda Wallace
233a30a045 Haml code style fix up 2017-12-17 17:49:05 +13:00
Brenda Wallace
8a446ecbfc Member admin 2017-12-17 12:45:19 +13:00
Brenda Wallace
406b2dbf04 Make admin index a bit nicer 2017-12-17 12:06:03 +13:00
Brenda Wallace
fb012c073e leaves a record of orders and payments intact when members deleted 2017-06-02 22:34:19 +12:00
Brenda Wallace
9560da90ab Add Scientific names to the menu 2017-05-29 16:17:43 +12:00
Brenda Wallace
cf9e5a6652 Adding alternate names to admin menu 2017-02-11 19:45:53 +13:00
Brenda Wallace
65a8bde467 Haml clean up for admin views 2017-02-04 12:00:42 +13:00
Cjay Billones
bb88041fef [Refactoring] Replace .count and .length with .size for collections
Improved program efficiency (in querying in particular) by replacing .count and .length with .size for collections.

Fix error in refactoring

Reverted some .size into .count
2015-06-25 12:09:03 +08:00
Mackenzie Morgan
c3429cc0f3 adding admin access test for cms, and changing the cms admin path, and adding a link for it to the admin page, and updating the navbar so i can actually target the sign-in link in the test. also removing sample fixture gencode from cms installation 2015-02-09 00:05:02 -05:00
Skud
d55d2c6409 Ongoing coverage improvements 2014-08-30 17:09:47 +10:00
Skud
117fd23bea add btn-default to all btn-xs 2014-07-22 12:06:28 +10:00
Skud
0294daf423 s/btn-mini/btn-xs/ for bootstrap3 2014-07-22 12:01:49 +10:00
Skud
ab588bd21b add referral code to order admin table 2013-09-16 10:39:12 +10:00
Skud
faea1904c2 Added referral code search to admin forms 2013-09-13 13:47:46 +10:00
Skud
16f4e153f2 Made admin/newsletter page with list of subscribers 2013-08-27 21:49:54 +10:00
Skud
6c8f2b477f minor tweakage to admin/order/search 2013-06-04 21:15:29 +10:00
Skud
cbca8c19a5 added admin controller and index view 2013-05-31 10:23:06 +10:00
Skud
7a1eaeffee added admin controller and index view 2013-05-29 14:37:42 +10:00