[#98] Add common issues tracker
This commit is contained in:
parent
d59a94df42
commit
d3ac9d1a2c
Binary file not shown.
After Width: | Height: | Size: 2.8 KiB |
|
@ -13,7 +13,7 @@ class Projects::IssuesController < Projects::BaseController
|
|||
def index(status = 200)
|
||||
@labels = params[:labels] || []
|
||||
@issues = @project.issues.without_pull_requests
|
||||
@issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me'
|
||||
@issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'assigned'
|
||||
@issues = @issues.joins(:labels).where(:labels => {:name => @labels}) unless @labels == []
|
||||
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
|
||||
@issues = @issues.search(params[:search_issue]) if params[:search_issue] !~ /#{t('layout.issues.search')}/
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class Users::UsersController < Users::BaseController
|
||||
skip_before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:allowed, :check, :discover]
|
||||
before_filter :find_user_by_key, :only => [:allowed, :discover]
|
||||
|
||||
def allowed
|
||||
|
@ -23,6 +23,35 @@ class Users::UsersController < Users::BaseController
|
|||
render :json => {:name => @user.name}.to_json
|
||||
end
|
||||
|
||||
def issues
|
||||
@created_issues = current_user.issues.without_pull_requests
|
||||
@assigned_issues = Issue.where(:assignee_id => current_user.id).without_pull_requests
|
||||
pr_ids = Project.accessible_by(current_ability, :membered).uniq.pluck(:id)
|
||||
@all_issues = Issue.where(:project_id => pr_ids).without_pull_requests
|
||||
|
||||
case params[:filter]
|
||||
when 'created'
|
||||
@issues = @created_issues
|
||||
when 'assigned'
|
||||
@issues = @assigned_issues
|
||||
else
|
||||
params[:filter] = 'all' # default
|
||||
@issues = @all_issues
|
||||
end
|
||||
@filter = params[:filter]
|
||||
@opened_issues, @closed_issues = @issues.not_closed_or_merged.count, @issues.closed_or_merged.count
|
||||
|
||||
@status = params[:status] == 'closed' ? :closed : :open
|
||||
@issues = @issues.send( (@status == :closed) ? :closed_or_merged : :not_closed_or_merged )
|
||||
|
||||
@sort = params[:sort] == 'updated' ? :updated : :created
|
||||
@direction = params[:direction] == 'asc' ? :asc : :desc
|
||||
@issues = @issues.order("issues.#{@sort}_at #{@direction}")
|
||||
.includes(:assignee, :user, :pull_request).uniq
|
||||
.paginate :per_page => 20, :page => params[:page]
|
||||
render 'issues_index', :layout => request.xhr? ? 'with_sidebar' : 'application'
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_user_by_key
|
||||
|
|
|
@ -28,6 +28,7 @@ class User < Avatar
|
|||
has_many :own_projects, :as => :owner, :class_name => 'Project', :dependent => :destroy
|
||||
has_many :own_groups, :foreign_key => :owner_id, :class_name => 'Group', :dependent => :destroy
|
||||
has_many :own_platforms, :as => :owner, :class_name => 'Platform', :dependent => :destroy
|
||||
has_many :issues
|
||||
has_many :assigned_issues, :foreign_key => :assignee_id, :class_name => 'Issue', :dependent => :nullify
|
||||
|
||||
has_many :key_pairs
|
||||
|
|
|
@ -2,4 +2,7 @@
|
|||
%nav
|
||||
%ul
|
||||
- (collection = t 'feed_menu').each do |base, title|
|
||||
%li= link_to title, root_path(:filter => base), :class => @filter == base ? 'active' : ''
|
||||
%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' : ''
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
%table
|
||||
%tr
|
||||
%td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
|
||||
%td.width135=t("layout.issues.all")
|
||||
%td.width135=t('layout.issues.all')
|
||||
%td.width30.right=@project.issues.without_pull_requests.count
|
||||
%tr
|
||||
%td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
|
||||
%td=t("layout.issues.to_me")
|
||||
%td=radio_button_tag :myradio, 'assigned', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
|
||||
%td=t('layout.issues.assigned')
|
||||
%td.width30.right=@project.issues.without_pull_requests.where(:assignee_id => current_user.id).count
|
||||
=form_tag project_issues_path(@project), :id => 'search_issue', :class => 'ajax_search_form', :method => :get do
|
||||
.bordered.bpadding20
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
- path = polymorphic_path [@project, issue.pull_request ? issue.pull_request : issue]
|
||||
- path = polymorphic_path [@project || issue.project, issue.pull_request ? issue.pull_request : issue]
|
||||
|
||||
%tr#row1{:name => "row", :class => issue.labels.map(&:name).compact}
|
||||
%td.td0
|
||||
|
@ -6,7 +6,9 @@
|
|||
%td.td1=issue.serial_id
|
||||
%td
|
||||
%a{:href => path}
|
||||
%div.issue_title=issue.title
|
||||
%div.issue_title
|
||||
-prefix = @project ? '' : "<span style=\"color: #999;\">#{issue.project.name}</span>: "
|
||||
="#{prefix} #{issue.title}".html_safe
|
||||
.smalltext
|
||||
=issue.send(@sort == :created ? :created_at : :updated_at).to_s(:long)
|
||||
=t("layout.by") if issue.user
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
-set_meta_tags :title => t('.title')
|
||||
-content_for :feed_tabs, render('activity_feeds/feed_tabs')
|
||||
-content_for :sidebar do
|
||||
=form_tag issues_path, :id => 'filter_issues', :method => :get do
|
||||
.bordered
|
||||
%table
|
||||
-%w[all assigned created].each do |filter|
|
||||
%tr
|
||||
%td.width18=radio_button_tag :myradio, filter, filter == @filter, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
|
||||
%td.width135=t("layout.issues.#{filter}")
|
||||
%td.width30.right=instance_variable_get("@#{filter}_issues").count
|
||||
=render 'projects/issues/issues_table', :issues => @issues
|
|
@ -20,7 +20,8 @@ en:
|
|||
assign_someone: Assign someone to this issue
|
||||
list: List
|
||||
all: All issues
|
||||
to_me: Assigned to me
|
||||
assigned: Assigned to me
|
||||
created: Created by you
|
||||
edit: Edit
|
||||
search: Find issue...
|
||||
comments_header: Comments
|
||||
|
|
|
@ -20,7 +20,8 @@ ru:
|
|||
assign_someone: Назначить кого-либо на задачу
|
||||
list: Список
|
||||
all: Все задачи
|
||||
to_me: Назначенные мне
|
||||
assigned: Назначенные мне
|
||||
created: Созданные мной
|
||||
edit: Редактировать
|
||||
search: Найти задачу...
|
||||
comments_header: Комментарии
|
||||
|
|
|
@ -6,6 +6,9 @@ en:
|
|||
settings:
|
||||
profile:
|
||||
title: 'Your Profile'
|
||||
users:
|
||||
issues_index:
|
||||
title: 'Your Issues'
|
||||
projects:
|
||||
build_lists:
|
||||
index:
|
||||
|
|
|
@ -6,6 +6,9 @@ ru:
|
|||
settings:
|
||||
profile:
|
||||
title: 'Ваш профиль'
|
||||
users:
|
||||
issues_index:
|
||||
title: 'Ваши задачи'
|
||||
projects:
|
||||
build_lists:
|
||||
index:
|
||||
|
|
|
@ -209,6 +209,8 @@ Rosa::Application.routes.draw do
|
|||
get '/allowed' => 'users#allowed'
|
||||
get '/check' => 'users#check'
|
||||
get '/discover' => 'users#discover'
|
||||
get '/issues' => 'users#issues'
|
||||
get '/pull_requests' => 'users#pull_requests'
|
||||
end
|
||||
|
||||
scope :module => 'groups' do
|
||||
|
|
Loading…
Reference in New Issue