Project

General

Profile

Defect #5933 » news.patch

Yuki Kita, 2010-07-26 15:20

View differences:

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
    <%= hidden_field_tag 'with_subprojects', 0 %>
50
    <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
51
    <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
52
  <% end %>
53
<% end if @project && @project.descendants.active.any? %>
54

  
46 55
<% content_for :header_tags do %>
47 56
  <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
48 57
<% end %>
(2-2/4)