From: Eric Davis Date: Mon, 27 Sep 2010 16:51:12 +0000 (+0000) Subject: Refactor: convert News to a REST resource X-Git-Tag: 1.1.0~321 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=79e30e7087d714ad81de83d389c37ae7d46d4dad;p=redmine.git Refactor: convert News to a REST resource git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4214 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/views/news/_news.rhtml b/app/views/news/_news.rhtml index 8f481f09c..ddbaecabf 100644 --- a/app/views/news/_news.rhtml +++ b/app/views/news/_news.rhtml @@ -1,5 +1,5 @@

<%= link_to_project(news.project) + ': ' unless @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 %>
<% unless news.summary.blank? %><%=h news.summary %>
<% end %> diff --git a/app/views/news/edit.rhtml b/app/views/news/edit.rhtml index 704820089..0d44bfbb9 100644 --- a/app/views/news/edit.rhtml +++ b/app/views/news/edit.rhtml @@ -1,11 +1,11 @@

<%=l(:label_news)%>

-<% labelled_tabular_form_for :news, @news, :url => { :action => "update" }, +<% labelled_tabular_form_for :news, @news, :url => news_path(@news), :html => { :id => 'news-form', :method => :put } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> <%= link_to_remote l(:label_preview), - { :url => { :controller => 'previews', :action => 'news', :project_id => @project }, + { :url => preview_news_path(:project_id => @project), :method => 'get', :update => 'preview', :with => "Form.serialize('news-form')" diff --git a/app/views/news/index.rhtml b/app/views/news/index.rhtml index d65bdf2f3..c2a227fe0 100644 --- a/app/views/news/index.rhtml +++ b/app/views/news/index.rhtml @@ -1,18 +1,18 @@
<%= link_to_if_authorized(l(:label_news_new), - {:controller => 'news', :action => 'new', :project_id => @project}, + new_project_news_path(@project), :class => 'icon icon-add', :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project %>