[issue #428] Added Atom feed to advisories.
This commit is contained in:
parent
01b8f3b5c5
commit
3d38adcb94
|
@ -6,7 +6,11 @@ class AdvisoriesController < ApplicationController
|
|||
authorize_resource
|
||||
|
||||
def index
|
||||
@advisories = @advisories.scoped(:include => :projects).paginate(:page => params[:page])
|
||||
@advisories = @advisories.scoped(:include => :platforms).paginate(:page => params[:page])
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.atom
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -12,6 +12,7 @@ class Advisory < ActiveRecord::Base
|
|||
TYPES = {'security' => 'SA', 'bugfix' => 'A'}
|
||||
|
||||
scope :by_project, lambda {|p| where('project_id' => p.try(:id) || p)}
|
||||
default_scope order('created_at DESC')
|
||||
|
||||
def to_param
|
||||
advisory_id
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
%h3= t("activerecord.attributes.advisory.description")
|
||||
%p= simple_format advisory.description
|
||||
|
||||
%h3= t("activerecord.attributes.advisory.references")
|
||||
%p
|
||||
- advisory.references.gsub(/\r| /, '').split("\n").each do |ref|
|
||||
= construct_ref_link(ref)
|
||||
%br
|
|
@ -1,5 +1,5 @@
|
|||
.packages_info_container
|
||||
%h3= t('layout.advisories.affected_versions')
|
||||
%h3= t('layout.advisories.affected_in')
|
||||
%ul.platforms
|
||||
- @packages_info.each_pair do |platform, projects|
|
||||
%li
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
atom_feed do |feed|
|
||||
feed.title(t("layout.advisories.atom_title"))
|
||||
feed.updated(@advisories.first.created_at) if @advisories.length > 0
|
||||
|
||||
@advisories.each do |advisory|
|
||||
feed.entry(advisory, :url => advisory_url(advisory)) do |entry|
|
||||
content = raw(render(:inline => true, :partial => 'feed_partial', :locals => { :advisory => advisory }))
|
||||
|
||||
entry.title("#{t("activerecord.models.advisory")} #{advisory.advisory_id}")
|
||||
entry.content(content, :type => 'html')
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,8 @@
|
|||
- set_meta_tags :title => t('layout.advisories.list_header')
|
||||
- render :partial => 'submenu'
|
||||
%h3.fix
|
||||
= t("layout.advisories.list_header")
|
||||
= link_to image_tag("rss.ico", :width => '15px', :height => '15px', :class => 'atom_icon'),
|
||||
APP_CONFIG['anonymous_access'] ? advisories_path(:format => 'atom') : advisories_path(:format => 'atom', :token => current_user.authentication_token)
|
||||
= render :partial => 'list', :object => @advisories
|
||||
= will_paginate @advisories
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
en:
|
||||
layout:
|
||||
advisories:
|
||||
atom_header: Advisories
|
||||
list_header: Advisories
|
||||
form_header: New advisory
|
||||
project_name: Project
|
||||
affected_versions: Affected versions
|
||||
affected_in: Affected in
|
||||
ref_comment: Add links one by row
|
||||
no_: No
|
||||
new: New
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
ru:
|
||||
layout:
|
||||
advisories:
|
||||
atom_title: Бюллетени
|
||||
list_header: Бюллетени
|
||||
form_header: Новый бюллетень
|
||||
project_name: Проект
|
||||
affected_versions: Применен в версиях
|
||||
affected_in: Применен в
|
||||
ref_comment: Вставляйте ссылки по одной на строку
|
||||
no_: Нет
|
||||
new: Новый
|
||||
|
|
Loading…
Reference in New Issue