Merge branch 'szzh' of http://repository.trustie.net/xianbo/trustie2 into szzh
This commit is contained in:
commit
9da116c0e3
|
@ -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|
|
||||
|
|
|
@ -827,9 +827,12 @@ module ApplicationHelper
|
|||
def select_option_helper option
|
||||
tmp = Hash.new
|
||||
tmp={"" => ""}
|
||||
if option.nil?
|
||||
else
|
||||
option.each do |project|
|
||||
tmp[project.name] = project.id
|
||||
end
|
||||
end
|
||||
tmp
|
||||
end
|
||||
# Redmine links
|
||||
|
@ -1172,6 +1175,7 @@ module ApplicationHelper
|
|||
objects = objects.first
|
||||
end
|
||||
# end
|
||||
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?
|
||||
|
@ -1192,6 +1196,7 @@ module ApplicationHelper
|
|||
###xianbo
|
||||
html << "</ul></div>\n"
|
||||
end
|
||||
end
|
||||
html.html_safe
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,96 @@
|
|||
<%#= error_messages_for 'softapplication' %>
|
||||
<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
|
||||
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
|
||||
<%= hidden_field_tag 'contest_id', @contest.id %>
|
||||
<tr style="width:700px; margin-left: -10px;">
|
||||
<span><%= l(:label_work_name) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
<!--span style="font-size: 10px">(<%#= l(:label_workname_lengthlimit) %>)</span-->
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_running_platform) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_type) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px">
|
||||
<span>
|
||||
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
|
||||
</span>
|
||||
<%= 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;" %>
|
||||
</td>
|
||||
<span style="font-size: 10px;display: none" id="other_span">
|
||||
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
|
||||
<input type="text" style="width: 100px;" id="other_input" name = "other_input"/>
|
||||
</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_description) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
<!--span style="font-size: 10px">(<%#= l(:label_workdescription_lengthlimit) %>)</span-->
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_softapplication_developers) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_deposit_project) %>:</span>
|
||||
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %></span>
|
||||
<span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) -->
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<fieldset style="width: 500px; padding-top: 10px">
|
||||
<legend>
|
||||
<%= l(:label_upload_softworkpacket_photo) %>
|
||||
</legend>
|
||||
<%#= render_flash_messages %>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
|
||||
<p style="font-size: 11px">
|
||||
1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
|
||||
<br>
|
||||
2、<%= l(:label_upload_softapplication_photo_condition) %>
|
||||
</p>
|
||||
|
||||
</fieldset>
|
||||
</fieldset></br>
|
||||
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
|
||||
<%= 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'" %>
|
||||
</div>
|
||||
<% end %>
|
|
@ -88,7 +88,7 @@
|
|||
<div style="padding-bottom: 10px; line-height: 15px">
|
||||
<div style="padding-left: 82px; font-size: 14px">
|
||||
<span><strong><%= l(:label_attending_contest) %>:</strong></span>
|
||||
<span><%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').toggle();" %></span>
|
||||
<span><%= link_to l(:label_new_attendingcontest_work), "javascript:void(0);", onclick: "$('#put-project-form').slideToggle();" %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
|
@ -99,102 +99,8 @@
|
|||
<% end %>
|
||||
|
||||
<!--点击新建参赛作品弹出框新建参赛作品并关联到竞赛中-->
|
||||
<div id="put-project-form" style="display: none; padding-left: 83px; width: 88%">
|
||||
<%= form_for Softapplication.new, :url => softapplications_path do |f| %>
|
||||
<fieldset class="contes-new-box" style="padding-left: 36px; line-height: 8px; margin-left: 1px" >
|
||||
<%= hidden_field_tag 'contest_id', @contest.id %>
|
||||
<tr style="width:700px; margin-left: -10px;">
|
||||
<span><%= l(:label_work_name) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td><%= f.text_field :name, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
<span style="font-size: 10px">(<%= l(:label_workname_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_running_platform) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :android_min_version_available, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_type) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px">
|
||||
<span>
|
||||
<%#= select_tag 'app_type_name', work_type_opttion, {:name => 'app_type_name',:style => "width:358px;"} %>
|
||||
</span>
|
||||
<%= 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;" %>
|
||||
</td>
|
||||
<span style="font-size: 10px;display: none" id="other_span">
|
||||
<%#= f.text_field :other_input, :required => true, :size => 60, :style => "width:100px;" %>
|
||||
<input type="text" style="width: 100px;" id="other_input" name = "other_input"/>
|
||||
</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_description) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :description, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
<span style="font-size: 10px">(<%= l(:label_workdescription_lengthlimit) %>)</span>
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_softapplication_developers) %></span>
|
||||
<span class="contest-star"> * </span>:
|
||||
<td style="width: 100px"><%= f.text_field :application_developers, :required => true, :size => 60, :style => "width:350px;" %></td>
|
||||
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<tr style="width:800px;">
|
||||
<span><%= l(:label_work_deposit_project) %>:</span>
|
||||
<span style="padding-left: 4px"><%= select_tag 'project', options_for_select(select_option_helper(@option)), :name => 'project', :class => 'grayline2',:style => "width:358px;" %></span>
|
||||
<span><%= link_to l(:label_create_new_projects),{:controller => 'projects',:action => 'new',course: 0, project_type: 0,host: Setting.project_domain}, :target => '_blank' %></span><!-- new_project_path(course: 0, project_type: 0) -->
|
||||
</tr>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<fieldset style="width: 500px; padding-top: 10px">
|
||||
<legend>
|
||||
<%= l(:label_upload_softworkpacket_photo) %>
|
||||
</legend>
|
||||
<%#= render_flash_messages %>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
|
||||
<p style="font-size: 11px">
|
||||
1、<%= l(:label_upload_softapplication_packets_mustpacketed) %> <br/>
|
||||
<br>
|
||||
2、<%= l(:label_upload_softapplication_photo_condition) %>
|
||||
</p>
|
||||
|
||||
</fieldset>
|
||||
</fieldset></br>
|
||||
<div class="align-center" style="padding-top: -3px; padding-bottom: 8px">
|
||||
<%= 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'" %>
|
||||
</div>
|
||||
<% end %>
|
||||
<div id="put-project-form" style=" padding-left: 83px; width: 88%">
|
||||
<%= render "new_softapplication" %>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,11 @@
|
|||
<%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %>
|
||||
|
||||
<div class="activity_description info-break" style="font-size: 13px;">
|
||||
<div class="issue-list-description">
|
||||
<div class="wiki">
|
||||
<%#= textilizable e.event_url,:description %>
|
||||
</div>
|
||||
</div>
|
||||
<%= h(truncate(strip_tags(e.event_description).gsub(/ /, ' '), length: 30, omission: '...')) %>
|
||||
</div>
|
||||
<div class="activity_status" style="position:relative; padding-top: 3px;">
|
||||
|
|
|
@ -257,17 +257,35 @@
|
|||
<tr>
|
||||
<% if e.user == User.current %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to("#{l(:label_i)}", user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_i_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||
<strong>
|
||||
<%= link_to("#{l(:label_i)}", user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_i_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||
</td>
|
||||
<% else %>
|
||||
<td colspan="2" valign="top">
|
||||
<strong><%= link_to(h(e.user), user_path(e.user_id)) %></strong> <span class="font_lighter"><%= l(:label_new_activity) %></span> <%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||
<strong>
|
||||
<%= link_to(h(e.user), user_path(e.user_id)) %>
|
||||
</strong>
|
||||
<span class="font_lighter">
|
||||
<%= l(:label_new_activity) %>
|
||||
</span>
|
||||
<%= link_to format_activity_title("#{act.source_from} (#{act.status}): #{act.tracker.name} #{act.subject}"), {:controller => 'issues', :action => 'show', :id => act.id} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" width="580">
|
||||
<p class="font_description"> <%= textilizable(act.description) %> </p></td>
|
||||
<div class="issue-list-description">
|
||||
<div class="wiki">
|
||||
<%= textilizable act, :description %>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <p class="font_description"> <%#= textilizable(act.description) %> </p> -->
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
|
|
@ -166,10 +166,10 @@
|
|||
<%= "#{l(:label_updated_time, value: time_tag_welcome(topic_last_time topic))}".html_safe %>
|
||||
</span>
|
||||
<span class="memo_author">
|
||||
楼主: <%= link_to_user(topic.author) %>
|
||||
楼主: <%= link_to topic.author.login.truncate(10, omission: '...'),user_path(topic.author),title: topic.author.login %>
|
||||
</span>
|
||||
<span class="memo_last_person">
|
||||
最后回复:<%=link_to_user topic.last_reply.try(:author) %>
|
||||
最后回复:<% unless (topic.last_reply.nil? || topic.last_reply.author.nil?) %><%=link_to topic.last_reply.author.login.truncate(10, omission: '...'),user_path(topic.last_reply.author),title: topic.last_reply.author.login%><% end %>
|
||||
</span>
|
||||
<span class="memo_reply">
|
||||
回复(<%= link_to topic.try(:replies_count), topic.event_url %>)
|
||||
|
|
|
@ -2048,6 +2048,7 @@ zh:
|
|||
notice_account_updated: 帐号更新成功
|
||||
notice_attendingcontest_work_successfully_created: 恭喜您,参赛作品创建成功!
|
||||
notice_softapplication_was_successfully_updated: 恭喜您,参赛作品更新成功!
|
||||
notice_attendingcontest_work_failed_created: 参赛产品创建失败
|
||||
|
||||
label_attendingcontestwork_belongs_contest: 所属竞赛
|
||||
label_attendingcontestwork_belongs_type: 所属类别
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
|
||||
|
||||
one:
|
||||
act_id:
|
||||
act_type: MyString
|
||||
user_id:
|
||||
id: 1
|
||||
act_id: 1
|
||||
act_type: JournalsForMessage
|
||||
user_id: 5
|
||||
|
||||
two:
|
||||
act_id:
|
||||
act_type: MyString
|
||||
user_id:
|
||||
act_id: 2
|
||||
act_type: JournalsForMessage
|
||||
user_id: 5
|
||||
|
|
|
@ -1,4 +1,34 @@
|
|||
jfm_001:
|
||||
id: 1
|
||||
jour_id: 5
|
||||
jour_type: Principal
|
||||
user_id: 2
|
||||
notes:
|
||||
status: 0
|
||||
reply_id: 0
|
||||
created_on: 2014-07-16 15:27:2
|
||||
updated_on: 2014-07-16 15:27:2
|
||||
m_parent_id:
|
||||
is_readed:
|
||||
m_reply_count:
|
||||
m_reply_id:
|
||||
is_comprehensive_evaluation:
|
||||
jfm_002:
|
||||
id: 2
|
||||
jour_id: 5
|
||||
jour_type: Principal
|
||||
user_id: 2
|
||||
notes: 我觉得这个系统挺实用,界面挺简洁美观1!
|
||||
status:
|
||||
reply_id: 0
|
||||
created_on: 2014-07-16 15:27:2
|
||||
updated_on: 2014-07-16 15:27:2
|
||||
m_parent_id:
|
||||
is_readed:
|
||||
m_reply_count:
|
||||
m_reply_id:
|
||||
is_comprehensive_evaluation:
|
||||
jfm_045:
|
||||
id: 45
|
||||
jour_id: 2
|
||||
jour_type: Project
|
||||
|
@ -64,7 +94,7 @@ jfm_060:
|
|||
jour_id: 2
|
||||
jour_type: Project
|
||||
user_id: 2
|
||||
notes: something very nice
|
||||
notes:
|
||||
status:
|
||||
reply_id: 0
|
||||
created_on: 2013-08-21 07:04:43
|
||||
|
@ -119,4 +149,3 @@ jfm_088:
|
|||
m_reply_count:
|
||||
m_reply_id:
|
||||
is_comprehensive_evaluation:
|
||||
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
require File.expand_path('../../test_helper', __FILE__)
|
||||
|
||||
class UsersControllerTest < ActionController::TestCase
|
||||
fixtures :users, :projects, :members, :member_roles, :roles,
|
||||
:custom_fields, :custom_values, :groups_users,
|
||||
:auth_sources,
|
||||
:activities,
|
||||
:journals_for_messages
|
||||
def setup
|
||||
User.current = nil
|
||||
@request.session[:user_id] = 1
|
||||
@request.session[:ctime] = Time.now
|
||||
@request.session[:atime] = Time.now
|
||||
end
|
||||
|
||||
test '#index by non-member' do
|
||||
@request.session[:user_id] = nil
|
||||
get :index
|
||||
assert_response :success
|
||||
assert_template 'index'
|
||||
end
|
||||
|
||||
test '#show by non-member' do
|
||||
@request.session[:user_id] = 8
|
||||
get :show, {id: 5}
|
||||
assert_response :success
|
||||
assert_template 'show'
|
||||
end
|
||||
|
||||
test '#user_newfeedback by non-member' do
|
||||
@request.session[:user_id] = nil
|
||||
get :user_newfeedback, {id: 5}
|
||||
assert_response :success
|
||||
assert_template 'user_newfeedback'
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in New Issue