This commit is contained in:
parent
39bf4ff188
commit
344e51105a
|
@ -47,24 +47,7 @@ module WelcomeHelper
|
|||
sort_contest_by_hot
|
||||
end
|
||||
|
||||
def find_all_event_type event
|
||||
case event.event_type
|
||||
when 'news'
|
||||
'新闻'
|
||||
when 'issue'
|
||||
'缺陷'
|
||||
when 'attachment'
|
||||
'附件'
|
||||
when 'message'
|
||||
'主题'
|
||||
when 'reply'
|
||||
'回复'
|
||||
when 'bid'
|
||||
'作业'
|
||||
else
|
||||
event.event_type
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def time_tag_welcome time
|
||||
text = distance_of_time_in_words(Time.now, time)
|
||||
|
@ -80,7 +63,21 @@ module WelcomeHelper
|
|||
end
|
||||
grade
|
||||
end
|
||||
|
||||
|
||||
def show_user_content event
|
||||
str = ''.html_safe
|
||||
case event.event_type
|
||||
when ('news' || 'issue' || 'attachment' || 'message' || 'bid' || 'wiki-page' || 'document')
|
||||
str << " ".html_safe << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url)
|
||||
when 'reply'
|
||||
str << " ".html_safe << content_tag("span", "发表了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_description, length: 30, omission:'...'), event.event_url)
|
||||
else
|
||||
str << " ".html_safe << content_tag("span", "更新了") << content_tag("span", find_all_event_type(event)) << ': '.html_safe << link_to(truncate(event.event_title, length: 30, omission:'...'), event.event_url)
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
# def search_project
|
||||
|
@ -148,5 +145,25 @@ module WelcomeHelper
|
|||
def sort_bid_by_hot_rails reward_type, limit = 10
|
||||
Bid.visible.where('reward_type = ?', reward_type).reorder('bids.commit desc').limit(limit)
|
||||
end
|
||||
|
||||
|
||||
def find_all_event_type event
|
||||
case event.event_type
|
||||
when 'news'
|
||||
'新闻'
|
||||
when 'issue'
|
||||
'缺陷'
|
||||
when 'attachment'
|
||||
'附件'
|
||||
when 'message'
|
||||
'主题'
|
||||
when 'reply'
|
||||
'回复'
|
||||
when 'bid'
|
||||
'作业'
|
||||
else
|
||||
event.event_type
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -129,8 +129,8 @@
|
|||
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
|
||||
</div>
|
||||
<div class="inner-right" style="float: right; width:86%; height: 100%; ">
|
||||
<span style="color: green;"><%= link_to event.event_author, user_path(event.event_author), :style => "color:green;" %></span> 发表了<%= find_all_event_type event %>:<span style="color: blue;"><%= link_to truncate(event.event_title, length: 30, omission:'...'), event.event_url %>
|
||||
</span>
|
||||
<span style="color: green;"><%= link_to event.event_author, user_path(event.event_author), :style => "color:green;" %></span><!-- 发表了<%= find_all_event_type event %>:<span style="color: blue;"><%= link_to truncate(event.event_title, length: 30, omission:'...'), event.event_url %>
|
||||
</span> --><%= show_user_content event %>
|
||||
<p><span style="color: rgb(172, 174, 177)"><%= time_tag_welcome event.event_datetime %>前</span> <!-- <span>评论(4)</span></p> -->
|
||||
</div>
|
||||
</li>
|
||||
|
@ -154,12 +154,10 @@
|
|||
<span style="display: inline-block; float: right; color: #ec6300; background: url('/images/score.png') no-repeat scroll ;background-position: left center;" title="项目得分"> <%= show_grade project %></span>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<!-- <span class="d-p-project-intro" ><%= project.description.truncate(50, omission: '...') %></span> -->
|
||||
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %>
|
||||
</p>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -175,7 +173,7 @@
|
|||
<%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}")%>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<span class="d-p-project-intro"><%= contest.description.truncate(50, omission: '...') %></span>
|
||||
<%= content_tag "span", contest.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => contest.description %>
|
||||
</p>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -194,7 +192,7 @@
|
|||
<%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}")%>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<span class="d-p-project-intro"><%= bid.description.truncate(50, omission: '...') %></span>
|
||||
<%= content_tag "span", bid.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => bid.description %>
|
||||
</p>
|
||||
</li>
|
||||
<% end %>
|
||||
|
@ -212,8 +210,7 @@
|
|||
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%>
|
||||
</p>
|
||||
<p class="layout-1" >
|
||||
<span class="d-p-project-intro"><%= project.description.truncate(50, omission: '...') %></span>
|
||||
|
||||
<%= content_tag "span", project.description.truncate(50, omission: '...'), :class => "d-p-project-intro" , :title => project.description %>
|
||||
</p>
|
||||
</li>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue