diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 5e9a0bc40..38afb7a28 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -111,8 +111,7 @@ class AccountController < ApplicationController user_params = params[:user] || {} @user = User.new @user.safe_attributes = user_params - #这里判断 - if params[:identity] == "2" + if params[:identity] == "2" # 2 企业 @user.firstname = params[:enterprise_name] @user.lastname = l(:field_enterprise) end @@ -132,16 +131,6 @@ class AccountController < ApplicationController @user.login = params[:user][:login] unless user_params[:identity_url].present? && user_params[:password].blank? && user_params[:password_confirmation].blank? @user.password, @user.password_confirmation = user_params[:password], user_params[:password_confirmation] - # system "htpasswd -mb "+@root_path+"user.passwd "+params[:user][:login]+" "+user_params[:password] - # system "echo -e '\n"+params[:user][:login]+"-write:"+ - # " "+params[:user][:login]+"' >> "+@root_path+"group.passwd" - # system "mkdir "+@root_path+"htdocs/"+params[:user][:login] -# - # system "echo -e 'Allow from all \n Order Deny,Allow \n "+ - # " \n"+ - # "Require group "+params[:user][:login]+"-write \n "+ - # " \n ' >>"+ - # @root_path+"htdocs/"+params[:user][:login]+"/.htaccess" end case Setting.self_registration @@ -183,6 +172,33 @@ class AccountController < ApplicationController redirect_to signin_path end + def valid_ajax + req = Hash.new(false) + req[:message] = '' + + valid_attr = params[:valid] + valid_value = params[:value] + + faker = User.new + + if valid_attr.eql?('login') + faker.login = valid_value + faker.valid? + req[:valid] = faker.errors[:login].blank? + req[:message] = faker.errors[:login] + end + + if valid_attr.eql?('mail') + faker.mail = valid_value + faker.valid? + req[:valid] = faker.errors[:mail].blank? + req[:message] = faker.errors[:mail] + end + + req[:message] = l(:modal_valid_passing) if req[:message].blank? + render :json => req + end + private def authenticate_user diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 6a9fb5c29..206421e5d 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -702,7 +702,10 @@ class BidsController < ApplicationController redirect_to respond_path(@bid) else @bid.safe_attributes = params[:bid] - render :action => 'new_bid' + @homework = @bid + @project = Project.find_by_id(params[:course_id]) + @project_id = @project.id + render file: 'projects/new_homework', layout: 'base_courses' end end diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 7ceb575f3..7741333a8 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -4,7 +4,8 @@ class ContestsController < ApplicationController menu_item :respond menu_item :project, :only => :show_project menu_item :application, :only => :show_softapplication - before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, + menu_item :attendingcontest, :only => :show_attendingcontest + before_filter :find_contest, :only => [:show_contest, :show_project, :show_softapplication, :show_attendingcontest, :create,:destroy,:more,:back,:add,:add_softapplication,:new,:show_results, :set_reward, :show_contest_project, :show_contest_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings] # added by fq @@ -252,6 +253,7 @@ class ContestsController < ApplicationController ############ ##显示参赛的应用 def show_softapplication + # @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) # @option = [] @@ -288,6 +290,66 @@ class ContestsController < ApplicationController end end + + ###我要参赛 + def show_attendingcontest +##取出参赛项目 + @membership = User.current.memberships.all(:conditions => Project.visible_condition(User.current)) + @option = [] + # @contesting_project_count = @contesting_project_all.count + # @contesting_project_pages = Paginator.new @contesting_project_count, per_page_option, params['page'] + @membership.each do |membership| + unless(membership.project.project_type==1) + membership.member_roles.each{|role| + if(role.role_id == 3) + @option << membership.project + end + } + end + end + @user = @contest.author + @contesting_project = @contest.contesting_projects.all + if params[:student_id].present? + @temp = [] + @contesting_project.each do |pro| + if pro.project && pro.project.project_status + if /#{params[:student_id]}/ =~ pro.user.user_extensions.student_id + @temp << pro + end + end + @temp + end + @contesting_project = @temp + else + + @temp = [] + @contesting_project.each do |pro| + if pro.project && pro.project.project_status + @temp << pro + end + @temp + end + if @temp.size > 0 + @contesting_project = @temp.sort {|a,b| b.project.project_status.grade <=> a.project.project_status.grade} + end + end +##取出参赛应用 + @softapplication = Softapplication.all + @contesting_softapplication = @contest.contesting_softapplications.reverse + @contesting_softapplication = paginateHelper @contesting_softapplication, 10 + + +##引用base_newcontest整体样式 + @contest = Contest.find_by_id(params[:id]) + respond_to do |format| + format.html { + render :layout => 'base_newcontest' + } + format.api + end + end + + ###end ###添加已创建的参赛项目 def add project = Project.find(params[:contest]) @@ -500,9 +562,9 @@ class ContestsController < ApplicationController @contest = Contest.find(params[:id]) @user = @contest.author end - rescue + rescue render_404 - end + end end diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index b8fb7a6f6..ec14ba5c8 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -47,8 +47,27 @@ class SchoolController < ApplicationController options << "" end - render :text => options - + # 取id取学校名 + # 连接子表: 查询已添加用户的学校 + school = School.select("id, name"). + joins("RIGHT JOIN ( + SELECT DISTINCT school_id + FROM #{UserExtensions.table_name} + WHERE school_id IS NOT NULL) AS sids ON schools.id = sids.school_id"). + where("#{School.table_name}.id IS NOT NULL") + + options_s = "" + school.each do |s| + options_s << "
  • #{s.name}
  • " + end + + res = Hash.new + res[:text] = options + res[:text_s] = options_s + + render :json => res + + end def get_options @@ -79,8 +98,11 @@ class SchoolController < ApplicationController end def search_school - @school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]); - + if params[:province].nil? or params[:province] == "0" + @school = School.where("name LIKE '%"+params[:key_word]+"%'"); + else + @school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]); + end options = "" @school.each do |s| options << "
  • #{s.name}
  • " diff --git a/app/controllers/softapplications_controller.rb b/app/controllers/softapplications_controller.rb index 3aba819e0..9ede52489 100644 --- a/app/controllers/softapplications_controller.rb +++ b/app/controllers/softapplications_controller.rb @@ -106,11 +106,13 @@ class SoftapplicationsController < ApplicationController @softapplication.save_attachments(params[:attachments]) respond_to do |format| if @softapplication.save + format.js format.html { redirect_to @softapplication, notice: 'Softapplication was successfully created.' } - format.json { render json: @softapplication, status: :created, location: @softapplication } + # format.json { render json: @softapplication, status: :created, location: @softapplication } else + format.js { render status: 406 } format.html { render action: "new" } - format.json { render json: @softapplication.errors, status: :unprocessable_entity } + # format.json { render json: @softapplication.errors, status: :unprocessable_entity } end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b18497548..9a21e26f2 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -38,6 +38,7 @@ class UsersController < ApplicationController :user_homeworks, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :watch_contests, :info, :watch_projects, :show_score, :topic_score_index, :project_score_index, :activity_score_index, :influence_score_index, :score_index] + before_filter :auth_user_extension, only: :show accept_api_auth :index, :show, :create, :update, :destroy,:tag_save #william @@ -743,4 +744,12 @@ class UsersController < ApplicationController def setting_layout(default_base='base_users') User.current.admin? ? 'base_admin' : default_base end + + # 必填自己的工作单位,其实就是学校 + def auth_user_extension + if @user == User.current && @user.user_extensions.school.nil? + flash[:error] = l(:error_complete_occupation) + redirect_to my_account_path + end + end end diff --git a/app/models/attachmentstype.rb b/app/models/attachmentstype.rb index 6a37cc51f..fb774836f 100644 --- a/app/models/attachmentstype.rb +++ b/app/models/attachmentstype.rb @@ -3,7 +3,7 @@ class Attachmentstype < ActiveRecord::Base has_many :attachments, :foreign_key => "attachtype",:primary_key => "id" # 当前使用的文件内容分类列表 - @@SuffixArr = ['pdf','zip','doc','docx','rar','txt','jpg','bmp','xls','xlsx'] + @@SuffixArr = ['pdf','zip','doc','docx','ppt','pptx','rar','txt','jpg','bmp','xls','xlsx'] def suffixArr @@SuffixArr diff --git a/app/models/issue.rb b/app/models/issue.rb index b69ac246c..d2332350a 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -57,7 +57,7 @@ class Issue < ActiveRecord::Base :include => [:project, :visible_journals], # sort by id so that limited eager loading doesn't break with postgresql :order_column => "#{table_name}.id" - acts_as_event :title => Proc.new {|o| + acts_as_event :title => Proc.new {|o| #"#{o.tracker.name} ##{o.id} (#{o.status}): #{o.subject}" "#{o.tracker.name} #{o.source_from} (#{o.status}): #{o.subject}" }, @@ -991,6 +991,11 @@ class Issue < ActiveRecord::Base "#{tracker} ##{id}: #{subject}" end + # 缺陷在项目中的序号 + def inProjectIndex + (self.project.issues.index(self).to_i + 1).to_s + end + # Returns a string of css classes that apply to the issue def css_classes s = "issue tracker-#{tracker_id} status-#{status_id} #{priority.try(:css_classes)}" diff --git a/app/models/journal.rb b/app/models/journal.rb index 02d313731..0997640d8 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -29,8 +29,8 @@ class Journal < ActiveRecord::Base # end attr_accessor :indice - acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}" }, - :description => :notes, + acts_as_event :title =>Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.inProjectIndex}#{status}: #{o.issue.subject}" }, + :description =>:notes, :author => :user, :group => :issue, :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' }, diff --git a/app/models/school.rb b/app/models/school.rb index 7dbf5e3a8..a180eefbe 100644 --- a/app/models/school.rb +++ b/app/models/school.rb @@ -1,4 +1,8 @@ class School < ActiveRecord::Base attr_accessible :name, :province has_many :courses + + def to_s + self.name.to_s + end end diff --git a/app/views/account/register.html.erb b/app/views/account/register.html.erb index 7f729552e..f24f7d052 100644 --- a/app/views/account/register.html.erb +++ b/app/views/account/register.html.erb @@ -278,8 +278,8 @@ <% if @user.auth_source_id.nil? %> -

    <%= f.text_field :login, :size => 25, :required => true %> - <%= l(:label_max_number) %>

    +

    <%= f.text_field :login, :size => 25, :required => true %> + <%= l(:label_max_number) %>

    <%= f.password_field :password, :size => 25, :required => true %> <%= l(:text_caracters_minimum, :count => Setting.password_min_length) %>

    @@ -294,7 +294,7 @@ <%= text_field_tag :enterprise_name %>

    -

    <%= f.text_field :mail, :required => true %>

    +

    <%= f.text_field :mail, :required => true %>

    <%="#{l(:label_mail_attention)} "%>

    <%= f.select :language, lang_options_for_select , :required => true %>

    @@ -368,3 +368,36 @@ + \ No newline at end of file diff --git a/app/views/contests/_contest_list.html.erb b/app/views/contests/_contest_list.html.erb index 6ffac831e..8b5e34975 100644 --- a/app/views/contests/_contest_list.html.erb +++ b/app/views/contests/_contest_list.html.erb @@ -18,9 +18,14 @@ - <%= l(:label_contest_project, :count => contest.contesting_projects.count) %>(<%= link_to(contest.contesting_projects.count, show_project_contest_path(contest), :target => "_blank") %>) - <%= l(:label_contest_softapplication, :count => contest.contesting_softapplications.count) %>(<%= link_to(contest.contesting_softapplications.count, show_softapplication_contest_path(contest), :target => "_blank") %>) - + + + <% if contest.id == 2 or contest.id == 3 or contest.id == 6 %> + <%= l(:label_contest_work, :count => contest.contesting_projects.count) %>(<%= link_to(contest.projects.where('is_public=1').count, show_attendingcontest_contest_path(contest), :target => "_blank") %>) + <% else %> + <%= l(:label_contest_work, :count => contest.contesting_softapplications.count) %>(<%= link_to(contest.contesting_softapplications.count, show_attendingcontest_contest_path(contest), :target => "_blank") %>) + <% end %> diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb new file mode 100644 index 000000000..8a00f12ae --- /dev/null +++ b/app/views/contests/show_attendingcontest.html.erb @@ -0,0 +1,246 @@ + + + + + +
    + 温馨提示:如果您希望在我们平台托管参赛数据和代码,请按下面参赛步骤参赛! +
    +<% if User.current.logged? %> + +
    +
    + 参赛步骤: +
    +
    + 步骤1: + <%#= link_to '新建参赛作品', new_softapplication_path(:target=>'_blank'), :target=>'_blank' %> + <%= link_to '新建参赛作品', "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %> + (先点击“新建参赛作品”,然后刷新页面,再继续步骤2。) +
    +
    + 步骤2: + <%= link_to '关联参赛作品', "javascript:void(0);", onclick: "$('#put-bid-form').toggle();" %> +
    +
    + + + + + + + +<% end %> + +
    + + + +<% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %> + +<% @contesting_project.sort.reverse.each do |c_project|%> +<% if c_project.project %> +
    +
    + + 参赛作品: + <%= link_to(c_project.project.name, project_path(c_project.project), :target => '_blank') %> +
    +
    +
    + + 简介: + <%= c_project.project.description.truncate(90, omission: '...') %> +
    +
    +
    + + 发布时间: + <%= format_time c_project.created_at%> + + +
    +
    +<% end %> +
    +<% end %> +<% else %> +<% @contesting_softapplication.each do |c_softapplication|%> +<% if c_softapplication.softapplication %> +
    +
    + + 参赛作品: + <%= link_to(c_softapplication.softapplication.name, softapplication_path(c_softapplication.softapplication), :target => '_blank') %> +
    +
    +
    + + 简介: + <%= c_softapplication.softapplication.description.truncate(90, omission: '...') %> +
    +
    +
    + + 发布时间: + <%= format_time c_softapplication.created_at %> + + +
    +
    +<% end %> +
    +<% end %> +<% end %> + + + diff --git a/app/views/files/index.html.erb b/app/views/files/index.html.erb index 02268746d..a4f63e4b2 100644 --- a/app/views/files/index.html.erb +++ b/app/views/files/index.html.erb @@ -82,7 +82,7 @@ var $tags = $td_tags_area.find('#tags') var $icona = $td_tags_area.find('.tags_icona') - var slideHeight = 5; //px + var slideHeight = 13; //px var defHeight = $tags.height(); var curHeight = $tags_area.height(); diff --git a/app/views/layouts/_base_softapplication_index_top_content.html.erb b/app/views/layouts/_base_softapplication_index_top_content.html.erb index 93b177b99..d029d27e4 100644 --- a/app/views/layouts/_base_softapplication_index_top_content.html.erb +++ b/app/views/layouts/_base_softapplication_index_top_content.html.erb @@ -15,7 +15,7 @@ <%=link_to request.host()+"/softapplications", :controller=>'softapplications', :action=>'index' %> <%=link_to l(:field_homepage), home_path %> > - <%=link_to l(:label_contest_softapplication), :controller=>'softapplications', :action=>'index' %> + <%=link_to l(:label_contest_work), :controller=>'softapplications', :action=>'index' %> diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 968752ed5..41e0c2a12 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -160,7 +160,7 @@ <% unless @course.teacher.user_extensions.nil?%> - <%= l(:label_teacher_work_unit) %> :<%= @course.teacher.user_extensions.occupation %> + <%= l(:label_teacher_work_unit) %> :<%= @course.teacher.user_extensions.school %> <% else %> diff --git a/app/views/layouts/base_newcontest.html.erb b/app/views/layouts/base_newcontest.html.erb index 07654eddb..e621f2f8b 100644 --- a/app/views/layouts/base_newcontest.html.erb +++ b/app/views/layouts/base_newcontest.html.erb @@ -98,19 +98,26 @@ + --> + - <%=link_to "#{@contest.projects.where('is_public=1').count}", :controller => 'contests', :action => 'show_project' %> - - - <%=link_to "#{@contest.contesting_softapplications.count}", :controller => 'contests', :action => 'show_softapplication' %> + + <%=link_to "#{@contest.watcher_users.count}", :controller => 'contests', :action => 'show_project' %> + + + + <% if @contest.id == 2 or @contest.id == 3 or @contest.id == 6 %> + <%=link_to "#{@contest.projects.where('is_public=1').count}" %> + <% else %> + <%=link_to "#{@contest.contesting_softapplications.count}", :controller => 'contests', :action => 'show_attendingcontest' %> + <% end %> - <%= l(:label_contest_project) %> - <%= l(:label_contest_application) %> + <%= l(:label_contest_watchers) %> + <%= l(:label_contest_work) %> @@ -178,9 +185,9 @@
    <%= l(:label_x_followers, :count => @contest.watcher_users.count) %> - <% if show_more_fans?(@contest) %> +
    diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 58f684009..f9b4e9ac3 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -1,604 +1,556 @@ - - - - - - -
    - <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> - <%= call_hook(:view_my_account_contextual, :user => @user)%> +
    + <%= link_to(l(:button_change_password), {:action => 'password'}, :class => 'icon icon-passwd') if @user.change_password_allowed? %> + <%= call_hook(:view_my_account_contextual, :user => @user) %>
    -

    <%= l(:label_my_account)%>

    +

    <%= l(:label_my_account) %>

    - - <%= labelled_form_for :user, @user, - :url => { :action => "account" }, - :html => { :id => 'my_account_form', - :method => :post } do |f| %> -
    - - - -<% else %> -<%= text_field_tag :no, nil, :placeholder => "请输入学号" %> - -<% end %> + + + + + + + +

    + <% if User.current.user_extensions.school.nil? %> + <%= l(:field_occupation) %> * + + + + <% else %> + <%= l(:field_occupation) %> * + + + + <% end %> +

    + +
    + + +

    学校列表

    + +
    +
      + <% @ss = School.find_by_sql("select distinct province from schools") %> + <% @ss.each do |s| %> +
    • + <%= s.province %> + +
    • + <% end %> +
    +
    +
    +
    +
      + +
    +
    +
    + + + + + + + +

    + <%= f.text_field :mail, :required => true %> +

    + +

    + <%= f.select :language, :Chinese => :zh, :English => :en %> +

    + + + + <% province = User.current.user_extensions.location %> + <% city = User.current.user_extensions.location_city %> + <% identity = User.current.user_extensions.identity %> + <% title = User.current.user_extensions.technical_title %> + + +

    <%= l(:label_location) %> + + +

    + + + + <% unless @user.user_extensions.identity == 2 %> +

    + <%= l(:label_identity) %> + + + + <% end %> + + + <% else %> + + + +

    + <% end %> + + + + <% if Setting.openid? %> +

    <%= f.text_field :identity_url %>

    + <% end %> + + <% @user.custom_field_values.select(&:editable?).each do |value| %> +

    <%= custom_field_tag_with_label :user, value %>

    + <% end %> + <%= call_hook(:view_my_account, :user => @user, :form => f) %> + + + + + + -
    -

    -<% else %> - - - -<% end %> - -
    - - - - - - - <% if Setting.openid? %> -

    - <%= f.text_field :identity_url %> -

    - <% end %> - - <% @user.custom_field_values.select(&:editable?).each do |value| %> -

    - <%= custom_field_tag_with_label :user, value %> -

    - <% end %> - <%= call_hook(:view_my_account, :user => @user, :form => f) %> - - - --> - - - <%= submit_tag l(:button_save) %> - + <% end %> <% html_title(l(:label_my_account)) -%> + + \ No newline at end of file diff --git a/app/views/projects/_course.html.erb b/app/views/projects/_course.html.erb index d65df0530..58168c999 100644 --- a/app/views/projects/_course.html.erb +++ b/app/views/projects/_course.html.erb @@ -17,9 +17,9 @@ <% @admin = @project.project_infos%> <%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%> - <% unless @project.course_extra.school.nil? %> - <%= @project.course_extra.school.name %> - <% end %> + <%# unless @project.course_extra.school.nil? %> + <%= @project.course_extra.teacher.user_extensions.school.try(:name) %> + <%# end %> <% end %>

    diff --git a/app/views/repositories/show.html.erb b/app/views/repositories/show.html.erb index 493280647..09ab9738f 100644 --- a/app/views/repositories/show.html.erb +++ b/app/views/repositories/show.html.erb @@ -13,7 +13,6 @@ <%=h @repository.url %> <% end %> - <% if @repositories.size >1 %>

    (<%= l(:label_all_revisions) %><%= @repositories.sort.collect {|repo| link_to h(repo.name), @@ -21,7 +20,6 @@ :id => @project, :repository_id => repo.identifier_param, :rev => nil, :path => nil}, :class => 'repository' + (repo == @repository ? ' selected' : '') }.join(' | ').html_safe %>)

    - <% else %>

    项目代码请设置好正确的编码方式(utf-8),否则中文会出现乱码

    建立版本库文件夹,打开命令行执行如下:

    @@ -29,6 +27,7 @@

    git add *

    git commit -m "first commit"

    git remote add origin <%= @repos_url%>

    +

    git config http.postBuffer 524288000 #设置本地post缓存为500MB

    git push -u origin master:master

    已经有本地库,还没有配置远程地址,打开命令行执行如下:

    @@ -36,6 +35,7 @@

    git remote add origin <%= @repos_url%>

    git add .

    git commit -m "first commit"

    +

    git config http.postBuffer 524288000 #设置本地post缓存为500MB

    git push -u origin master:matser

    @@ -44,10 +44,10 @@

    git remote add trustie <%= @repos_url%>

    git add .

    git commit -m "first commit"

    +

    git config http.postBuffer 524288000 #设置本地post缓存为500MB

    git push -u trustie master:matser

    <%= link_to "李海提供", user_path(646)%>

    - <% end %> <% if !@entries.nil? && authorize_for('repositories', 'browse') %> <%= render :partial => 'dir_list' %> diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb index 06b294f89..755bd3151 100644 --- a/app/views/school/index.html.erb +++ b/app/views/school/index.html.erb @@ -4,12 +4,17 @@ $(document).ready(function() { $("#province").html(""); + + + $.ajax({ type :"POST", url :'/school/get_province', - data :'text', - success: function(data){ - $("#province").append(data); + data: "send", + success: function(data, textStatus){ + + $("#province").append(data.text); + $("#schoollist").html(data.text_s); } }) diff --git a/app/views/softapplications/create.js.erb b/app/views/softapplications/create.js.erb new file mode 100644 index 000000000..7f4ac2284 --- /dev/null +++ b/app/views/softapplications/create.js.erb @@ -0,0 +1 @@ +alert('新建参赛作品成功!'); diff --git a/app/views/softapplications/index.html.erb b/app/views/softapplications/index.html.erb index 30a57b1a7..841a8a207 100644 --- a/app/views/softapplications/index.html.erb +++ b/app/views/softapplications/index.html.erb @@ -14,10 +14,10 @@
    <%= image_tag('/images/app1.png')%>
    <%= softapplication.description.truncate(95, omission: '...') %>
    -
    +
    <%contest = softapplication.contests.first%> -

    所属竞赛:<%= contest ? link_to(contest.name.truncate(10, omission: '...'), show_softapplication_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

    -

    所属类别:<%= softapplication.app_type_name.truncate(5, omission: '...') %>

    +

    所属竞赛:<%= contest ? link_to(contest.name.truncate(14, omission: '...'), show_attendingcontest_contest_path(contest), title: contest.name.to_s ) : '尚未加入竞赛'%>

    +

    所属类别:<%= softapplication.app_type_name.truncate(10, omission: '...') %>

    系统支持:<%= softapplication.android_min_version_available %>

    @@ -36,4 +36,4 @@ -<% html_title l(:label_softapplication_list)%> \ No newline at end of file +<% html_title l(:label_contest_work_list)%> \ No newline at end of file diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index c2f260e60..4bd6871a0 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -27,7 +27,7 @@ 所属类别:<%= @softapplication.app_type_name %> <% contest = @softapplication.contests.first %> - 所属竞赛:<%= contest ? link_to(contest.name, show_softapplication_contest_path(contest)) : '尚未加入竞赛'%> + 所属竞赛:<%= contest ? link_to(contest.name, show_attendingcontest_contest_path(contest)) : '尚未加入竞赛'%> 发布人员:<%= @softapplication.user.name %> @@ -35,7 +35,7 @@ - 应用下载: + 作品下载: <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> @@ -56,13 +56,13 @@
    -
    应用简介:
    +
    作品简介:
    <%= @softapplication.description %>
    -
    应用得分:
    +
    作品得分:
    @@ -93,7 +93,7 @@
    -
    软件截图:
    +
    作品截图:
    <% @image_results.take(4).each do |attachment| %> <%= link_to_attachment_img attachment, :class => "soft-application", :download => "true" %> @@ -116,7 +116,7 @@ <% end %>
    -->
    -
    软件评论:
    +
    作品评论:
    评分: <%= rating_for @softapplication, dimension: :quality, class: 'rateable div_inline' %>(您可以重新打分,打分结果以最后一次打分为主!)
    diff --git a/app/views/test/index.html.erb b/app/views/test/index.html.erb index 17c7089d1..de889b15b 100644 --- a/app/views/test/index.html.erb +++ b/app/views/test/index.html.erb @@ -1,12 +1,12 @@

    test

    -<% users = User.all%> +<% user = User.find(1)%> -<% users.each do |user| %> + @@ -22,7 +22,7 @@ -<% end %> +
    idnameCISfilecountissuecountlevelattachconut
    <%= calculate_attachments(user) %>

    diff --git a/app/views/users/_mail_notifications.html.erb b/app/views/users/_mail_notifications.html.erb index ee6ccb00b..47face839 100644 --- a/app/views/users/_mail_notifications.html.erb +++ b/app/views/users/_mail_notifications.html.erb @@ -1,5 +1,5 @@

    -<%= label_tag "user_mail_notification", l(:description_user_mail_notification), :class => "hidden-for-sighted" %> +<%= label_tag "user_mail_notification", l(:description_user_mail_notification), :class => "hidden-for-sighted_bak" %> <%= select_tag( 'user[mail_notification]', options_for_select( diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index dd912cfe6..d521d59f5 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -33,15 +33,24 @@ <% when 'JournalsForMessage' %> <% if User.current.login == @user.login %> <%# if e.user_id == act.jour.id %> - <%= link_to("#{e.user.name}", user_path(e.user_id)) %> 有了<%= link_to("#{e.act.user.name}", user_path(e.user.id))%>的留言 + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%= + link_to("#{e.act.user.name}", user_path(e.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> <%# else %> <%# end %> <% else %> - <%= link_to("#{@user.name}", user_path(e.user_id)) %> 有了新的动态 + <%= link_to("#{e.user.name}", user_path(e.user_id)) %> <%= l(:label_have_feedback) %><%= + link_to("#{e.act.user.name}", user_path(e.user.id)) %><%= l(:label_of_feedback) + l(:label_layouts_feedback) %> <% end %> -

    <%=textilizable act.notes %>

    - + +

    <%= textilizable act.notes %>

    +
    <%= link_to(l(:label_goto), user_newfeedback_user_path(e.user_id)) %> +
    + + + + +
    <%=(l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
    @@ -171,9 +180,26 @@
    <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %>
    -
    <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %><%= l(:label_comments_count, :count => e.act.journals.count)%>
    +
    <%= link_to l(:label_find_all_comments), {:controller => 'issues', :action => 'show', :id => act.id} %><%= l(:label_comments_count, :count => e.act.journals.count)%>
    +<% when 'Contest' %> + + <% if e.user == User.current%> + <%= link_to("#{l(:label_i)}", user_path(e.user_id)) %> <%= l(:label_i_new_activity) %> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> + <% else %> + <%= link_to(h(e.user), user_path(e.user_id)) %> <%= l(:label_new_activity) %> <%= link_to format_activity_title("#{l(:label_contest)}: #{act.name}"), {:controller => 'contests', :action => 'show_contest', :id => act.id} %> + <% end %> + +

    <%= h act.description %>

    + + +
    + <%= (l(:label_update_time).to_s << ':' << format_time(e.act.created_on)).to_s %> +
    + +<% else %> + <% f=1 %> <% end %> @@ -244,7 +270,7 @@
    <% else %> diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 1b6336985..65c96e4d0 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -152,7 +152,11 @@
    <%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> - (<%= link_to("含#{contest.contesting_softapplications.count}个app", show_softapplication_contest_path(contest), :target => "_blank") %>) + <% if contest.id == 2 or contest.id == 3 or contest.id == 6 %> + (<%= link_to("含#{contest.projects.where('is_public=1').count}个作品", show_attendingcontest_contest_path(contest), :target => "_blank") %>) + <% else %> + (<%= link_to("含#{contest.contesting_softapplications.count}个app", show_attendingcontest_contest_path(contest), :target => "_blank") %>) + <% end %>
    @@ -201,7 +205,7 @@
    -

    最新参赛应用

    +

    最新参赛作品

    <%= link_to "更多>>", {:controller => 'softapplications', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %>
    <% if Softapplication.count > 0%> diff --git a/config/locales/en.yml b/config/locales/en.yml index 4f995d794..0215d43b6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1306,6 +1306,7 @@ en: label_have_respond: had a respond label_welcome: Welcome + label_goto: Go to>> label_join: join Trustie! label_repository_new: link to existing SVN repository label_repository_path: path of repository @@ -1411,6 +1412,8 @@ en: label_user_activity_myself: About me label_user_all_respond: All replies label_layouts_feedback: Messages + label_have_feedback: Have + label_of_feedback: Of label_welcome_participate: participates #modify by men label_x_welcome_participate: @@ -1607,3 +1610,5 @@ en: label_activity_time: publish date + # ajax异步验证 + modal_valid_passing: can be used. diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 6b4a925c8..3d8a0e54e 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -189,6 +189,8 @@ zh: notice_unable_delete_time_entry: 无法删除工时 notice_issue_done_ratios_updated: 问题完成度已更新。 notice_gantt_chart_truncated: "这个表是截断的因为它超过了可以显示的最大数量(%{max})" + + error_complete_occupation: "请您填写工作单位,否则本系统的部分功能将无法正常使用。" error_can_t_load_default_data: "无法载入默认设置:%{value}" error_scm_not_found: "版本库中不存在该条目和(或)其修订版本。" @@ -1495,6 +1497,7 @@ zh: label_issue_praise_over: 我刚才顶过了~ label_issue_tread_over: 我刚才踩过了~ #end + label_goto: 前往>> label_issue_appraise_over: 只能评价一次哦! label_welcome_my_respond: 请在此留下你的意见和建议! label_no_current_fans: 该用户暂无粉丝 @@ -1575,6 +1578,8 @@ zh: label_my_honework_no_homework: 暂无任何作业! label_user_all_respond: 所有反馈 label_layouts_feedback: 留言 + label_have_feedback: 有了 + label_of_feedback: 的 label_welcome_participate: 参与了 #modify by men label_x_welcome_participate: @@ -1844,8 +1849,9 @@ zh: label_contest_project: 参赛项目 label_contest_softapplication: 参赛应用 label_contest_response: 用户反馈 - label_contest_watchers: 关注人员 + label_contest_watchers: 关注人数 label_contest_application: 参赛应用 + label_contest_work: 参赛作品 button_contesting_as_project: 我要参赛(新建项目) button_contesting_as_application: 我要参赛(发布应用) label_release_softapplication: 发布应用 @@ -1874,6 +1880,8 @@ zh: label_edit_softapplication: 修改应用 label_contest_delete: 删除竞赛 label_softapplication_list: 应用列表 + label_contest_work_list: 参赛作品列表 + label_attending_contest: 我要参赛 label_coursefile_sharingarea: 课程资源共享区 label_sort_by_activity: 按动态数排序 @@ -1887,4 +1895,7 @@ zh: label_relation_files: 关联已有资源 label_contest_settings: 配置竞赛 label_contest_delete: 删除竞赛 + + # ajax异步验证 + modal_valid_passing: 可以使用 \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index a856deaf1..d93112c54 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -67,15 +67,16 @@ RedmineApp::Application.routes.draw do end member do match 'add_softapplication' - match 'update_contest' , via: [:put] - match 'show_contest' , via: :get - match 'show_project' , via: :get - match 'show_softapplication', via: :get - match 'show_participator' , via: :get - match 'add' , via: [:get, :post] - match 'add_softapplication' , via: [:get, :post] - match 'create' , via: :post - match 'settings' , via: [:get, :post] + match 'update_contest' , via: [:put] + match 'show_contest' , via: :get + match 'show_project' , via: :get + match 'show_softapplication' , via: :get + match 'show_attendingcontest' , via: :get + match 'show_participator' , via: :get + match 'add' , via: [:get, :post] + match 'add_softapplication' , via: [:get, :post] + match 'create' , via: :post + match 'settings' , via: [:get, :post] end end @@ -126,6 +127,7 @@ RedmineApp::Application.routes.draw do match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' match 'account/activate', :to => 'account#activate', :via => :get + match 'account/valid_ajax', :to => 'account#valid_ajax', :via => :get match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put] match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] diff --git a/db/migrate/20140505082635_drop_user_scores.rb b/db/migrate/20140505082635_drop_user_scores.rb new file mode 100644 index 000000000..fc65788f2 --- /dev/null +++ b/db/migrate/20140505082635_drop_user_scores.rb @@ -0,0 +1,5 @@ +class DropUserScores < ActiveRecord::Migration + def change + drop_table :user_scores + end +end diff --git a/db/migrate/20140505083218_create_user_levels.rb b/db/migrate/20140505083218_create_user_levels.rb new file mode 100644 index 000000000..f0e201212 --- /dev/null +++ b/db/migrate/20140505083218_create_user_levels.rb @@ -0,0 +1,8 @@ +class CreateUserLevels < ActiveRecord::Migration + def change + create_table :user_levels do |t| + t.integer :user_id + t.integer :level + end + end +end diff --git a/db/migrate/20140505083430_create_user_scores.rb b/db/migrate/20140505083430_create_user_scores.rb new file mode 100644 index 000000000..6c63aa327 --- /dev/null +++ b/db/migrate/20140505083430_create_user_scores.rb @@ -0,0 +1,11 @@ +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 diff --git a/db/schema.rb b/db/schema.rb index 1d329f3c3..74310a946 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -863,6 +863,11 @@ ActiveRecord::Schema.define(:version => 20140509020307) do add_index "user_grades", ["project_id"], :name => "index_user_grades_on_project_id" add_index "user_grades", ["user_id"], :name => "index_user_grades_on_user_id" + create_table "user_levels", :force => true do |t| + t.integer "user_id" + t.integer "level" + end + create_table "user_preferences", :force => true do |t| t.integer "user_id", :default => 0, :null => false t.text "others" @@ -873,16 +878,11 @@ ActiveRecord::Schema.define(:version => 20140509020307) do add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" create_table "user_scores", :force => true do |t| - t.integer "user_id", :null => false - t.integer "collaboration" - t.integer "influence" - t.integer "skill" - t.integer "active" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - t.integer "level" - t.integer "file" - t.integer "issue" + t.integer "user_id" + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "activity" end create_table "user_statuses", :force => true do |t| diff --git a/lib/redmine.rb b/lib/redmine.rb index 2c935074b..d22feb9fc 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -279,8 +279,10 @@ end ###new add by linchun Redmine::MenuManager.map :contest_menu do |menu| menu.push :respond, :show_contest_contest_path, :caption => :label_user_response - menu.push :project, :show_project_contest_path, :caption => :label_contest_project - menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application + #menu.push :project, :show_project_contest_path, :caption => :label_contest_project + #menu.push :application, :show_softapplication_contest_path, :caption => :label_contest_application + menu.push :attendingcontest, {:controller => 'contests', :action => 'show_attendingcontest'}, :caption => :label_attending_contest + # menu.push :attendingcontest, :show_attendingcontest_contest_path, :caption => :label_attendin,g_contest # menu.push :result, { :controller => 'bids', :action => 'show_results' }, # :caption => :label_bidding_results,:if => Proc.new{ |p| User.current.id == p } end diff --git a/public/stylesheets/nyan.css b/public/stylesheets/nyan.css index 4bb81d2f8..e1088c8c0 100644 --- a/public/stylesheets/nyan.css +++ b/public/stylesheets/nyan.css @@ -1,5 +1,14 @@ /* TODO: base/common/page 准备封装一些基本样式组合调用 参考YUI *******************************************************************************/ +span[id^=valid_user]{ + padding-left: 10px; +} +.red{ + color: red; +} +.green{ + color: green; +} .border_box { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; @@ -941,7 +950,7 @@ div.issue { /* project 文件列表 资源库 *******************************************************************************/ .tags_area { - height: 5px; + height: 13px; } #ver-zebra, .file_table_des {