Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
f44c715cfb
|
@ -449,7 +449,7 @@ class BidsController < ApplicationController
|
|||
# 显示作业课程
|
||||
# add by nwb
|
||||
def show_courseEx
|
||||
if (User.current.logged? && User.current.member_of_course?(@bid.courses.first))
|
||||
if (User.current.logged? && (User.current.member_of_course?(@bid.courses.first) || User.current.admin?))
|
||||
# flash[:notice] = ""
|
||||
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))
|
||||
|
||||
|
|
|
@ -256,8 +256,8 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def format_activity_description(text)
|
||||
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')
|
||||
).gsub(/[\r\n]+/, "<br />").html_safe
|
||||
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />").html_safe
|
||||
#h(truncate(text.to_s, :length => 120).gsub(/<\/?.*?>/,"")).html_safe
|
||||
end
|
||||
|
||||
def format_version_name(version)
|
||||
|
|
|
@ -104,7 +104,19 @@ class Course < ActiveRecord::Base
|
|||
|
||||
# 课程的短描述信息
|
||||
def short_description(length = 255)
|
||||
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
end
|
||||
|
||||
def strip_html(html)
|
||||
return html if html.empty? || !html.include?('<')
|
||||
output = ""
|
||||
tokenizer = HTML::Tokenizer.new(html)
|
||||
while token = tokenizer.next
|
||||
node = HTML::Node.parse(nil, 0, 0, token, false)
|
||||
output += token unless (node.kind_of? HTML::Tag) or (token =~ /^<!/)
|
||||
end
|
||||
return output
|
||||
end
|
||||
|
||||
def extra_frozen?
|
||||
|
|
|
@ -562,6 +562,12 @@ class Issue < ActiveRecord::Base
|
|||
@workflow_rule_by_attribute = result if user.nil?
|
||||
result
|
||||
end
|
||||
# 缺陷的短描述信息
|
||||
def short_description(length = 255)
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
end
|
||||
|
||||
private :workflow_rule_by_attribute
|
||||
|
||||
def done_ratio
|
||||
|
@ -1513,4 +1519,6 @@ class Issue < ActiveRecord::Base
|
|||
def be_user_score_new_issue
|
||||
UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -74,6 +74,12 @@ class News < ActiveRecord::Base
|
|||
visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all
|
||||
end
|
||||
|
||||
# 新闻的短描述信息
|
||||
def short_description(length = 255)
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
|
|
|
@ -84,7 +84,8 @@ class OpenSourceProject < ActiveRecord::Base
|
|||
# end
|
||||
|
||||
def short_description(length = 255)
|
||||
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
end
|
||||
|
||||
def applied_by?(user)
|
||||
|
|
|
@ -629,7 +629,8 @@ class Project < ActiveRecord::Base
|
|||
|
||||
# Returns a short description of the projects (first lines)
|
||||
def short_description(length = 255)
|
||||
description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
|
||||
description.gsub(/<\/?.*?>/,"").html_safe if description
|
||||
end
|
||||
|
||||
def css_classes
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%>
|
||||
<% @admin = @course.course_infos%>
|
||||
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
|
||||
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
|
||||
<!-- <%#= @admin.first.user.user_extensions.occupation %> -->
|
||||
<% unless @course.teacher.user_extensions.school.nil? %>
|
||||
<%= link_to @course.teacher.user_extensions.school.try(:name), school_course_list_path(@course.teacher.user_extensions.school) %>
|
||||
<% end %>
|
||||
|
@ -76,6 +76,10 @@
|
|||
|
||||
<div class="add-info" style="margin-left: 30px; margin-top: -20px">
|
||||
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
|
||||
<%# desc = course.short_description.nil? ? "" : course.short_description%>
|
||||
<!--<#div class="brief_introduction" title="<%#= desc.html_safe%>">
|
||||
<%#= desc.html_safe%>
|
||||
</div>-->
|
||||
<%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
<div id="courses-index">
|
||||
<%if @courses%>
|
||||
<%= render_course_hierarchy(@courses)%>
|
||||
<%#= render :partial => 'course', :locals => {:course => @courses.first}%>
|
||||
<%#= "<a herf = 'aaa'>hello</a>".html_safe %>
|
||||
<%end%>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<% end -%>
|
||||
<ul class="list-group-item-meta">
|
||||
<div class="issue-list-description">
|
||||
<%= l(:field_description)%>: <%= issue.description %>
|
||||
<%= l(:field_description)%>: <%= issue.short_description %>
|
||||
</div>
|
||||
</ul>
|
||||
<ul class="list-group-item-meta">
|
||||
|
|
|
@ -18,18 +18,40 @@
|
|||
|
||||
<div class="information">
|
||||
<p class="stats">
|
||||
<strong><span style="font-size: 17px;margin-left: 145px"><%= link_to @project.watcher_users.count, project_watcherlist_path(project)%></span></strong>
|
||||
<table style="padding-left: 100px">
|
||||
<tr>
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;">
|
||||
<strong><%= link_to @project.watcher_users.count, project_watcherlist_path(project)%></strong>
|
||||
</td>
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<strong><span style="font-size: 17px;margin-left: 145px"><%= link_to "#{@project.members.count}", project_member_path(@project)%></span></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;">
|
||||
<strong><%= link_to "#{@project.members.count}", project_member_path(@project)%></strong>
|
||||
</td>
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %><%= content_tag('span', l(:label_since_last_commits)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %><%= content_tag('span', l(:label_commit_on)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
|
||||
<strong><%= content_tag('span', "#{(@project.repository.nil? || @project.repository.changesets[0].nil?) ? '0' : distance_of_time_in_words(Time.now, @project.repository.changesets[0].committed_on)}", :class => "info") %></strong>
|
||||
</td>
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_since_last_commits)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
|
||||
<strong><%= content_tag('span', "#{@project.repository.nil? || @project.project_status.nil? ? '0' : @project.project_status.changesets_count }", :class => "info") %></strong>
|
||||
</td>
|
||||
<td style="width: 60%;text-align: left">
|
||||
<%= content_tag('span', l(:label_commit_on)) %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -71,7 +71,9 @@
|
|||
<p>
|
||||
|
||||
<%= link_to "全部学校",school_index_path %>
|
||||
<% if User.current.logged? %>
|
||||
<a href="http://course.trustie.net">我的学校</a>
|
||||
<% end %>
|
||||
</p>
|
||||
<ul>
|
||||
<li style="width: 40%; float: left">请选择省份:
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description">
|
||||
<%= membership.course.description %>
|
||||
<%= membership.course.short_description %>
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
<% when 'JournalsForMessage' %>
|
||||
<% if User.current.login == e.user.try(:login) %>
|
||||
<%# if e.user_id == act.jour.id %>
|
||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %><%=
|
||||
link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
||||
<tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_have_feedback) %>
|
||||
<%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
|
||||
<%# else %>
|
||||
<!-- <tr><td colspan="2" valign="top" class="font_lighter"><strong><%#= link_to("#{e.user.name}", user_path(e.user_id)) %> 给 <%#= link_to("#{act.at_user.name if act.at_user}", user_path(act.jour.id)) %> 留言了</strong> </td></tr> -->
|
||||
<%# end %>
|
||||
|
@ -92,7 +92,7 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.description.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -109,7 +109,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to( l(:label_activity_project)+act.issue.project.name, project_path(act.issue.project.identifier))%> <%= link_to format_activity_title("#{act.issue.tracker} ##{act.issue.id}: #{act.issue.subject}"), {:controller => 'issues', :action => 'show', :id => act.issue.id, :anchor => "change-#{act.id}"} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.notes %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.notes.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -126,7 +126,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title(act.title), {:controller => 'repositories', :action => 'revision', :id => act.repository.project, :repository_id => act.repository.identifier_param, :rev => act.identifier} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.long_comments %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.long_comments.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -177,7 +177,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= h act.description %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= act.description.html_safe %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
@ -193,7 +193,7 @@
|
|||
<td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= textilizable act.description %> </p></td> </tr>
|
||||
<tr> <td colspan="2" width="580" > <p class="font_description"> <%= textilizable(act.description) %> </p></td> </tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
<!-- <tr><div class="line_under"></div></tr> -->
|
||||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</table><% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<tr>
|
||||
<td colspan="2" width="580" >
|
||||
<p class="font_description">
|
||||
<%= membership.project.description%>
|
||||
<%= membership.project.short_description%>
|
||||
</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
<ul class="d-p-projectlist">
|
||||
<% projects = find_miracle_project(10, 3) %>
|
||||
<% projects.map do |project| %>
|
||||
<!--<% cache cache_key_for_project(project) do %> -->
|
||||
<!--<%# cache cache_key_for_project(project) do %> -->
|
||||
<li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
|
||||
<div style="float: left;">
|
||||
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
|
||||
|
@ -73,43 +73,43 @@
|
|||
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
|
||||
</div>
|
||||
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; width: 380px;">
|
||||
<span class='font_lighter' title =<%=project.description.to_s%>><%=project.description.truncate(50, omission: '...')%></span>
|
||||
<span class='font_lighter' title =<%=project.short_description.to_s%>><%=project.short_description.truncate(50, omission: '...')%></span>
|
||||
</div>
|
||||
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
|
||||
<% issue_count = project.issues.count %>
|
||||
<% issue_journal_count = project.issue_changes.count %>
|
||||
<% issue_score = issue_count * 0.2 %>
|
||||
<% issue_journal_score = issue_journal_count * 0.1 %>
|
||||
<% finall_issue_score = issue_score + issue_journal_score %>
|
||||
<%# issue_count = project.issues.count %>
|
||||
<%# issue_journal_count = project.issue_changes.count %>
|
||||
<%# issue_score = issue_count * 0.2 %>
|
||||
<%# issue_journal_score = issue_journal_count * 0.1 %>
|
||||
<%# finall_issue_score = issue_score + issue_journal_score %>
|
||||
|
||||
<% new_count = project.news.count %>
|
||||
<% new_score = new_count * 0.1 %>
|
||||
<% finall_new_score = new_score %>
|
||||
<%# new_count = project.news.count %>
|
||||
<%# new_score = new_count * 0.1 %>
|
||||
<%# finall_new_score = new_score %>
|
||||
|
||||
<% document_count = project.documents.count %>
|
||||
<% file_score = document_count * 0.1 %>
|
||||
<% finall_file_score = file_score %>
|
||||
<%# document_count = project.documents.count %>
|
||||
<%# file_score = document_count * 0.1 %>
|
||||
<%# finall_file_score = file_score %>
|
||||
|
||||
<% changeset_count = project.changesets.count %>
|
||||
<% code_submit_score = changeset_count * 0.3 %>
|
||||
<% finall_code_submit_score = code_submit_score %>
|
||||
<%# changeset_count = project.changesets.count %>
|
||||
<%# code_submit_score = changeset_count * 0.3 %>
|
||||
<%# finall_code_submit_score = code_submit_score %>
|
||||
|
||||
<% board_message_count = 0 %>
|
||||
<% project.boards.each do |board| %>
|
||||
<% board_message_count += board.messages_count %>
|
||||
<% end %>
|
||||
<% topic_score = board_message_count * 0.1 %>
|
||||
<% finall_topic_score = topic_score %>
|
||||
<%# board_message_count = 0 %>
|
||||
<%# project.boards.each do |board| %>
|
||||
<%# board_message_count += board.messages_count %>
|
||||
<%# end %>
|
||||
<%# topic_score = board_message_count * 0.1 %>
|
||||
<%# finall_topic_score = topic_score %>
|
||||
|
||||
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
|
||||
<%= content_tag "span", l(:label_project_score)+ ":" + format("%.2f" , finall_project_score ),
|
||||
<%# finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_score + topic_score %>
|
||||
<%= content_tag "span", l(:label_project_score)+ ":" + project_score(project),
|
||||
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
|
||||
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
|
||||
:class => "tooltip",
|
||||
:id => "tooltip-#{project.id}" %>
|
||||
</div>
|
||||
</li>
|
||||
<!--<%end %> -->
|
||||
<!--<%#end %> -->
|
||||
<% end; reset_cycle %>
|
||||
</ul>
|
||||
</div>
|
||||
|
@ -122,7 +122,7 @@
|
|||
<div class="user-message-box-list" style="margin-top: 10px;">
|
||||
<%activities = find_all_activities%>
|
||||
<% activities.each do |event| %>
|
||||
<!--<% cache cache_key_for_event(event) do %> -->
|
||||
<!--<%# cache cache_key_for_event(event) do %> -->
|
||||
<li style="display: block;height:60px; padding-bottom: 4px;">
|
||||
<div class="inner-right" style="float: left; height: 100%; ">
|
||||
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
|
||||
|
@ -133,7 +133,7 @@
|
|||
<p style="margin-top: 4px;"><span style="color: rgb(172, 174, 177)"><%= l(:field_updated_on) %><%= time_tag_welcome event.event_datetime %>前</span> <span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p>
|
||||
</div>
|
||||
</li>
|
||||
<!--<%end %> --><!-- cache -->
|
||||
<!--<%#end %> --><!-- cache -->
|
||||
<% end %>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue