diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index a3bb96aa9..1d5dd65eb 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -263,9 +263,6 @@ class UsersController < ApplicationController
sort_init 'login', 'asc'
sort_update %w(login firstname lastname mail admin created_on last_login_on)
- # Deprecation
- @project_type = params[:project_type]
-
case params[:format]
when 'xml', 'json'
@offset, @limit = api_offset_and_limit({:limit => 15})
@@ -274,16 +271,9 @@ class UsersController < ApplicationController
end
# retrieve all users
- scope = UserStatus.visible
-
- # if role has something, change scope.
- case params[:role]
- when 'teacher'
- scope = UserStatus.teacher
- when 'student'
- scope = UserStatus.student
- else
- end
+ # 先内连一下statuses 保证排序之后数量一致
+ scope = User.visible.
+ joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id")
# unknow
scope = scope.in_group(params[:group_id]) if params[:group_id].present?
@@ -295,25 +285,32 @@ class UsersController < ApplicationController
# users classify
case params[:user_sort_type]
when '0'
+ # 创建时间排序
@s_type = 0
- @us_ordered = scope.
- joins("LEFT JOIN users ON user_statuses.user_id = users.id").
- reorder('users.created_on DESC')
+ @users = scope.reorder('users.created_on DESC')
when '1'
+ # 活跃度排序, 就是所谓的得分情况
@s_type = 1
- @us_ordered = scope.reorder('user_statuses.grade DESC')
+ @users = scope.
+ joins("LEFT JOIN user_scores ON users.id = user_scores.user_id").
+ reorder('user_scores.active DESC')
when '2'
+ # 粉丝数排序
@s_type = 2
- @us_ordered = scope.reorder('user_statuses.watchers_count DESC')
+ @users = scope.
+ #joins("INNER JOIN user_statuses ON users.id = user_statuses.user_id").
+ reorder('user_statuses.watchers_count DESC')
+
else
+ # 默认活跃度排序
@s_type = 1
- @us_ordered = scope.reorder('user_statuses.grade DESC')
+ @users = scope.
+ joins("LEFT JOIN user_scores ON users.id = user_scores.user_id").
+ reorder('user_scores.active DESC')
end
# limit and offset
- @users_statuses = @us_ordered.offset(@user_pages.offset).limit(@user_pages.per_page)
- # get users ActiveRecord
- @users = @users_statuses.includes(:user).map(&:user)
+ @users = @users.limit(@user_pages.per_page).offset(@user_pages.offset)
@user_base_tag = params[:id] ? 'base_users':'users_base'
respond_to do |format|
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 77741e5e5..50500b40d 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -827,8 +827,11 @@ module ApplicationHelper
def select_option_helper option
tmp = Hash.new
tmp={"" => ""}
- option.each do |project|
- tmp[project.name] = project.id
+ if option.nil?
+ else
+ option.each do |project|
+ tmp[project.name] = project.id
+ end
end
tmp
end
@@ -1172,25 +1175,27 @@ module ApplicationHelper
objects = objects.first
end
# end
- objects = objects.map {|o| o.is_a?(String) ? instance_variable_get("@#{o}") : o}.compact
- errors = objects.map {|o| o.errors.full_messages}.flatten
- if errors.any?
- html << "
\n"
- errors.each do |error|
+ if objects != nil
+ objects = objects.map {|o| o.is_a?(String) ? instance_variable_get("@#{o}") : o}.compact
+ errors = objects.map {|o| o.errors.full_messages}.flatten
+ if errors.any?
+ html << "\n"
+ errors.each do |error|
+ ###by xianbo
+ if(error!=l(:label_repository_path_not_null))
+ html << "#{h error} \n"
+ end
+ ###xianbo
+ end
###by xianbo
- if(error!=l(:label_repository_path_not_null))
- html << "#{h error} \n"
+ unless params[:repository].nil?
+ if params[:repository][:upassword]==""
+ html << ""+ l(:label_password_not_null) +" \n"
+ end
end
###xianbo
+ html << " \n"
end
- ###by xianbo
- unless params[:repository].nil?
- if params[:repository][:upassword]==""
- html << ""+ l(:label_password_not_null) +" \n"
- end
- end
- ###xianbo
- html << " \n"
end
html.html_safe
end
diff --git a/app/views/contests/_new_softapplication.html.erb b/app/views/contests/_new_softapplication.html.erb
new file mode 100644
index 000000000..830bcd314
--- /dev/null
+++ b/app/views/contests/_new_softapplication.html.erb
@@ -0,0 +1,96 @@
+<%#= error_messages_for 'softapplication' %>
+<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
+
+ <%= hidden_field_tag 'contest_id', @contest.id %>
+
+ <%= l(:label_work_name) %>
+ * :
+ <%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %>
+
+
+
+
+
+
+
+ <%= l(:label_running_platform) %>
+ * :
+ <%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %>
+
+
+
+
+
+
+
+ <%= l(:label_work_type) %>
+ * :
+
+
+ <%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
+
+ <%= f.select :app_type_name,work_type_opttion, {},{:style => "width:358px;",:onchange => "selectChange(this)"} %>
+ <%#= f.text_field :app_type_name, :required => true, :size => 60, :style => "width:400px;" %>
+
+
+ <%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
+
+
+
+
+
+
+
+
+ <%= l(:label_work_description) %>
+ * :
+ <%= f.text_field :description, :required => true, :size => 60, :style => "width:350px;" %>
+
+
+
+
+
+
+
+ <%= l(:label_softapplication_developers) %>
+ * :
+ <%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %>
+
+
+
+
+
+
+
+ <%= l(:label_work_deposit_project) %>:
+ <%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %>
+ <%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %>
+
+
+
+
+
+
+
+ <%= l(:label_upload_softworkpacket_photo) %>
+
+ <%#= render_flash_messages %>
+
+ <%= render :partial => 'attachments/form' %>
+
+
+
+ 1、<%= l(:label_upload_softapplication_packets_mustpacketed) %>
+
+ 2、<%= l(:label_upload_softapplication_photo_condition) %>
+
+
+
+
+
+ <%= submit_tag l(:button_create) %>
+ <%= submit_tag l(:button_cancel), :name => nil, :onclick => "cancel();",
+ :type => 'button', :class => "enterprise", :onmouseout => "this.style.backgroundPosition = 'left top'",
+ :onmouseover => "this.style.backgroundPosition = 'left -30px'" %>
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/contests/show_attendingcontest.html.erb b/app/views/contests/show_attendingcontest.html.erb
index f6b684e5f..415897492 100644
--- a/app/views/contests/show_attendingcontest.html.erb
+++ b/app/views/contests/show_attendingcontest.html.erb
@@ -88,7 +88,7 @@
<%= l(:label_attending_contest) %>:
- <%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %>
+ <%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').slideToggle();" %>
<% else %>
@@ -99,102 +99,8 @@
<% end %>
-