From dd6a319dfb3dc78188aea5b3318b6fcf7fa2b4d2 Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Mon, 13 May 2013 23:15:23 +0600 Subject: [PATCH] [#98] common pull requests --- app/controllers/users/users_controller.rb | 20 ++++++++++++++++--- app/views/activity_feeds/_feed_tabs.html.haml | 4 ---- app/views/activity_feeds/_top_menu.html.haml | 2 +- app/views/users/users/issues_index.html.haml | 4 ++-- config/locales/models/issue.en.yml | 2 +- config/locales/models/issue.ru.yml | 2 +- config/locales/title.en.yml | 2 ++ config/locales/title.ru.yml | 2 ++ 8 files changed, 26 insertions(+), 12 deletions(-) diff --git a/app/controllers/users/users_controller.rb b/app/controllers/users/users_controller.rb index 7ffbcb99b..7a0536ecb 100644 --- a/app/controllers/users/users_controller.rb +++ b/app/controllers/users/users_controller.rb @@ -24,10 +24,20 @@ class Users::UsersController < Users::BaseController end def issues - @created_issues = current_user.issues.without_pull_requests - @assigned_issues = Issue.where(:assignee_id => current_user.id).without_pull_requests + @created_issues = current_user.issues + @assigned_issues = Issue.where(:assignee_id => current_user.id) pr_ids = Project.accessible_by(current_ability, :membered).uniq.pluck(:id) - @all_issues = Issue.where(:project_id => pr_ids).without_pull_requests + @all_issues = Issue.where(:project_id => pr_ids) + @created_issues, @assigned_issues, @all_issues = + if action_name == 'issues' + [@created_issues.without_pull_requests, + @assigned_issues.without_pull_requests, + @all_issues.without_pull_requests] + else + [@created_issues.joins(:pull_request), + @assigned_issues.joins(:pull_request), + @all_issues.joins(:pull_request)] + end case params[:filter] when 'created' @@ -52,6 +62,10 @@ class Users::UsersController < Users::BaseController render 'issues_index', :layout => request.xhr? ? 'with_sidebar' : 'application' end + def pull_requests + issues + end + protected def find_user_by_key diff --git a/app/views/activity_feeds/_feed_tabs.html.haml b/app/views/activity_feeds/_feed_tabs.html.haml index eb2dc3abc..e02b8c03b 100644 --- a/app/views/activity_feeds/_feed_tabs.html.haml +++ b/app/views/activity_feeds/_feed_tabs.html.haml @@ -3,7 +3,3 @@ %ul - (collection = t 'feed_menu').each do |base, title| %li= link_to title, root_path(:filter => base), :class => controller_name == 'activity_feeds' && @filter == base ? 'active' : '' - -# - %li - = image_tag 'menu-delimiter.png', :style => 'margin-bottom: -7px;' - %li=link_to t('users.users.issues_index.title'), issues_path, :class => controller_name== 'users' && action_name == 'issues' ? 'active' : '' diff --git a/app/views/activity_feeds/_top_menu.html.haml b/app/views/activity_feeds/_top_menu.html.haml index 2df5dacd7..f1c53309f 100644 --- a/app/views/activity_feeds/_top_menu.html.haml +++ b/app/views/activity_feeds/_top_menu.html.haml @@ -4,4 +4,4 @@ %ul %li= link_to t('activity_menu.activity_feed'), root_path, :class => controller_name == 'activity_feeds' ? 'active' : '' %li= link_to t('activity_menu.tracker'), issues_path, :class => controller_name == 'users' && action_name == 'issues' ? 'active' : '' - %li= link_to t('activity_menu.pull_requests'), root_path, :class => controller_name == 'users' && action_name == 'pull_requests' ? 'active' : '' \ No newline at end of file + %li= link_to t('activity_menu.pull_requests'), pull_requests_path, :class => controller_name == 'users' && action_name == 'pull_requests' ? 'active' : '' \ No newline at end of file diff --git a/app/views/users/users/issues_index.html.haml b/app/views/users/users/issues_index.html.haml index d5e14d473..b210b2f3d 100644 --- a/app/views/users/users/issues_index.html.haml +++ b/app/views/users/users/issues_index.html.haml @@ -1,7 +1,7 @@ --set_meta_tags :title => t('.title') +-set_meta_tags :title => t("users.users.#{action_name}_index.title") -render('activity_feeds/top_menu') -content_for :sidebar do - =form_tag issues_path, :id => 'filter_issues', :method => :get do + =form_tag send("#{action_name}_path"), :id => 'filter_issues', :method => :get do .bordered %table -%w[all assigned created].each do |filter| diff --git a/config/locales/models/issue.en.yml b/config/locales/models/issue.en.yml index c6ed5d582..87e95006a 100644 --- a/config/locales/models/issue.en.yml +++ b/config/locales/models/issue.en.yml @@ -19,7 +19,7 @@ en: no_one_is_assigned: No one is assigned assign_someone: Assign someone to this issue list: List - all: All issues + all: All assigned: Assigned to me created: Created by you edit: Edit diff --git a/config/locales/models/issue.ru.yml b/config/locales/models/issue.ru.yml index 427f95510..5891d1e29 100644 --- a/config/locales/models/issue.ru.yml +++ b/config/locales/models/issue.ru.yml @@ -19,7 +19,7 @@ ru: no_one_is_assigned: Никто не назначен assign_someone: Назначить кого-либо на задачу list: Список - all: Все задачи + all: Все assigned: Назначенные мне created: Созданные мной edit: Редактировать diff --git a/config/locales/title.en.yml b/config/locales/title.en.yml index a7cc0675a..24a08a7fa 100644 --- a/config/locales/title.en.yml +++ b/config/locales/title.en.yml @@ -9,6 +9,8 @@ en: users: issues_index: title: 'Your Issues' + pull_requests_index: + title: 'Your Pull Requests' projects: build_lists: index: diff --git a/config/locales/title.ru.yml b/config/locales/title.ru.yml index 354fa68ea..61ed7838f 100644 --- a/config/locales/title.ru.yml +++ b/config/locales/title.ru.yml @@ -9,6 +9,8 @@ ru: users: issues_index: title: 'Ваши задачи' + pull_requests_index: + title: 'Ваши пул реквесты' projects: build_lists: index: