aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Legler <a3li@gentoo.org>2011-10-10 23:00:01 +0200
committerAlex Legler <a3li@gentoo.org>2011-10-10 23:00:01 +0200
commit7c3d9d198f3297ada34012e017a0bdd413171006 (patch)
treef3a78955d1eb9a4758c3b5147a5a910e764c90c5
parentDisplay close bugs link on the show view for releases, ticket #166 (diff)
downloadglsamaker-7c3d9d198f3297ada34012e017a0bdd413171006.tar.gz
glsamaker-7c3d9d198f3297ada34012e017a0bdd413171006.tar.bz2
glsamaker-7c3d9d198f3297ada34012e017a0bdd413171006.zip
Send txt release as text/plain in a new window, include email headers. Redmine tickets #165 and #164
-rw-r--r--app/controllers/glsa_controller.rb20
-rw-r--r--app/views/glsa/_email_headers.txt.erb4
-rw-r--r--app/views/glsa/release.html.erb2
3 files changed, 20 insertions, 6 deletions
diff --git a/app/controllers/glsa_controller.rb b/app/controllers/glsa_controller.rb
index df84ea4..5668a38 100644
--- a/app/controllers/glsa_controller.rb
+++ b/app/controllers/glsa_controller.rb
@@ -121,12 +121,22 @@ class GlsaController < ApplicationController
text = nil
respond_to do |wants|
- wants.xml { text = render_to_string(:action => :show, :format => 'xml')}
- wants.txt { text = render_to_string(:action => :show, :format => 'txt')}
- wants.html { render :text => "Cannot download HTML format. Pick .xml or .txt"; return }
+ wants.xml do
+ text = render_to_string(:action => :show, :format => 'xml')
+ send_data(text, :filename => "glsa-#{@glsa.glsa_id}.#{params[:format]}")
+ end
+
+ wants.txt do
+ text = render_to_string(:template => 'glsa/_email_headers.txt.erb', :format => 'txt')
+ text += render_to_string(:action => :show, :format => 'txt')
+ render :text => text
+ end
+
+ wants.html do
+ render :text => "Cannot download HTML format. Pick .xml or .txt"
+ return
+ end
end
-
- send_data(text, :filename => "glsa-#{@glsa.glsa_id}.#{params[:format]}")
end
def edit
diff --git a/app/views/glsa/_email_headers.txt.erb b/app/views/glsa/_email_headers.txt.erb
new file mode 100644
index 0000000..106fd0d
--- /dev/null
+++ b/app/views/glsa/_email_headers.txt.erb
@@ -0,0 +1,4 @@
+To: gentoo-announce@gentoo.org
+CC: bugtraq@securityfocus.com, full-disclosure@lists.grok.org.uk, security-alerts@linuxsecurity.com
+Subject: [ GLSA <%= @glsa.glsa_id %> ] <%= @rev.title %>
+
diff --git a/app/views/glsa/release.html.erb b/app/views/glsa/release.html.erb
index 9e4e4f0..693cfe4 100644
--- a/app/views/glsa/release.html.erb
+++ b/app/views/glsa/release.html.erb
@@ -25,7 +25,7 @@
<div class='box-actions'>
<button onclick="document.location = '<%= escape_javascript(download_glsa_path(@glsa, :format => 'xml')) %>'">Download XML</button>
- <button onclick="document.location = '<%= escape_javascript(download_glsa_path(@glsa, :format => 'txt')) %>'">Show text</button>
+ <button onclick="window.open('<%= escape_javascript(download_glsa_path(@glsa, :format => 'txt')) %>'); return false;">Show text</button>
<%= button_to "Close bugs", finalize_release_glsa_path(@glsa, :close_bugs => '1'), :method => :post %>
</div>
</div> \ No newline at end of file