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