Commit 6aead7991f93c63e23fd96677a1c499ebca2155f

Authored by Dmitriy Zaporozhets
1 parent 520f0225

fix decorate calls on collections after draper update

app/controllers/admin/teams/members_controller.rb
1 class Admin::Teams::MembersController < Admin::Teams::ApplicationController 1 class Admin::Teams::MembersController < Admin::Teams::ApplicationController
2 def new 2 def new
3 @users = User.potential_team_members(user_team) 3 @users = User.potential_team_members(user_team)
4 - @users = UserDecorator.decorate @users 4 + @users = UserDecorator.decorate_collection @users
5 end 5 end
6 6
7 def create 7 def create
app/controllers/commits_controller.rb
@@ -13,7 +13,7 @@ class CommitsController &lt; ProjectResourceController @@ -13,7 +13,7 @@ class CommitsController &lt; ProjectResourceController
13 @limit, @offset = (params[:limit] || 40), (params[:offset] || 0) 13 @limit, @offset = (params[:limit] || 40), (params[:offset] || 0)
14 14
15 @commits = @repo.commits(@ref, @path, @limit, @offset) 15 @commits = @repo.commits(@ref, @path, @limit, @offset)
16 - @commits = CommitDecorator.decorate(@commits) 16 + @commits = CommitDecorator.decorate_collection(@commits)
17 17
18 respond_to do |format| 18 respond_to do |format|
19 format.html # index.html.erb 19 format.html # index.html.erb
app/controllers/compare_controller.rb
@@ -16,7 +16,7 @@ class CompareController &lt; ProjectResourceController @@ -16,7 +16,7 @@ class CompareController &lt; ProjectResourceController
16 @refs_are_same = result[:same] 16 @refs_are_same = result[:same]
17 @line_notes = [] 17 @line_notes = []
18 18
19 - @commits = CommitDecorator.decorate(@commits) 19 + @commits = CommitDecorator.decorate_collection(@commits)
20 end 20 end
21 21
22 def create 22 def create
app/controllers/merge_requests_controller.rb
@@ -94,12 +94,12 @@ class MergeRequestsController &lt; ProjectResourceController @@ -94,12 +94,12 @@ class MergeRequestsController &lt; ProjectResourceController
94 94
95 def branch_from 95 def branch_from
96 @commit = @repository.commit(params[:ref]) 96 @commit = @repository.commit(params[:ref])
97 - @commit = CommitDecorator.decorate(@commit) 97 + @commit = CommitDecorator.decorate_collection(@commit)
98 end 98 end
99 99
100 def branch_to 100 def branch_to
101 @commit = @repository.commit(params[:ref]) 101 @commit = @repository.commit(params[:ref])
102 - @commit = CommitDecorator.decorate(@commit) 102 + @commit = CommitDecorator.decorate_collection(@commit)
103 end 103 end
104 104
105 def ci_status 105 def ci_status
@@ -143,7 +143,7 @@ class MergeRequestsController &lt; ProjectResourceController @@ -143,7 +143,7 @@ class MergeRequestsController &lt; ProjectResourceController
143 # Get commits from repository 143 # Get commits from repository
144 # or from cache if already merged 144 # or from cache if already merged
145 @commits = @merge_request.commits 145 @commits = @merge_request.commits
146 - @commits = CommitDecorator.decorate(@commits) 146 + @commits = CommitDecorator.decorate_collection(@commits)
147 147
148 @allowed_to_merge = allowed_to_merge? 148 @allowed_to_merge = allowed_to_merge?
149 @show_merge_controls = @merge_request.opened? && @commits.any? && @allowed_to_merge 149 @show_merge_controls = @merge_request.opened? && @commits.any? && @allowed_to_merge
app/controllers/teams/members_controller.rb
@@ -8,7 +8,7 @@ class Teams::MembersController &lt; Teams::ApplicationController @@ -8,7 +8,7 @@ class Teams::MembersController &lt; Teams::ApplicationController
8 8
9 def new 9 def new
10 @users = User.potential_team_members(user_team) 10 @users = User.potential_team_members(user_team)
11 - @users = UserDecorator.decorate @users 11 + @users = UserDecorator.decorate_collection @users
12 end 12 end
13 13
14 def create 14 def create
app/decorators/application_decorator.rb
1 -class ApplicationDecorator < Draper::Base 1 +class ApplicationDecorator < Draper::Decorator
  2 + delegate_all
2 # Lazy Helpers 3 # Lazy Helpers
3 # PRO: Call Rails helpers without the h. proxy 4 # PRO: Call Rails helpers without the h. proxy
4 # ex: number_to_currency(model.price) 5 # ex: number_to_currency(model.price)
5 # CON: Add a bazillion methods into your decorator's namespace 6 # CON: Add a bazillion methods into your decorator's namespace
6 # and probably sacrifice performance/memory 7 # and probably sacrifice performance/memory
7 - # 8 + #
8 # Enable them by uncommenting this line: 9 # Enable them by uncommenting this line:
9 # lazy_helpers 10 # lazy_helpers
10 11
11 # Shared Decorations 12 # Shared Decorations
12 # Consider defining shared methods common to all your models. 13 # Consider defining shared methods common to all your models.
13 - # 14 + #
14 # Example: standardize the formatting of timestamps 15 # Example: standardize the formatting of timestamps
15 # 16 #
16 # def formatted_timestamp(time) 17 # def formatted_timestamp(time)
17 - # h.content_tag :span, time.strftime("%a %m/%d/%y"),  
18 - # class: 'timestamp' 18 + # h.content_tag :span, time.strftime("%a %m/%d/%y"),
  19 + # class: 'timestamp'
19 # end 20 # end
20 - # 21 + #
21 # def created_at 22 # def created_at
22 # formatted_timestamp(model.created_at) 23 # formatted_timestamp(model.created_at)
23 # end 24 # end
24 - # 25 + #
25 # def updated_at 26 # def updated_at
26 # formatted_timestamp(model.updated_at) 27 # formatted_timestamp(model.updated_at)
27 # end 28 # end