Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop

This commit is contained in:
daiao 2017-01-04 10:41:38 +08:00
commit 432c98881b
14 changed files with 130 additions and 154 deletions

View File

@ -23,6 +23,12 @@ class AccountController < ApplicationController
skip_before_filter :check_if_login_required
# Login request and validation
def login
if params[:type] == "activated"
@message = l(:notice_account_activated)
elsif params[:type] == "expired"
@message = l(:notice_account_expired)
end
if request.get?
@login = params[:login] || true
if User.current.logged?
@ -201,7 +207,8 @@ class AccountController < ApplicationController
def activate
(redirect_to(signin_path); return) unless Setting.self_registration? && params[:token].present?
token = Token.find_token('register', params[:token].to_s)
(redirect_to(signin_path); return) unless token and !token.expired?
type = l(:notice_account_expired) if (token && token.expired?)
(redirect_to(signin_path(:type => "expired")); return) unless token and !token.expired?
user = token.user
(redirect_to(signin_path); return) unless user.registered?
user.activate
@ -209,7 +216,7 @@ class AccountController < ApplicationController
token.destroy
flash[:notice] = l(:notice_account_activated)
end
redirect_to signin_url
redirect_to signin_url(:type => "activated")
end
def api_register login,password,email

View File

@ -136,6 +136,9 @@
<p>在这里您的创新意识和创新潜力将得到充分发挥目前已有超过200所高校和科研机构在平台中开展在线协同开发、协同学习和协同研究。</p>
</div>
<div class="new_login_box fr mr45 mt100">
<% if @message %>
<p class="f14 mb5" style=" color:#fff;"><i class="icon-ok mr5"></i><%= h @message %></p>
<% end %>
<h2 class="new_login_h2">登录
<a href="<%= register_url_without_domain %>" class="fr mt5">立即注册</a><div class="cl"></div>
</h2>

View File

@ -12,7 +12,7 @@
<tr>
<td><%= index + 1 %></td>
<td>
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname", :title => "#{member.user.show_name}" %>
<%= link_to member.user.show_name, user_path(member.user), :class => "pro_new_idname ml10", :title => "#{member.user.show_name}" %>
</td>
<td style="width: 200px">
<span id="member_role_<%=member.id %>"><%= zh_contest_role(h member.roles.sort.collect(&:to_s).join(', ')) %></span>

View File

@ -1,7 +1,7 @@
<% @forums.each_with_index do |forum, i| %>
<div class="wenba-rightbar-li clearfix <%= i > 9 ? 'none' : ''%> " id="forum_list_<%= forum.id %>">
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px"><%= link_to forum.name, forum_path(forum), :class => "" %></h4>
<h4 class="fl wenba-rightbar-title mt5 ml10" style="border-bottom: 0px"><%= link_to forum.name, forum_path(forum), :class => "", :target => "_blank" %></h4>
<ul class=" fl right-line wenba-rightbar-ul" >
<li><%= link_to forum.memo_count, forum_path(forum), :class => "linkGrey5" %></li>
<li>回答</li>

View File

@ -19,10 +19,10 @@ function set_score_rule_submit() {
if($("#late_penalty_num").val().trim() == ""){
$("#late_penalty_num").val("0");
}
if($("#absence_penalty_num").val().trim() == ""){
if($("#absence_penalty_num").length > 0 && $("#absence_penalty_num").val().trim() == ""){
$("#absence_penalty_num").val("0");
}
if($("#appeal_penalty").val().trim() == ""){
if($("#absence_penalty_num").length > 0 && $("#appeal_penalty").val().trim() == ""){
$("#appeal_penalty").val("0");
}
$('#muban_popup_box').find('form').submit();

View File

@ -7,33 +7,31 @@
<li class="navHomepageMenu fl">
<%= link_to "首页", user_activities_path(User.current), :class => "c_white f16 db p10", :title => "回到个人首页" %>
</li>
<!-- <li class="navHomepageMenu fl">
<%#= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10" %>
</li>-->
<li class="navHomepageMenu fl">
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
</li>
<% if !hidden_unproject_infos %>
<li class="navHomepageMenu fl">
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :class => "c_white f16 db p10", :target => "_blank" %>
</li>
<% end %>
<% if hidden_unproject_infos %>
<li class="navHomepageMenu fl">
<%= link_to "课程", user_course_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
</li>
<% end %>
<li class="navHomepageMenu fl">
<%= link_to "项目", user_project_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
</li>
<li class="navHomepageMenu fl">
<%= link_to "竞赛", user_contest_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
</li>
<% if hidden_unproject_infos %>
<!-- <li class="navHomepageMenu fl">
<%#= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>-->
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr20">
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
</li>
<% end %>
<% else %>
<li class="navHomepageMenu fl mr30">
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" >公共贴吧</a>
<li class="navHomepageMenu fl">
<%= link_to "竞赛", user_contest_community_path(User.current), :class => "c_white f16 db p10", :target => "_blank" %>
</li>
<% end %>
<li class="navHomepageMenu fl mr20">
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
</li>
</ul>
</div>
<script>
@ -60,7 +58,11 @@
<% name = name%>
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子"/>
<% if hidden_unproject_infos %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的课程、班级、项目、用户、资源以及帖子" />
<% else %>
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词搜索公开的项目、用户、资源以及帖子" />
<% end %>
<input type="hidden" name="search_type" id="type" value="all"/>
<input type="text" style="display: none;"/>
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="search_in_header($(this));"></a>

View File

@ -7,11 +7,17 @@
<!--<li class="navHomepageMenu fl mr40">-->
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
<!--</li>-->
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
</li>
<% if hidden_unproject_infos %>
<% memo = Memo.where(:id => 1168).first %>
<% unless memo.nil? %>
<li class="navHomepageMenu fl mr40">
<a href="http://forge.trustie.net/forums/1/memos/1168" target="_blank" class="c_white f16 db p10" >帮助中心</a>
</li>
<% end %>
<% else %>
<li class="navHomepageMenu fl mr40">
<%= link_to "问吧", forums_path, :class =>"c_white f16 db p10", :target => "_blank" %>
</li>
<% end %>
</ul>
</div>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %>
<%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure', :media => 'all' %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'css/common', 'css/structure', 'css/font-awesome', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%>

View File

@ -101,7 +101,7 @@
<div class="cl"></div>
<div class="homepageContent">
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftdata_background mb10">
<div class="user_leftinfo mb10">
<% if User.current.logged? && User.current == @user%>
<div class="pr" style="width: 80px; margin:0 auto;">
<%= link_to image_tag(url_to_avatar(@user),width:"74", height: "74", :id => 'nh_source_tx'),
@ -159,38 +159,20 @@
</div>
</div>
<% if is_current_user %>
<div class="home-user-leftnav">
<h3 >
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %>
</h3>
<%# if hidden_unproject_infos %>
<% if hidden_unproject_infos %>
<div class="home-user-leftnav">
<h3 >
<%= link_to "课程社区", user_course_community_path(User.current), :class => "fl" , :target => "_blank", :style => "color:#666" %>
</h3>
<%# if hidden_unproject_infos %>
<ul>
<li class="home-user-leftnav-li icons-class clear">
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;font-size: 11px;background-color:#f5f2f2;color:#666;'>#{user_course_count}</span>".html_safe : "课程",
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
<!-- <div class="user_navmore_box" >
<ul>
<li class="user_navmore_icons">
<ul class="user_navmore_txt02" >
<%# if is_current_user %>
<li>
<%#= link_to "新建课程", new_syllabus_path(:host=> Setting.host_course), :target => "_blank", :class => "user_navmore_li" %>
</li>
<li>
<%#= link_to "新建班级", new_course_path(:host=> Setting.host_course), :target => "_blank", :class => "user_navmore_li" %>
</li>
<li>
<%#= link_to "加入班级", join_private_courses_courses_path, :remote => true, :method => "post", :class => "user_navmore_li" %>
</li>
<#% end %>
</ul>
</li>
</ul>
</div>-->
user_course_community_path(User.current), :id => "user_course_list", :target => "_blank" %>
</li>
<li class="home-user-leftnav-li icons-homework clear">
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
</li>
<li class="home-user-leftnav-li icons-homework clear">
<%=link_to '我的作业', my_homeworks_user_path(@user), :target => "_blank", :class => "fl", :style => "color:#666" %>
</li>
<li class="home-user-leftnav-li icons-doc clear">
<%= link_to "题库", user_homeworks_user_path(User.current), :target => "_blank", :class => "fl", :style => "color:#666" %>
</li>
@ -198,9 +180,9 @@
<%= link_to "资源库", user_resource_user_path(User.current, :type => 1), :target => "_blank", :class => "fl", :style => "color:#666" %>
</li>
</ul>
<%# end %>
</div>
<%# end %>
</div>
<% end %>
<div class="home-user-leftnav">
<h3 >
<%= link_to "项目社区", user_project_community_path(User.current), :class => "fl", :target => "_blank", :style => "color:#666" %>
@ -209,24 +191,6 @@
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:#666;'>#{user_project_count}</span>".html_safe : "项目",
user_project_community_path(User.current), :id => 'user_project_list', :target => "_blank" %>
<!-- <div class="user_navmore_box" >
<ul>
<li class="user_navmore_icons">
<ul class="user_navmore_txt02">
<li>
<%#= link_to "新建项目", new_project_path(:host => Setting.host_name), :target => "_blank", :class => "user_navmore_li" %>
</li>
<li>
<%#= link_to "加入项目", applied_join_project_path, :remote => true, :method => "post", :class => "user_navmore_li" %>
</li>
<li>
<%#= link_to "我的关注", user_watchlist_user_path(@user), :remote => true, :method => "post", :class => "user_navmore_li" %>
</li>
&lt;!&ndash;<li><a href="javascript:void(0);" class="user_navmore_li">发现更多</a></li>&ndash;&gt;
</ul>
</li>
</ul>
</div>-->
</li>
<li class="home-user-leftnav-li icons-issue clear">
<%= link_to issues_author_is_self_count > 0 ? "我发布的issue<span class='issues_nav_tag mr10 fr'style='line-height:18px;margin-top:9px;font-size:11px;background-color:#f5f2f2;color:##666;'>#{issues_author_is_self_count}</span>".html_safe : "我发布的issue",
@ -238,37 +202,42 @@
</li>
</ul>
</div>
<div class="home-user-leftnav">
<h3 >
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
</h3>
<ul>
<li class="home-user-leftnav-li icons-contest clear">
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_contest_count}</span>".html_safe : "竞赛",
user_contest_community_path(User.current), :id => "user_contest_list", :target => "_blank" %>
</li>
</ul>
<%# end %>
</div>
<% if hidden_unproject_infos %>
<div class="home-user-leftnav">
<h3 >
<%= link_to "竞赛社区", user_contest_community_path(User.current), :class => "fl" , :target => "_blank"%>
</h3>
<ul>
<li class="home-user-leftnav-li icons-contest clear">
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag mr10 fr' style='line-height:18px;margin-top: 9px;'>#{user_contest_count}</span>".html_safe : "竞赛",
user_contest_community_path(User.current), :id => "user_contest_list", :target => "_blank" %>
</li>
</ul>
<%# end %>
</div>
<% end %>
<% else %>
<div class="home-user-leftnav">
<h3 >Ta在确实
<span class="fr mr5" style="font-size:12px;color: #7f7f7f;"><%= time_tag(@user.created_on).html_safe %></span>
</h3>
<ul>
<li class="home-user-leftnav-li icons-class clear">
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
</li>
<% if hidden_unproject_infos %>
<li class="home-user-leftnav-li icons-class clear">
<%= link_to user_course_count > 0 ? "课程<span class='issues_nav_tag ml140'>#{user_course_count}</span>".html_safe : "课程",
user_course_community_path(@user), :id => "user_course_list", :class => "fl", :target => "_blank" %>
</li>
<% end %>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_project_count > 0 ? "项目<span class='issues_nav_tag ml140'>#{user_project_count}</span>".html_safe : "项目",
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
</li>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140'>#{user_contest_count}</span>".html_safe : "竞赛",
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>
user_project_community_path(@user), :id => 'user_project_list', :class => "fl", :target => "_blank" %>
</li>
<% if hidden_unproject_infos %>
<li class="home-user-leftnav-li icons-project clear">
<%= link_to user_contest_count > 0 ? "竞赛<span class='issues_nav_tag ml140'>#{user_contest_count}</span>".html_safe : "竞赛",
user_contest_community_path(@user), :id => 'user_contest_list', :class => "fl", :target => "_blank" %>
</li>
<% end %>
</ul>
</div>
<% end %>

View File

@ -10,7 +10,7 @@
<p><%= setting_check_box :plain_text_mail %></p>
<p><%= setting_select(:default_notification_option, User.valid_notification_options.collect {|o| [l(o.last), o.first.to_s]}) %></p>
<!--<p><%#= setting_select(:default_notification_option, User.valid_notification_options.collect {|o| [l(o.last), o.first.to_s]}) %></p>-->
</div>

View File

@ -17,7 +17,7 @@
<%= link_to homework.course.name, course_path(homework.course), :target => '_blank', :class => 'hw_cgrey' %>
</span>
<span class="mr15 fl">类别:<%=homework.homework_type_ch %></span>
<% my_work = cur_user_works_for_homework(homework) %>
<% my_work = homework.student_works.where("user_id = ? && work_status != 0",User.current).first %>
<span class="fl">状态:</span><span class="<%= my_work ? '' : 'hw_cir_nomal hw_cir_lorange' %> fl mr15"><%= my_work ? '已提交' : '未提交' %></span>
<span class="fl">作品:</span><span class="sy_corange hw_w20 fl mr15"><%=homework.student_works.has_committed.count %></span>
<span class="fl">成绩:</span>

View File

@ -12,61 +12,63 @@
</a>
</div>
<% end %>
<% if @unfinished_homework_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_2" onclick="HoverLi(2);">
<a href="<%= unfinished_homework_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" style="">
<% if hidden_unproject_infos %>
<% if @unfinished_homework_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_2" onclick="HoverLi(2);">
<a href="<%= unfinished_homework_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" style="">
<span style="margin: 5px auto; vertical-align: middle; display: inline-block;">
<li class="homepage_work_tab mb5 fl"></li>
<span class="ml5 fl" style="font-size: 20px;" id="unfinished_homework_num"><%= @unfinished_homework_count %></span>
<div class="cl"></div>
</span>
<br />待完成作业
<br />待完成作业
</div>
</a>
</div>
</a>
</div>
<% end %>
<% if @unfinished_test_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_3" onclick="HoverLi(3);">
<a href="<%= unfinished_test_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" style="">
<% end %>
<% if @unfinished_test_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_3" onclick="HoverLi(3);">
<a href="<%= unfinished_test_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" style="">
<span style="margin: 5px auto; vertical-align: middle; display: inline-block;">
<li class="homepage_test_tab mb5 fl"></li>
<span class="ml5 fl" style="font-size: 20px;" id="unfinished_test_num"><%= @unfinished_test_count %></span>
<div class="cl"></div>
</span>
<br />待完成测验
<br />待完成测验
</div>
</a>
</div>
</a>
</div>
<% end %>
<% if @unfinished_poll_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_4" onclick="HoverLi(4);">
<a href="<%= unfinished_poll_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" style="">
<% end %>
<% if @unfinished_poll_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_4" onclick="HoverLi(4);">
<a href="<%= unfinished_poll_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" style="">
<span style="margin: 5px auto; vertical-align: middle; display: inline-block;">
<li class="homepage_poll_tab mb5 fl"></li>
<span class="ml5 fl" style="font-size: 20px;" id="unfinished_poll_num"><%= @unfinished_poll_count %></span>
<div class="cl"></div>
</span>
<br />待完成问卷
<br />待完成问卷
</div>
</a>
</div>
</a>
</div>
<% end %>
<% if @anonymous_evaluation_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_5" onclick="HoverLi(5);">
<a href="<%= anonymous_evaluation_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" id="user_homepage_tab_05" style="">
<% end %>
<% if @anonymous_evaluation_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_5" onclick="HoverLi(5);">
<a href="<%= anonymous_evaluation_list_user_path(@user) %>" data-remote = "true">
<div class="homepage_tab_div" id="user_homepage_tab_05" style="">
<span style="margin: 5px auto; vertical-align: middle; display: inline-block;">
<li class="homepage_anonymity_tab mb5 fl"></li>
<span class="ml5 fl" style="font-size: 20px;" id="anonymous_evaluation_num"><%= @anonymous_evaluation_count %></span>
<div class="cl"></div>
</span>
<br />待匿评作品
<br />待匿评作品
</div>
</a>
</div>
</a>
</div>
<% end %>
<% end %>
<% if @applied_message_alls_count > 0 %>
<div class="flex-cell_homepage" id="user_homepage_tab_6" onclick="HoverLi(6);">

View File

@ -11,17 +11,4 @@ $(function() {
$("#no_limit").attr('disabled', 'disabled');
$("#evaluation_num").attr('disabled', 'disabled');
<% end %>
});
function set_score_rule_submit() {
if($("#late_penalty_num").val().trim() == ""){
$("#late_penalty_num").val("0");
}
if($("#absence_penalty_num").val().trim() == ""){
$("#absence_penalty_num").val("0");
}
if($("#appeal_penalty").val().trim() == ""){
$("#appeal_penalty").val("0");
}
$('#muban_popup_box').find('form').submit();
hideModal();
}
});

View File

@ -89,4 +89,4 @@ zh:
label_check_email: 立即查收邮件
label_mail_resend: 重新发送激活邮件
notice_account_activated: 您的帐号已被激活。
notice_account_expired: 账号激活信息已过期。