diff app/views/news/index.rhtml @ 37:94944d00e43c

* Update to SVN trunk rev 4411
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Fri, 19 Nov 2010 13:24:41 +0000
parents 40f7cfd4df19
children
line wrap: on
line diff
--- a/app/views/news/index.rhtml	Fri Sep 24 14:06:04 2010 +0100
+++ b/app/views/news/index.rhtml	Fri Nov 19 13:24:41 2010 +0000
@@ -1,19 +1,19 @@
 <div class="contextual">
-<%= link_to_if_authorized(l(:label_news_new),
-                          {:controller => 'news', :action => 'new', :project_id => @project},
-                          :class => 'icon icon-add',
-                          :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project %>
+<%= link_to(l(:label_news_new),
+            new_project_news_path(@project),
+            :class => 'icon icon-add',
+            :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %>
 </div>
 
 <div id="add-news" style="display:none;">
 <h2><%=l(:label_news_new)%></h2>
-<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'create', :project_id => @project },
+<% labelled_tabular_form_for :news, @news, :url => project_news_index_path(@project),
                                            :html => { :id => 'news-form' } do |f| %>
 <%= render :partial => 'news/form', :locals => { :f => f } %>
 <%= submit_tag l(:button_create) %>
 <%= link_to_remote l(:label_preview), 
-                   { :url => { :controller => 'news', :action => 'preview', :project_id => @project },
-                     :method => 'post',
+                   { :url => preview_news_path(:project_id => @project),
+                     :method => 'get',
                      :update => 'preview',
                      :with => "Form.serialize('news-form')"
                    }, :accesskey => accesskey(:preview) %> |
@@ -29,7 +29,7 @@
 <% else %>
 <% @newss.each do |news| %>
     <h3><%= link_to_project(news.project) + ': ' unless news.project == @project %>
-    <%= link_to h(news.title), :controller => 'news', :action => 'show', :id => news %>
+    <%= link_to h(news.title), news_path(news) %>
     <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
     <p class="author"><%= authoring news.created_on, news.author %></p>
     <div class="wiki">