def new
respond_to do |format|
format.html { render :action => 'new', :layout => !request.xhr? }
- format.js {
- render(:update) { |page|
- page.replace_html 'all_attributes', :partial => 'form'
- m = User.current.allowed_to?(:log_time, @issue.project) ? 'show' : 'hide'
- page << "if ($('log_time')) {Element.#{m}('log_time');}"
- }
- }
+ format.js { render :partial => 'update_form' }
end
end
--- /dev/null
+Element.update('all_attributes', '<%= escape_javascript(render :partial => 'form') %>');
+
+if ($('log_time')) {
+ <% if User.current.allowed_to?(:log_time, @issue.project) %>
+ Element.show('log_time');
+ <% else %>
+ Element.hide('log_time');
+ <% end %>
+}
:description => 'This is the description',
:priority_id => 5}
assert_response :success
+ assert_template 'update_form'
assert_template 'form'
+ assert_equal 'text/javascript', response.content_type
issue = assigns(:issue)
assert_kind_of Issue, issue
:description => 'This is the description',
:priority_id => 5}
assert_response :success
+ assert_equal 'text/javascript', response.content_type
+ assert_template 'update_form'
assert_template 'form'
issue = assigns(:issue)