diff options
author | Rémy Coutable <remy@rymai.me> | 2017-01-10 17:41:04 -0500 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-01-18 16:38:35 +0100 |
commit | 061bb6eb6ed0ca6be3c571b3fcfd14a6f9729205 (patch) | |
tree | 2b87e3ea5d1e67b19c515891d19b466c80040a04 /app/presenters/README.md | |
parent | e950830ba6a0efa3b0992e6e55cb5b5842f8573a (diff) | |
download | gitlab-ce-061bb6eb6ed0ca6be3c571b3fcfd14a6f9729205.tar.gz |
More improvements to presenters23563-document-presenters
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/presenters/README.md')
-rw-r--r-- | app/presenters/README.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/presenters/README.md b/app/presenters/README.md index 91c1d2609f5..3edd63451e7 100644 --- a/app/presenters/README.md +++ b/app/presenters/README.md @@ -66,7 +66,7 @@ we gain the following benefits: ### Presenter definition -Every presenters should inherit from `Gitlab::View::Presenter::Simple`, which +Every presenter should inherit from `Gitlab::View::Presenter::Simple`, which provides a `.presents` method which allows you to define an accessor for the presented object. It also includes common helpers like `Gitlab::Routing` and `Gitlab::Allowable`. @@ -76,7 +76,7 @@ class LabelPresenter < Gitlab::View::Presenter::Simple presents :label def text_color - LabelsHelper.text_color_for_bg(label.color) + label.color.to_s end def to_partial_path @@ -95,7 +95,7 @@ class LabelPresenter < Gitlab::View::Presenter::Delegated def text_color # color is delegated to label - LabelsHelper.text_color_for_bg(color) + color.to_s end def to_partial_path @@ -132,7 +132,7 @@ and then in the controller: ```ruby class Projects::LabelsController < Projects::ApplicationController def edit - @label = @label.present(current_user) + @label = @label.present(user: current_user) end end ``` |