diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-03 14:38:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-02-03 14:38:04 +0000 |
commit | 1ecef3a95ae0471707ce6490e9c725daabce9d67 (patch) | |
tree | 105a30efe4830429418aee5fbed83a6c8b8e4d13 /app/views/news | |
parent | b124501a4e825801024c873304757d3094753f02 (diff) | |
download | redmine-1ecef3a95ae0471707ce6490e9c725daabce9d67.tar.gz redmine-1ecef3a95ae0471707ce6490e9c725daabce9d67.zip |
ProjectsController#add_news moved to NewsController#new.
Preview added when adding/editing a news (#590).
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1111 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views/news')
-rw-r--r-- | app/views/news/edit.rhtml | 12 | ||||
-rw-r--r-- | app/views/news/index.rhtml | 12 | ||||
-rw-r--r-- | app/views/news/new.rhtml | 14 | ||||
-rw-r--r-- | app/views/news/show.rhtml | 10 |
4 files changed, 43 insertions, 5 deletions
diff --git a/app/views/news/edit.rhtml b/app/views/news/edit.rhtml index 5e015c4c7..a7e5e6e36 100644 --- a/app/views/news/edit.rhtml +++ b/app/views/news/edit.rhtml @@ -1,6 +1,14 @@ <h2><%=l(:label_news)%></h2> -<% labelled_tabular_form_for :news, @news, :url => { :action => "edit" } do |f| %> +<% labelled_tabular_form_for :news, @news, :url => { :action => "edit" }, + :html => { :id => 'news-form' } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> -<% end %>
\ No newline at end of file +<%= link_to_remote l(:label_preview), + { :url => { :controller => 'news', :action => 'preview' }, + :method => 'post', + :update => 'preview', + :with => "Form.serialize('news-form')" + }, :accesskey => accesskey(:preview) %> +<% end %> +<div id="preview" class="wiki"></div> diff --git a/app/views/news/index.rhtml b/app/views/news/index.rhtml index c6bb9ad5a..369eaf1b1 100644 --- a/app/views/news/index.rhtml +++ b/app/views/news/index.rhtml @@ -1,17 +1,25 @@ <div class="contextual"> <%= link_to_if_authorized(l(:label_news_new), - {:controller => 'projects', :action => 'add_news', :id => @project}, + {:controller => 'news', :action => 'new', :project_id => @project}, :class => 'icon icon-add', :onclick => 'Element.show("add-news"); return false;') if @project %> </div> <div id="add-news" style="display:none;"> <h2><%=l(:label_news_new)%></h2> -<% labelled_tabular_form_for :news, @news, :url => { :controller => 'projects', :action => "add_news", :id => @project } do |f| %> +<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'new', :project_id => @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' }, + :method => 'post', + :update => 'preview', + :with => "Form.serialize('news-form')" + }, :accesskey => accesskey(:preview) %> | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %> <% end if @project %> +<div id="preview" class="wiki"></div> </div> <h2><%=l(:label_news_plural)%></h2> diff --git a/app/views/news/new.rhtml b/app/views/news/new.rhtml new file mode 100644 index 000000000..9208d8840 --- /dev/null +++ b/app/views/news/new.rhtml @@ -0,0 +1,14 @@ +<h2><%=l(:label_news_new)%></h2> + +<% labelled_tabular_form_for :news, @news, :url => { :controller => 'news', :action => 'new', :project_id => @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' }, + :method => 'post', + :update => 'preview', + :with => "Form.serialize('news-form')" + }, :accesskey => accesskey(:preview) %> +<% end %> +<div id="preview" class="wiki"></div> diff --git a/app/views/news/show.rhtml b/app/views/news/show.rhtml index bff737f40..cc9eed043 100644 --- a/app/views/news/show.rhtml +++ b/app/views/news/show.rhtml @@ -10,11 +10,19 @@ <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| %> +<% labelled_tabular_form_for :news, @news, :url => { :action => "edit", :id => @news }, + :html => { :id => 'news-form' } do |f| %> <%= render :partial => 'form', :locals => { :f => f } %> <%= submit_tag l(:button_save) %> +<%= link_to_remote l(:label_preview), + { :url => { :controller => 'news', :action => 'preview' }, + :method => 'post', + :update => 'preview', + :with => "Form.serialize('news-form')" + }, :accesskey => accesskey(:preview) %> | <%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news")' %> <% end %> +<div id="preview" class="wiki"></div> </div> <p><em><% unless @news.summary.empty? %><%=h @news.summary %><br /><% end %> |