The news list now shows the full news contents.
News add/edit forms are now accessible with no additional request. git-svn-id: http://redmine.rubyforge.org/svn/trunk@750 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
fe7c0d6484
commit
2b77964468
@ -383,11 +383,11 @@ class ProjectsController < ApplicationController
|
|||||||
|
|
||||||
# Show news list of @project
|
# Show news list of @project
|
||||||
def list_news
|
def list_news
|
||||||
@news_pages, @news = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC"
|
@news_pages, @newss = paginate :news, :per_page => 10, :conditions => ["project_id=?", @project.id], :include => :author, :order => "#{News.table_name}.created_on DESC"
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :layout => false if request.xhr? }
|
format.html { render :layout => false if request.xhr? }
|
||||||
format.atom { render_feed(@news, :title => "#{@project.name}: #{l(:label_news_plural)}") }
|
format.atom { render_feed(@newss, :title => "#{@project.name}: #{l(:label_news_plural)}") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<%= error_messages_for 'news' %>
|
<%= error_messages_for 'news' %>
|
||||||
<div class="box">
|
<div class="box tabular">
|
||||||
<p><%= f.text_field :title, :required => true, :size => 60 %></p>
|
<p><%= f.text_field :title, :required => true, :size => 60 %></p>
|
||||||
<p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p>
|
<p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p>
|
||||||
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
|
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= link_to_if_authorized l(:button_edit), {:controller => 'news', :action => 'edit', :id => @news}, :class => 'icon icon-edit' %>
|
<%= link_to_if_authorized l(:button_edit),
|
||||||
|
{:controller => 'news', :action => 'edit', :id => @news},
|
||||||
|
:class => 'icon icon-edit',
|
||||||
|
:onclick => 'Element.show("edit-news"); return false;' %>
|
||||||
<%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
|
<%= link_to_if_authorized l(:button_delete), {:controller => 'news', :action => 'destroy', :id => @news}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2><%=h @news.title %></h2>
|
<h2><%=h @news.title %></h2>
|
||||||
|
|
||||||
|
<div id="edit-news" style="display:none;">
|
||||||
|
<% labelled_tabular_form_for :news, @news, :url => { :action => "edit", :id => @news } do |f| %>
|
||||||
|
<%= render :partial => 'form', :locals => { :f => f } %>
|
||||||
|
<%= submit_tag l(:button_save) %>
|
||||||
|
<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news")' %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %>
|
<p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %>
|
||||||
<span class="author"><%= authoring @news.created_on, @news.author %></span></em></p>
|
<span class="author"><%= authoring @news.created_on, @news.author %></span></em></p>
|
||||||
<%= textilizable(@news.description) %>
|
<%= textilizable(@news.description) %>
|
||||||
|
@ -1,15 +1,31 @@
|
|||||||
<div class="contextual">
|
<div class="contextual">
|
||||||
<%= link_to_if_authorized l(:label_news_new), {:controller => 'projects', :action => 'add_news', :id => @project}, :class => 'icon icon-add' %>
|
<%= link_to_if_authorized l(:label_news_new),
|
||||||
|
{:controller => 'projects', :action => 'add_news', :id => @project},
|
||||||
|
:class => 'icon icon-add',
|
||||||
|
:onclick => 'Element.show("add-news"); return false;' %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="add-news" style="display:none;">
|
||||||
|
<h2><%=l(:label_news_new)%></h2>
|
||||||
|
<% labelled_tabular_form_for :news, @news, :url => { :action => "add_news", :id => @project } do |f| %>
|
||||||
|
<%= render :partial => 'news/form', :locals => { :f => f } %>
|
||||||
|
<%= submit_tag l(:button_create) %>
|
||||||
|
<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2><%=l(:label_news_plural)%></h2>
|
<h2><%=l(:label_news_plural)%></h2>
|
||||||
|
|
||||||
<% if @news.empty? %>
|
<% if @newss.empty? %>
|
||||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||||
|
<% else %>
|
||||||
|
<% @newss.each do |news| %>
|
||||||
|
<h3><%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %>
|
||||||
|
<%= "(#{news.comments_count} #{lwr(:label_comment, news.comments_count).downcase})" if news.comments_count > 0 %></h3>
|
||||||
|
<p><span class="author"><%= authoring news.created_on, news.author %></p>
|
||||||
|
<%= textilizable(news.description) %>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<%= render :partial => 'news/news', :collection => @news %>
|
|
||||||
<%= pagination_links_full @news_pages %>
|
<%= pagination_links_full @news_pages %>
|
||||||
|
|
||||||
<% content_for :header_tags do %>
|
<% content_for :header_tags do %>
|
||||||
|
@ -88,7 +88,7 @@ class ProjectsControllerTest < Test::Unit::TestCase
|
|||||||
get :list_news, :id => 1
|
get :list_news, :id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_template 'list_news'
|
assert_template 'list_news'
|
||||||
assert_not_nil assigns(:news)
|
assert_not_nil assigns(:newss)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_list_files
|
def test_list_files
|
||||||
|
Loading…
x
Reference in New Issue
Block a user