Conflicts:
	db/schema.rb
This commit is contained in:
nwb 2014-07-14 11:32:01 +08:00
commit 0950ac2329
46 changed files with 586 additions and 125 deletions

View File

@ -234,4 +234,96 @@ class AdminController < ApplicationController
format.api format.api
end end
end end
#首页定制
def first_page_made
if request.get?
@first_page = FirstPage.where("page_type = 'project'").first
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@first_page.web_title = params[:web_title]
@first_page.description = params[:description]
@first_page.title = params[:title]
if @first_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_first_page_made_path
}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
first_page_made
render :action => 'first_page_made'
}
format.api { render_validation_errors(@first_page) }
end
end
end
end
def course_page_made
if request.get?
@course_page = FirstPage.where("page_type = 'course'").first
@first_page = FirstPage.where("page_type = 'project'").first
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@course_page = FirstPage.where("page_type = 'course'").first
@first_page.web_title = params[:web_title]
@course_page.title = params[:course_title]
@course_page.description = params[:course_description]
if @first_page.save && @course_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_course_page_made_path
}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
course_page_made
render :action => 'course_page_made'
}
format.api { render_validation_errors(@first_page) }
format.api { render_validation_errors(@course_page) }
end
end
end
end
def contest_page_made
if request.get?
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page = FirstPage.where("page_type = 'project'").first
elsif request.post?
@first_page = FirstPage.where("page_type = 'project'").first
@contest_page = FirstPage.where("page_type = 'contest'").first
@first_page.web_title = params[:web_title]
@contest_page.title = params[:contest_title]
@contest_page.description = params[:contest_description]
if @first_page.save && @contest_page.save
respond_to do |format|
format.html {
flash[:notice] = l(:notice_successful_update)
redirect_to admin_contest_page_made_path
}
format.api { render_api_ok }
end
else
respond_to do |format|
format.html {
contest_page_made
render :action => 'contest_page_made'
}
format.api { render_validation_errors(@first_page) }
format.api { render_validation_errors(@contest_page) }
end
end
end
end
end end

View File

@ -449,7 +449,7 @@ class BidsController < ApplicationController
# 显示作业课程 # 显示作业课程
# add by nwb # add by nwb
def show_courseEx 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] = "" # flash[:notice] = ""
@membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current)) @membership = User.current.coursememberships.all(:conditions => Course.visible_condition(User.current))

View File

@ -16,12 +16,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class WelcomeController < ApplicationController class WelcomeController < ApplicationController
include ApplicationHelper
caches_action :robots caches_action :robots
# before_filter :fake, :only => [:index, :course] # before_filter :fake, :only => [:index, :course]
before_filter :entry_select, :only => [:index] before_filter :entry_select, :only => [:index]
def index def index
@first_page = FirstPage.where("page_type = 'project'").first
end end
def robots def robots
@ -30,6 +31,7 @@ class WelcomeController < ApplicationController
end end
def course def course
@course_page = FirstPage.where("page_type = 'course'").first
if params[:school_id] if params[:school_id]
@school_id = params[:school_id] @school_id = params[:school_id]
elsif User.current.logged? && User.current.user_extensions.school elsif User.current.logged? && User.current.user_extensions.school
@ -41,13 +43,24 @@ class WelcomeController < ApplicationController
def logolink() def logolink()
@course_page = FirstPage.where("page_type = 'course'").first
logo = get_avatar?(@course_page)
id = params[:school_id] id = params[:school_id]
logo_link = "" logo_link = ""
if id.nil? and User.current.user_extensions.school.nil? if id.nil? && User.current.user_extensions.school.nil?
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png' logo_link = '/images/transparent.png'
end
else else
if id == "0" if id == "0"
if logo
logo_link = url_to_avatar(@course_page)
else
logo_link = '/images/transparent.png' logo_link = '/images/transparent.png'
end
else else
if id.nil? if id.nil?
if School.find(User.current.user_extensions.school.id).logo_link.nil? if School.find(User.current.user_extensions.school.id).logo_link.nil?
@ -66,7 +79,7 @@ class WelcomeController < ApplicationController
def contest def contest
@contest_page = FirstPage.where("page_type = 'contest'").first
end end
def search def search

View File

@ -256,8 +256,8 @@ module ApplicationHelper
end end
def format_activity_description(text) def format_activity_description(text)
h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...') h(truncate(text.to_s, :length => 120).gsub(%r{[\r\n]*<(pre|code)>.*$}m, '...')).gsub(/[\r\n]+/, "<br />").html_safe
).gsub(/[\r\n]+/, "<br />").html_safe #h(truncate(text.to_s, :length => 120).gsub(/<\/?.*?>/,"")).html_safe
end end
def format_version_name(version) def format_version_name(version)
@ -625,10 +625,15 @@ module ApplicationHelper
end end
def html_title(*args) def html_title(*args)
first_page = FirstPage.where("page_type = 'project'").first
if args.empty? if args.empty?
title = @html_title || [] title = @html_title || []
title << @project.name if @project title << @project.name if @project
if first_page.nil? || first_page.web_title.nil?
title << Setting.app_title unless Setting.app_title == title.last title << Setting.app_title unless Setting.app_title == title.last
else
title << first_page.web_title unless first_page.web_title == title.last
end
title.select {|t| !t.blank? }.join(' - ') title.select {|t| !t.blank? }.join(' - ')
else else
@html_title ||= [] @html_title ||= []

View File

@ -104,7 +104,19 @@ class Course < ActiveRecord::Base
# 课程的短描述信息 # 课程的短描述信息
def short_description(length = 255) 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 end
def extra_frozen? def extra_frozen?

3
app/models/first_page.rb Normal file
View File

@ -0,0 +1,3 @@
class FirstPage < ActiveRecord::Base
attr_accessible :description, :title, :web_title,:page_type
end

View File

@ -562,6 +562,12 @@ class Issue < ActiveRecord::Base
@workflow_rule_by_attribute = result if user.nil? @workflow_rule_by_attribute = result if user.nil?
result result
end 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 private :workflow_rule_by_attribute
def done_ratio def done_ratio
@ -1513,4 +1519,6 @@ class Issue < ActiveRecord::Base
def be_user_score_new_issue def be_user_score_new_issue
UserScore.project(:post_issue, User.current,self, { issue_id: self.id }) UserScore.project(:post_issue, User.current,self, { issue_id: self.id })
end end
end end

View File

@ -74,6 +74,12 @@ class News < ActiveRecord::Base
visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all visible(user).includes([:author, :project]).order("#{News.table_name}.created_on DESC").limit(count).all
end end
# 新闻的短描述信息
def short_description(length = 255)
description.gsub(/<\/?.*?>/,"").html_safe if description
#description.gsub(/^(.{#{length}}[^\n\r]*).*$/m, '\1...').strip if description
end
private private
def add_author_as_watcher def add_author_as_watcher

View File

@ -84,7 +84,8 @@ class OpenSourceProject < ActiveRecord::Base
# end # end
def short_description(length = 255) 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 end
def applied_by?(user) def applied_by?(user)

View File

@ -629,7 +629,8 @@ class Project < ActiveRecord::Base
# Returns a short description of the projects (first lines) # Returns a short description of the projects (first lines)
def short_description(length = 255) 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 end
def css_classes def css_classes

View File

@ -0,0 +1,39 @@
<h3><%=l(:label_first_page_made)%></h3>
<%= form_tag(:controller => 'admin', :action => 'contest_page_made') do %>
<p style="margin-left:60px;padding-right: 20px;">
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} , :class => 'selected'%></li>
</ul>
</div>
<h4><%=l(:label_contest_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@contest_page} %>
</div>
<p style="margin-left:60px;padding-right: 20px;">
<label for='contest_title'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_title) %>:</label>
<%= text_field_tag 'contest_title', params[:label_site_title], :value => @contest_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label for='contest_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_site_description)%>:</label>
<%= text_area_tag 'contest_description',@contest_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>
</div>

View File

@ -0,0 +1,37 @@
<h3><%=l(:label_first_page_made)%></h3>
<%= form_tag(:controller => 'admin', :action => 'course_page_made') do %>
<p style="margin-left:60px;padding-right: 20px;">
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'} %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'}, :class => 'selected' %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
</ul>
</div>
<h4><%=l(:label_course_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@course_page} %>
</div>
<p style="margin-left:60px;padding-right: 20px;">
<label for='course_title'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_title) %>:</label>
<%= text_field_tag 'course_title', params[:label_site_title], :value => @course_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label for='course_description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_site_description)%>:</label>
<%= text_area_tag 'course_description',@course_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>
</div>

View File

@ -0,0 +1,38 @@
<h3><%=l(:label_first_page_made)%></h3>
<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
<p style="margin-left:60px;padding-right: 20px;">
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<div class="tabs">
<ul>
<li><%= link_to l(:label_project_first_page), {:action => 'first_page_made'}, :class => 'selected' %></li>
<li><%= link_to l(:label_course_first_page), {:action => 'course_page_made'} %></li>
<li><%= link_to l(:label_contest_first_page), {:action => 'contest_page_made'} %></li>
</ul>
</div>
<h4><%=l(:label_project_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
</div>
<p style="margin-left:60px;padding-right: 20px;">
<label for='title'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_title) %>:</label>
<%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label for='description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_site_description)%>:</label>
<%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>
</div>

View File

@ -0,0 +1,31 @@
<h3><%=l(:label_first_page_made)%></h3>
<%= form_tag(:controller => 'admin', :action => 'first_page_made') do %>
<p style="margin-left:60px;padding-right: 20px;">
<label for='web_title'><%= l(:label_web_title) %>:</label>
<%= text_field_tag 'web_title', params[:wbe_title],:value => @first_page.web_title, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<h4><%=l(:label_project_first_page)%></h4>
<p style="margin-left:60px;padding-right: 20px;">
<label for='attachments_fields'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_image) %>:</label>
</p>
<div style="margin-left: 82px;">
<%= render :partial=>"avatar/avatar_form",:style => "display:inline",:locals=> {source:@first_page} %>
</div>
<p style="margin-left:60px;padding-right: 20px;">
<label for='title'>&nbsp;&nbsp;&nbsp;<%= l(:label_site_title) %>:</label>
<%= text_field_tag 'title', params[:label_site_title], :value => @first_page.title,:size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<p style="margin-left:60px;padding-right: 20px;">
<label for='description' style="vertical-align: top">&nbsp;&nbsp;&nbsp;<%= l(:label_site_description)%>:</label>
<%= text_area_tag 'description',@first_page.description,:rows => 8, :size => 30,:style => "font-size:small;width:490px;margin-left:10px;" %>
</p>
<%= submit_tag l(:button_save), :class => "small", :name => nil %>
<% end %>
<div>
</div>

View File

@ -45,6 +45,7 @@
<a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;"> <a href="javascript:void(0);" class="btn_addPic" style="text-decoration:none;">
<span><%= l(:button_upload_photo) %></span> <span><%= l(:button_upload_photo) %></span>
</a> </a>
<!-- :accept => 'image/png,image/gif,image/jpeg', -->
<span class="add_avatar" style="margin-left: -55px;width: 70px"> <span class="add_avatar" style="margin-left: -55px;width: 70px">
<%= file_field_tag 'avatar[image]', <%= file_field_tag 'avatar[image]',
:id => nil, :id => nil,
@ -57,6 +58,8 @@
:max_file_size => Setting.attachment_max_size.to_i.kilobytes, :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)), :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i, :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
:file_type => Redmine::Configuration['pic_types'].to_s,
:type_support_message => l(:error_pic_type),
:upload_path => upload_avatar_path(:format => 'js'), :upload_path => upload_avatar_path(:format => 'js'),
:description_placeholder => nil ,# l(:label_optional_description) :description_placeholder => nil ,# l(:label_optional_description)
:source_type => source.class.to_s, :source_type => source.class.to_s,

View File

@ -2,11 +2,19 @@
<% contests.each do |contest|%> <% contests.each do |contest|%>
<table width="95%" border="0" style="padding-left: 10px; padding-top: 10px;"> <table width="95%" border="0" style="padding-left: 10px; padding-top: 10px;">
<tr> <tr>
<td colspan="2" valign="top" width="50" ><%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'), user_path(contest.author), :class => "avatar") %></td> <td colspan="2" valign="top" width="50" >
<% unless contest.author.nil? %>
<%= link_to(image_tag(url_to_avatar(contest.author), :class => 'avatar'), user_path(contest.author), :class => "avatar") %>
<% end %>
</td>
<td> <td>
<table width="100%" border="0"> <table width="100%" border="0">
<tr> <tr>
<td colspan="2" valign="top"><strong><%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>: &nbsp;<%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %></strong></td> <td colspan="2" valign="top"><strong>
<% unless contest.author.nil? %>
<%= link_to(contest.author, user_path(contest.author), :class => 'bid_user') %>:
<% end %>
&nbsp;<%= link_to(contest.name, show_contest_contest_path(contest), :class => 'bid_path', :target => "_blank") %></strong></td>
</tr> </tr>
<tr> <tr>
<td width="500"> <td width="500">

View File

@ -16,7 +16,7 @@
<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%> <%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%>
<% @admin = @course.course_infos%> <% @admin = @course.course_infos%>
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%> <%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? %> <% 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) %> <%= link_to @course.teacher.user_extensions.school.try(:name), school_course_list_path(@course.teacher.user_extensions.school) %>
<% end %> <% end %>
@ -76,6 +76,10 @@
<div class="add-info" style="margin-left: 30px; margin-top: -20px"> <div class="add-info" style="margin-left: 30px; margin-top: -20px">
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %> <%= 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 %> <%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
</div> </div>

View File

@ -35,6 +35,8 @@
<div id="courses-index"> <div id="courses-index">
<%if @courses%> <%if @courses%>
<%= render_course_hierarchy(@courses)%> <%= render_course_hierarchy(@courses)%>
<%#= render :partial => 'course', :locals => {:course => @courses.first}%>
<%#= "<a herf = 'aaa'>hello</a>".html_safe %>
<%end%> <%end%>
</div> </div>

View File

@ -3,7 +3,11 @@
<% if forums.any? %> <% if forums.any? %>
<% forums.each do |forum| %> <% forums.each do |forum| %>
<div class="forums-index"> <div class="forums-index">
<div class="forums-inex-avatar"><%= link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator) %></div> <div class="forums-inex-avatar">
<% unless forum.creator.nil? %>
<%= link_to image_tag(url_to_avatar(forum.creator), :class => "avatar"), user_path(forum.creator) %>
<% end %>
</div>
<div class="forums-index-content"> <div class="forums-index-content">
<p ><%= link_to h(forum.name), forum_path(forum) %></p> <p ><%= link_to h(forum.name), forum_path(forum) %></p>
<p ><%= forum.description%></p> <p ><%= forum.description%></p>

View File

@ -38,7 +38,7 @@
<% end -%> <% end -%>
<ul class="list-group-item-meta"> <ul class="list-group-item-meta">
<div class="issue-list-description"> <div class="issue-list-description">
<%= l(:field_description)%>:&nbsp;<%= issue.description %> <%= l(:field_description)%>:&nbsp;<%= issue.short_description %>
</div> </div>
</ul> </ul>
<ul class="list-group-item-meta"> <ul class="list-group-item-meta">

View File

@ -18,18 +18,40 @@
<div class="information"> <div class="information">
<p class="stats"> <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)) %> <%= content_tag('span', l(:label_x_follow_people,:count =>@project.watcher_users.count)) %>
</p> </td>
<p class="stats"> </tr>
<strong><span style="font-size: 17px;margin-left: 145px"><%= link_to "#{@project.members.count}", project_member_path(@project)%></span></strong> <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)) %> <%= content_tag('span', l(:label_x_current_contributors, :count => @project.users.count)) %>
</p> </td>
<p class="stats"> </tr>
<%= 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)) %> <tr>
</p> <td style="width: 40%;text-align: right;font-size: 17px;color: rgb(17, 102, 153)">
<p class="stats"> <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>
<%= 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>
<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> </p>
</div> </div>
<% end %> <% end %>

View File

@ -71,7 +71,9 @@
<p> <p>
<%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% if User.current.logged? %>
<a href="http://course.trustie.net">我的学校</a> <a href="http://course.trustie.net">我的学校</a>
<% end %>
</p> </p>
<ul> <ul>
<li style="width: 40%; float: left">请选择省份: <li style="width: 40%; float: left">请选择省份:

View File

@ -32,7 +32,7 @@
<tr> <tr>
<td colspan="2" width="580"> <td colspan="2" width="580">
<p class="font_description"> <p class="font_description">
<%= membership.course.description %> <%= membership.course.short_description %>
</p></td> </p></td>
</tr> </tr>
<tr> <tr>

View File

@ -28,7 +28,7 @@
<div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> + <div> = <%= l(:label_user_score_of_collaboration) %> + <%= l(:label_user_score_of_influence) %> +
<%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div> <%= l(:label_user_score_of_skill)%> + <%= l(:label_user_score_of_active) %></div>
<!-- <div>&nbsp;&nbsp;&nbsp;+ <%= l(:label_user_score_of_influence) %></div> --> <!-- <div>&nbsp;&nbsp;&nbsp;+ <%= l(:label_user_score_of_influence) %></div> -->
<div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_f %> <div> = <%= format("%.2f" ,@user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %> + <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence ).to_i %>
+ <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %></div> + <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %> + <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %></div>
<div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_f %></div> <div> = <%= format("%.2f" ,@user.user_score_attr.total_score.nil? ? 0:@user.user_score_attr.total_score).to_i %></div>
<!-- end --> <!-- end -->

View File

@ -38,7 +38,7 @@
<td> <td>
<table> <table>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr> <tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_f %></span></td></tr> <tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_i %></span></td></tr>
</table> </table>
</td> </td>
</tr> </tr>
@ -49,23 +49,23 @@
<table style="border-bottom: solid 0px #80a6d2;" width="100%"> <table style="border-bottom: solid 0px #80a6d2;" width="100%">
<tr> <tr>
<%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> : <%= link_to l(:label_user_score) , {:controller => 'users', :action => 'score_new_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %> <%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> : <%= link_to l(:label_user_score_of_collaboration), {:controller => 'users',:action => 'topic_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> : <%= link_to l(:label_user_score_of_influence), {:controller => 'users',:action => 'project_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %> <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> : <%= link_to l(:label_user_score_of_skill), {:controller => 'users',:action => 'activity_new_score_index', :remote => true} %> :
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %> <%= link_to l(:label_user_score_of_active), {:controller => 'users',:action => 'influence_new_score_index', :remote => true} %>
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %> <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
</tr><br> </tr><br>
</table> </table>

View File

@ -1,5 +1,5 @@
<%= l(:label_user_grade)%>: <%= l(:label_user_grade)%>:
<%= link_to(format("%.2f" , user.user_score_attr.total_score).to_f, {:controller => 'users', <%= link_to(format("%.2f" , user.user_score_attr.total_score).to_i, {:controller => 'users',
:action => 'show_new_score', :action => 'show_new_score',
:remote => true, :remote => true,
:id => user.id :id => user.id

View File

@ -52,8 +52,8 @@
<% when 'JournalsForMessage' %> <% when 'JournalsForMessage' %>
<% if User.current.login == e.user.try(:login) %> <% if User.current.login == e.user.try(:login) %>
<%# if e.user_id == act.jour.id %> <%# 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>&nbsp;<span class="font_lighter"><%= l(:label_have_feedback) %><%= <tr><td colspan="2" valign="top"><strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong>&nbsp;<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> <%= link_to("#{e.act.user.name}", user_path(e.act.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %></span></td></tr>
<%# else %> <%# 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>&nbsp;</td></tr> --> <!-- <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>&nbsp;</td></tr> -->
<%# end %> <%# end %>
@ -92,7 +92,7 @@
<% end %> <% end %>
<% end %> <% end %>
</tr> </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> <tr>
<td> <td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a"> <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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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> <td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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 %> <% end %>
</tr> </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> <tr>
<td> <td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a"> <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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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> <td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= 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 %> <% end %>
</tr> </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> <tr>
<td> <td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a"> <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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td> <td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{l(:label_news)}: #{act.title}"), {:controller => 'news', :action => 'show', :id => act.id} %></td>
<% end %> <% end %>
</tr> </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> <tr>
<td> <td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a"> <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>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td> <td colspan="2" valign="top"><strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong>&nbsp;<span class="font_lighter"><%= l(:label_new_activity) %></span>&nbsp;<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %></td>
<% end %> <% end %>
</tr> </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> <tr>
<td> <td>
<div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a"> <div style="display: inline-block; float: left; margin-top: 0px" width="200" align="right" class="a">

View File

@ -53,7 +53,7 @@
<td> <td>
<table> <table>
<tr class="info_font"><td><%= l(:label_user_score) %></td></tr> <tr class="info_font"><td><%= l(:label_user_score) %></td></tr>
<tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_f %></span></td></tr> <tr class="buttons_for_score" style="margin-top:30px;margin-left:144px"><td><span style="color:#ec6300"><%= format("%.2f" , @user.user_score_attr.total_score).to_i %></span></td></tr>
</table> </table>
</td> </td>
</tr> </tr>
@ -64,23 +64,23 @@
<table style="border-bottom: solid 0px #80a6d2;" width="100%"> <table style="border-bottom: solid 0px #80a6d2;" width="100%">
<tr> <tr>
<%= l(:label_user_score) %> : <%= l(:label_user_score) %> :
<%= format("%.2f" , @user.user_score_attr.total_score).to_f %> <%= format("%.2f" , @user.user_score_attr.total_score).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= l(:label_user_score_of_collaboration) %> : <%= l(:label_user_score_of_collaboration) %> :
<%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_f %> <%= format("%.2f" , @user.user_score_attr.collaboration.nil? ? 0:@user.user_score_attr.collaboration).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= l(:label_user_score_of_influence) %> : <%= l(:label_user_score_of_influence) %> :
<%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_f %> <%= format("%.2f" , @user.user_score_attr.influence.nil? ? 0:@user.user_score_attr.influence).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= l(:label_user_score_of_skill) %> : <%= l(:label_user_score_of_skill) %> :
<%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_f %> <%= format("%.2f" , @user.user_score_attr.skill.nil? ? 0:@user.user_score_attr.skill).to_i %>
</tr><br> </tr><br>
<tr> <tr>
<%= l(:label_user_score_of_active) %> <%= l(:label_user_score_of_active) %>
<%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_f %> <%= format("%.2f" , @user.user_score_attr.active.nil? ? 0:@user.user_score_attr.active).to_i %>
</tr><br> </tr><br>
</table> </table>

View File

@ -40,7 +40,8 @@
<!-- <tr><div class="line_under"></div></tr> --> <!-- <tr><div class="line_under"></div></tr> -->
</table></td> </table></td>
</tr> </tr>
</table>
<% end %> <% end %>
</table><% end %> <% end %>
</div> </div>
<% end %> <% end %>

View File

@ -30,7 +30,7 @@
<tr> <tr>
<td colspan="2" width="580" > <td colspan="2" width="580" >
<p class="font_description"> <p class="font_description">
<%= membership.project.description%> <%= membership.project.short_description%>
</p></td> </p></td>
</tr> </tr>
<tr> <tr>

View File

@ -114,11 +114,16 @@
<div class="main-content-bar" id="main-content-bar"> <div class="main-content-bar" id="main-content-bar">
<!--文字--> <!--文字-->
<div style="float: left"> <div style="float: left">
<% if get_avatar?(@contest_page) %>
<%= image_tag(url_to_avatar(@contest_page), size: "75x75") %>
<% else %>
<%= image_tag '/images/transparent.png', size: "75x75" %> <%= image_tag '/images/transparent.png', size: "75x75" %>
<% end %>
</div> </div>
<div class="welcome_left" id="welcome_left"> <div class="welcome_left" id="welcome_left">
<% unless @contest_page.nil? %>
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %>&nbsp;<%= l(:label_welcome_trustie_contest) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_contest_description) %></span> <span class="font_welcome_trustie"><%= @contest_page.title %></span> <span class="font_welcome_tdescription">, <%= @contest_page.description %></span>
<% end %>
</div> </div>
<!--搜索框--> <!--搜索框-->

View File

@ -51,12 +51,15 @@
<% end %> <% end %>
<% end %> <% end %>
<% end %> </span> <% end %> </span>
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %> </span> <% unless @course_page.nil? %>
<span class="font_welcome_trustie"><%= @course_page.title %> </span>
<% if @school_id.nil? and User.current.user_extensions.school.nil? %> <% if @school_id.nil? and User.current.user_extensions.school.nil? %>
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span> <span class="font_welcome_tdescription">, <%= @course_page.description %></span>
<% else %> <% else %>
<% if @school_id == "0" %> <% if @school_id == "0" %>
<span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_course_description) %></span> <span class="font_welcome_tdescription">, <%= @course_page.description %></span>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
</div> </div>

View File

@ -33,10 +33,18 @@
</div> </div>
<div class="main-content-bar" id="main-content-bar"> <div class="main-content-bar" id="main-content-bar">
<div style="float: left"> <div style="float: left">
<!-- <#%= image_tag(get_project_avatar(@first_page), size: "75x75") %> -->
<% if get_avatar?(@first_page) %>
<%= image_tag(url_to_avatar(@first_page), size: "75x75") %>
<% else %>
<%= image_tag '/images/transparent.png', size: "75x75" %> <%= image_tag '/images/transparent.png', size: "75x75" %>
<% end %>
</div> </div>
<div class="welcome_left" id="welcome_left"> <div class="welcome_left" id="welcome_left">
<span class="font_welcome_trustie"><%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_project) %></span> <span class="font_welcome_tdescription">, <%= l(:label_welcome_trustie_project_description) %></span> <% unless @first_page.nil? %>
<span class="font_welcome_trustie"><%= @first_page.title %></span> <span class="font_welcome_tdescription">, <%= @first_page.description %></span>
<% end %>
</div> </div>
<div class="search-bar" id="search-bar"> <div class="search-bar" id="search-bar">
<%= render :partial => "search_project", :locals => {:project_type => 0}%> <%= render :partial => "search_project", :locals => {:project_type => 0}%>
@ -54,7 +62,7 @@
<ul class="d-p-projectlist"> <ul class="d-p-projectlist">
<% projects = find_miracle_project(10, 3) %> <% projects = find_miracle_project(10, 3) %>
<% projects.map do |project| %> <% 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") %>'> <li style="position:relative;height:6em;" class='<%= cycle("odd", "even") %>'>
<div style="float: left;"> <div style="float: left;">
<%= image_tag(get_project_avatar(project), :class => "avatar-4") %> <%= image_tag(get_project_avatar(project), :class => "avatar-4") %>
@ -65,43 +73,43 @@
(<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>) (<%= link_to "#{projectCount(project)}人", project_member_path(project) ,:course =>'0' %>)
</div> </div>
<div class='text_nowrap' style="float: left;margin:5px; margin-left: 10px; width: 380px;"> <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>
<div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;"> <div style="position:absolute; bottom:0;right:0;margin:5px 10px 5px 5px ;">
<% issue_count = project.issues.count %> <%# issue_count = project.issues.count %>
<% issue_journal_count = project.issue_changes.count %> <%# issue_journal_count = project.issue_changes.count %>
<% issue_score = issue_count * 0.2 %> <%# issue_score = issue_count * 0.2 %>
<% issue_journal_score = issue_journal_count * 0.1 %> <%# issue_journal_score = issue_journal_count * 0.1 %>
<% finall_issue_score = issue_score + issue_journal_score %> <%# finall_issue_score = issue_score + issue_journal_score %>
<% new_count = project.news.count %> <%# new_count = project.news.count %>
<% new_score = new_count * 0.1 %> <%# new_score = new_count * 0.1 %>
<% finall_new_score = new_score %> <%# finall_new_score = new_score %>
<% document_count = project.documents.count %> <%# document_count = project.documents.count %>
<% file_score = document_count * 0.1 %> <%# file_score = document_count * 0.1 %>
<% finall_file_score = file_score %> <%# finall_file_score = file_score %>
<% changeset_count = project.changesets.count %> <%# changeset_count = project.changesets.count %>
<% code_submit_score = changeset_count * 0.3 %> <%# code_submit_score = changeset_count * 0.3 %>
<% finall_code_submit_score = code_submit_score %> <%# finall_code_submit_score = code_submit_score %>
<% board_message_count = 0 %> <%# board_message_count = 0 %>
<% project.boards.each do |board| %> <%# project.boards.each do |board| %>
<% board_message_count += board.messages_count %> <%# board_message_count += board.messages_count %>
<% end %> <%# end %>
<% topic_score = board_message_count * 0.1 %> <%# topic_score = board_message_count * 0.1 %>
<% finall_topic_score = topic_score %> <%# finall_topic_score = topic_score %>
<% finall_project_score = finall_issue_score + finall_new_score + finall_file_score + finall_code_submit_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 ), <%= content_tag "span", l(:label_project_score)+ ":" + project_score(project),
:style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ", :style => "cursor: pointer; display: inline-block; float: right; color: #ec6300; ",
:title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度", :title => "项目得分,综合考虑了项目的各项活动,反映了该项目的活跃程度",
:class => "tooltip", :class => "tooltip",
:id => "tooltip-#{project.id}" %> :id => "tooltip-#{project.id}" %>
</div> </div>
</li> </li>
<!--<%end %> --> <!--<%#end %> -->
<% end; reset_cycle %> <% end; reset_cycle %>
</ul> </ul>
</div> </div>
@ -114,7 +122,7 @@
<div class="user-message-box-list" style="margin-top: 10px;"> <div class="user-message-box-list" style="margin-top: 10px;">
<%activities = find_all_activities%> <%activities = find_all_activities%>
<% activities.each do |event| %> <% 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;"> <li style="display: block;height:60px; padding-bottom: 4px;">
<div class="inner-right" style="float: left; height: 100%; "> <div class="inner-right" style="float: left; height: 100%; ">
<%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %> <%= image_tag url_to_avatar(event.event_author), :class => "avatar-3" %>
@ -125,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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p> <p style="margin-top: 4px;"><span style="color: rgb(172, 174, 177)"><%= l(:field_updated_on) %><%= time_tag_welcome event.event_datetime %>前</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="float: right; color: rgb(172, 174, 177);"><%= show_event_reply event %></span></p>
</div> </div>
</li> </li>
<!--<%end %> --><!-- cache --> <!--<%#end %> --><!-- cache -->
<% end %> <% end %>
</div> </div>
</ul> </ul>

View File

@ -199,6 +199,7 @@ default:
# Maximum number of simultaneous AJAX uploads # Maximum number of simultaneous AJAX uploads
#max_concurrent_ajax_uploads: 2 #max_concurrent_ajax_uploads: 2
#pic_types: "bmp,jpeg,jpg,png,gif"
# specific configuration options for production environment # specific configuration options for production environment
# that overrides the default ones # that overrides the default ones

View File

@ -516,6 +516,10 @@ zh:
label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。' label_project_new_description: '项目可以是软件开发项目,也可以是协作研究项目。'
label_project_plural: 项目列表 label_project_plural: 项目列表
label_project_score: 项目评分 label_project_score: 项目评分
label_first_page_made: 首页定制
label_project_first_page: 项目托管平台首页
label_course_first_page: 课程实践平台首页
label_contest_first_page: 竞赛实战平台首页
label_x_projects: label_x_projects:
zero: 无项目 zero: 无项目
one: 1 个项目 one: 1 个项目
@ -563,6 +567,10 @@ zh:
label_login_with_open_id_option: 或使用OpenID登录 label_login_with_open_id_option: 或使用OpenID登录
label_password_lost: 忘记密码 label_password_lost: 忘记密码
label_home: 主页 label_home: 主页
label_web_title: 浏览器标题
label_site_title: 网站标题
label_site_description: 网站简介
label_site_image: 简介图片
#by young #by young
label_requirement: 需求 label_requirement: 需求
label_new_course: 课程列表 label_new_course: 课程列表
@ -1220,6 +1228,7 @@ zh:
button_export: 导出 button_export: 导出
label_export_options: "%{export_format} 导出选项" label_export_options: "%{export_format} 导出选项"
error_attachment_too_big: 该文件无法上传。超过文件大小限制 (%{max_size}) error_attachment_too_big: 该文件无法上传。超过文件大小限制 (%{max_size})
error_pic_type: "仅支持如下图片格式:"
notice_failed_to_save_time_entries: "无法保存下列所选取的 %{total} 个项目中的 %{count} 工时: %{ids}。" notice_failed_to_save_time_entries: "无法保存下列所选取的 %{total} 个项目中的 %{count} 工时: %{ids}。"
label_x_issues: label_x_issues:
zero: 0 问题 zero: 0 问题

View File

@ -559,6 +559,9 @@ RedmineApp::Application.routes.draw do
match 'admin', :controller => 'admin', :action => 'index', :via => :get match 'admin', :controller => 'admin', :action => 'index', :via => :get
match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get
match 'admin/users', :controller => 'admin', :action => 'users', :via => :get match 'admin/users', :controller => 'admin', :action => 'users', :via => :get
match 'admin/first_page_made',:controller => 'admin',:action => 'first_page_made',:via => [:get,:post]
match 'admin/course_page_made',:controller => 'admin',:action => 'course_page_made',:via => [:get,:post]
match 'admin/contest_page_made',:controller => 'admin',:action => 'contest_page_made',:via => [:get,:post]
match 'admin/search', :controller => 'admin', :action => 'search', :via => [:get, :post] match 'admin/search', :controller => 'admin', :action => 'search', :via => [:get, :post]
match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get
match 'admin/info', :controller => 'admin', :action => 'info', :via => :get match 'admin/info', :controller => 'admin', :action => 'info', :via => :get

View File

@ -0,0 +1,17 @@
# -*coding:utf-8 -*-
class CreateFirstPages < ActiveRecord::Migration
def change
create_table :first_pages do |t|
t.string :web_title
t.string :title
t.string :description
t.timestamps
end
fp = FirstPage.new
fp.web_title = "Trustie - 为大学生技术创新筑巢"
fp.title = "Trustie在线项目托管平台"
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
fp.save
end
end

View File

@ -0,0 +1,9 @@
class AddCloumnToFirstPage < ActiveRecord::Migration
def change
add_column :first_pages,:type,:string
fr = FirstPage.all.first
fr.type = "project"
fr.save
end
end

View File

@ -0,0 +1,5 @@
class AltColumnName < ActiveRecord::Migration
def change
rename_column :first_pages,:type,:page_type
end
end

View File

@ -0,0 +1,17 @@
# -*coding:utf-8 -*-
class AddContestAndCourseFirstPage < ActiveRecord::Migration
def change
fp = FirstPage.new
fp.web_title = ""
fp.title = "Trustie在线课程实践平台"
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
fp.page_type = "course"
fp.save
fp1 = FirstPage.new
fp1.web_title = ""
fp1.title = "Trustie在线竞赛实战平台"
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
fp1.page_type = "contest"
fp1.save
end
end

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140714021812) do ActiveRecord::Schema.define(:version => 20140711012924) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -379,7 +379,6 @@ ActiveRecord::Schema.define(:version => 20140714021812) do
t.text "description" t.text "description"
t.datetime "created_on" t.datetime "created_on"
t.integer "user_id", :default => 0 t.integer "user_id", :default => 0
t.integer "is_public", :default => 1
end end
add_index "documents", ["category_id"], :name => "index_documents_on_category_id" add_index "documents", ["category_id"], :name => "index_documents_on_category_id"
@ -408,6 +407,15 @@ ActiveRecord::Schema.define(:version => 20140714021812) do
add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type"
add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id"
create_table "first_pages", :force => true do |t|
t.string "web_title"
t.string "title"
t.string "description"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "page_type"
end
create_table "forums", :force => true do |t| create_table "forums", :force => true do |t|
t.string "name", :null => false t.string "name", :null => false
t.string "description", :default => "" t.string "description", :default => ""

View File

@ -351,6 +351,7 @@ end
Redmine::MenuManager.map :admin_menu do |menu| Redmine::MenuManager.map :admin_menu do |menu|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made
menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural
menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions menu.push :roles, {:controller => 'roles'}, :caption => :label_role_and_permissions
menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural menu.push :trackers, {:controller => 'trackers'}, :caption => :label_tracker_plural

View File

@ -21,7 +21,8 @@ module Redmine
# Configuration default values # Configuration default values
@defaults = { @defaults = {
'email_delivery' => nil, 'email_delivery' => nil,
'max_concurrent_ajax_uploads' => 2 'max_concurrent_ajax_uploads' => 2,
'pic_types' => "bmp,jpeg,jpg,png,gif"
} }
@config = nil @config = nil

View File

@ -140,7 +140,31 @@ function uploadAndAttachFiles(files, inputEl) {
if (sizeExceeded) { if (sizeExceeded) {
window.alert(maxFileSizeExceeded); window.alert(maxFileSizeExceeded);
} else { } else {
uploadAndTypeFiles(files,inputEl);
//$.each(files, function() {addFile(inputEl, this, true);});
}
}
function uploadAndTypeFiles(files, inputEl) {
var enableType = $(inputEl).data('file-type');
var typeSupportrdMessage = $(inputEl).data('type-support-message');
if (enableType == null || enableType.trim() == "")
{
$.each(files, function() {addFile(inputEl, this, true);}); $.each(files, function() {addFile(inputEl, this, true);});
return;
}
var typeSupported = false;
$.each(files, function() {
var a = this.name.split('.');
var type = a[a.length-1];
var rs = enableType.indexOf(type);
if(rs >= 0) {typeSupported = true }
});
if (typeSupported) {
$.each(files, function() {addFile(inputEl, this, true);});
} else {
window.alert(typeSupportrdMessage + enableType);
} }
} }

11
test/fixtures/first_pages.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
web_title: MyString
title: MyString
description: MyString
two:
web_title: MyString
title: MyString
description: MyString

View File

@ -0,0 +1,7 @@
require 'test_helper'
class FirstPageTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end