Merge pull request #128 from abf/rosa-build:98-common_tracker
[refs #98] common tracker for issues and pull requests
This commit is contained in:
commit
d092a355a3
|
@ -2026,3 +2026,11 @@ article .activity .top {
|
|||
}
|
||||
th { text-align: center; }
|
||||
}
|
||||
|
||||
.activity-tabs {
|
||||
margin: 10px 0 0 0;
|
||||
background: none;
|
||||
-webkit-box-shadow: 0;
|
||||
-moz-box-shadow: 0;
|
||||
box-shadow: 0;
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class ActivityFeedsController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
|
||||
def index
|
||||
@filter = t('feed_menu').has_key?(params[:filter].try(:to_sym)) ? params[:filter].to_sym : :all
|
||||
@activity_feeds = current_user.activity_feeds
|
||||
@activity_feeds = @activity_feeds.where(:kind => "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all
|
||||
@activity_feeds = @activity_feeds.paginate :page => params[:page]
|
||||
respond_to do |format|
|
||||
format.html { request.xhr? ? render('_list', :layout => false) : render('index') }
|
||||
format.atom
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class HomeController < ApplicationController
|
||||
before_filter :authenticate_user!, :only => [:activity, :issues, :pull_requests]
|
||||
|
||||
def root
|
||||
render 'pages/tour/abf-tour-project-description-1', :layout => 'tour'
|
||||
end
|
||||
|
||||
def activity
|
||||
@filter = t('feed_menu').has_key?(params[:filter].try(:to_sym)) ? params[:filter].to_sym : :all
|
||||
@activity_feeds = current_user.activity_feeds
|
||||
@activity_feeds = @activity_feeds.where(:kind => "ActivityFeed::#{@filter.upcase}".constantize) unless @filter == :all
|
||||
@activity_feeds = @activity_feeds.paginate :page => params[:page]
|
||||
respond_to do |format|
|
||||
format.html { request.xhr? ? render('_list', :layout => false) : render('activity') }
|
||||
format.atom
|
||||
end
|
||||
end
|
||||
|
||||
def issues
|
||||
@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)
|
||||
@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'
|
||||
@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', :layout => request.xhr? ? 'with_sidebar' : 'application'
|
||||
end
|
||||
|
||||
def pull_requests
|
||||
issues
|
||||
end
|
||||
end
|
|
@ -1,11 +1,5 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class PagesController < ApplicationController
|
||||
# before_filter :authenticate_user!, :except => [:show, :main, :forbidden]
|
||||
# load_and_authorize_resource
|
||||
|
||||
def root
|
||||
render 'pages/tour/abf-tour-project-description-1', :layout => 'tour'
|
||||
end
|
||||
|
||||
def tour_inside
|
||||
@entries = case params[:id]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -15,7 +15,7 @@ class ActivityFeed < ActiveRecord::Base
|
|||
self.per_page = 10
|
||||
|
||||
def partial
|
||||
'activity_feeds/partials/' + self.kind
|
||||
'home/partials/' + self.kind
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.sub-menu
|
||||
.sub-menu.activity-tabs
|
||||
%nav
|
||||
%ul
|
||||
- (collection = t 'feed_menu').each do |base, title|
|
|
@ -0,0 +1,7 @@
|
|||
- content_for :feed_tabs do
|
||||
.sub-menu
|
||||
%nav
|
||||
%ul
|
||||
%li= link_to t('activity_menu.activity_feed'), root_path, :class => action_name == 'activity' ? 'active' : ''
|
||||
%li= link_to t('activity_menu.tracker'), issues_path, :class => action_name == 'issues' ? 'active' : ''
|
||||
%li= link_to t('activity_menu.pull_requests'), pull_requests_path, :class => action_name == 'pull_requests' ? 'active' : ''
|
|
@ -2,7 +2,8 @@
|
|||
%h3.fix
|
||||
= t("layout.activity_feed.header")
|
||||
= link_to image_tag("rss.ico", :width => '15px', :height => '15px', :class => 'atom_icon'), atom_activity_feeds_path(:format => 'atom', :token => current_user.authentication_token)
|
||||
=render 'feed_tabs'
|
||||
=render 'list'
|
||||
|
||||
- content_for :sidebar, render('sidebar')
|
||||
- content_for :feed_tabs, render('feed_tabs')
|
||||
- render 'top_menu'
|
|
@ -0,0 +1,12 @@
|
|||
-set_meta_tags :title => t("users.users.#{action_name}_index.title")
|
||||
-render 'top_menu'
|
||||
-content_for :sidebar do
|
||||
=form_tag send("#{action_name}_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.#{action_name}.#{filter}")
|
||||
%td.width30.right=instance_variable_get("@#{filter}_issues").count
|
||||
=render 'projects/issues/issues_table', :issues => @issues
|
|
@ -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
|
||||
|
|
|
@ -35,6 +35,10 @@ en:
|
|||
readme: Readme
|
||||
settings: Settings
|
||||
pull_requests: Pull Requests (%{count})
|
||||
activity_menu:
|
||||
activity_feed: Activity Feed
|
||||
tracker: Tracker
|
||||
pull_requests: Pull Requests
|
||||
feed_menu:
|
||||
all: All
|
||||
code: Code
|
||||
|
|
|
@ -35,6 +35,10 @@ ru:
|
|||
readme: Readme
|
||||
settings: Настройки
|
||||
pull_requests: Пул реквесты (%{count})
|
||||
activity_menu:
|
||||
activity_feed: Лента активности
|
||||
tracker: Трекер
|
||||
pull_requests: Пул реквесты
|
||||
feed_menu:
|
||||
all: Все
|
||||
code: Код
|
||||
|
|
|
@ -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: Комментарии
|
||||
|
|
|
@ -60,4 +60,6 @@ en:
|
|||
search: Find pull request...
|
||||
all: All requests
|
||||
to_me: Assigned to me
|
||||
assigned: Assigned to me
|
||||
created: Created by you
|
||||
view_full_changes: View full changes
|
||||
|
|
|
@ -61,4 +61,6 @@ ru:
|
|||
search: Найти пул реквест...
|
||||
all: Все пул реквесты
|
||||
to_me: Назначенные мне
|
||||
assigned: Назначенные мне
|
||||
created: Созданные мной
|
||||
view_full_changes: Посмотреть все изменения
|
||||
|
|
|
@ -33,3 +33,8 @@ en:
|
|||
product_build_lists:
|
||||
index:
|
||||
title: 'Products Monitoring'
|
||||
pages:
|
||||
issues:
|
||||
title: 'Your Issues'
|
||||
pull_requests:
|
||||
title: 'Your Pull Requests'
|
||||
|
|
|
@ -33,3 +33,8 @@ ru:
|
|||
product_build_lists:
|
||||
index:
|
||||
title: 'Мониторинг продуктов'
|
||||
pages:
|
||||
issues:
|
||||
title: 'Ваши задачи'
|
||||
pull_requests:
|
||||
title: 'Ваши пул реквесты'
|
||||
|
|
|
@ -94,16 +94,19 @@ Rosa::Application.routes.draw do
|
|||
get '/forbidden' => 'pages#forbidden', :as => 'forbidden'
|
||||
get '/terms-of-service' => 'pages#tos', :as => 'tos'
|
||||
get '/tour/:id' => 'pages#tour_inside', :as => 'tour_inside', :id => /projects|sources|builds/
|
||||
match '/invite.html' => redirect('/register_requests/new')
|
||||
#match '/invite.html' => redirect('/register_requests/new')
|
||||
|
||||
get '/activity_feeds.:format' => 'home#activity', :as => 'atom_activity_feeds', :format => /atom/
|
||||
get '/issues' => 'home#issues'
|
||||
get '/pull_requests' => 'home#pull_requests'
|
||||
|
||||
get '/activity_feeds.:format' => 'activity_feeds#index', :as => 'atom_activity_feeds', :format => /atom/
|
||||
if APP_CONFIG['anonymous_access']
|
||||
authenticated do
|
||||
root :to => 'activity_feeds#index'
|
||||
root :to => 'home#activity'
|
||||
end
|
||||
root :to => 'pages#root'
|
||||
root :to => 'home#root'
|
||||
else
|
||||
root :to => 'activity_feeds#index'
|
||||
root :to => 'home#activity'
|
||||
end
|
||||
|
||||
namespace :admin do
|
||||
|
|
Loading…
Reference in New Issue