Skip to content

Commit

Permalink
Fix: RecordNotFound exception fixed for redmine 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jongha committed Mar 4, 2015
1 parent 522b755 commit d825128
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 32 deletions.
62 changes: 30 additions & 32 deletions app/views/messages/_after_top_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,39 @@ unless User.current.login == ''
%>
<div class="sticky_messages-area">
<%
messages = News.find(
:all,
:limit => 2,
:order => "created_on desc",
:include => [:author]
)

unless messages.length == 0
%>
<div class="_sticky_messages _sticky_messages-news" data-flag="1">
<strong><%= l(:label_news) %></strong>
<% messages.each do |m| %>
<ul><li><a href="<%=url_for :controller => 'welcome' %>news/<%= m.id %>"><%= m.title %><% unless m.comments_count == 0 %> [<%= m.comments_count %>]<% end %></a></li></ul>
<% end %>
</div>
<% end %>

<%
messages = Message.find(
:all,
:limit => 3,
:conditions => "sticky = 1 and parent_id is null",
:order => "created_on desc",
:include => [:author, :board]
)
messages = News
.order('created_on desc')
.limit(2)
.all

unless messages.length == 0
unless messages.count == 0
%>
<div class="_sticky_messages _sticky_messages-news" data-flag="1">
<strong><%= l(:label_news) %></strong>
<% messages.each do |m| %>
<ul><li><a href="<%=url_for :controller => 'welcome' %>news/<%= m.id %>"><%= m.title %><% unless m.comments_count == 0 %> [<%= m.comments_count %>]<% end %></a></li></ul>
<% end %>
</div>
<%
end

messages = Message
.where('sticky = 1 and parent_id is null')
.order('created_on desc')
.limit(3)
.all

unless messages.count == 0
%>
<div class="_sticky_messages _sticky_messages-messages" data-flag="2">
<strong><%= l(:label_message) %></strong>
<% messages.each do |m| %>
<ul><li><a href="<%=url_for :controller => 'welcome' %>boards/<%= m.board_id %>/topics/<%= m.id %>?r=<%= m.parent_id %>"><%= m.subject %><% unless m.replies_count == 0 %> [<%= m.replies_count %>]<% end %></a></li></ul>
<% end %>
</div>
<% end %>
<div class="_sticky_messages _sticky_messages-messages" data-flag="2">
<strong><%= l(:label_message) %></strong>
<% messages.each do |m| %>
<ul><li><a href="<%=url_for :controller => 'welcome' %>boards/<%= m.board_id %>/topics/<%= m.id %>?r=<%= m.parent_id %>"><%= m.subject %><% unless m.replies_count == 0 %> [<%= m.replies_count %>]<% end %></a></li></ul>
<% end %>
</div>

<% end %>

<label id="_sticky_messages-ok"><%= l(:label_ok) %></label>
<label id="_sticky_messages-dismiss"><%= l(:label_dismiss) %></label>
Expand Down
6 changes: 6 additions & 0 deletions config/locales/ja.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# English strings go here for Rails i18n
ko:
label_ok: "確認"
label_dismiss: "やめる"
label_news: "ニュース"
label_message: "メッセージ"

0 comments on commit d825128

Please sign in to comment.