This commit is contained in:
z9hang 2014-08-01 14:55:55 +08:00
commit 0d46c63c54
24 changed files with 92 additions and 174 deletions

View File

@ -29,8 +29,9 @@ class ContestsController < ApplicationController
# @contests = Contest.visible
# @contests ||= []
@offset, @limit = api_offset_and_limit({:limit => 10})
@contests = Contest.visible
@contests = @contests.like(params[:name]) if params[:name].present?
#@contests = Contest.visible
#@contests = @contests.like(params[:name]) if params[:name].present?
@contests = Contest.visible.where("name like '%#{params[:name]}%'")
if params[:contests_search]
(redirect_to contests_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
end

View File

@ -71,8 +71,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@obj_flag,@selected_tags)
@ -107,8 +107,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -130,8 +130,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results= refresh_results(@obj_id,@show_flag)
@ -199,7 +199,7 @@ class TagsController < ApplicationController
@bids_results = nil
@contests_results = nil
@forums_results = nil
attachments_results = nil
@attachments_results = nil
@open_source_projects_results = nil
@obj_pages = nil
@obj = nil
@ -228,8 +228,9 @@ class TagsController < ApplicationController
# modifed by Long Jun
# this is used to find the attachments that came from the same project and tagged with the same tag.
@result = get_attachments_by_project_tag(selected_tags, @obj)
@obj_pages, attachments_results, @results_count = for_pagination(@result)
#@result = get_attachments_by_project_tag(selected_tags, @obj)
@result = get_attachments_by_tag(selected_tags)
@obj_pages, @attachments_results, @results_count = for_pagination(@result)
when '7'
@obj = Contest.find_by_id(obj_id)
@obj_pages,@contests_results,@results_count = for_pagination(get_contests_by_tag(selected_tags))
@ -249,8 +250,8 @@ class TagsController < ApplicationController
@projects_results,
@issues_results,
@bids_results,
@forums_results,
attachments_results,
@forums_results,
@attachments_results,
@contests_results,
@courses_results,
@open_source_projects_results]

View File

@ -87,8 +87,9 @@ module AttachmentsHelper
@project_id = obj.container_id
end
Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
attachments = Attachment.tagged_with(tag_name).order('created_on desc').where("(container_id = :project_id and container_type = 'Project') or
(container_id in (select id from versions where project_id =:project_id) and container_type = 'Version')", {:project_id => @project_id})
return attachments
end

View File

@ -6,7 +6,7 @@ class Contest < ActiveRecord::Base
has_many :contesting_projects, :dependent => :destroy
has_many :projects, :through => :contesting_projects
has_many :contesting_softapplications, :dependent => :destroy
has_many :softapplications, :through => :contesting_softapplications
has_many :softapplications, :through => :contesting_softapplications, :dependent => :destroy
has_many :projects_member, :class_name => 'User', :through => :projects
has_many :journals_for_messages, :as => :jour, :dependent => :destroy
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy

View File

@ -3,7 +3,7 @@ class ContestingSoftapplication < ActiveRecord::Base
attr_accessible :contest_id, :description, :softapplication_id, :user_id
belongs_to :contest
belongs_to :softapplication
belongs_to :softapplication, :dependent => :destroy
belongs_to :user

View File

@ -18,7 +18,7 @@ class IssueOverdue < ActiveRecord::Base
sleep 5
else
#发邮件
puts "11" + issue.id.to_s
#puts "11" + issue.id.to_s
#Mailer.issue_expire(issue).deliver
Mailer.issue_add(issue).deliver
break

View File

@ -6,17 +6,17 @@
<td class="location-list"><strong><%= l(:label_user_location) %> :</strong></td>
<td rowspan="2">
<% if User.current.logged? %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), {:controller => 'contests', :action => 'new_contest'}, :class => 'icon icon-add', :target => "_blank") %>
<% end %>
<% end %>
<% unless User.current.user_extensions.identity == 1 %>
<%= link_to(l(:label_newtype_contest), {:controller => 'contests', :action => 'new_contest'}, :class => 'icon icon-add', :target => "_blank") %>
<% end %>
<% end %>
</td>
<td rowspan="2" >
<div class="project-search" style="float: right">
<td rowspan="2" >
<div class="project-search" style="float: right">
<%= text_field_tag 'name', params[:name], :size => 30 %>
<%= hidden_field_tag 'project_type', params[:project_type] %>
<%= submit_tag l(:label_search), :class => "enterprise", :name => "contests_search" %>
</div>
</div>
</td>
</tr>
<tr>

View File

@ -276,7 +276,7 @@
<!-- 评价显隐控制按钮-->
<% if ((User.current.id == @contest.author_id) && (@contest.deadline > Date.today))||User.current.admin %>
<div style="valign=" top" align="right" width="10%"">
<div style="text-align: right;width: 100%;">
<span style="padding-right: 5px; padding-top: 1px"> <%= toggle_link '评奖', c_softapplication.id.to_s %></span>
<!-- 评价应标项目的表单 -->
<span style="display: none; vertical-align: top " id='<%= c_softapplication.id %>'>

View File

@ -78,6 +78,7 @@
<div id="principals_for_new_member">
<%= render_principals_for_new_course_members(@course) %>
</div>
<br/>
<!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% roles.each do |role| %>

View File

@ -92,6 +92,7 @@
<div id="principals_for_applied_member">
<%= render_principals_for_applied_members(@project) %>
</div>
<br/>
<!--show the roles which will select-->
<p style="padding-top: 5px"><%= l(:label_role_plural) %>:
<% roles.each do |role| %>

View File

@ -22,12 +22,12 @@ border:none
<% end %>
</p>
<p><%= f.check_box :is_default, :label => :field_repository_is_default %></p>
<p><%= f.text_field :identifier, :required=>true, :disabled => @repository.identifier_frozen?, :label => l(:label_repository_name) %>
<p><%= f.text_field :identifier, :required=>true, :disabled => @repository.identifier_frozen?, :label => l(:label_repository_name)%>
<% unless @repository.identifier_frozen? %>
<em class="info"><%= l(:text_length_between, :min => 1, :max => Repository::IDENTIFIER_MAX_LENGTH) %>
<%= l(:text_repository_identifier_info).html_safe %></em>
<% end %></p>
<!-- <p><%= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<!-- <p><%#= f.text_field :url, :size => 60, :required => true,:readonly=>true, :class=>'textbg'%></p> -->
<p><%= f.password_field :upassword, :required =>true, :label=> :field_password %>
<em class="info"><%= l(:label_upassword_info)%></em></p>
</div>

View File

@ -1,5 +1,5 @@
<div id="issues">
<% if attachments_results.try(:size).to_i < 0 %>
<% if attachments_results.nil? || attachments_results.try(:size).to_i < 0 %>
<% else %>
<hr />
<% attachments_results.each do |file| %>

View File

@ -157,7 +157,7 @@
<div class="d-p-projectlist-box">
<div class="d-p-projectlist">
<% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
<li style="overflow:auto;word-break:break-all;height:100%;" class='<%= cycle("odd", "even") %>'>
<div class="avatar-4" style="float: left; margin-top: 7px">
<%= image_tag('/images/contest1.png')%>
@ -173,7 +173,7 @@
<% end %>
</div>
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;">
<div style="float: left;margin:5px; margin-left: 12px; margin-bottom: 2px; width: 380px;" class="text_nowrap">
<span class='font_lighter' title ='<%=contest.description%>'><%=contest.description.truncate(100, omission: '...')%></span>
</div><br />

View File

@ -2,7 +2,7 @@ class CreateOpenSourceProjects < ActiveRecord::Migration
def change
create_table :open_source_projects do |t|
t.column "name", :string, :default => nil, :null => true
t.column "description", :string, :default => '', :null => true
t.column "description", :text, :null => true
t.column "commit_count", :integer, :default => 0
t.column "code_line", :integer, :default => 0
t.column "users_count",:integer, :default => 0

View File

@ -1,9 +0,0 @@
class ChangeDescriptionTypeToOpenSourceProject < ActiveRecord::Migration
def up
change_column :open_source_projects, :description, :text
end
def down
raise ActiveRecord::IrreversibleMigration
end
end

View File

@ -1,5 +0,0 @@
class DropUserScores < ActiveRecord::Migration
def change
drop_table :user_scores
end
end

View File

@ -1,11 +0,0 @@
class CreateUserScores < ActiveRecord::Migration
def change
create_table :user_scores do |t|
t.integer :user_id
t.integer :collaboration
t.integer :influence
t.integer :skill
t.integer :activity
end
end
end

View File

@ -4,49 +4,49 @@ class AddCourseRoles < ActiveRecord::Migration
# 添加课程权限
Role.all.each do |role|
if role.name == 'Non member'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.permissions.append(:add_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
role.add_permission!(:add_course )
elsif role.name == 'Anonymous'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
elsif role.name == 'Manager'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.permissions.append(:add_course )
role.permissions.append(:close_course )
role.permissions.append(:select_course_modules )
role.permissions.append(:edit_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
role.add_permission!(:add_course )
role.add_permission!(:close_course )
role.add_permission!(:select_course_modules )
role.add_permission!(:edit_course )
elsif role.name =='Developer'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.permissions.append(:add_course )
role.permissions.append(:close_course )
role.permissions.append(:select_course_modules )
role.permissions.append(:edit_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
role.add_permission!(:add_course )
role.add_permission!(:close_course )
role.add_permission!(:select_course_modules )
role.add_permission!(:edit_course )
elsif role.name == 'Reporter'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
elsif role.name == '助教'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.permissions.append(:add_course )
role.permissions.append(:select_course_modules )
role.permissions.append(:edit_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
role.add_permission!(:add_course )
role.add_permission!(:select_course_modules )
role.add_permission!(:edit_course )
elsif role.name == '老师'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.permissions.append(:add_course )
role.permissions.append(:close_course )
role.permissions.append(:select_course_modules )
role.permissions.append(:edit_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
role.add_permission!(:add_course )
role.add_permission!(:close_course )
role.add_permission!(:select_course_modules )
role.add_permission!(:edit_course )
elsif role.name == '学生'
role.permissions.append(:view_course )
role.permissions.append(:search_course )
role.add_permission!(:view_course )
role.add_permission!(:search_course )
end
role.permissions.append(:view_course_files )
role.permissions.append(:view_course_journals_for_messages )
role.permissions.append(:view_course_messages )
role.add_permission!(:view_course_files )
role.add_permission!(:view_course_journals_for_messages )
role.add_permission!(:view_course_messages )
role.save(:validate => false)
end
end

View File

@ -9,12 +9,13 @@ class CreateFirstPages < ActiveRecord::Migration
t.timestamps
end
fp = FirstPage.new
fp.web_title = "Trustie - 为大学生技术创新筑巢"
fp.title = "Trustie在线项目托管平台"
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
fp.page_type = "project"
fp.save
fp.save(:validate => false)
end
end

View File

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

View File

@ -3,7 +3,7 @@ class SetWebTitle < ActiveRecord::Migration
def change
FirstPage.all.each do |fp|
fp.web_title = "Trustie - 为大学生技术创新筑巢"
fp.save
fp.save(:validate => false)
end
end
end

View File

@ -2,7 +2,7 @@ class SetSortType < ActiveRecord::Migration
def change
FirstPage.all.each do |fp|
fp.sort_type = 1
fp.save
fp.save(:validate => false)
end
end
end

View File

@ -9,7 +9,7 @@ class RepairFirstPage < ActiveRecord::Migration
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
fp.page_type = "project"
fp.sort_type = 1
fp.save
fp.save(:validate => false)
else
fp = pro_fps.first
fp.web_title = "Trustie - 为大学生技术创新筑巢"
@ -17,7 +17,7 @@ class RepairFirstPage < ActiveRecord::Migration
fp.description = "面向中国大学生与软件从业者,提供社交化的项目管理、代码托管、资源共享、合作交流。"
fp.page_type = "project"
fp.sort_type = 1
fp.save
fp.save(:validate => false)
end
course_fps = FirstPage.where("page_type = 'course'")
if course_fps.nil? || course_fps.first.nil?
@ -27,7 +27,7 @@ class RepairFirstPage < ActiveRecord::Migration
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
fp.page_type = "course"
fp.sort_type = 1
fp.save
fp.save(:validate => false)
else
fp = course_fps.first
fp.web_title = "Trustie - 为大学生技术创新筑巢"
@ -35,7 +35,7 @@ class RepairFirstPage < ActiveRecord::Migration
fp.description = "面向中国高校教师与大学生,提供社交化的课程管理、资源共享、合作实验、协同研究。"
fp.page_type = "course"
fp.sort_type = 1
fp.save
fp.save(:validate => false)
end
contest_fps = FirstPage.where("page_type = 'contest'")
if contest_fps.nil? || contest_fps.first.nil?
@ -45,7 +45,7 @@ class RepairFirstPage < ActiveRecord::Migration
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
fp1.page_type = "contest"
fp1.sort_type = 1
fp1.save
fp1.save(:validate => false)
else
fp1 = contest_fps.first
fp1.web_title = "Trustie - 为大学生技术创新筑巢"
@ -53,7 +53,7 @@ class RepairFirstPage < ActiveRecord::Migration
fp1.description = "面向中国大学生与编程爱好者,提供社交化的竞赛管理、应用管理、代码托管、合作交流。"
fp1.page_type = "contest"
fp1.sort_type = 1
fp1.save
fp1.save(:validate => false)
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140730021521) do
ActiveRecord::Schema.define(:version => 20140730024419) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@ -177,58 +177,6 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
create_table "code_review_assignments", :force => true do |t|
t.integer "issue_id"
t.integer "change_id"
t.integer "attachment_id"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.string "action_type"
t.integer "changeset_id"
end
create_table "code_review_project_settings", :force => true do |t|
t.integer "project_id"
t.integer "tracker_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "updated_by"
t.boolean "hide_code_review_tab", :default => false
t.integer "auto_relation", :default => 1
t.integer "assignment_tracker_id"
t.text "auto_assign"
t.integer "lock_version", :default => 0, :null => false
t.boolean "tracker_in_review_dialog", :default => false
end
create_table "code_review_user_settings", :force => true do |t|
t.integer "user_id", :default => 0, :null => false
t.integer "mail_notification", :default => 0, :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "code_reviews", :force => true do |t|
t.integer "project_id"
t.integer "change_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "line"
t.integer "updated_by_id"
t.integer "lock_version", :default => 0, :null => false
t.integer "status_changed_from"
t.integer "status_changed_to"
t.integer "issue_id"
t.string "action_type"
t.string "file_path"
t.string "rev"
t.string "rev_to"
t.integer "attachment_id"
t.integer "file_count", :default => 0, :null => false
t.boolean "diff_all"
end
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false
@ -272,7 +220,7 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
t.integer "contest_id"
t.string "title"
t.string "summary"
t.string "description"
t.text "description"
t.integer "author_id"
t.integer "notificationcomments_count"
t.datetime "created_at", :null => false
@ -419,9 +367,9 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
t.string "web_title"
t.string "title"
t.text "description"
t.string "page_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "page_type"
t.integer "sort_type"
t.integer "image_width", :default => 107
t.integer "image_height", :default => 63
@ -882,19 +830,6 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
add_index "repositories", ["project_id"], :name => "index_repositories_on_project_id"
create_table "rich_rich_files", :force => true do |t|
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "rich_file_file_name"
t.string "rich_file_content_type"
t.integer "rich_file_file_size"
t.datetime "rich_file_updated_at"
t.string "owner_type"
t.integer "owner_id"
t.text "uri_cache"
t.string "simplified_type", :default => "file"
end
create_table "roles", :force => true do |t|
t.string "name", :limit => 30, :default => "", :null => false
t.integer "position", :default => 1
@ -945,11 +880,10 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
t.string "url"
t.string "title"
t.integer "share_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "project_id"
t.integer "user_id"
t.string "description"
end
create_table "softapplications", :force => true do |t|
@ -1055,8 +989,8 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
t.integer "zip_code"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "technical_title"
t.integer "identity"
t.string "technical_title"
t.string "student_id"
t.string "teacher_realname"
t.string "student_realname"
@ -1114,6 +1048,9 @@ ActiveRecord::Schema.define(:version => 20140730021521) do
t.integer "active"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "level"
t.integer "file"
t.integer "issue"
end
create_table "user_statuses", :force => true do |t|