diff options
author | Rémy Coutable <remy@rymai.me> | 2017-01-09 21:45:49 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-01-18 16:38:34 +0100 |
commit | bf789ff567c71ff68c216bfa8f3d43e09b6f49fb (patch) | |
tree | 28d4ac2aa74824eb5d85dc8271474980a3237bbe /app/presenters | |
parent | fd72c0f4c748658f539d24a286366e9ac7a22b57 (diff) | |
download | gitlab-ce-bf789ff567c71ff68c216bfa8f3d43e09b6f49fb.tar.gz |
Improve presenter architecture
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/presenters')
-rw-r--r-- | app/presenters/build_presenter.rb | 15 | ||||
-rw-r--r-- | app/presenters/ci/build/presenter.rb | 17 | ||||
-rw-r--r-- | app/presenters/ci/variable/presenter.rb | 7 | ||||
-rw-r--r-- | app/presenters/variable_presenter.rb | 5 |
4 files changed, 24 insertions, 20 deletions
diff --git a/app/presenters/build_presenter.rb b/app/presenters/build_presenter.rb deleted file mode 100644 index 9c44a6d2dbe..00000000000 --- a/app/presenters/build_presenter.rb +++ /dev/null @@ -1,15 +0,0 @@ -class BuildPresenter < SimpleDelegator - include Gitlab::View::Presenter - - presents :build - - def erased_by_user? - # Build can be erased through API, therefore it does not have - # `erase_by` user assigned in that case. - erased? && erased_by - end - - def self.ancestors - super + [Ci::Build] - end -end diff --git a/app/presenters/ci/build/presenter.rb b/app/presenters/ci/build/presenter.rb new file mode 100644 index 00000000000..60392200fde --- /dev/null +++ b/app/presenters/ci/build/presenter.rb @@ -0,0 +1,17 @@ +module Ci + class Build + class Presenter < Gitlab::View::Presenter::Delegated + presents :build + + def erased_by_user? + # Build can be erased through API, therefore it does not have + # `erase_by` user assigned in that case. + erased? && erased_by + end + + def erased_by_name + erased_by.name if erased_by + end + end + end +end diff --git a/app/presenters/ci/variable/presenter.rb b/app/presenters/ci/variable/presenter.rb new file mode 100644 index 00000000000..02045e19cac --- /dev/null +++ b/app/presenters/ci/variable/presenter.rb @@ -0,0 +1,7 @@ +module Ci + class Variable + class Presenter < Gitlab::View::Presenter::Simple + presents :variable + end + end +end diff --git a/app/presenters/variable_presenter.rb b/app/presenters/variable_presenter.rb deleted file mode 100644 index 80382f3a001..00000000000 --- a/app/presenters/variable_presenter.rb +++ /dev/null @@ -1,5 +0,0 @@ -class VariablePresenter - include Gitlab::View::Presenter - - presents :variable -end |