summaryrefslogtreecommitdiff
path: root/app/views/issues
diff options
context:
space:
mode:
Diffstat (limited to 'app/views/issues')
-rw-r--r--app/views/issues/_form.html.haml24
-rw-r--r--app/views/issues/_issues.html.haml10
-rw-r--r--app/views/issues/_show.html.haml18
-rw-r--r--app/views/issues/create.js.haml9
-rw-r--r--app/views/issues/edit.js.haml12
-rw-r--r--app/views/issues/index.html.haml24
-rw-r--r--app/views/issues/index.js.haml2
-rw-r--r--app/views/issues/new.js.haml12
-rw-r--r--app/views/issues/show.html.haml44
-rw-r--r--app/views/issues/update.js.haml14
10 files changed, 169 insertions, 0 deletions
diff --git a/app/views/issues/_form.html.haml b/app/views/issues/_form.html.haml
new file mode 100644
index 00000000000..71acdba1895
--- /dev/null
+++ b/app/views/issues/_form.html.haml
@@ -0,0 +1,24 @@
+%div
+ = form_for [@project, @issue], :remote => "true" do |f|
+ -if @issue.errors.any?
+ %ul
+ - @issue.errors.full_messages.each do |msg|
+ %li= msg
+
+ .span-6
+ = f.label :title
+ = f.text_field :title, :style => "width:450px"
+ .span-6
+ = f.label :content
+ = f.text_area :content, :style => "width:450px; height:130px"
+ .span-6.append-bottom
+ = f.label :assignee_id
+ = f.select(:assignee_id, @project.users.all.collect {|p| [ p.name, p.id ] }, { :include_blank => "Select user" })
+ - unless @issue.new_record?
+ .span-3.right
+ = f.label :closed
+ %br
+ = f.check_box :closed
+ %hr
+ .span-6
+ = f.submit 'Save', :class => "lbutton vm"
diff --git a/app/views/issues/_issues.html.haml b/app/views/issues/_issues.html.haml
new file mode 100644
index 00000000000..d3e21940346
--- /dev/null
+++ b/app/views/issues/_issues.html.haml
@@ -0,0 +1,10 @@
+%table.round-borders#issues-table
+ %tr
+ %th Assignee
+ %th ID
+ %th Title
+ %th Closed?
+ %th
+
+ - @issues.each do |issue|
+ = render(:partial => 'show', :locals => {:issue => issue})
diff --git a/app/views/issues/_show.html.haml b/app/views/issues/_show.html.haml
new file mode 100644
index 00000000000..131d0d4c8a2
--- /dev/null
+++ b/app/views/issues/_show.html.haml
@@ -0,0 +1,18 @@
+%tr{ :id => dom_id(issue), :class => "issue", :url => project_issue_path(@project, issue) }
+ %td
+ = image_tag gravatar_icon(issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
+ = truncate issue.assignee.name, :lenght => 20
+ %td ##{issue.id}
+ %td= html_escape issue.title
+ %td
+ - if can? current_user, :write_issue, @project
+ = form_for([@project, issue], :remote => true) do |f|
+ = f.check_box :closed, :onclick => "$(this).parent().submit();"
+ = hidden_field_tag :status_only, true
+ - else
+ = check_box_tag "closed", 1, issue.closed, :disabled => true
+ %td
+ - if can?(current_user, :admin_issue, @project) || issue.author == current_user
+ = link_to 'Edit', edit_project_issue_path(@project, issue), :class => "lbutton positive", :remote => true
+ - if can?(current_user, :admin_issue, @project) || issue.author == current_user
+ = link_to 'Destroy', [@project, issue], :confirm => 'Are you sure?', :method => :delete, :remote => true, :class => "lbutton delete-issue negative", :id => "destroy_issue_#{issue.id}"
diff --git a/app/views/issues/create.js.haml b/app/views/issues/create.js.haml
new file mode 100644
index 00000000000..3713a8aff41
--- /dev/null
+++ b/app/views/issues/create.js.haml
@@ -0,0 +1,9 @@
+- if @issue.valid?
+ :plain
+ $("#new_issue_dialog").dialog("close");
+ $.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});
diff --git a/app/views/issues/edit.js.haml b/app/views/issues/edit.js.haml
new file mode 100644
index 00000000000..f08e3217a89
--- /dev/null
+++ b/app/views/issues/edit.js.haml
@@ -0,0 +1,12 @@
+:plain
+ var edit_issue_dialog = $("<div id='edit_issue_dialog'></div>");
+ 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});
diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml
new file mode 100644
index 00000000000..7157d2c385d
--- /dev/null
+++ b/app/views/issues/index.html.haml
@@ -0,0 +1,24 @@
+%div
+ - if can? current_user, :write_issue, @project
+ .left= link_to 'New Issue', new_project_issue_path(@project), :remote => true, :class => "lbutton vm"
+ .right
+ = form_tag project_issues_path(@project), :method => :get do
+ .span-2
+ = radio_button_tag :f, 0, (params[:f] || "0") == "0", :onclick => "this.form.submit()", :id => "open_issues"
+ = label_tag "open_issues","Open"
+ .span-2
+ = radio_button_tag :f, 2, params[:f] == "2", :onclick => "this.form.submit()", :id => "closed_issues"
+ = label_tag "closed_issues","Closed"
+ .span-2
+ = radio_button_tag :f, 3, params[:f] == "3", :onclick => "this.form.submit()", :id => "my_issues"
+ = label_tag "my_issues","To Me"
+
+ .span-2
+ = radio_button_tag :f, 1, params[:f] == "1", :onclick => "this.form.submit()", :id => "all_issues"
+ = label_tag "all_issues","All"
+
+ #issues-table-holder= render "issues"
+ %br
+:javascript
+ $('.delete-issue').live('ajax:success', function() {
+ $(this).closest('tr').fadeOut(); });
diff --git a/app/views/issues/index.js.haml b/app/views/issues/index.js.haml
new file mode 100644
index 00000000000..1f051309233
--- /dev/null
+++ b/app/views/issues/index.js.haml
@@ -0,0 +1,2 @@
+:plain
+ $('#issues-table-holder').html("#{escape_javascript(render('issues'))}");
diff --git a/app/views/issues/new.js.haml b/app/views/issues/new.js.haml
new file mode 100644
index 00000000000..530641440a7
--- /dev/null
+++ b/app/views/issues/new.js.haml
@@ -0,0 +1,12 @@
+:plain
+ var new_issue_dialog = $("<div id='new_issue_dialog'></div>");
+ 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});
diff --git a/app/views/issues/show.html.haml b/app/views/issues/show.html.haml
new file mode 100644
index 00000000000..199c80c8617
--- /dev/null
+++ b/app/views/issues/show.html.haml
@@ -0,0 +1,44 @@
+%h2
+ = "Issue ##{@issue.id} - #{@issue.title}"
+
+.span-15
+ = simple_format html_escape(@issue.content)
+ .issue_notes= render "notes/notes"
+.span-8.right
+ .span-8
+ - if @issue.closed
+ %center.success Closed
+ - else
+ %center.error Open
+ %table.round-borders
+ %tr
+ %td Title:
+ %td
+ = truncate html_escape(@issue.title)
+ %tr
+ %td Project
+ %td
+ %strong= @issue.project.name
+ %tr
+ %td Author:
+ %td
+ = image_tag gravatar_icon(@issue.author.email), :class => "left", :width => 40, :style => "padding:0 5px;"
+ = @issue.author.name
+ %tr
+ %td Assignee:
+ %td
+ = image_tag gravatar_icon(@issue.assignee.email), :class => "left", :width => 40, :style => "padding:0 5px;"
+ = @issue.assignee.name
+ %tr
+ %td Closed?
+ %td
+ - if can? current_user, :write_issue, @project
+ = form_for([@project, @issue]) do |f|
+ = f.check_box :closed, :onclick => "$(this).parent().submit();"
+ = hidden_field_tag :status_only, true
+ - else
+ = check_box_tag "closed", 1, @issue.closed, :disabled => true
+
+
+.clear
+
diff --git a/app/views/issues/update.js.haml b/app/views/issues/update.js.haml
new file mode 100644
index 00000000000..c365c3f5d55
--- /dev/null
+++ b/app/views/issues/update.js.haml
@@ -0,0 +1,14 @@
+- if params[:status_only]
+ - if @issue.valid?
+ :plain
+ $("##{dom_id(@issue)}").fadeOut();
+- else
+ - if @issue.valid?
+ :plain
+ $("#edit_issue_dialog").dialog("close");
+ $.ajax({type: "GET", url: location.href, dataType: "script"});
+ - else
+ :plain
+ $("#edit_issue_dialog").empty();
+ $("#edit_issue_dialog").append("#{escape_javascript(render('form'))}");
+ $('select#issue_assignee_id').selectmenu({width:300});