[#277] profile projects
This commit is contained in:
parent
7da70b5f12
commit
5ff87be8a9
|
@ -100,4 +100,33 @@ $(document).ready(function() {
|
|||
|
||||
updateTime();
|
||||
setInterval( updateTime, 15000 );
|
||||
|
||||
window.updatePagination = function(link) {
|
||||
var page = parseInt($('.pagination .current').text());
|
||||
if (link.hasClass('next_page')) {
|
||||
page += 1;
|
||||
} else {
|
||||
if (link.hasClass('previous_page')) {
|
||||
page -= 1;
|
||||
} else {
|
||||
page = link.text();
|
||||
}
|
||||
}
|
||||
$('.pagination .current').html(page);
|
||||
};
|
||||
|
||||
window.isSearchUser = null;
|
||||
window.search_items = function(path, fdata, dom) {
|
||||
if (window.isSearchUser != null) { window.isSearchUser.abort(); }
|
||||
window.isSearchUser = $.ajax({
|
||||
type: 'GET',
|
||||
url: path,
|
||||
data: fdata,
|
||||
success: function(data) {
|
||||
dom.html(data);
|
||||
updateTime();
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -18,18 +18,7 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$("#table1.issues-table .pagination a").live('click', function() {
|
||||
var a = $(this);
|
||||
var page = parseInt($('.pagination .current').text());
|
||||
if (a.hasClass('next_page')) {
|
||||
page += 1;
|
||||
} else {
|
||||
if (a.hasClass('previous_page')) {
|
||||
page -= 1;
|
||||
} else {
|
||||
page = a.text();
|
||||
}
|
||||
}
|
||||
$('.pagination .current').html(page);
|
||||
updatePagination($(this));
|
||||
return send_index_tracker_request('GET');
|
||||
});
|
||||
|
||||
|
@ -116,18 +105,11 @@ $(document).ready(function() {
|
|||
return false;
|
||||
};
|
||||
|
||||
var isSearchUser = null;
|
||||
$('#search_user').on('keyup', function() {
|
||||
if (isSearchUser != null) { isSearchUser.abort(); }
|
||||
isSearchUser = $.ajax({
|
||||
type: 'GET',
|
||||
url: $('#search_user_path').attr('path'),
|
||||
data: $(this).serialize(),
|
||||
success: function(data){
|
||||
$('#manage_issue_users_list').html(data);
|
||||
}
|
||||
});
|
||||
return false;
|
||||
path = $('#search_user_path').attr('path');
|
||||
data = $(this).serialize();
|
||||
dom = $('#manage_issue_users_list');
|
||||
return search_items(path, data, dom);
|
||||
});
|
||||
|
||||
$('.users-search-popup .header .icon-remove-circle').live('click', function() {
|
||||
|
|
|
@ -40,32 +40,32 @@ hr.profile_line {
|
|||
float: left;
|
||||
margin: 15px 10px;
|
||||
width: 837px;
|
||||
}
|
||||
div.search div.pic {
|
||||
background: url("/assets/search-button.png") repeat scroll 0 0 transparent;
|
||||
float: left;
|
||||
height: 22px;
|
||||
width: 24px;
|
||||
}
|
||||
div.search div.field {
|
||||
float: left;
|
||||
margin: -1px 0 0;
|
||||
}
|
||||
|
||||
div.search div.field input {
|
||||
background: none repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
height: 18px;
|
||||
padding: 2px 0 0;
|
||||
width: 132px;
|
||||
}
|
||||
div.search div.field input.gray {
|
||||
color: #CFCFCF;
|
||||
}
|
||||
div.search div.field input.black {
|
||||
color: #333333;
|
||||
div.pic {
|
||||
background: url("/assets/search-button.png") repeat scroll 0 0 transparent;
|
||||
float: left;
|
||||
height: 22px;
|
||||
width: 24px;
|
||||
}
|
||||
div.field {
|
||||
float: left;
|
||||
margin: -1px 0 0;
|
||||
width: 750px;
|
||||
input {
|
||||
background: none repeat scroll 0 0 transparent;
|
||||
border: medium none;
|
||||
font-family: Arial;
|
||||
font-size: 12px;
|
||||
height: 18px;
|
||||
padding: 2px 0 0;
|
||||
width: 700px;
|
||||
}
|
||||
input.gray {
|
||||
color: #CFCFCF;
|
||||
}
|
||||
input.black {
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
table {
|
||||
border: none;
|
||||
|
@ -74,6 +74,7 @@ hr.profile_line {
|
|||
width: 844px;
|
||||
th {
|
||||
padding-left: 10px;
|
||||
min-width: 411px;
|
||||
.project-link {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
|
|
@ -10,8 +10,19 @@ class Groups::ProfileController < Groups::BaseController
|
|||
end
|
||||
|
||||
def show
|
||||
@path, page = group_path, params[:page].to_i
|
||||
@projects = @group.projects.opened.search(params[:search]).recent
|
||||
.paginate(:page => params[:page], :per_page => 24)
|
||||
if params[:projects] == 'show'
|
||||
if params[:visibility] != 'hidden'
|
||||
@projects = @projects.opened
|
||||
@hidden = true
|
||||
else
|
||||
@projects = @projects.by_visibilities('hidden').accessible_by(current_ability, :read)
|
||||
end
|
||||
render :partial => 'shared/profile_projects', :layout => nil, :locals => {:projects => paginate_projects(page)}
|
||||
else
|
||||
@projects = paginate_projects(page)
|
||||
end
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -53,4 +64,10 @@ class Groups::ProfileController < Groups::BaseController
|
|||
Relation.by_actor(current_user).by_target(@group).destroy_all
|
||||
redirect_to groups_path
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def paginate_projects(page)
|
||||
@projects.paginate(:page => (page>0 ? page : nil), :per_page => 24)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -54,7 +54,7 @@ class Platforms::ProductsController < Platforms::BaseController
|
|||
def autocomplete_project
|
||||
items = Project.accessible_by(current_ability, :membered)
|
||||
.search(params[:term]).limit(20)
|
||||
items.select! {|e| e.repo.branches.count > 0}
|
||||
#items.select! {|e| e.repo.branches.count > 0}
|
||||
render :json => items.map{ |p|
|
||||
{
|
||||
:id => p.id,
|
||||
|
|
|
@ -3,7 +3,24 @@ class Users::ProfileController < Users::BaseController
|
|||
skip_before_filter :authenticate_user!, :only => :show if APP_CONFIG['anonymous_access']
|
||||
|
||||
def show
|
||||
@projects = @user.projects.opened.search(params[:search]).recent
|
||||
.paginate(:page => params[:page], :per_page => 24)
|
||||
@path = user_path
|
||||
@projects = @user.projects.search(params[:search]).recent
|
||||
if params[:projects] == 'show'
|
||||
if params[:visibility] != 'hidden'
|
||||
@projects = @projects.opened
|
||||
@hidden = true
|
||||
else
|
||||
@projects = @projects.by_visibilities('hidden').accessible_by(current_ability, :read)
|
||||
end
|
||||
render :partial => 'shared/profile_projects', :layout => nil, :locals => {:projects => paginate_projects(page)}
|
||||
else
|
||||
@projects = paginate_projects(page)
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def paginate_projects(page)
|
||||
@projects.paginate(:page => (page>0 ? page : nil), :per_page => 24)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
- [group.description , t('activerecord.attributes.group.description')]
|
||||
- max_length = 35
|
||||
|
||||
= hidden_field_tag :profile_path, @profile_path
|
||||
.row
|
||||
.span3.profile
|
||||
.avatar= image_tag avatar_url(user || group, :big), :alt => (user || group).uname
|
||||
|
@ -44,14 +45,10 @@
|
|||
.span12.sub-menu
|
||||
%nav
|
||||
%ul
|
||||
%li= link_to t('layout.projects.public'), '#', :class => "public-projects #{@public ? 'active' : ''}"
|
||||
%li= link_to t('layout.projects.private'), '#', :class => "private-projects #{!@public ? 'active' : ''}"
|
||||
%li= link_to t('layout.projects.public'), '#', :class => "public-projects #{!@hidden ? 'active' : ''}"
|
||||
%li= link_to t('layout.projects.private'), '#', :class => "private-projects #{@hidden ? 'active' : ''}"
|
||||
.search
|
||||
.pic
|
||||
.field= text_field_tag 'query', @query, :placeholder => t('layout.find_project')
|
||||
|
||||
%table.profile-table
|
||||
%tbody= render 'shared/profile_projects', :projects => projects
|
||||
%br
|
||||
= will_paginate projects
|
||||
|
||||
.field= text_field_tag :query_projects, @query, :placeholder => t('layout.find_project')
|
||||
.both
|
||||
.profile-table= render 'shared/profile_projects', :projects => projects
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
- pr_groups = projects.in_groups(2)
|
||||
- pr_groups[0].each_with_index do |project, ind|
|
||||
%tr{:class => ind.odd? ? 'odd' : 'even'}
|
||||
- [project, pr_groups[1][ind]].each do |project|
|
||||
%th
|
||||
- if project.present?
|
||||
.project-link= link_to project.name, project
|
||||
.row-fluid
|
||||
= datetime_moment project.updated_at, :class => :span3
|
||||
- commits_count = project.total_commits_count
|
||||
.span3= "#{commits_count > 10000 ? '10000+' : commits_count} #{commits_pluralize(commits_count)}"
|
||||
%table
|
||||
%tbody
|
||||
- pr_groups[0].each_with_index do |project, ind|
|
||||
%tr{:class => ind.odd? ? 'odd' : 'even'}
|
||||
- [project, pr_groups[1][ind]].each do |project|
|
||||
%th
|
||||
- if project.present?
|
||||
.project-link= link_to short_message(project.name, 60), project, :title => project.name
|
||||
.both
|
||||
.row-fluid
|
||||
= datetime_moment project.updated_at, :class => :span3
|
||||
- commits_count = project.total_commits_count
|
||||
.span3= "#{commits_count > 10000 ? '10000+' : commits_count} #{commits_pluralize(commits_count)}"
|
||||
%br
|
||||
%div{:style => 'margin: 10px;'}= will_paginate projects
|
||||
|
||||
|
|
Loading…
Reference in New Issue