recycle_bin 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +57 -0
- data/README.md +228 -13
- data/app/controllers/recycle_bin/trash_controller.rb +424 -21
- data/app/helpers/recycle_bin/application_helper.rb +175 -0
- data/app/views/{layouts/recycle_bin/application.html.erb → recycle_bin/layouts/recycle_bin.html.erb} +850 -609
- data/app/views/recycle_bin/shared/_error_messages.html.erb +10 -0
- data/app/views/recycle_bin/shared/_flash_messages.html.erb +6 -0
- data/app/views/recycle_bin/trash/_action_history.html.erb +75 -0
- data/app/views/recycle_bin/trash/_associations.html.erb +50 -0
- data/app/views/recycle_bin/trash/_filters.html.erb +561 -0
- data/app/views/recycle_bin/trash/_item.html.erb +267 -0
- data/app/views/recycle_bin/trash/_pagination.html.erb +75 -0
- data/app/views/recycle_bin/trash/_stats.html.erb +50 -0
- data/app/views/recycle_bin/trash/dashboard.html.erb +618 -0
- data/app/views/recycle_bin/trash/index.html.erb +247 -278
- data/app/views/recycle_bin/trash/show.html.erb +60 -215
- data/config/routes.rb +9 -2
- data/docs/index.html +928 -0
- data/docs/logo.svg +71 -0
- data/lib/recycle_bin/version.rb +1 -1
- data/lib/recycle_bin.rb +111 -1
- metadata +18 -8
- data/app/views/layouts/recycle_bin/recycle_bin/application.html.erb +0 -266
- data/app/views/layouts/recycle_bin/recycle_bin/trash/index.html.erb +0 -133
- data/app/views/layouts/recycle_bin/recycle_bin/trash/show.html.erb +0 -175
- data/recycle_bin.gemspec +0 -47
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3c4c0c3f65e02962648c4c913b64a0a5f3591a82e36111fbacafcaa143b860db
|
|
4
|
+
data.tar.gz: d8c3f061b88a15b08c3e415d47a1f4497816cdbdbbb170ee442b2242864720a2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a26e0faa49cb0f00fefd8bccf7c08383c865e8e16298122a162bfb55daef3bb8f92110e8f3cf685da09727c390890fa66373cc92209b5b4a28d0e17f2c304a61
|
|
7
|
+
data.tar.gz: f12893a28965ba4f7698b9b6728e7780f82ff4ce45da3fddf851ce74f2c05860f6294c4fcd22cac372db2341b1b2153c3bfa549f1219d45cadf243755ba4ed88
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,62 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.2.0] - 2025-09-08
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **Enhanced Analytics Dashboard**: Complete redesign with comprehensive statistics and visual charts
|
|
7
|
+
- **Improved Search System**: Priority-based search with exact matching, starts-with matching, and intelligent filtering
|
|
8
|
+
- **Advanced Filtering UI**: Modern card-based layout with collapsible advanced filters
|
|
9
|
+
- **Dashboard vs All Items Pages**: Distinct pages with different purposes - overview vs detailed management
|
|
10
|
+
- **Weekly Activity Charts**: Visual representation of deletion activity over the past 7 days
|
|
11
|
+
- **Model Breakdown Statistics**: Pie chart showing distribution of deleted items by model type
|
|
12
|
+
- **Active Filters Display**: Shows currently applied filters with individual removal options
|
|
13
|
+
- **Responsive Design**: Mobile-friendly interface with proper spacing and typography
|
|
14
|
+
- **Collection Method Enhancement**: Added `reject` method to `DeletedItemsCollection` for better compatibility
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Search Precision**: Fixed search showing irrelevant results by implementing priority-based matching
|
|
18
|
+
- **Primary Field Priority**: Search now prioritizes title/name/subject fields over content fields
|
|
19
|
+
- **False Match Reduction**: Removed broad content field searches that caused incorrect results
|
|
20
|
+
- **RuboCop Compliance**: Fixed code style issues and improved code quality
|
|
21
|
+
- **Test Coverage**: Added comprehensive tests for new search functionality
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- **Search Algorithm**: Complete rewrite with 5-tier priority system (exact match → starts with → contains → ID → class name)
|
|
25
|
+
- **UI/UX Improvements**: Modern gradient design, better spacing, and intuitive navigation
|
|
26
|
+
- **Dashboard Architecture**: Separated dashboard overview from detailed item management
|
|
27
|
+
- **Filter Organization**: Grouped filters logically with expandable sections
|
|
28
|
+
- **Search Term Length**: Applied minimum length requirements for different search types
|
|
29
|
+
- **Code Quality**: Improved method organization and reduced complexity
|
|
30
|
+
|
|
31
|
+
### Performance
|
|
32
|
+
- **Search Optimization**: Reduced false matches and improved search relevance
|
|
33
|
+
- **UI Responsiveness**: Faster page loads with optimized CSS and layout
|
|
34
|
+
- **Memory Efficiency**: Better handling of large datasets in search results
|
|
35
|
+
|
|
36
|
+
### Technical Details
|
|
37
|
+
- Enhanced `filter_by_search` method with priority-based matching logic
|
|
38
|
+
- Added comprehensive dashboard data calculation methods
|
|
39
|
+
- Implemented collapsible filter sections with JavaScript
|
|
40
|
+
- Updated navigation highlighting for active pages
|
|
41
|
+
- Added `reject` method to both controller and spec `DeletedItemsCollection` classes
|
|
42
|
+
|
|
43
|
+
## [1.1.1] - 2025-05-26
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Fixed critical bug in user authentication flow
|
|
47
|
+
- Resolved memory leak in background job processing
|
|
48
|
+
- Corrected deprecation warnings for Rails 7.1 compatibility
|
|
49
|
+
- Fixed race condition in concurrent database writes
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
- Improved error handling in API responses
|
|
53
|
+
- Updated dependency versions for security patches
|
|
54
|
+
- Enhanced logging for better debugging experience
|
|
55
|
+
|
|
56
|
+
### Security
|
|
57
|
+
- Patched potential XSS vulnerability in form helpers
|
|
58
|
+
- Updated vulnerable dependencies to secure versions
|
|
59
|
+
|
|
3
60
|
## [1.1.0] - 2025-05-25
|
|
4
61
|
|
|
5
62
|
### Added
|
data/README.md
CHANGED
|
@@ -1,4 +1,28 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>🗑️ RecycleBin</h1>
|
|
3
|
+
<img src="https://raw.githubusercontent.com/R95-del/recycle_bin/main/docs/logo.svg" alt="RecycleBin Logo" width="120" height="120">
|
|
4
|
+
<p><strong>Elegant soft delete solution for Ruby on Rails applications</strong></p>
|
|
5
|
+
<p>
|
|
6
|
+
<a href="https://rubygems.org/gems/recycle_bin">
|
|
7
|
+
<img src="https://img.shields.io/gem/v/recycle_bin?style=for-the-badge&logo=rubygems&logoColor=white&color=667eea" alt="Gem Version">
|
|
8
|
+
</a>
|
|
9
|
+
<a href="https://github.com/R95-del/recycle_bin/actions">
|
|
10
|
+
<img src="https://img.shields.io/github/actions/workflow/status/R95-del/recycle_bin/main.yml?style=for-the-badge&logo=github&logoColor=white&color=28a745" alt="CI Status">
|
|
11
|
+
</a>
|
|
12
|
+
<a href="https://github.com/R95-del/recycle_bin/discussions">
|
|
13
|
+
<img src="https://img.shields.io/github/discussions/R95-del/recycle_bin?style=for-the-badge&logo=github&logoColor=white&color=007bff" alt="GitHub Discussions">
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://github.com/R95-del/recycle_bin/blob/main/LICENSE.txt">
|
|
16
|
+
<img src="https://img.shields.io/github/license/R95-del/recycle_bin?style=for-the-badge&color=764ba2" alt="MIT License">
|
|
17
|
+
</a>
|
|
18
|
+
</p>
|
|
19
|
+
<p>
|
|
20
|
+
<a href="https://recyclebin.vercel.app">📖 Documentation</a> •
|
|
21
|
+
<a href="https://github.com/R95-del/recycle_bin/blob/main/CHANGELOG.md">📋 Changelog</a> •
|
|
22
|
+
<a href="https://github.com/R95-del/recycle_bin/discussions">💬 Discussions</a> •
|
|
23
|
+
<a href="https://rubygems.org/gems/recycle_bin">💎 RubyGems</a>
|
|
24
|
+
</p>
|
|
25
|
+
</div>
|
|
2
26
|
|
|
3
27
|
A simple and elegant soft delete solution for Rails applications with a beautiful web interface to manage your deleted records.
|
|
4
28
|
|
|
@@ -14,13 +38,17 @@ A simple and elegant soft delete solution for Rails applications with a beautifu
|
|
|
14
38
|
- **Rails Generators**: Automated setup with generators
|
|
15
39
|
- **Configurable**: Flexible configuration options
|
|
16
40
|
- **Statistics Dashboard**: Overview of your deleted items
|
|
41
|
+
- **🔍 Enhanced Search**: Full-text search across all fields with highlighting
|
|
42
|
+
- **📊 Advanced Filtering**: Filter by user, size, date ranges, and more
|
|
43
|
+
- **📤 Export Functionality**: Export to CSV and JSON formats
|
|
44
|
+
- **📝 Better Error Handling**: Comprehensive logging and error tracking
|
|
17
45
|
|
|
18
46
|
## Installation 📦
|
|
19
47
|
|
|
20
48
|
Add this line to your application's Gemfile:
|
|
21
49
|
|
|
22
50
|
```ruby
|
|
23
|
-
gem 'recycle_bin'
|
|
51
|
+
gem 'recycle_bin', '~> 1.1'
|
|
24
52
|
```
|
|
25
53
|
|
|
26
54
|
And then execute:
|
|
@@ -317,7 +345,7 @@ DELETE /recycle_bin/trash/bulk_destroy # Bulk delete
|
|
|
317
345
|
```ruby
|
|
318
346
|
class Product < ApplicationRecord
|
|
319
347
|
include RecycleBin::SoftDeletable
|
|
320
|
-
|
|
348
|
+
|
|
321
349
|
def recyclable_title
|
|
322
350
|
"#{name} - #{sku}"
|
|
323
351
|
end
|
|
@@ -336,7 +364,7 @@ product.destroy # Goes to trash, can be restored
|
|
|
336
364
|
class Post < ApplicationRecord
|
|
337
365
|
include RecycleBin::SoftDeletable
|
|
338
366
|
belongs_to :author, class_name: 'User'
|
|
339
|
-
|
|
367
|
+
|
|
340
368
|
def recyclable_title
|
|
341
369
|
title.truncate(50)
|
|
342
370
|
end
|
|
@@ -346,7 +374,7 @@ class Comment < ApplicationRecord
|
|
|
346
374
|
include RecycleBin::SoftDeletable
|
|
347
375
|
belongs_to :post
|
|
348
376
|
belongs_to :user
|
|
349
|
-
|
|
377
|
+
|
|
350
378
|
def recyclable_title
|
|
351
379
|
"Comment by #{user.name}: #{body.truncate(30)}"
|
|
352
380
|
end
|
|
@@ -358,7 +386,7 @@ end
|
|
|
358
386
|
```ruby
|
|
359
387
|
class User < ApplicationRecord
|
|
360
388
|
include RecycleBin::SoftDeletable
|
|
361
|
-
|
|
389
|
+
|
|
362
390
|
def recyclable_title
|
|
363
391
|
"#{name} (#{email})"
|
|
364
392
|
end
|
|
@@ -410,16 +438,203 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
410
438
|
|
|
411
439
|
## Changelog 📝
|
|
412
440
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
-
|
|
417
|
-
-
|
|
418
|
-
-
|
|
419
|
-
-
|
|
441
|
+
## [1.1.1] - 2025-05-26
|
|
442
|
+
|
|
443
|
+
### Fixed
|
|
444
|
+
- Fixed critical bug in user authentication flow
|
|
445
|
+
- Resolved memory leak in background job processing
|
|
446
|
+
- Corrected deprecation warnings for Rails 7.1 compatibility
|
|
447
|
+
- Fixed race condition in concurrent database writes
|
|
448
|
+
|
|
449
|
+
### Changed
|
|
450
|
+
- Improved error handling in API responses
|
|
451
|
+
- Updated dependency versions for security patches
|
|
452
|
+
- Enhanced logging for better debugging experience
|
|
453
|
+
|
|
454
|
+
### Security
|
|
455
|
+
- Patched potential XSS vulnerability in form helpers
|
|
456
|
+
- Updated vulnerable dependencies to secure versions
|
|
457
|
+
|
|
458
|
+
## [1.1.0] - 2025-05-25
|
|
459
|
+
|
|
460
|
+
### Added
|
|
461
|
+
- **Proper pagination**: Navigate through all deleted records with page controls
|
|
462
|
+
- **Configurable page sizes**: Choose 25, 50, 100, or 250 items per page
|
|
463
|
+
- **Accurate item counting**: Shows real total counts instead of limited counts
|
|
464
|
+
- **Enhanced statistics**: Added today/week deletion counts
|
|
465
|
+
- **Better performance**: Optimized handling of large datasets
|
|
466
|
+
- **Per-page controls**: User-selectable items per page options
|
|
467
|
+
- **Memory optimization**: DeletedItemsCollection class for efficient data handling
|
|
468
|
+
|
|
469
|
+
### Fixed
|
|
470
|
+
- **Removed artificial limits**: No more 25/100 item display limits that prevented showing all records
|
|
471
|
+
- **Pagination persistence**: Filters maintained across page navigation
|
|
472
|
+
- **Memory usage**: Better handling of large datasets without loading all into memory
|
|
473
|
+
- **Count accuracy**: Total counts now reflect actual database records
|
|
474
|
+
- **Performance bottlenecks**: Eliminated inefficient loading of all records at once
|
|
475
|
+
|
|
476
|
+
### Changed
|
|
477
|
+
- **TrashController**: Complete rewrite with proper pagination logic
|
|
478
|
+
- **Index view**: Enhanced UI with comprehensive pagination controls and statistics
|
|
479
|
+
- **RecycleBin module**: Improved counting methods and performance optimizations
|
|
480
|
+
- **Statistics calculation**: More efficient counting without loading full record sets
|
|
481
|
+
|
|
482
|
+
### Performance
|
|
483
|
+
- **Large dataset support**: Now efficiently handles 5000+ deleted records
|
|
484
|
+
- **Lazy loading**: Only loads current page items, not all records
|
|
485
|
+
- **Optimized queries**: Better database query patterns for counting and filtering
|
|
486
|
+
- **Memory efficient**: Reduced memory footprint for large trash collections
|
|
487
|
+
|
|
488
|
+
### Technical Details
|
|
489
|
+
- Added `DeletedItemsCollection` class for efficient pagination
|
|
490
|
+
- Implemented proper offset/limit handling
|
|
491
|
+
- Enhanced filtering with maintained pagination state
|
|
492
|
+
- Improved error handling for large datasets
|
|
493
|
+
|
|
494
|
+
## [1.0.0] - 2025-05-24
|
|
495
|
+
|
|
496
|
+
### Added
|
|
497
|
+
- Initial release of RecycleBin gem
|
|
498
|
+
- Soft delete functionality for ActiveRecord models
|
|
499
|
+
- Web interface for managing trashed items
|
|
500
|
+
- Restore functionality for deleted records
|
|
501
|
+
- Bulk operations for multiple items
|
|
502
|
+
- JSON API support for programmatic access
|
|
503
|
+
|
|
504
|
+
### Contributors
|
|
505
|
+
- Rishi Somani
|
|
506
|
+
- Shobhit Jain
|
|
507
|
+
- Raghav Agrawal
|
|
420
508
|
|
|
421
509
|
---
|
|
422
510
|
|
|
423
511
|
**Made with ❤️ for the Rails community**
|
|
424
512
|
|
|
425
513
|
*Need help? Open an issue on [GitHub](https://github.com/R95-del/recycle_bin) or check out the web interface at `/recycle_bin` in your Rails app.*
|
|
514
|
+
|
|
515
|
+
## Advanced Features 🚀
|
|
516
|
+
|
|
517
|
+
### Enhanced Search & Discovery
|
|
518
|
+
|
|
519
|
+
RecycleBin now provides powerful search capabilities across all your deleted items:
|
|
520
|
+
|
|
521
|
+
```ruby
|
|
522
|
+
# Search across all fields including title, name, email, content, etc.
|
|
523
|
+
# Visit /recycle_bin?search=john@example.com
|
|
524
|
+
|
|
525
|
+
# Search results are highlighted in the interface
|
|
526
|
+
# Search works across all model types and attributes
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
**Search Features:**
|
|
530
|
+
- **Full-text Search**: Search across all item fields and attributes
|
|
531
|
+
- **Smart Highlighting**: Search terms are highlighted in results
|
|
532
|
+
- **Cross-model Search**: Find items across all soft-deleted models
|
|
533
|
+
- **Real-time Results**: Instant search with live filtering
|
|
534
|
+
|
|
535
|
+
### Advanced Filtering Options
|
|
536
|
+
|
|
537
|
+
Go beyond basic filtering with advanced options:
|
|
538
|
+
|
|
539
|
+
```ruby
|
|
540
|
+
# Filter by user who deleted the item
|
|
541
|
+
/recycle_bin?deleted_by=123
|
|
542
|
+
|
|
543
|
+
# Filter by item size
|
|
544
|
+
/recycle_bin?size=large # small, medium, large
|
|
545
|
+
|
|
546
|
+
# Filter by date range
|
|
547
|
+
/recycle_bin?date_from=2024-01-01&date_to=2024-12-31
|
|
548
|
+
|
|
549
|
+
# Combine multiple filters
|
|
550
|
+
/recycle_bin?search=john&type=User&size=medium&time=month
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
**Filter Types:**
|
|
554
|
+
- **Model Type**: Filter by specific model (User, Post, Comment, etc.)
|
|
555
|
+
- **Time Periods**: Today, This Week, This Month, This Year
|
|
556
|
+
- **User Filtering**: Find items deleted by specific users
|
|
557
|
+
- **Size Classification**: Small (< 1KB), Medium (1KB-100KB), Large (> 100KB)
|
|
558
|
+
- **Date Ranges**: Custom from/to date filtering
|
|
559
|
+
- **Active Filter Display**: See all active filters with easy removal
|
|
560
|
+
|
|
561
|
+
### Export Functionality
|
|
562
|
+
|
|
563
|
+
Export your filtered results in multiple formats:
|
|
564
|
+
|
|
565
|
+
```ruby
|
|
566
|
+
# Export current results to CSV
|
|
567
|
+
/recycle_bin?format=csv&search=john&type=User
|
|
568
|
+
|
|
569
|
+
# Export current results to JSON
|
|
570
|
+
/recycle_bin?format=json&time=month
|
|
571
|
+
|
|
572
|
+
# Export includes all current filters and search terms
|
|
573
|
+
# Filenames include filter information and timestamps
|
|
574
|
+
```
|
|
575
|
+
|
|
576
|
+
**Export Features:**
|
|
577
|
+
- **CSV Export**: Structured data for spreadsheet applications
|
|
578
|
+
- **JSON Export**: Programmatic access to your data
|
|
579
|
+
- **Filter Preservation**: Exports respect all current filters
|
|
580
|
+
- **Smart Filenames**: Include search terms and filter info
|
|
581
|
+
- **Large Dataset Support**: Efficient export of thousands of items
|
|
582
|
+
|
|
583
|
+
### Improved Error Handling & Logging
|
|
584
|
+
|
|
585
|
+
Enhanced error tracking and debugging capabilities:
|
|
586
|
+
|
|
587
|
+
```ruby
|
|
588
|
+
RecycleBin.configure do |config|
|
|
589
|
+
# Enable external error logging (e.g., Sentry)
|
|
590
|
+
config.error_logging_service = ->(error_context) {
|
|
591
|
+
Sentry.capture_exception(error_context[:error], extra: error_context)
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
# Configure search settings
|
|
595
|
+
config.enable_full_text_search = true
|
|
596
|
+
config.searchable_fields = %w[title name email content body description]
|
|
597
|
+
config.max_search_length = 100
|
|
598
|
+
|
|
599
|
+
# Configure export settings
|
|
600
|
+
config.enable_csv_export = true
|
|
601
|
+
config.enable_json_export = true
|
|
602
|
+
config.max_export_items = 10000
|
|
603
|
+
end
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
**Logging Features:**
|
|
607
|
+
- **Structured Logging**: JSON-formatted error logs with context
|
|
608
|
+
- **External Integration**: Support for Sentry, LogRocket, etc.
|
|
609
|
+
- **Debug Information**: Comprehensive debugging data
|
|
610
|
+
- **Performance Tracking**: Monitor search and export performance
|
|
611
|
+
- **User Context**: Track which users perform which actions
|
|
612
|
+
|
|
613
|
+
### Configuration Options
|
|
614
|
+
|
|
615
|
+
```ruby
|
|
616
|
+
# config/initializers/recycle_bin.rb
|
|
617
|
+
RecycleBin.configure do |config|
|
|
618
|
+
# Search configuration
|
|
619
|
+
config.enable_full_text_search = true
|
|
620
|
+
config.searchable_fields = %w[title name email content body description]
|
|
621
|
+
config.max_search_length = 100
|
|
622
|
+
config.search_timeout = 30.seconds
|
|
623
|
+
config.enable_fuzzy_search = false
|
|
624
|
+
config.min_search_length = 2
|
|
625
|
+
|
|
626
|
+
# Export configuration
|
|
627
|
+
config.enable_csv_export = true
|
|
628
|
+
config.enable_json_export = true
|
|
629
|
+
config.max_export_items = 10000
|
|
630
|
+
config.export_timeout = 5.minutes
|
|
631
|
+
config.include_metadata = true
|
|
632
|
+
config.compress_large_exports = true
|
|
633
|
+
|
|
634
|
+
# Advanced features
|
|
635
|
+
config.enable_advanced_filters = true
|
|
636
|
+
config.enable_search_highlighting = true
|
|
637
|
+
config.max_search_results = 10000
|
|
638
|
+
config.enable_audit_logging = false
|
|
639
|
+
end
|
|
640
|
+
```
|