门户网站页面微调
This commit is contained in:
parent
929bb2bd70
commit
3700294890
|
@ -18,124 +18,135 @@
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
module WelcomeHelper
|
module WelcomeHelper
|
||||||
|
|
||||||
# def newbieTopiclist
|
|
||||||
# find_all_topic_by_board_id
|
|
||||||
# end
|
|
||||||
|
|
||||||
# def newbieTopicStickyList
|
# def newbieTopiclist
|
||||||
# find_all_topic_by_board_id 1
|
# find_all_topic_by_board_id
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# def find_project_by_topic topic
|
# def newbieTopicStickyList
|
||||||
# board = find_board_by_topic(topic)
|
# find_all_topic_by_board_id 1
|
||||||
# find_project_by_board board
|
# end
|
||||||
# end
|
|
||||||
|
|
||||||
def find_all_hot_project
|
# def find_project_by_topic topic
|
||||||
sort_project_by_hot
|
# board = find_board_by_topic(topic)
|
||||||
end
|
# find_project_by_board board
|
||||||
|
# end
|
||||||
def find_all_hot_course
|
def find_all_hot_project
|
||||||
sort_course_by_hot
|
sort_project_by_hot
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_all_hot_bid
|
|
||||||
sort_bid_by_hot
|
|
||||||
end
|
|
||||||
|
|
||||||
def find_all_hot_contest
|
def find_all_hot_course
|
||||||
sort_contest_by_hot
|
sort_course_by_hot
|
||||||
end
|
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)
|
|
||||||
content_tag('span', text, :title => format_time(time))
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
def find_all_hot_bid
|
||||||
|
sort_bid_by_hot
|
||||||
|
end
|
||||||
|
|
||||||
# def search_project
|
def find_all_hot_contest
|
||||||
# Project.find_by_identifier "newbie_faq"
|
sort_contest_by_hot
|
||||||
# end
|
end
|
||||||
|
|
||||||
# def find_all_topic_by_board_id sticky = 0, limit = 30
|
def find_all_event_type event
|
||||||
# project = search_project
|
case event.event_type
|
||||||
# return [] if(project.nil? or project.boards.nil?)
|
when 'news'
|
||||||
# board_id = project.boards.first.id
|
'新闻'
|
||||||
# logger.debug "[WelcomeHelper] ===> find_all_topic_by_board_id=> project.id:#{project.id}, board_id:#{board_id}, sticky:#{sticky}"
|
when 'issue'
|
||||||
# Message.where("board_id = :board_id and sticky=:sticky", :board_id => board_id, :sticky => sticky ).limit(limit)
|
'缺陷'
|
||||||
# end
|
when 'attachment'
|
||||||
|
'附件'
|
||||||
|
when 'message'
|
||||||
|
'主题'
|
||||||
|
when 'reply'
|
||||||
|
'回复'
|
||||||
|
when 'bid'
|
||||||
|
'众包'
|
||||||
|
else
|
||||||
|
event.event_type
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# def find_board_by_topic topic
|
def time_tag_welcome time
|
||||||
# Board.find_by_id(topic.board_id)
|
text = distance_of_time_in_words(Time.now, time)
|
||||||
# end
|
content_tag('span', text, :title => format_time(time))
|
||||||
# def find_project_by_board board
|
end
|
||||||
# Project.find_by_id(board.project_id)
|
|
||||||
# end
|
|
||||||
|
|
||||||
def sort_project_by_hot
|
|
||||||
sort_project_by_hot_rails 0, 'grade DESC'
|
|
||||||
end
|
|
||||||
|
|
||||||
def sort_course_by_hot
|
def show_grade project
|
||||||
sort_project_by_hot_rails 1, 'course_ac_para DESC'
|
grade = 0
|
||||||
end
|
begin
|
||||||
|
grade = project.project_status.grade if project && project.project_status
|
||||||
|
rescue Exception => e
|
||||||
|
logger.error "[WelcomeHelper] ===> #{e}"
|
||||||
|
end
|
||||||
|
grade
|
||||||
|
end
|
||||||
|
|
||||||
def sort_bid_by_hot
|
private
|
||||||
sort_bid_by_hot_rails 1
|
|
||||||
end
|
|
||||||
|
|
||||||
def sort_contest_by_hot
|
# def search_project
|
||||||
sort_bid_by_hot_rails 2
|
# Project.find_by_identifier "newbie_faq"
|
||||||
end
|
# end
|
||||||
#取得所有活动
|
|
||||||
def find_all_activities limit=5
|
|
||||||
# users = []
|
|
||||||
# activities = Activity.find_by_sql("select distinct user_id from activities order by id DESC limit #{limit}" )
|
|
||||||
# activities.each { |activity|
|
|
||||||
# users << activity.user_id
|
|
||||||
# }
|
|
||||||
# user_objs = User.find_by_sql("SELECT * FROM users WHERE (users.id IN #{"(" << users.join(',') << ")"} )")
|
|
||||||
activity = Redmine::Activity::Fetcher.new(nil)
|
|
||||||
|
|
||||||
activity.events_welcome(nil, nil, {:limit => limit})
|
# def find_all_topic_by_board_id sticky = 0, limit = 30
|
||||||
end
|
# project = search_project
|
||||||
|
# return [] if(project.nil? or project.boards.nil?)
|
||||||
|
# board_id = project.boards.first.id
|
||||||
|
# logger.debug "[WelcomeHelper] ===> find_all_topic_by_board_id=> project.id:#{project.id}, board_id:#{board_id}, sticky:#{sticky}"
|
||||||
|
# Message.where("board_id = :board_id and sticky=:sticky", :board_id => board_id, :sticky => sticky ).limit(limit)
|
||||||
|
# end
|
||||||
|
|
||||||
#取得论坛数据
|
# def find_board_by_topic topic
|
||||||
def find_hot_forum_topics limit=10
|
# Board.find_by_id(topic.board_id)
|
||||||
Memo.order('replies_count DESC').where('replies_count <> 0').limit(limit)
|
# end
|
||||||
end
|
# def find_project_by_board board
|
||||||
|
# Project.find_by_id(board.project_id)
|
||||||
|
# end
|
||||||
|
|
||||||
def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15
|
def sort_project_by_hot
|
||||||
Project.find_by_sql("
|
sort_project_by_hot_rails 0, 'grade DESC'
|
||||||
SELECT p.id, p.name, p.description, p.identifier, t.project_id
|
end
|
||||||
|
|
||||||
|
def sort_course_by_hot
|
||||||
|
sort_project_by_hot_rails 1, 'course_ac_para DESC'
|
||||||
|
end
|
||||||
|
|
||||||
|
def sort_bid_by_hot
|
||||||
|
sort_bid_by_hot_rails 1
|
||||||
|
end
|
||||||
|
|
||||||
|
def sort_contest_by_hot
|
||||||
|
sort_bid_by_hot_rails 2
|
||||||
|
end
|
||||||
|
|
||||||
|
#取得所有活动
|
||||||
|
def find_all_activities limit=5
|
||||||
|
# users = []
|
||||||
|
# activities = Activity.find_by_sql("select distinct user_id from activities order by id DESC limit #{limit}" )
|
||||||
|
# activities.each { |activity|
|
||||||
|
# users << activity.user_id
|
||||||
|
# }
|
||||||
|
# user_objs = User.find_by_sql("SELECT * FROM users WHERE (users.id IN #{"(" << users.join(',') << ")"} )")
|
||||||
|
activity = Redmine::Activity::Fetcher.new(nil)
|
||||||
|
|
||||||
|
activity.events_welcome(nil, nil, {:limit => limit})
|
||||||
|
end
|
||||||
|
|
||||||
|
#取得论坛数据
|
||||||
|
def find_hot_forum_topics limit=10
|
||||||
|
#Memo.order('replies_count DESC').where('replies_count <> 0').limit(limit)
|
||||||
|
Memo.order('replies_count DESC').where('parent_id IS NULL').limit(limit)
|
||||||
|
end
|
||||||
|
|
||||||
|
def sort_project_by_hot_rails project_type=0, order_by='grade DESC', limit=15
|
||||||
|
Project.find_by_sql("
|
||||||
|
SELECT p.id, p.name, p.description, p.identifier, t.project_id
|
||||||
FROM projects AS p RIGHT OUTER JOIN (
|
FROM projects AS p RIGHT OUTER JOIN (
|
||||||
SELECT project_id,grade FROM project_statuses
|
SELECT project_id,grade FROM project_statuses
|
||||||
WHERE project_type = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.id = t.project_id ")
|
WHERE project_type = #{project_type} ORDER BY #{order_by} LIMIT #{limit} ) AS t ON p.id = t.project_id ")
|
||||||
end
|
end
|
||||||
|
|
||||||
def sort_bid_by_hot_rails reward_type, limit = 10
|
def sort_bid_by_hot_rails reward_type, limit = 10
|
||||||
Bid.visible.where('reward_type = ?', reward_type).reorder('bids.commit desc').limit(limit)
|
Bid.visible.where('reward_type = ?', reward_type).reorder('bids.commit desc').limit(limit)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -120,7 +120,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="right" style="float: right; margin-right: -10px; height: 445px; width: 50%; ">
|
<div class="right" style="float: right; margin-right: -10px; height: 445px; width: 50%; ">
|
||||||
<ul class="user-welcome-message-list" style="width: 80%; margin-top: 80px;">
|
<ul class="user-welcome-message-list" style="width: 80%; margin-top: 0px;">
|
||||||
<h3 style="margin-left: -5px;">用户动态</h3>
|
<h3 style="margin-left: -5px;">用户动态</h3>
|
||||||
<div class="user-message-box-list">
|
<div class="user-message-box-list">
|
||||||
<% find_all_activities.each do |event| %>
|
<% find_all_activities.each do |event| %>
|
||||||
|
@ -141,7 +141,6 @@
|
||||||
|
|
||||||
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
<div id="J_Slide" class="d-p-index-box d-p-index-hotproject">
|
||||||
<h2>热门项目</h2>
|
<h2>热门项目</h2>
|
||||||
|
|
||||||
<div class="d-p-projectlist-box">
|
<div class="d-p-projectlist-box">
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %>
|
<% find_all_hot_project.map do |project| break if(project == find_all_hot_project[15]) %>
|
||||||
|
@ -151,10 +150,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div style="float: left; margin-left: 10px; width: 360px;">
|
<div style="float: left; margin-left: 10px; width: 360px;">
|
||||||
<p class="layout">
|
<p class="layout">
|
||||||
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%>
|
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :title => "#{project.name}")%>
|
||||||
|
<span style="display: inline-block; float: right; color: red; background: url('/images/score.png') no-repeat scroll ;background-position: left center;" title="项目得分"> <%= show_grade project %></span>
|
||||||
</p>
|
</p>
|
||||||
<p class="layout-1" >
|
<p class="layout-1" >
|
||||||
<span class="d-p-project-intro" ><%= project.description.truncate(50, omission: '...') %></span>
|
<!-- <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>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -171,7 +172,7 @@
|
||||||
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
|
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
|
||||||
<li style="background-image:none;">
|
<li style="background-image:none;">
|
||||||
<p class="layout">
|
<p class="layout">
|
||||||
<%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{contest.name}")%>
|
<%= link_to( contest.name, respond_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}")%>
|
||||||
</p>
|
</p>
|
||||||
<p class="layout-1" >
|
<p class="layout-1" >
|
||||||
<span class="d-p-project-intro"><%= contest.description.truncate(50, omission: '...') %></span>
|
<span class="d-p-project-intro"><%= contest.description.truncate(50, omission: '...') %></span>
|
||||||
|
@ -190,7 +191,7 @@
|
||||||
<% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %>
|
<% find_all_hot_bid.map do |bid| break if(bid == find_all_hot_bid[5]) %>
|
||||||
<li style="background-image:none;">
|
<li style="background-image:none;">
|
||||||
<p class="layout">
|
<p class="layout">
|
||||||
<%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{bid.name}")%>
|
<%= link_to( bid.name, respond_path(bid.id), :class => "d-g-blue d-p-project-name", :title => "#{bid.name}")%>
|
||||||
</p>
|
</p>
|
||||||
<p class="layout-1" >
|
<p class="layout-1" >
|
||||||
<span class="d-p-project-intro"><%= bid.description.truncate(50, omission: '...') %></span>
|
<span class="d-p-project-intro"><%= bid.description.truncate(50, omission: '...') %></span>
|
||||||
|
@ -208,10 +209,11 @@
|
||||||
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
|
<% find_all_hot_course.map do |project| break if(project == find_all_hot_course[5]) %>
|
||||||
<li style="background-image:none;">
|
<li style="background-image:none;">
|
||||||
<p class="layout">
|
<p class="layout">
|
||||||
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name", :target => "_blank", :title => "#{project.name}")%>
|
<%= link_to( project.name, project_path(project.project_id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}")%>
|
||||||
</p>
|
</p>
|
||||||
<p class="layout-1" >
|
<p class="layout-1" >
|
||||||
<span class="d-p-project-intro"><%= project.description.truncate(50, omission: '...') %></span>
|
<span class="d-p-project-intro"><%= project.description.truncate(50, omission: '...') %></span>
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
|
@ -81,7 +81,7 @@ ul {
|
||||||
}
|
}
|
||||||
|
|
||||||
ul.welcome-message-list{
|
ul.welcome-message-list{
|
||||||
margin-top: 80px;
|
margin-top: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.welcome-message-list h3, .user-welcome-message-list h3 {
|
.welcome-message-list h3, .user-welcome-message-list h3 {
|
||||||
|
|
Loading…
Reference in New Issue