From a7ead83aba3a3987feaab7ac8b4089a2caa324d3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 14 Jun 2017 18:58:13 +0200 Subject: Move ModelDecorator to a new file; Remove duplicate PaginatingDecorator Move `ModelDecorator` to a new file now that we know it works and that we're going to use it. I had previously put these two classes in the same file as `ReferentialDecorator` because I wanted to test that it worked before making the code correct. Also remove the `PaginatingDecorator` because apparently we already have one, which I didn't realise. Use the existing one instead. Refs #3479 --- app/decorators/model_decorator.rb | 3 +++ app/decorators/referential_decorator.rb | 17 ----------------- 2 files changed, 3 insertions(+), 17 deletions(-) create mode 100644 app/decorators/model_decorator.rb (limited to 'app') diff --git a/app/decorators/model_decorator.rb b/app/decorators/model_decorator.rb new file mode 100644 index 000000000..dee014cc3 --- /dev/null +++ b/app/decorators/model_decorator.rb @@ -0,0 +1,3 @@ +class ModelDecorator < PaginatingDecorator + delegate :model +end diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb index 45a4b38d1..1c2347529 100644 --- a/app/decorators/referential_decorator.rb +++ b/app/decorators/referential_decorator.rb @@ -1,20 +1,3 @@ -# Delegates 'will_paginate' methods -class PaginatingDecorator < Draper::CollectionDecorator - delegate( - :current_page, - :per_page, - :offset, - :total_entries, - :total_pages - ) -end - - -class ModelDecorator < PaginatingDecorator - delegate :model -end - - class ReferentialDecorator < Draper::Decorator delegate_all -- cgit v1.2.3