Skip to content
Snippets Groups Projects
Commit 6aead799 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

fix decorate calls on collections after draper update

parent 520f0225
No related branches found
No related tags found
No related merge requests found
class Admin::Teams::MembersController < Admin::Teams::ApplicationController
def new
@users = User.potential_team_members(user_team)
@users = UserDecorator.decorate @users
@users = UserDecorator.decorate_collection @users
end
 
def create
Loading
Loading
Loading
Loading
@@ -13,7 +13,7 @@ class CommitsController < ProjectResourceController
@limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
 
@commits = @repo.commits(@ref, @path, @limit, @offset)
@commits = CommitDecorator.decorate(@commits)
@commits = CommitDecorator.decorate_collection(@commits)
 
respond_to do |format|
format.html # index.html.erb
Loading
Loading
Loading
Loading
@@ -16,7 +16,7 @@ class CompareController < ProjectResourceController
@refs_are_same = result[:same]
@line_notes = []
 
@commits = CommitDecorator.decorate(@commits)
@commits = CommitDecorator.decorate_collection(@commits)
end
 
def create
Loading
Loading
Loading
Loading
@@ -94,12 +94,12 @@ class MergeRequestsController < ProjectResourceController
 
def branch_from
@commit = @repository.commit(params[:ref])
@commit = CommitDecorator.decorate(@commit)
@commit = CommitDecorator.decorate_collection(@commit)
end
 
def branch_to
@commit = @repository.commit(params[:ref])
@commit = CommitDecorator.decorate(@commit)
@commit = CommitDecorator.decorate_collection(@commit)
end
 
def ci_status
Loading
Loading
@@ -143,7 +143,7 @@ class MergeRequestsController < ProjectResourceController
# Get commits from repository
# or from cache if already merged
@commits = @merge_request.commits
@commits = CommitDecorator.decorate(@commits)
@commits = CommitDecorator.decorate_collection(@commits)
 
@allowed_to_merge = allowed_to_merge?
@show_merge_controls = @merge_request.opened? && @commits.any? && @allowed_to_merge
Loading
Loading
Loading
Loading
@@ -8,7 +8,7 @@ class Teams::MembersController < Teams::ApplicationController
 
def new
@users = User.potential_team_members(user_team)
@users = UserDecorator.decorate @users
@users = UserDecorator.decorate_collection @users
end
 
def create
Loading
Loading
class ApplicationDecorator < Draper::Base
class ApplicationDecorator < Draper::Decorator
delegate_all
# Lazy Helpers
# PRO: Call Rails helpers without the h. proxy
# ex: number_to_currency(model.price)
# CON: Add a bazillion methods into your decorator's namespace
# and probably sacrifice performance/memory
#
#
# Enable them by uncommenting this line:
# lazy_helpers
 
# Shared Decorations
# Consider defining shared methods common to all your models.
#
#
# Example: standardize the formatting of timestamps
#
# def formatted_timestamp(time)
# h.content_tag :span, time.strftime("%a %m/%d/%y"),
# class: 'timestamp'
# h.content_tag :span, time.strftime("%a %m/%d/%y"),
# class: 'timestamp'
# end
#
#
# def created_at
# formatted_timestamp(model.created_at)
# end
#
#
# def updated_at
# formatted_timestamp(model.updated_at)
# end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment