diff options
author | Long Nguyen <long.polyglot@gmail.com> | 2016-05-02 12:37:12 +0300 |
---|---|---|
committer | Long Nguyen <long.polyglot@gmail.com> | 2016-05-02 12:37:12 +0300 |
commit | c0f02aad4a1a178109a235d34bd70218c0aec86c (patch) | |
tree | 0fda1649d7d67e1308ed0aaee241a638e4117119 /app/controllers/users_controller.rb | |
parent | df8fda60fbbd2b6b38bdcb1680a0f24598c29f79 (diff) |
Add snippet tab under user profile
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r-- | app/controllers/users_controller.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2ae180c8a12..799421c185b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -58,6 +58,19 @@ class UsersController < ApplicationController end end + def snippets + load_snippets + + respond_to do |format| + format.html { render 'show' } + format.json do + render json: { + html: view_to_html_string("snippets/_snippets", collection: @snippets) + } + end + end + end + def calendar calendar = contributions_calendar @timestamps = calendar.timestamps @@ -116,6 +129,15 @@ class UsersController < ApplicationController @groups = JoinedGroupsFinder.new(user).execute(current_user) end + def load_snippets + @snippets = SnippetsFinder.new.execute( + current_user, + filter: :by_user, + user: user, + scope: params[:scope] + ).page(params[:page]) + end + def projects_for_current_user ProjectsFinder.new.execute(current_user) end |