[issue #195] Added legend for projects table. Added titles.

This commit is contained in:
George Vinogradov 2012-03-30 18:51:57 +04:00
parent c03ae5015e
commit 78943fdc04
5 changed files with 47 additions and 10 deletions

View File

@ -671,25 +671,53 @@ table.tablesorter tr.search th input[type="text"] {
margin-top: 2px; margin-top: 2px;
} }
table.dataTable tr td.rights span.group { div.toolbar {
}
div.toolbar a.button {
float: left;
}
div.toolbar div.legend {
float: left;
margin-left: 50px;
padding: 4px 0 6px;
}
table.dataTable tr td.rights span.group,
div.toolbar div.legend.rights span.group {
background: image-url('group16.png') no-repeat 0 0 transparent; background: image-url('group16.png') no-repeat 0 0 transparent;
} }
table.dataTable tr td.rights span.user { table.dataTable tr td.rights span.user,
div.toolbar div.legend.rights span.user {
background: image-url('user16.png') no-repeat 0 0 transparent; background: image-url('user16.png') no-repeat 0 0 transparent;
} }
table.dataTable tr td.rights span.group_owner { table.dataTable tr td.rights span.group_owner,
div.toolbar div.legend.rights span.group_owner {
background: image-url('group16g.png') no-repeat 0 0 transparent; background: image-url('group16g.png') no-repeat 0 0 transparent;
} }
table.dataTable tr td.rights span.user_owner { table.dataTable tr td.rights span.user_owner,
div.toolbar div.legend.rights span.user_owner {
background: image-url('user16g.png') no-repeat 0 0 transparent; background: image-url('user16g.png') no-repeat 0 0 transparent;
} }
table.dataTable tr td.rights span.group_owner, table.dataTable tr td.rights span.group_owner,
div.toolbar div.legend.rights span.group_owner,
table.dataTable tr td.rights span.user_owner, table.dataTable tr td.rights span.user_owner,
div.toolbar div.legend.rights span.user_owner,
table.dataTable tr td.rights span.group, table.dataTable tr td.rights span.group,
table.dataTable tr td.rights span.user { div.toolbar div.legend.rights span.group,
table.dataTable tr td.rights span.user,
div.toolbar div.legend.rights span.user {
padding-left: 20px; padding-left: 20px;
} }
div.toolbar div.legend.rights span.group_owner,
div.toolbar div.legend.rights span.user_owner,
div.toolbar div.legend.rights span.group,
div.toolbar div.legend.rights span.user {
margin: 0 10px;
}

View File

@ -28,7 +28,6 @@ module ProjectsHelper
end end
def alone_member?(project) def alone_member?(project)
urel = Relation.by_target(project).by_object(current_user) Relation.by_target(project).by_object(current_user).size > 0
return urel.size == 0 ? false : true
end end
end end

View File

@ -9,7 +9,8 @@
%td.td2= project.description %td.td2= project.description
- alone_member = alone_member? project - alone_member = alone_member? project
%td %td
%span{:class => participant_class(alone_member, project)} - c = participant_class(alone_member, project)
%span{:class => c, :title => t("layout.relations.#{c}")}
= t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}") = t("layout.collaborators.role_names.#{project.relations.by_user_through_groups(current_user).first.role}")
%td.td5 %td.td5
- unless project.owner == current_user or !alone_member - unless project.owner == current_user or !alone_member

View File

@ -9,6 +9,7 @@ json.project do |proj|
proj.leave_link remove_user_project_path(project) unless project.owner == current_user or !alone_member? project 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.rights_class participant_class(alone_member?(project), project)
proj.title t("layout.relations.#{participant_class(alone_member?(project), project)}")
proj.owner do |owner| proj.owner do |owner|
owner.name project.owner.uname owner.name project.owner.uname

View File

@ -1,4 +1,12 @@
= link_to t('layout.projects.new'), new_project_path, :class => 'button' if can?(:create, Project) .toolbar
= link_to t('layout.projects.new'), new_project_path, :class => 'button' if can?(:create, Project)
.legend.rights
%span.user_owner= t("layout.relations.user_owner")
%span.group_owner= t("layout.relations.group_owner")
%span.user= t("layout.relations.user")
%span.group= t("layout.relations.group")
.both
- columns = [{:type => 'html'}, - columns = [{:type => 'html'},
{:type => 'html', :sortable => false, :searchable => false}, {:type => 'html', :sortable => false, :searchable => false},
@ -47,7 +55,7 @@
var thirdColumn = function(row) { var thirdColumn = function(row) {
var project = row.project var project = row.project
return '<span class="' + project.rights_class + '">' + project.role + '</span>'; return '<span class="' + project.rights_class + '" title="' + project.title + '">' + project.role + '</span>';
} }
var lastColumn = function(row) { var lastColumn = function(row) {