Refactor issues, Remove ajax
This commit is contained in:
parent
8826077471
commit
2f7effe804
17 changed files with 44 additions and 174 deletions
|
@ -1,18 +1,18 @@
|
|||
%div.issue-form-holder
|
||||
%h3.page_title= @issue.new_record? ? "New Issue" : "Edit Issue ##{@issue.id}"
|
||||
= form_for [@project, @issue], remote: request.xhr? do |f|
|
||||
= form_for [@project, @issue] do |f|
|
||||
-if @issue.errors.any?
|
||||
.alert-message.block-message.error
|
||||
%ul
|
||||
- @issue.errors.full_messages.each do |msg|
|
||||
%li= msg
|
||||
- @issue.errors.full_messages.each do |msg|
|
||||
%span= msg
|
||||
%br
|
||||
.issue_form_box
|
||||
.issue_title
|
||||
.clearfix
|
||||
= f.label :title do
|
||||
%strong= "Subject *"
|
||||
.input
|
||||
= f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true
|
||||
= f.text_field :title, maxlength: 255, class: "xxlarge js-gfm-input", autofocus: true, required: true
|
||||
.issue_middle_block
|
||||
.issue_assignee
|
||||
= f.label :assignee_id do
|
||||
|
@ -47,14 +47,8 @@
|
|||
-else
|
||||
= f.submit 'Save changes', class: "save-btn btn"
|
||||
|
||||
- cancel_class = 'btn cancel-btn'
|
||||
- if request.xhr?
|
||||
= link_to "Cancel", "#back", onclick: "backToIssues();", class: cancel_class
|
||||
- else
|
||||
- if @issue.new_record?
|
||||
= link_to "Cancel", project_issues_path(@project), class: cancel_class
|
||||
- else
|
||||
= link_to "Cancel", project_issue_path(@project, @issue), class: cancel_class
|
||||
- cancel_path = @issue.new_record? ? project_issues_path(@project) : project_issue_path(@project, @issue)
|
||||
= link_to "Cancel", cancel_path, class: 'btn cancel-btn'
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
= link_to 'Reopen', project_issue_path(issue.project, issue, issue: {closed: false }, status_only: true), method: :put, class: "btn small grouped reopen_issue", remote: true
|
||||
- else
|
||||
= link_to 'Close', project_issue_path(issue.project, issue, issue: {closed: true }, status_only: true), method: :put, class: "btn small grouped close_issue", remote: true
|
||||
= link_to edit_project_issue_path(issue.project, issue), class: "btn small edit-issue-link grouped", remote: true do
|
||||
= link_to edit_project_issue_path(issue.project, issue), class: "btn small edit-issue-link grouped" do
|
||||
%i.icon-edit
|
||||
Edit
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
- if @issue.valid?
|
||||
:plain
|
||||
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').chosen();
|
|
@ -1,4 +0,0 @@
|
|||
:plain
|
||||
$("#edit_issue_dialog").html("#{escape_javascript(render('form'))}");
|
||||
switchToEditIssue();
|
||||
|
|
@ -1,4 +1,6 @@
|
|||
= render "issues/head"
|
||||
#new_issue_dialog
|
||||
#edit_issue_dialog
|
||||
.issues_content
|
||||
%h3.page_title
|
||||
Issues
|
||||
|
@ -6,7 +8,7 @@
|
|||
.right
|
||||
.span5
|
||||
- if can? current_user, :write_issue, @project
|
||||
= link_to new_project_issue_path(@project), class: "right btn", title: "New Issue", remote: true, id: "new_issue_link" do
|
||||
= link_to new_project_issue_path(@project, issue: { assignee_id: params[:assignee_id], milestone_id: params[:milestone_id]}), class: "right btn", title: "New Issue", id: "new_issue_link" do
|
||||
%i.icon-plus
|
||||
New Issue
|
||||
= form_tag search_project_issues_path(@project), method: :get, remote: true, id: "issue_search_form", class: :right do
|
||||
|
@ -58,9 +60,6 @@
|
|||
%ul#issues-table.well-list.issues_table
|
||||
= render "issues"
|
||||
|
||||
#new_issue_dialog
|
||||
#edit_issue_dialog
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
issuesPage();
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
:plain
|
||||
$("#new_issue_dialog").html("#{escape_javascript(render('form'))}");
|
||||
switchToNewIssue();
|
|
@ -1,14 +0,0 @@
|
|||
- if params[:status_only]
|
||||
- if @issue.valid?
|
||||
:plain
|
||||
$("##{dom_id(@issue)}").fadeOut();
|
||||
- else
|
||||
- if @issue.valid?
|
||||
:plain
|
||||
updatePage();
|
||||
switchFromEditIssue();
|
||||
- else
|
||||
:plain
|
||||
$("#edit_issue_dialog").empty();
|
||||
$("#edit_issue_dialog").append("#{escape_javascript(render('form'))}");
|
||||
$('select#issue_assignee_id').chosen();
|
|
@ -32,7 +32,7 @@
|
|||
.top_box_content
|
||||
= f.label :title do
|
||||
%strong= "Title *"
|
||||
.input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5
|
||||
.input= f.text_field :title, class: "input-xxlarge pad js-gfm-input", maxlength: 255, rows: 5, required: true
|
||||
.merge_requests_middle_box
|
||||
.merge_requests_assignee
|
||||
= f.label :assignee_id do
|
||||
|
|
|
@ -10,15 +10,18 @@
|
|||
%span.cred (Expired)
|
||||
%small
|
||||
= milestone.expires_at
|
||||
.row
|
||||
.span4
|
||||
.progress.progress-info
|
||||
.bar{style: "width: #{milestone.percent_complete}%;"}
|
||||
.span6
|
||||
= link_to project_issues_path(milestone.project, milestone_id: milestone.id) do
|
||||
= pluralize milestone.issues.count, 'Issue'
|
||||
|
||||
= link_to project_merge_requests_path(milestone.project, milestone_id: milestone.id) do
|
||||
= pluralize milestone.merge_requests.count, 'Merge Request'
|
||||
|
||||
%span.light #{milestone.percent_complete}% complete
|
||||
- if milestone.is_empty?
|
||||
%span.muted Empty
|
||||
- else
|
||||
.row
|
||||
.span4
|
||||
.progress.progress-info
|
||||
.bar{style: "width: #{milestone.percent_complete}%;"}
|
||||
.span6
|
||||
= link_to project_issues_path(milestone.project, milestone_id: milestone.id) do
|
||||
= pluralize milestone.issues.count, 'Issue'
|
||||
|
||||
= link_to project_merge_requests_path(milestone.project, milestone_id: milestone.id) do
|
||||
= pluralize milestone.merge_requests.count, 'Merge Request'
|
||||
|
||||
%span.light #{milestone.percent_complete}% complete
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue