remove modal window from team member managment

This commit is contained in:
Dmitriy Zaporozhets 2012-01-14 19:54:41 +02:00
parent 621491c677
commit 09b877ef29
7 changed files with 54 additions and 42 deletions

View file

@ -0,0 +1,8 @@
function backToMembers(){
$("#team_member_new").hide("slide", { direction: "right" }, 150, function(){
$("#team-table").show("slide", { direction: "left" }, 150, function() {
$("#team_member_new").remove();
$(".add_new").show();
});
});
}

View file

@ -815,7 +815,7 @@ tr.line_notes_row {
width:28px; width:28px;
height:27px; height:27px;
top: -12px; top: -12px;
border: 1px solid #474D57; border: 1px solid #CCC;
border-radius: 3px; border-radius: 3px;
background: #fff; background: #fff;

View file

@ -1,4 +1,3 @@
= render "project_head" = render "project_head"
%div = render :partial => "team", :locals => {:project => @project}
= render :partial => "team", :locals => {:project => @project}

View file

@ -1,24 +1,33 @@
%div = form_for @team_member, :as => :team_member, :url => project_team_members_path(@project, @team_member), :remote => "true" do |f|
= form_for @team_member, :as => :team_member, :url => project_team_members_path(@project, @team_member), :remote => "true" do |f| %div
-if @team_member.errors.any? %span.entity-info
%ul - if request.xhr?
- @team_member.errors.full_messages.each do |msg| = link_to "#back", :onclick => "backToMembers();" do
%li= msg .entity-button
Team List
%i
%h2= "New Team member"
.span-6.append-bottom %hr
%b Name -if @team_member.errors.any?
.span-6 %ul
= f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, { :style => "width:300px" }) - @team_member.errors.full_messages.each do |msg|
.span-6 %li= msg
%b Project Access:
.span-6
= f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select"
.span-6 .span-6.append-bottom
%b Repository Access: %b Name
.span-6 .span-6
= f.select :repo_access, options_for_select(Repository.access_options, @team_member.repo_access), {}, :class => "repo-access-select" = f.select(:user_id, User.not_in_project(@project).all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }, { :style => "width:300px" })
%br .span-6
.span-6 %b Project Access:
= f.submit 'Save', :class => "grey-button" .span-6
= f.select :project_access, options_for_select(Project.access_options, @team_member.project_access), {}, :class => "project-access-select"
.span-6
%b Repository Access:
.span-6
= f.select :repo_access, options_for_select(Repository.access_options, @team_member.repo_access), {}, :class => "repo-access-select"
%br
.merge-tabs
= f.submit 'Save', :class => "grey-button"

View file

@ -1,9 +1,13 @@
- if @team_member.valid? - if @team_member.valid?
:plain :plain
$("#new_tm_dialog").dialog("close"); $("#team_member_new").hide("slide", { direction: "right" }, 150, function(){
$("#team-table").append("#{escape_javascript(render(:partial => 'show', :locals => {:member => @team_member} ))}"); $("#team-table").show("slide", { direction: "left" }, 150, function() {
$("#team_member_new").remove();
$("#team-table").replaceWith("#{escape_javascript(render('projects/team'))}");
$(".add_new").show();
});
});
- else - else
:plain :plain
$("#new_tm_dialog").empty(); $("#team_member_new").replaceWith("#{escape_javascript(render('form'))}");
$("#new_tm_dialog").append("#{escape_javascript(render('form'))}");
$('select#team_member_user_id').chosen(); $('select#team_member_user_id').chosen();

View file

@ -1,16 +1,8 @@
-#$("#new-member-holder").empty();
-#$("#new-member-holder").append("#{escape_javascript(render('form'))}");
:plain :plain
var new_tm_dialog = $("<div id='new_tm_dialog'></div>"); $("#team-table").hide("slide", { direction: "left" }, 150, function(){
new_tm_dialog.html("#{escape_javascript(render('form'))}"); $(this).parent().append("#{escape_javascript(render('form'))}");
$(new_tm_dialog).dialog({ $('#team_member_new select#team_member_user_id').chosen();
width: 350, $("#team_member_new").show("slide", { direction: "right" }, 150);
resizable: false, $(".add_new").hide();
draggable: false,
title: "Add new member to project team",
close: function(event, ui) { $("#new_tm_dialog").remove();},
modal: true
}); });
$('#team_member_new select#team_member_user_id').chosen();

View file

@ -26,7 +26,7 @@ describe "TeamMembers" do
end end
it "should open new team member popup" do it "should open new team member popup" do
page.should have_content("Add new member to project") page.should have_content("New Team member")
end end
describe "fill in" do describe "fill in" do