[refs #194] update issue content
This commit is contained in:
parent
f9c834cf4d
commit
99e3bbb762
|
@ -205,4 +205,28 @@ $(document).ready(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
$('#edit_issue_content').live('click', function() {
|
||||
$('.edit_form.issue').fadeIn('slow');
|
||||
$(this).fadeOut('slow');
|
||||
});
|
||||
|
||||
$('.edit_form.issue').live('submit', function() {
|
||||
var form = $(this);
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: form.attr("action"),
|
||||
data: form.serialize(),
|
||||
success: function(data){
|
||||
form.fadeOut('slow');
|
||||
$('#edit_issue_content').fadeIn('slow');
|
||||
$('h3.issue_title').html(form.find('#issue_title').attr('value'));
|
||||
$('.fulltext.view.issue_body').html(form.find('#issue_body').attr('value'));
|
||||
},
|
||||
error: function(data){
|
||||
alert('error') // TODO remove
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -65,9 +65,13 @@ class IssuesController < ApplicationController
|
|||
@issue.set_close(current_user) if status == 'closed'
|
||||
@issue.set_open if status == 'open'
|
||||
status = 200 if @issue.save
|
||||
render action, :status => (status || 500), :layout => false
|
||||
else
|
||||
@issue.title = params[:issue][:title]
|
||||
@issue.body = params[:issue][:body]
|
||||
status = 200 if @issue.save
|
||||
render :nothing => true, :status => (status || 500), :layout => false
|
||||
end
|
||||
|
||||
render action, :status => (status || 500), :layout => false
|
||||
end
|
||||
|
||||
def destroy
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
-render :partial => 'issues/create_sidebar'
|
||||
-content_for :right_nopadding do
|
||||
dummy
|
||||
%h3=@issue.title
|
||||
%h3.issue_title=@issue.title
|
||||
.activity
|
||||
.top
|
||||
.image
|
||||
|
@ -13,8 +13,18 @@
|
|||
%span.date=@issue.created_at.to_s(:long)
|
||||
%br/
|
||||
.both
|
||||
.fulltext.view=@issue.body
|
||||
.fulltext.view.issue_body=@issue.body
|
||||
.both
|
||||
%br
|
||||
- if can? :write, @issue.project
|
||||
=link_to t('layout.edit'), '#', :id => 'edit_issue_content', :class => 'button'
|
||||
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_form issue', :style => 'display:none;' } do |f|
|
||||
.leftlist= t('activerecord.attributes.issue.title') + ':'
|
||||
.rightlist= f.text_field :title
|
||||
.leftlist= t('activerecord.attributes.issue.body') + ':'
|
||||
.rightlist= f.text_area :body
|
||||
.both
|
||||
=f.submit t('layout.update'), :id => 'update_issue_content'
|
||||
.hr
|
||||
|
||||
=render :partial => 'issues/status'
|
||||
|
|
Loading…
Reference in New Issue