diff --git a/app/assets/javascripts/issues.js b/app/assets/javascripts/issues.js new file mode 100644 index 0000000000000000000000000000000000000000..ef70a99ddf8d09de73296e1d83a387907662d60a --- /dev/null +++ b/app/assets/javascripts/issues.js @@ -0,0 +1,32 @@ +function switchToNewIssue(form){ + $("#issues-table-holder").hide("slide", { direction: "left" }, 150, function(){ + $(".project-content").append(form); + $('select#issue_assignee_id').chosen(); + $("#new_issue_dialog").show("slide", { direction: "right" }, 150); + }); +} + +function switchToEditIssue(form){ + $("#issues-table-holder").hide("slide", { direction: "left" }, 150, function(){ + $(".project-content").append(form); + $('select#issue_assignee_id').chosen(); + $("#edit_issue_dialog").show("slide", { direction: "right" }, 150); + }); +} + +function switchFromNewIssue(){ + backToIssues(); +} + +function switchFromEditIssue(){ + backToIssues(); +} + +function backToIssues(){ + $("#edit_issue_dialog, #new_issue_dialog").hide("slide", { direction: "right" }, 150, function(){ + $("#issues-table-holder").show("slide", { direction: "left" }, 150, function() { + $("#edit_issue_dialog").remove(); + $("#new_issue_dialog").remove(); + }); + }); +} diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 4387066e02cf92cba16c78adf1aafe01a59cc9e4..73dc9af7fee9d1aab415ab9c570c969153eec4b2 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -40,3 +40,6 @@ .prepend-top-10 { margin-top:10px; } +.no-borders { + border:none; +} diff --git a/app/assets/stylesheets/issues.css.scss b/app/assets/stylesheets/issues.css.scss index 9098b632b79418117ce9c16ca2742a7ba99e1726..a66c43dd9e327a39a1e230633adf49fcead827f3 100644 --- a/app/assets/stylesheets/issues.css.scss +++ b/app/assets/stylesheets/issues.css.scss @@ -48,3 +48,21 @@ width:100%; .data p { font-size:16px } } + +#issue_assignee_id { + width:300px; +} + +.issue-form-holder .ui-box .data { + margin: 0; + padding: 0; +} + +body.project-page .issue-form-holder table.no-borders tr, +body.project-page .issue-form-holder table.no-borders td +{ + &:hover { + background:none; + } +} + diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index 5466d21afcf04d08cba35abe867caa23f15a4988..b6c14c80141fed1a415a20fa3896609cee7b8629 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -387,3 +387,10 @@ body.dashboard.project-page .news-feed .project-updates a.project-update span.up body.project-page .team_member_new .span-6, .team_member_edit .span-6{ padding:10px 0; } body.projects-page input.text.git-url.project_list_url { width:165px; } + + + +body.project-page table.no-borders tr, +body.project-page table.no-borders td{ + border:none; +} diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml index d648f71edf2f1df23c231c415e2d6879c6cb4d4e..c5999334dabe9004a153c61892bcb5efafa162fa 100644 --- a/app/views/issues/_form.html.haml +++ b/app/views/issues/_form.html.haml @@ -1,24 +1,45 @@ -%div - = form_for [@project, @issue], :remote => "true" do |f| - -if @issue.errors.any? - %ul - - @issue.errors.full_messages.each do |msg| - %li= msg +%div.issue-form-holder + .issue-show-holder.ui-box + %h3 + = @issue.new_record? ? "New issue" : "Edit Issue ##{@issue.id}" + - unless @issue.new_record? + .right + - if @issue.closed + %span.tag.high Resolved + - else + %span.tag.today Open + = form_for [@project, @issue], :remote => "true" do |f| + .data + %table.no-borders + -if @issue.errors.any? + %tr + %td Errors + %td + #error_explanation + - @issue.errors.full_messages.each do |msg| + %span= msg + %br - .form-row - = f.label :title - = f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255 - .form-row - = f.label :assignee_id - = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) - .form-row - = f.label :critical, "Critical" - %br - = f.check_box :critical - - unless @issue.new_record? - .form-row - = f.label :closed - %br - = f.check_box :closed - .form-row - = f.submit 'Save', :class => "grey-button" + %tr + %td= f.label :title + %td= f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255 + + %tr + %td= f.label :assignee_id + %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) + + %tr + %td= f.label :critical, "Critical" + %td= f.check_box :critical + + - unless @issue.new_record? + %tr + %td= f.label :closed + %td= f.check_box :closed + .buttons + = f.submit 'Save', :class => "grey-button" + .right + - if request.xhr? + = link_to_function "Back", "backToIssues();", :class => "grey-button" + - else + = link_to "Back", [@project, @issue], :class => "grey-button" diff --git a/app/views/issues/create.js.haml b/app/views/issues/create.js.haml index b8043290972a315041b765c2ce78e75ac84d1671..f9d26c52684de4c0f6cd3a6c8da9c562d17282b8 100644 --- a/app/views/issues/create.js.haml +++ b/app/views/issues/create.js.haml @@ -1,10 +1,10 @@ - if @issue.valid? :plain - $("#new_issue_dialog").dialog("close"); + switchFromNewIssue(); $("#issues-table").prepend("#{escape_javascript(render(:partial => 'show', :locals => {:issue => @issue} ))}"); $.ajax({type: "GET", url: location.href, dataType: "script"}); - else :plain $("#new_issue_dialog").empty(); $("#new_issue_dialog").append("#{escape_javascript(render('form'))}"); - $('select#issue_assignee_id').selectmenu({width:300}); + $('select#issue_assignee_id').chosen(); diff --git a/app/views/issues/edit.html.haml b/app/views/issues/edit.html.haml index 394e0e2082f4e5cabe20c2b59a7496e8ef599024..bada72459c99f425c04acd009c508a1600f57d85 100644 --- a/app/views/issues/edit.html.haml +++ b/app/views/issues/edit.html.haml @@ -1,37 +1,7 @@ -%div.issue-form-holder - = form_for [@project, @issue] do |f| - -if @issue.errors.any? - %ul - - @issue.errors.full_messages.each do |msg| - %li= msg - - %table - %thead - %th Name - %th Value - %tr - %td= f.label :title - %td= f.text_area :title, :style => "width:450px; height:100px", :maxlength => 255 - %tr - %td= f.label :assignee_id - %td= f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" }) - -#%tr - %td= f.label :branch_name - %td= f.select(:branch_name, @project.heads.map(&:name), { :include_blank => "Select git branch" }) - %tr - %td - = f.label :critical, "Critical" - %br - %td= f.check_box :critical - - unless @issue.new_record? - %tr - %td= f.label :closed - %td= f.check_box :closed - = f.submit 'Save', :class => "grey-button" += render "form" :javascript $(function(){ - $('select#issue_branch_name').selectmenu({width:300}); - $('select#issue_assignee_id').selectmenu({width:300}); + $('select#issue_assignee_id').chosen(); }); diff --git a/app/views/issues/edit.js.haml b/app/views/issues/edit.js.haml index f08e3217a8923f3a7763eca3589fce66b4af63a6..76d9e02ecb1234672a52aea2150e706ae0e6e30c 100644 --- a/app/views/issues/edit.js.haml +++ b/app/views/issues/edit.js.haml @@ -1,12 +1,5 @@ :plain var edit_issue_dialog = $("
"); edit_issue_dialog.html("#{escape_javascript(render('form'))}"); - $(edit_issue_dialog).dialog({ - width: 500, - resizable: false, - draggable: false, - title: "Issue ##{@issue.id} #{"[CLOSED]" if @issue.closed}", - close: function(event, ui) { $("#edit_issue_dialog").remove();}, - modal: true - }); - $('select#issue_assignee_id').selectmenu({width:300}); + switchToEditIssue(edit_issue_dialog); + diff --git a/app/views/issues/new.html.haml b/app/views/issues/new.html.haml new file mode 100644 index 0000000000000000000000000000000000000000..bada72459c99f425c04acd009c508a1600f57d85 --- /dev/null +++ b/app/views/issues/new.html.haml @@ -0,0 +1,7 @@ += render "form" + +:javascript + $(function(){ + $('select#issue_assignee_id').chosen(); + }); + diff --git a/app/views/issues/new.js.haml b/app/views/issues/new.js.haml index 530641440a74c1c03fce7de9efbf717871357b94..afa2b86ea926feec328e5f41175916a4f38daf5f 100644 --- a/app/views/issues/new.js.haml +++ b/app/views/issues/new.js.haml @@ -1,12 +1,4 @@ :plain var new_issue_dialog = $(""); new_issue_dialog.html("#{escape_javascript(render('form'))}"); - $(new_issue_dialog).dialog({ - width: 500, - resizable: false, - draggable: false, - title: "Add new issue", - modala: true, - close: function(event, ui) { $("#new_issue_dialog").remove();} - }); - $('select#issue_assignee_id').selectmenu({width:300}); + switchToNewIssue(new_issue_dialog); diff --git a/app/views/issues/update.js.haml b/app/views/issues/update.js.haml index 137dba3cc7120b37ff4a433afb306b161a882d41..44722895025f4cd56dc0117ad045b824ebc25278 100644 --- a/app/views/issues/update.js.haml +++ b/app/views/issues/update.js.haml @@ -5,10 +5,10 @@ - else - if @issue.valid? :plain - $("#edit_issue_dialog").dialog("close"); updatePage(); + switchFromEditIssue(); - else :plain $("#edit_issue_dialog").empty(); $("#edit_issue_dialog").append("#{escape_javascript(render('form'))}"); - $('select#issue_assignee_id').selectmenu({width:300}); + $('select#issue_assignee_id').chosen(); diff --git a/spec/requests/issues_spec.rb b/spec/requests/issues_spec.rb index 85cee062ded23ef73a7b5be5e022e16d98490332..29dc473939fbf812b3ee6f0a8fe100fe54546e71 100644 --- a/spec/requests/issues_spec.rb +++ b/spec/requests/issues_spec.rb @@ -95,18 +95,16 @@ describe "Issues" do click_link "New Issue" end - it "should open new issue popup" do - page.should have_content("Add new issue") + it "should open new issue form" do + page.should have_content("New issue") end describe "fill in" do describe 'assign to me' do before do fill_in "issue_title", :with => "bug 345" - click_link "Select user" - within "#issue_assignee_id-menu" do - click_link @user.name - end + page.execute_script("$('#issue_assignee_id').show();") + select @user.name, :from => "issue_assignee_id" end it { expect { click_button "Save" }.to change {Issue.count}.by(1) } @@ -129,10 +127,8 @@ describe "Issues" do describe 'assign to other' do before do fill_in "issue_title", :with => "bug 345" - click_link "Select user" - within "#issue_assignee_id-menu" do - click_link @user2.name - end + page.execute_script("$('#issue_assignee_id').show();") + select @user2.name, :from => "issue_assignee_id" end it { expect { click_button "Save" }.to change {Issue.count}.by(1) }