Project

General

Profile

Defect #5933 » news.patch

Yuki Kita, 2010-07-26 15:03

View differences:

app/controllers/news_controller.rb (working copy)
accept_key_auth :index
def index
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1')
@news_pages, @newss = paginate :news,
:per_page => 10,
:conditions => Project.allowed_to_condition(User.current, :view_news, :project => @project),
:conditions => Project.allowed_to_condition(User.current, :view_news, :project => @project, :with_subprojects => @with_subprojects),
:include => [:author, :project],
:order => "#{News.table_name}.created_on DESC"
respond_to do |format|
app/views/news/index.rhtml (working copy)
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
<% end %>
<% content_for :sidebar do %>
<% form_tag({:project_id => @project}, :method => :get) do %>
<h3><%= l(:label_news) %></h3>
<% if @project.descendants.active.any? %>
<%= hidden_field_tag 'with_subprojects', 0 %>
<br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
<% end %>
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
<% end %>
<% end if @project %>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
<% end %>
(1-1/4)