Revision 912:5e80956cc792 app/views/news

View differences:

app/views/news/_form.html.erb
1
<%= f.error_messages %>
2
<div class="box tabular">
3
<p><%= f.text_field :title, :required => true, :size => 60 %></p>
4
<p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p>
5
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
6
</div>
7

  
8
<%= wikitoolbar_for 'news_description' %>
app/views/news/_form.rhtml
1
<%= error_messages_for 'news' %>
2
<div class="box tabular">
3
<p><%= f.text_field :title, :required => true, :size => 60 %></p>
4
<p><%= f.text_area :summary, :cols => 60, :rows => 2 %></p>
5
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 15, :class => 'wiki-edit' %></p>
6
</div>
7

  
8
<%= wikitoolbar_for 'news_description' %>
app/views/news/_news.html.erb
1
<div id="news">
2
<dt>
3
<span class="time"><%= format_time(news.created_on) %></span>
4
<% project ||= @project %>
5
<% if !project %>
6
<span class="project"><%= link_to_project(news.project) %></span>
7
<% end %>
8
<span class="headline"><%= link_to h(news.title), news_path(news) %></span>
9
<span class="comments"><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></span>
10
</dt><dd>
11
<% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %>
12
</dd>
13
</div>
app/views/news/_news.rhtml
1
<div id="news">
2
<dt>
3
<span class="time"><%= format_time(news.created_on) %></span>
4
<% project ||= @project %>
5
<% if !project %>
6
<span class="project"><%= link_to_project(news.project) %></span>
7
<% end %>
8
<span class="headline"><%= link_to h(news.title), news_path(news) %></span>
9
<span class="comments"><%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></span>
10
</dt><dd>
11
<% unless news.summary.blank? %><span class="summary"><%=h news.summary %></span><br /><% end %>
12
</dd>
13
</div>
app/views/news/edit.html.erb
1
<h2><%=l(:label_news)%></h2>
2

  
3
<% labelled_tabular_form_for @news, :html => { :id => 'news-form', :method => :put } do |f| %>
4
<%= render :partial => 'form', :locals => { :f => f } %>
5
<%= submit_tag l(:button_save) %>
6
<%= link_to_remote l(:label_preview),
7
                   { :url => preview_news_path(:project_id => @project),
8
                     :method => 'get',
9
                     :update => 'preview',
10
                     :with => "Form.serialize('news-form')"
11
                   }, :accesskey => accesskey(:preview) %>
12
<% end %>
13
<div id="preview" class="wiki"></div>
14

  
15
<% content_for :header_tags do %>
16
  <%= stylesheet_link_tag 'scm' %>
17
<% end %>
app/views/news/edit.rhtml
1
<h2><%=l(:label_news)%></h2>
2

  
3
<% labelled_tabular_form_for :news, @news, :url => news_path(@news),
4
                                           :html => { :id => 'news-form', :method => :put } do |f| %>
5
<%= render :partial => 'form', :locals => { :f => f } %>
6
<%= submit_tag l(:button_save) %>
7
<%= link_to_remote l(:label_preview), 
8
                   { :url => preview_news_path(:project_id => @project),
9
                     :method => 'get',
10
                     :update => 'preview',
11
                     :with => "Form.serialize('news-form')"
12
                   }, :accesskey => accesskey(:preview) %>
13
<% end %>
14
<div id="preview" class="wiki"></div>
15

  
16
<% content_for :header_tags do %>
17
  <%= stylesheet_link_tag 'scm' %>
18
<% end %>
app/views/news/index.api.rsb
4 4
      api.id news.id
5 5
      api.project(:id => news.project_id, :name => news.project.name) unless news.project.nil?
6 6
      api.author(:id => news.author_id, :name => news.author.name) unless news.author.nil?
7
      
8
      api.title 		news.title
9
      api.summary		news.summary
10
      api.description 	news.description
7

  
8
      api.title         news.title
9
      api.summary       news.summary
10
      api.description   news.description
11 11
      api.created_on news.created_on
12 12
    end
13 13
  end
app/views/news/index.html.erb
1
<div class="contextual">
2
<%= link_to(l(:label_news_new),
3
            new_project_news_path(@project),
4
            :class => 'icon icon-add',
5
            :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %>
6
</div>
7

  
8
<div id="add-news" style="display:none;">
9
<h2><%=l(:label_news_new)%></h2>
10
<% labelled_tabular_form_for @news, :url => project_news_index_path(@project),
11
                                           :html => { :id => 'news-form' } do |f| %>
12
<%= render :partial => 'news/form', :locals => { :f => f } %>
13
<%= submit_tag l(:button_create) %>
14
<%= link_to_remote l(:label_preview),
15
                   { :url => preview_news_path(:project_id => @project),
16
                     :method => 'get',
17
                     :update => 'preview',
18
                     :with => "Form.serialize('news-form')"
19
                   }, :accesskey => accesskey(:preview) %> |
20
<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %>
21
<% end if @project %>
22
<div id="preview" class="wiki"></div>
23
</div>
24

  
25
<h2><%=l(:label_news_plural)%></h2>
26

  
27
<% if @newss.empty? %>
28
<p class="nodata"><%= l(:label_no_data) %></p>
29
<% else %>
30
<% @newss.each do |news| %>
31
    <h3><%= avatar(news.author, :size => "24") %><%= link_to_project(news.project) + ': ' unless news.project == @project %>
32
    <%= link_to h(news.title), news_path(news) %>
33
    <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
34
    <p class="author"><%= authoring news.created_on, news.author %></p>
35
    <div class="wiki">
36
    <%= textilizable(news.description) %>
37
    </div>
38
<% end %>
39
<% end %>
40
<p class="pagination"><%= pagination_links_full @news_pages %></p>
41

  
42
<% other_formats_links do |f| %>
43
  <%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
44
<% end %>
45

  
46
<% content_for :header_tags do %>
47
  <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
48
  <%= stylesheet_link_tag 'scm' %>
49
<% end %>
50

  
51
<% html_title(l(:label_news_plural)) -%>
app/views/news/index.rhtml
1
<div class="contextual">
2
<%= link_to(l(:label_news_new),
3
            new_project_news_path(@project),
4
            :class => 'icon icon-add',
5
            :onclick => 'Element.show("add-news"); Form.Element.focus("news_title"); return false;') if @project && User.current.allowed_to?(:manage_news, @project) %>
6
</div>
7

  
8
<div id="add-news" style="display:none;">
9
<h2><%=l(:label_news_new)%></h2>
10
<% labelled_tabular_form_for :news, @news, :url => project_news_index_path(@project),
11
                                           :html => { :id => 'news-form' } do |f| %>
12
<%= render :partial => 'news/form', :locals => { :f => f } %>
13
<%= submit_tag l(:button_create) %>
14
<%= link_to_remote l(:label_preview), 
15
                   { :url => preview_news_path(:project_id => @project),
16
                     :method => 'get',
17
                     :update => 'preview',
18
                     :with => "Form.serialize('news-form')"
19
                   }, :accesskey => accesskey(:preview) %> |
20
<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("add-news")' %>
21
<% end if @project %>
22
<div id="preview" class="wiki"></div>
23
</div>
24

  
25
<h2><%=l(:label_news_plural)%></h2>
26

  
27
<% if @newss.empty? %>
28
<p class="nodata"><%= l(:label_no_data) %></p>
29
<% else %>
30
<% @newss.each do |news| %>
31
    <h3><%= link_to_project(news.project) + ': ' unless news.project == @project %>
32
    <%= link_to h(news.title), news_path(news) %>
33
    <%= "(#{l(:label_x_comments, :count => news.comments_count)})" if news.comments_count > 0 %></h3>
34
    <p class="author"><%= authoring news.created_on, news.author %></p>
35
    <div class="wiki">
36
    <%= textilizable(news.description) %>
37
    </div>
38
<% end %>
39
<% end %>
40
<p class="pagination"><%= pagination_links_full @news_pages %></p>
41

  
42
<% other_formats_links do |f| %>
43
	<%= f.link_to 'Atom', :url => {:project_id => @project, :key => User.current.rss_key} %>
44
<% end %>
45

  
46
<% content_for :header_tags do %>
47
  <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %>
48
  <%= stylesheet_link_tag 'scm' %>
49
<% end %>
50

  
51
<% html_title(l(:label_news_plural)) -%>
app/views/news/new.html.erb
1
<h2><%=l(:label_news_new)%></h2>
2

  
3
<% labelled_tabular_form_for @news, :url => project_news_index_path(@project),
4
                                           :html => { :id => 'news-form' } do |f| %>
5
	<%= render :partial => 'news/form', :locals => { :f => f } %>
6
	<%= submit_tag l(:button_create) %>
7
	<%= link_to_remote l(:label_preview),
8
	                   { :url => preview_news_path(:project_id => @project),
9
	                     :method => 'get',
10
	                     :update => 'preview',
11
	                     :with => "Form.serialize('news-form')"
12
	                   }, :accesskey => accesskey(:preview) %>
13
<% end %>
14
<div id="preview" class="wiki"></div>
app/views/news/new.rhtml
1
<h2><%=l(:label_news_new)%></h2>
2

  
3
<% labelled_tabular_form_for :news, @news, :url => project_news_index_path(@project),
4
                                           :html => { :id => 'news-form' } do |f| %>
5
<%= render :partial => 'news/form', :locals => { :f => f } %>
6
<%= submit_tag l(:button_create) %>
7
<%= link_to_remote l(:label_preview), 
8
                   { :url => preview_news_path(:project_id => @project),
9
                     :method => 'get',
10
                     :update => 'preview',
11
                     :with => "Form.serialize('news-form')"
12
                   }, :accesskey => accesskey(:preview) %>
13
<% end %>
14
<div id="preview" class="wiki"></div>
app/views/news/show.html.erb
1
<div class="contextual">
2
<%= watcher_tag(@news, User.current) %>
3
<%= link_to(l(:button_edit),
4
      edit_news_path(@news),
5
      :class => 'icon icon-edit',
6
      :accesskey => accesskey(:edit),
7
      :onclick => 'Element.show("edit-news"); return false;') if User.current.allowed_to?(:manage_news, @project) %>
8
<%= link_to(l(:button_delete),
9
      news_path(@news),
10
      :confirm => l(:text_are_you_sure),
11
      :method => :delete,
12
      :class => 'icon icon-del') if User.current.allowed_to?(:manage_news, @project) %>
13
</div>
14

  
15
<h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
16

  
17
<% if authorize_for('news', 'edit') %>
18
<div id="edit-news" style="display:none;">
19
<% labelled_tabular_form_for :news, @news, :url => news_path(@news),
20
                                           :html => { :id => 'news-form', :method => :put } do |f| %>
21
<%= render :partial => 'form', :locals => { :f => f } %>
22
<%= submit_tag l(:button_save) %>
23
<%= link_to_remote l(:label_preview),
24
                   { :url => preview_news_path(:project_id => @project),
25
                     :method => 'get',
26
                     :update => 'preview',
27
                     :with => "Form.serialize('news-form')"
28
                   }, :accesskey => accesskey(:preview) %> |
29
<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %>
30
<% end %>
31
<div id="preview" class="wiki"></div>
32
</div>
33
<% end %>
34

  
35
<p><% unless @news.summary.blank? %><em><%=h @news.summary %></em><br /><% end %>
36
<span class="author"><%= authoring @news.created_on, @news.author %></span></p>
37
<div class="wiki">
38
<%= textilizable(@news.description) %>
39
</div>
40
<br />
41

  
42
<div id="comments" style="margin-bottom:16px;">
43
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
44
<% @comments.each do |comment| %>
45
    <% next if comment.new_record? %>
46
    <div class="contextual">
47
    <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
48
                                                       :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
49
    </div>
50
    <h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
51
    <%= textilizable(comment.comments) %>
52
<% end if @comments.any? %>
53
</div>
54

  
55
<% if authorize_for 'comments', 'create' %>
56
<p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
57
<% form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
58
<div class="box">
59
    <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
60
    <%= wikitoolbar_for 'comment_comments' %>
61
</div>
62
<p><%= submit_tag l(:button_add) %></p>
63
<% end %>
64
<% end %>
65

  
66
<% html_title @news.title -%>
67

  
68
<% content_for :header_tags do %>
69
  <%= stylesheet_link_tag 'scm' %>
70
<% end %>
app/views/news/show.rhtml
1
<div class="contextual">
2
<%= watcher_tag(@news, User.current) %>
3
<%= link_to(l(:button_edit), 
4
      edit_news_path(@news),
5
      :class => 'icon icon-edit',
6
      :accesskey => accesskey(:edit),
7
      :onclick => 'Element.show("edit-news"); return false;') if User.current.allowed_to?(:manage_news, @project) %>
8
<%= link_to(l(:button_delete), 
9
      news_path(@news),
10
      :confirm => l(:text_are_you_sure),
11
      :method => :delete,
12
      :class => 'icon icon-del') if User.current.allowed_to?(:manage_news, @project) %>
13
</div>
14

  
15
<h2><%= avatar(@news.author, :size => "24") %><%=h @news.title %></h2>
16

  
17
<% if authorize_for('news', 'edit') %>
18
<div id="edit-news" style="display:none;">
19
<% labelled_tabular_form_for :news, @news, :url => news_path(@news),
20
                                           :html => { :id => 'news-form', :method => :put } do |f| %>
21
<%= render :partial => 'form', :locals => { :f => f } %>
22
<%= submit_tag l(:button_save) %>
23
<%= link_to_remote l(:label_preview), 
24
                   { :url => preview_news_path(:project_id => @project),
25
                     :method => 'get',
26
                     :update => 'preview',
27
                     :with => "Form.serialize('news-form')"
28
                   }, :accesskey => accesskey(:preview) %> |
29
<%= link_to l(:button_cancel), "#", :onclick => 'Element.hide("edit-news"); return false;' %>
30
<% end %>
31
<div id="preview" class="wiki"></div>
32
</div>
33
<% end %>
34

  
35
<p><% unless @news.summary.blank? %><em><%=h @news.summary %></em><br /><% end %>
36
<span class="author"><%= authoring @news.created_on, @news.author %></span></p>
37
<div class="wiki">
38
<%= textilizable(@news.description) %>
39
</div>
40
<br />
41

  
42
<div id="comments" style="margin-bottom:16px;">
43
<h3 class="comments"><%= l(:label_comment_plural) %></h3>
44
<% @comments.each do |comment| %>
45
    <% next if comment.new_record? %>
46
    <div class="contextual">
47
    <%= link_to_if_authorized image_tag('delete.png'), {:controller => 'comments', :action => 'destroy', :id => @news, :comment_id => comment},
48
                                                       :confirm => l(:text_are_you_sure), :method => :delete, :title => l(:button_delete) %>
49
    </div>
50
    <h4><%= avatar(comment.author, :size => "24") %><%= authoring comment.created_on, comment.author %></h4>
51
    <%= textilizable(comment.comments) %>
52
<% end if @comments.any? %>
53
</div>
54

  
55
<% if authorize_for 'comments', 'create' %>
56
<p><%= toggle_link l(:label_comment_add), "add_comment_form", :focus => "comment_comments" %></p>
57
<% form_tag({:controller => 'comments', :action => 'create', :id => @news}, :id => "add_comment_form", :style => "display:none;") do %>
58
<div class="box">
59
    <%= text_area 'comment', 'comments', :cols => 80, :rows => 15, :class => 'wiki-edit' %>
60
    <%= wikitoolbar_for 'comment_comments' %>
61
</div>
62
<p><%= submit_tag l(:button_add) %></p>
63
<% end %>
64
<% end %>
65

  
66
<% html_title @news.title -%>
67

  
68
<% content_for :header_tags do %>
69
  <%= stylesheet_link_tag 'scm' %>
70
<% end %>

Also available in: Unified diff