[issue #195] Fixed leave button. Added participant icons.

This commit is contained in:
George Vinogradov 2012-03-29 20:27:33 +04:00
parent 441bdc9f05
commit c03ae5015e
15 changed files with 55 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 941 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 939 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 667 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

View File

@ -670,3 +670,26 @@ table.tablesorter tr.search th input[type="text"] {
width: 830px;
margin-top: 2px;
}
table.dataTable tr td.rights span.group {
background: image-url('group16.png') no-repeat 0 0 transparent;
}
table.dataTable tr td.rights span.user {
background: image-url('user16.png') no-repeat 0 0 transparent;
}
table.dataTable tr td.rights span.group_owner {
background: image-url('group16g.png') no-repeat 0 0 transparent;
}
table.dataTable tr td.rights span.user_owner {
background: image-url('user16g.png') no-repeat 0 0 transparent;
}
table.dataTable tr td.rights span.group_owner,
table.dataTable tr td.rights span.user_owner,
table.dataTable tr td.rights span.group,
table.dataTable tr td.rights span.user {
padding-left: 20px;
}

View File

@ -19,4 +19,16 @@ module ProjectsHelper
def visibility_icon(visibility)
visibility == 'open' ? 'unlock.png' : 'lock.png'
end
def participant_class(alone_member, project)
c = alone_member ? 'user' : 'group'
c = 'user_owner' if project.owner == current_user
c = 'group_owner' if project.owner.in? current_user.groups
return c
end
def alone_member?(project)
urel = Relation.by_target(project).by_object(current_user)
return urel.size == 0 ? false : true
end
end

View File

@ -7,8 +7,11 @@
#{ ' / ' }
= link_to project.name, project_path(project)
%td.td2= project.description
%td= t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}")
- alone_member = alone_member? project
%td
%span{:class => participant_class(alone_member, project)}
= t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}")
%td.td5
- unless project.owner == current_user
- unless project.owner == current_user or !alone_member
= link_to remove_user_project_path(project), :method => :delete, :confirm => t("layout.confirm") do
%span.delete  

View File

@ -7,7 +7,8 @@ json.project do |proj|
proj.role t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}").force_encoding(Encoding::UTF_8)
proj.leave_link remove_user_project_path(project) unless project.owner == current_user
proj.leave_link remove_user_project_path(project) unless project.owner == current_user or !alone_member? project
proj.rights_class participant_class(alone_member?(project), project)
proj.owner do |owner|
owner.name project.owner.uname

View File

@ -2,7 +2,7 @@
- columns = [{:type => 'html'},
{:type => 'html', :sortable => false, :searchable => false},
{:type => nil, :sortable => false, :searchable => false, :class => 'buttons'},
{:type => nil, :sortable => false, :searchable => false, :class => 'rights'},
{:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}]
-#= raw datatable(columns, {:sort_by => "[0, 'asc']", :search_label => t("layout.search_by_name"), :processing => t("layout.processing"),
-# :pagination_labels => {:previous => t("datatables.previous_label"), :next => t("datatables.next_label")},
@ -44,6 +44,12 @@
'<div class="table-sort-right">' + owner + ' / ' + project + '<div>';
}
var thirdColumn = function(row) {
var project = row.project
return '<span class="' + project.rights_class + '">' + project.role + '</span>';
}
var lastColumn = function(row) {
var project = row.project
var res = '';
@ -63,7 +69,7 @@
var inner = [];
inner.push( firstColumn(data) );
inner.push( data.project.description );
inner.push( data.project.role );
inner.push( thirdColumn(data) );
inner.push( lastColumn(data) );
res.push( inner );
}
@ -113,9 +119,7 @@
return true;
});
$search.live('keyup', function() {
if (this.value.length > 1) {
oTable.fnFilter(this.value);
}
oTable.fnFilter(this.value);
});
});

View File

@ -39,6 +39,8 @@ en:
message: Message
author: Author
participant_type: Part. type
current_branch: Current branch/tag
current_commit: Current commit
files_in_project: Files in

View File

@ -39,6 +39,8 @@ ru:
message: Сообщение
author: Автор
participant_type: Тип участия
current_branch: Текущая ветка/тег
current_commit: Текущий коммит
files_in_project: Файлы в