Commit 6aead7991f93c63e23fd96677a1c499ebca2155f
1 parent
520f0225
Exists in
master
and in
4 other branches
fix decorate calls on collections after draper update
Showing
6 changed files
with
15 additions
and
14 deletions
Show diff stats
app/controllers/admin/teams/members_controller.rb
app/controllers/commits_controller.rb
| ... | ... | @@ -13,7 +13,7 @@ class CommitsController < 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 < 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 < 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 < 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
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 | ... | ... |