Defect #5933 » news.patch
app/controllers/news_controller.rb (working copy) | ||
---|---|---|
26 | 26 |
accept_key_auth :index |
27 | 27 |
|
28 | 28 |
def index |
29 |
@with_subprojects = params[:with_subprojects].nil? ? Setting.display_subprojects_issues? : (params[:with_subprojects] == '1') |
|
29 | 30 |
@news_pages, @newss = paginate :news, |
30 | 31 |
:per_page => 10, |
31 |
:conditions => Project.allowed_to_condition(User.current, :view_news, :project => @project), |
|
32 |
:conditions => Project.allowed_to_condition(User.current, :view_news, :project => @project, :with_subprojects => @with_subprojects),
|
|
32 | 33 |
:include => [:author, :project], |
33 | 34 |
:order => "#{News.table_name}.created_on DESC" |
34 | 35 |
respond_to do |format| |
app/views/news/index.rhtml (working copy) | ||
---|---|---|
43 | 43 |
<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %> |
44 | 44 |
<% end %> |
45 | 45 | |
46 |
<% content_for :sidebar do %> |
|
47 |
<% form_tag({:project_id => @project}, :method => :get) do %> |
|
48 |
<h3><%= l(:label_news) %></h3> |
|
49 |
<% if @project.descendants.active.any? %> |
|
50 |
<%= hidden_field_tag 'with_subprojects', 0 %> |
|
51 |
<br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label> |
|
52 |
<% end %> |
|
53 |
<p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p> |
|
54 |
<% end %> |
|
55 |
<% end if @project %> |
|
56 | ||
46 | 57 |
<% content_for :header_tags do %> |
47 | 58 |
<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> |
48 | 59 |
<% end %> |