diff options
author | Andrey Kumanyaev <me@zzet.org> | 2013-01-19 21:47:08 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-01-25 00:31:24 +0400 |
commit | ea6f46cb87c7ba8c0c620a8ff954f203b3276a7c (patch) | |
tree | cdd5c1375caaf79815959bf23300b568041c1564 /app/views/teams/members | |
parent | 360aa1b4075ba6ffa9927971c580db0059ab4842 (diff) |
Team members public section
Diffstat (limited to 'app/views/teams/members')
-rw-r--r-- | app/views/teams/members/_form.html.haml | 23 | ||||
-rw-r--r-- | app/views/teams/members/_show.html.haml | 31 | ||||
-rw-r--r-- | app/views/teams/members/_team.html.haml | 16 | ||||
-rw-r--r-- | app/views/teams/members/index.html.haml | 18 | ||||
-rw-r--r-- | app/views/teams/members/new.html.haml | 2 | ||||
-rw-r--r-- | app/views/teams/members/show.html.haml | 60 |
6 files changed, 150 insertions, 0 deletions
diff --git a/app/views/teams/members/_form.html.haml b/app/views/teams/members/_form.html.haml new file mode 100644 index 00000000000..a963e462a78 --- /dev/null +++ b/app/views/teams/members/_form.html.haml @@ -0,0 +1,23 @@ +%h3.page_title + = "New Team member(s)" +%hr += form_for @team_member, as: :team_member, url: project_team_members_path(@project, @team_member) do |f| + -if @team_member.errors.any? + .alert-message.block-message.error + %ul + - @team_member.errors.full_messages.each do |msg| + %li= msg + + %h6 1. Choose people you want in the team + .clearfix + = f.label :user_ids, "People" + .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true}) + + %h6 2. Set access level for them + .clearfix + = f.label :project_access, "Project Access" + .input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen" + + .actions + = f.submit 'Save', class: "btn save-btn" + = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" diff --git a/app/views/teams/members/_show.html.haml b/app/views/teams/members/_show.html.haml new file mode 100644 index 00000000000..dfe73c77652 --- /dev/null +++ b/app/views/teams/members/_show.html.haml @@ -0,0 +1,31 @@ +- user = member.user +- allow_admin = can? current_user, :manage_user_team, @user_team +%li{id: dom_id(member), class: "team_member_row user_#{user.id}"} + .row + .span5 + = link_to team_member_path(@user_team, user), title: user.name, class: "dark" do + = image_tag gravatar_icon(user.email, 40), class: "avatar s32" + = link_to team_member_path(@user_team, user), title: user.name, class: "dark" do + %strong= truncate(user.name, lenght: 40) + %br + %small.cgray= user.email + + .span6.right + - if allow_admin + .left.span2 + = form_for(member, as: :team_member, url: team_member_path(@user_team, user)) do |f| + = f.select :permission, options_for_select(UsersProject.access_roles, @user_team.default_projects_access(user)), {}, class: "medium project-access-select span2" + .left.span2 + %span + Admin access + = check_box_tag :group_admin + .right + - if current_user == user + %span.btn.disabled This is you! + - if @user_team.owner == user + %span.btn.disabled.success Owner + - elsif user.blocked + %span.btn.disabled.blocked Blocked + - elsif allow_admin + = link_to team_member_path(@user_team, user), confirm: remove_from_team_message(@user_team, user), method: :delete, class: "very_small btn danger" do + %i.icon-minus.icon-white diff --git a/app/views/teams/members/_team.html.haml b/app/views/teams/members/_team.html.haml new file mode 100644 index 00000000000..e1fbf6d1e75 --- /dev/null +++ b/app/views/teams/members/_team.html.haml @@ -0,0 +1,16 @@ +- grouped_user_team_members(@user_team).each do |access, members| + .ui-box + %h5.title + = Project.access_options.key(access).pluralize + %small= members.size + %ul.well-list + - members.sort_by(&:user_name).each do |up| + = render(partial: 'teams/members/show', locals: {member: up}) + + +:javascript + $(function(){ + $('.repo-access-select, .project-access-select').live("change", function() { + $(this.form).submit(); + }); + }) diff --git a/app/views/teams/members/index.html.haml b/app/views/teams/members/index.html.haml new file mode 100644 index 00000000000..5b125b32769 --- /dev/null +++ b/app/views/teams/members/index.html.haml @@ -0,0 +1,18 @@ += render "teams/team_head" +%h3.page_title + Team Members + (#{@members.count}) + %small + Read more about project permissions + %strong= link_to "here", help_permissions_path, class: "vlink" + + - if can? current_user, :manage_user_team, @user_team + %span.right + = link_to new_team_member_path(@user_team), class: "btn success small grouped", title: "New Team Member" do + New Team Member +%hr + + +.clearfix +%div.team-table + = render partial: "teams/members/team", locals: {project: @user_team} diff --git a/app/views/teams/members/new.html.haml b/app/views/teams/members/new.html.haml new file mode 100644 index 00000000000..40eb4cebf08 --- /dev/null +++ b/app/views/teams/members/new.html.haml @@ -0,0 +1,2 @@ += render "projects/project_head" += render "team_members/form" diff --git a/app/views/teams/members/show.html.haml b/app/views/teams/members/show.html.haml new file mode 100644 index 00000000000..4008e8bd23e --- /dev/null +++ b/app/views/teams/members/show.html.haml @@ -0,0 +1,60 @@ +- allow_admin = can? current_user, :admin_project, @project +- user = @team_member.user + +.team_member_show + - if can? current_user, :admin_project, @project + = link_to 'Remove from team', project_team_member_path(project_id: @project, id: @team_member.id), confirm: 'Are you sure?', method: :delete, class: "right btn danger" + .profile_avatar_holder + = image_tag gravatar_icon(user.email, 60), class: "borders" + %h3.page_title + = user.name + %small (@#{user.username}) + + %hr + .back_link + %br + = link_to project_team_index_path(@project), class: "" do + ← To team list + %br + .row + .span6 + %table.lite + %tr + %td Email + %td= mail_to user.email + %tr + %td Skype + %td= user.skype + - unless user.linkedin.blank? + %tr + %td LinkedIn + %td= user.linkedin + - unless user.twitter.blank? + %tr + %td Twitter + %td= user.twitter + - unless user.bio.blank? + %tr + %td Bio + %td= user.bio + .span6 + %table.lite + %tr + %td Member since + %td= @team_member.created_at.stamp("Aug 21, 2011") + %tr + %td + Project Access: + %small (#{link_to "read more", help_permissions_path, class: "vlink"}) + %td + = form_for(@team_member, as: :team_member, url: project_team_member_path(@project, @team_member)) do |f| + = f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, class: "project-access-select", disabled: !allow_admin + %hr + = render @events +:javascript + $(function(){ + $('.repo-access-select, .project-access-select').live("change", function() { + $(this.form).submit(); + }); + }) + |