diff --git a/app/assets/images/group16.png b/app/assets/images/group16.png new file mode 100644 index 000000000..d2570824e Binary files /dev/null and b/app/assets/images/group16.png differ diff --git a/app/assets/images/group16g.png b/app/assets/images/group16g.png new file mode 100644 index 000000000..8c6790fca Binary files /dev/null and b/app/assets/images/group16g.png differ diff --git a/app/assets/images/group32.png b/app/assets/images/group32.png new file mode 100644 index 000000000..f9fbc099d Binary files /dev/null and b/app/assets/images/group32.png differ diff --git a/app/assets/images/group32g.png b/app/assets/images/group32g.png new file mode 100644 index 000000000..0dbf57c71 Binary files /dev/null and b/app/assets/images/group32g.png differ diff --git a/app/assets/images/user16.png b/app/assets/images/user16.png new file mode 100644 index 000000000..c736ece52 Binary files /dev/null and b/app/assets/images/user16.png differ diff --git a/app/assets/images/user16g.png b/app/assets/images/user16g.png new file mode 100644 index 000000000..1f7a75087 Binary files /dev/null and b/app/assets/images/user16g.png differ diff --git a/app/assets/images/user32.png b/app/assets/images/user32.png new file mode 100644 index 000000000..fb7a9dff8 Binary files /dev/null and b/app/assets/images/user32.png differ diff --git a/app/assets/images/user32g.png b/app/assets/images/user32g.png new file mode 100644 index 000000000..6c420a66f Binary files /dev/null and b/app/assets/images/user32g.png differ diff --git a/app/assets/stylesheets/design/custom.scss b/app/assets/stylesheets/design/custom.scss index 796de18ed..e5a77a6b8 100644 --- a/app/assets/stylesheets/design/custom.scss +++ b/app/assets/stylesheets/design/custom.scss @@ -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; +} diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index fcb7480f1..91bcbd13b 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -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 diff --git a/app/views/projects/_project.html.haml b/app/views/projects/_project.html.haml index f4b5c8307..d0ea09db9 100644 --- a/app/views/projects/_project.html.haml +++ b/app/views/projects/_project.html.haml @@ -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   diff --git a/app/views/projects/_project.json.jbuilder b/app/views/projects/_project.json.jbuilder index 86c3d2723..a89cc7b17 100644 --- a/app/views/projects/_project.json.jbuilder +++ b/app/views/projects/_project.json.jbuilder @@ -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 diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 9c9bb852b..83893b761 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -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 @@ '
' + owner + ' / ' + project + '
'; } + var thirdColumn = function(row) { + var project = row.project + + return '' + project.role + ''; + } + 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); }); }); diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index 4e1a50f05..c89796cd4 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -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 diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index abc61082a..13ffe7d49 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -39,6 +39,8 @@ ru: message: Сообщение author: Автор + participant_type: Тип участия + current_branch: Текущая ветка/тег current_commit: Текущий коммит files_in_project: Файлы в