recycle_bin 1.1.1 → 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 +40 -0
- data/README.md +136 -7
- data/app/controllers/recycle_bin/trash_controller.rb +418 -21
- data/app/helpers/recycle_bin/application_helper.rb +175 -0
- data/app/views/recycle_bin/layouts/recycle_bin.html.erb +33 -32
- data/app/views/recycle_bin/trash/_action_history.html.erb +13 -9
- data/app/views/recycle_bin/trash/_associations.html.erb +9 -5
- data/app/views/recycle_bin/trash/_filters.html.erb +558 -14
- data/app/views/recycle_bin/trash/_item.html.erb +262 -19
- data/app/views/recycle_bin/trash/_stats.html.erb +27 -9
- data/app/views/recycle_bin/trash/dashboard.html.erb +618 -0
- data/app/views/recycle_bin/trash/index.html.erb +246 -17
- data/config/routes.rb +9 -2
- data/lib/recycle_bin/version.rb +1 -1
- data/lib/recycle_bin.rb +111 -1
- metadata +7 -4
- 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,45 @@
|
|
|
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
|
+
|
|
3
43
|
## [1.1.1] - 2025-05-26
|
|
4
44
|
|
|
5
45
|
### Fixed
|
data/README.md
CHANGED
|
@@ -38,6 +38,10 @@ A simple and elegant soft delete solution for Rails applications with a beautifu
|
|
|
38
38
|
- **Rails Generators**: Automated setup with generators
|
|
39
39
|
- **Configurable**: Flexible configuration options
|
|
40
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
|
|
41
45
|
|
|
42
46
|
## Installation 📦
|
|
43
47
|
|
|
@@ -341,7 +345,7 @@ DELETE /recycle_bin/trash/bulk_destroy # Bulk delete
|
|
|
341
345
|
```ruby
|
|
342
346
|
class Product < ApplicationRecord
|
|
343
347
|
include RecycleBin::SoftDeletable
|
|
344
|
-
|
|
348
|
+
|
|
345
349
|
def recyclable_title
|
|
346
350
|
"#{name} - #{sku}"
|
|
347
351
|
end
|
|
@@ -360,7 +364,7 @@ product.destroy # Goes to trash, can be restored
|
|
|
360
364
|
class Post < ApplicationRecord
|
|
361
365
|
include RecycleBin::SoftDeletable
|
|
362
366
|
belongs_to :author, class_name: 'User'
|
|
363
|
-
|
|
367
|
+
|
|
364
368
|
def recyclable_title
|
|
365
369
|
title.truncate(50)
|
|
366
370
|
end
|
|
@@ -370,7 +374,7 @@ class Comment < ApplicationRecord
|
|
|
370
374
|
include RecycleBin::SoftDeletable
|
|
371
375
|
belongs_to :post
|
|
372
376
|
belongs_to :user
|
|
373
|
-
|
|
377
|
+
|
|
374
378
|
def recyclable_title
|
|
375
379
|
"Comment by #{user.name}: #{body.truncate(30)}"
|
|
376
380
|
end
|
|
@@ -382,7 +386,7 @@ end
|
|
|
382
386
|
```ruby
|
|
383
387
|
class User < ApplicationRecord
|
|
384
388
|
include RecycleBin::SoftDeletable
|
|
385
|
-
|
|
389
|
+
|
|
386
390
|
def recyclable_title
|
|
387
391
|
"#{name} (#{email})"
|
|
388
392
|
end
|
|
@@ -434,8 +438,6 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
434
438
|
|
|
435
439
|
## Changelog 📝
|
|
436
440
|
|
|
437
|
-
# Changelog
|
|
438
|
-
|
|
439
441
|
## [1.1.1] - 2025-05-26
|
|
440
442
|
|
|
441
443
|
### Fixed
|
|
@@ -457,7 +459,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
457
459
|
|
|
458
460
|
### Added
|
|
459
461
|
- **Proper pagination**: Navigate through all deleted records with page controls
|
|
460
|
-
- **Configurable page sizes**: Choose 25, 50, 100, or 250 items per page
|
|
462
|
+
- **Configurable page sizes**: Choose 25, 50, 100, or 250 items per page
|
|
461
463
|
- **Accurate item counting**: Shows real total counts instead of limited counts
|
|
462
464
|
- **Enhanced statistics**: Added today/week deletion counts
|
|
463
465
|
- **Better performance**: Optimized handling of large datasets
|
|
@@ -509,3 +511,130 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
509
511
|
**Made with ❤️ for the Rails community**
|
|
510
512
|
|
|
511
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
|
+
```
|