diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 9bb0dc75c..c6298555e 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -939,6 +939,39 @@ class AdminController < ApplicationController end + # 身份认证 + def identity_authentication + type = params[:type] || 0 # 存在type 就用type 没有就为 0 + + user_id = User.find_by_sql("select id from users where concat(lastname,firstname) like '%#{params[:name]}%'") + @unapproved_user = ApplyUserAuthentication.where(:status => type, :user_id => user_id).order("updated_at desc") + + + respond_to do |format| + format.html{ render :layout => 'base_edu' } + format.js + end + end + + # 拒绝身份认证 + def reject_authentication + apply_user = ApplyUserAuthentication.find(params[:apply_id]) + reason = apply_user.update_attributes(:status => 2, :remarks => params[:reject_reason]) + render :json => {success: reason} + end + + # 统一身份认证 + def agree_authentication + apply_user = ApplyUserAuthentication.find(params[:apply_id]) + user = User.find(apply_user.user_id) + apply_user.update_attribute(:status, 1) + user.update_attribute(:authentication, true) + @unapproved_user = ApplyUserAuthentication.where(:status => 0).order("updated_at desc") + respond_to do |format| + format.js + end + end + def create_version @versions = PhoneAppVersion.reorder('created_at desc') @new_version = PhoneAppVersion.new diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 14af87c5c..80faef066 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2109,8 +2109,8 @@ class UsersController < ApplicationController @courses = @user.courses.visible.not_deleted @courses_count = @courses.count @courses = @courses.select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS updatetime").order("updatetime desc").limit(8) - @shixuns = [] - @shixuns_count = 0 + @shixuns = @user.shixuns + @shixuns_count = @shixuns.count # if User.current == @user # # 点击小铃铛,更新点击时间 # update_onclick_time if params[:click_user_message] == 'true' diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 97b4ae6e6..99159e721 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -68,6 +68,16 @@ module ApplicationHelper end end + # 已通过的关卡数 + def had_passed_changllenge_count shixun + myshixun = Myshixun.where(:shixun_id => shixun.id, :user_id => User.current.id).first + if myshixun.nil? + 0 + else + myshixun.games.select{|game| game.status == 2}.count + end + end + # 定义实训相关方法 def sum_final_score Game.find_by_sql("SELECT sum(final_score) as total_score FROM `games` where user_id=#{User.current.id}").first.try(:total_score) diff --git a/app/helpers/shixuns_helper.rb b/app/helpers/shixuns_helper.rb index 635645587..6a9004aca 100644 --- a/app/helpers/shixuns_helper.rb +++ b/app/helpers/shixuns_helper.rb @@ -21,4 +21,5 @@ module ShixunsHelper def had_passed_challenge challenge Game.where(:challenge_id => challenge.id, :status => 2).limit(3).reorder("final_score desc") end + end diff --git a/app/models/shixun.rb b/app/models/shixun.rb index be8c7b989..988bdd557 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -3,7 +3,7 @@ class Shixun < ActiveRecord::Base attr_accessible :description, :is_public, :name, :changeset_num, :status, :user_id, :gpid, :language, :identifier, :authentication, :myshixun_count, :propaedeutics has_many :users, :through => :shixun_members - has_many :shixun_members + has_many :shixun_members, :dependent => :destroy has_one :repository has_many :challenges, :dependent => :destroy, :order => "challenges.id ASC" has_many :myshixuns diff --git a/app/models/user.rb b/app/models/user.rb index 19e3d83b7..a3fdc06b2 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -124,6 +124,7 @@ class User < Principal has_many :contestant_work_scores has_many :contestant_work_projects + has_many :shixuns, :through => :shixun_members has_many :shixun_members, :dependent => :destroy has_many :challenges, :dependent => :destroy diff --git a/app/views/account/avatar.html.erb b/app/views/account/avatar.html.erb index 911eef99d..2c8c201a4 100644 --- a/app/views/account/avatar.html.erb +++ b/app/views/account/avatar.html.erb @@ -136,13 +136,13 @@ if(re){ var o = JSON.parse(re); if (o.status !=0 ){ - alert(o.message); + console.log(o.message); } else { - alert('上传成功'); + long_notice_box("上传成功"); window.location.reload(); } } else { - alert("上传出错"); + long_notice_box("上传出错"); } }, diff --git a/app/views/admin/_audit_authentication_list.html.erb b/app/views/admin/_audit_authentication_list.html.erb new file mode 100644 index 000000000..4616aa88f --- /dev/null +++ b/app/views/admin/_audit_authentication_list.html.erb @@ -0,0 +1,32 @@ +<% @unapproved_user.each_with_index do |apply_user, index| %> + <% user = User.find(apply_user.user_id) %> +
+ + <%= image_tag(url_to_avatar(@user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %> + +
+ +
+
+<% end %> \ No newline at end of file diff --git a/app/views/admin/_authentication_list.html.erb b/app/views/admin/_authentication_list.html.erb new file mode 100644 index 000000000..ad5f19f57 --- /dev/null +++ b/app/views/admin/_authentication_list.html.erb @@ -0,0 +1,40 @@ +<% @unapproved_user.each do |apply_user| %> + <% user = User.find(apply_user.user_id) %> +
+ + <%= image_tag(url_to_avatar(@user), :class => "fl with10 edu-ad-user", :alt => "头像", :width => "50", :height => "50" ) %> + +
+ +
+
+<% end %> \ No newline at end of file diff --git a/app/views/admin/agree_authentication.js.erb b/app/views/admin/agree_authentication.js.erb new file mode 100644 index 000000000..53bfcb733 --- /dev/null +++ b/app/views/admin/agree_authentication.js.erb @@ -0,0 +1 @@ +$("#authentication_list").html("<%= j( render :partial => "admin/authentication_list" ) %>"); \ No newline at end of file diff --git a/app/views/admin/identity_authentication.html.erb b/app/views/admin/identity_authentication.html.erb new file mode 100644 index 000000000..7888e7e06 --- /dev/null +++ b/app/views/admin/identity_authentication.html.erb @@ -0,0 +1,135 @@ +
+
+

身份认证

+
+
+
+ +
+
+
+
+ + +
+
+
+ <%= render :partial => "admin/authentication_list" %> +
+
+
+ +
+
+

+ 全部 + 同意 + 拒绝 +

+
+ + +
+
+
+
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/app/views/admin/identity_authentication.js.erb b/app/views/admin/identity_authentication.js.erb new file mode 100644 index 000000000..82b62fd42 --- /dev/null +++ b/app/views/admin/identity_authentication.js.erb @@ -0,0 +1,30 @@ +var nTabIcon_1 = $("#edu-tab-con-1"); +var nTabIcon_2 = $("#edu-tab-con-2"); +var nTabNav_1 = $("#edu-tab-nav-1"); +var nTabNav_2 = $("#edu-tab-nav-2"); +var nAudit = $("#audit_all_authentication").parent(); + +<% if params[:type] == "0" %> + $("#authentication_list").html("<%= j( render :partial => "admin/authentication_list" ) %>"); + nTabNav_1.addClass("edu-tab-hover"); + nTabNav_2.removeClass("edu-tab-hover"); + nTabIcon_1.show(); + nTabIcon_2.hide(); +<% else %> + $("#audit_authentication_list").html("<%= j( render :partial => "admin/audit_authentication_list" ) %>"); + nTabNav_1.removeClass("edu-tab-hover"); + nTabNav_2.addClass("edu-tab-hover"); + nTabIcon_1.hide(); + nTabIcon_2.show(); + /* -------------------------- 未审批(全部、同意、拒绝点击时动态样式) ------------------------------ */ + if(<%= params[:type] == "1" %>){ + nAudit.find(".active").removeClass("active"); + $("#audit_agree_authentication").addClass("active"); + }else if(<%= params[:type] == "2" %>){ + nAudit.find(".active").removeClass("active"); + $("#audit_reject_authentication").addClass("active"); + }else{ + nAudit.find(".active").removeClass("active"); + $("#audit_all_authentication").addClass("active"); + } +<% end %> \ No newline at end of file diff --git a/app/views/games/_game_results.html.erb b/app/views/games/_game_results.html.erb index d402d8ac6..f78c66a6a 100644 --- a/app/views/games/_game_results.html.erb +++ b/app/views/games/_game_results.html.erb @@ -39,7 +39,7 @@ - + diff --git a/app/views/games/_pass_game_show.html.erb b/app/views/games/_pass_game_show.html.erb index a0c04c7d0..dc9155ecb 100644 --- a/app/views/games/_pass_game_show.html.erb +++ b/app/views/games/_pass_game_show.html.erb @@ -8,7 +8,7 @@

恭喜您通过本关

<%= link_to "下 一 关", {:controller => 'games', :action => "next_step", :id => game, :myshixun_id => myshixun}, :class => "task-su-btn", :onclick => "hideModal();", :remote => true %> <% else %> - 查看光辉历史 + 查看光辉历史 <% end %> diff --git a/app/views/games/show.js.erb b/app/views/games/show.js.erb index f6332a61e..4023c81af 100644 --- a/app/views/games/show.js.erb +++ b/app/views/games/show.js.erb @@ -1,7 +1,10 @@ -clearInterval(cm); // tpi关闭耗时 -$("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); -$("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>'); -$("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); -$("#all_task_show").hide(); -fadein = 0; - +<% if params[:index].nil? %> + clearInterval(cm); // tpi关闭耗时 + $("#game_show_content").html('<%= escape_javascript(render :partial => 'games/game_show') %>'); + $("#myshixun_top").html('<%= escape_javascript(render :partial => 'myshixuns/myshixun_top') %>'); + $("#current_task_tab").attr('href','<%= myshixun_game_path(@myshixun.current_task, :myshixun_id => @myshixun) %>'); + $("#all_task_show").hide(); + fadein = 0; +<% else %> + $("#all_task_tab").trigger("click"); // 模拟全部任务点击事件 +<% end %> diff --git a/app/views/layouts/base_edu.html.erb b/app/views/layouts/base_edu.html.erb index 640354926..eb2b03765 100644 --- a/app/views/layouts/base_edu.html.erb +++ b/app/views/layouts/base_edu.html.erb @@ -9,7 +9,7 @@ <%= favicon %> <%= javascript_heads %> <%= heads_for_theme %> - <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-common', 'css/edu-public','css/taskstyle', 'css/font-awesome', 'css/edu-class', 'css/edu-popup', 'css/ketang' %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/edu-common', 'css/edu-public','css/taskstyle', 'css/font-awesome', 'css/edu-class', 'css/edu-popup', 'css/ketang', "css/edu-admin" %> <%= javascript_include_tag "edu/application",'edu/base_edu' %> <%= call_hook :view_layouts_base_html_head %> <%= yield :header_tags -%> diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index a134e8a5c..5611a480d 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -5,7 +5,7 @@
<%= image_tag(url_to_avatar(@user), :class => "person", :alt => "头像") %> <% if current_user %> -
更换头像
+
更换头像
<% end %>
@@ -212,11 +212,11 @@ <% end %>
-
+
<% @shixuns.each do |shixun| %> -

-   胡莎莎/Helloword:java实训入门 - 已解锁第2关/共8 +

+   <%= link_to shixun.name, shixun_path %> + 已解锁第<%= had_passed_changllenge_count(shixun) %>关/共<%= shixun.challenges.count %> 分享  

<% end %> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 90a0d68ee..68da15c43 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -911,7 +911,7 @@ zh: label_principal_search: "搜索用户或组:" label_user_search: "搜索用户:" label_mobile_version: "移动端版本管理" - + label_identity_authentication: "身份认证" button_create_and_continue: 创建并继续 diff --git a/config/routes.rb b/config/routes.rb index 8b5a15169..cdb923e0c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1443,6 +1443,9 @@ RedmineApp::Application.routes.draw do get 'admin/code_work_tests' post 'admin/select_course_syllabus' post 'admin/create_syllabus' + get 'admin/identity_authentication' + get 'admin/reject_authentication' + get 'admin/agree_authentication' resources :auth_sources do member do diff --git a/lib/redmine.rb b/lib/redmine.rb index 90b06dec0..d08eb8628 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -385,6 +385,7 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural menu.push :applied_schools, {:controller => 'admin', :action => 'applied_schools'}, :caption => :label_applied_shcools menu.push :applied_departments, {:controller => 'admin', :action => 'applied_departments'}, :caption => :label_applied_departments + menu.push :identity_authentication, { :controller => 'admin', :action => 'identity_authentication' }, :caption => :label_identity_authentication menu.push :first_page_made, {:controller => 'admin',:action => 'first_page_made'},:caption => :label_first_page_made menu.push :mobile_version, {:controller => 'admin',:action => 'mobile_version'},:caption => :label_mobile_version menu.push :groups, {:controller => 'groups'}, :caption => :label_group_plural diff --git a/public/javascripts/edu/application.js b/public/javascripts/edu/application.js index fb00f0806..9c646d3a6 100644 --- a/public/javascripts/edu/application.js +++ b/public/javascripts/edu/application.js @@ -218,6 +218,8 @@ function notice_box_redirect_remote(url, str){ pop_box_new(htmlvalue, 400, 140); } + + // 警告/提示弹框点击“x”关闭 $(function(){ $("button.task-close").live('click', function(){ diff --git a/public/javascripts/edu/user.js b/public/javascripts/edu/user.js index acc551eb9..6bb75bc77 100644 --- a/public/javascripts/edu/user.js +++ b/public/javascripts/edu/user.js @@ -44,4 +44,5 @@ $(function(){ $("#cancel_watch").live('mouseleave',function(){ $("#cancel_watch").html("已关注"); }); -}); \ No newline at end of file +}); + diff --git a/public/stylesheets/css/edu-admin.css b/public/stylesheets/css/edu-admin.css new file mode 100644 index 000000000..84c62d8fe --- /dev/null +++ b/public/stylesheets/css/edu-admin.css @@ -0,0 +1,94 @@ +/* 共用 后期再添加至公共样式 bylinda*/ +a:link,a:visited{text-decoration:none;color:#666; } +a:hover {color:#5faee3;} +a:hover.fa{color:#5faee3;} +a.link-color-grey{color:#aaa!important;} +a:hover.link-color-grey{color:#5faee3!important;} +a.link-name-dark{ color:#333; max-width:140px; display: block; } +a:hover.link-name-dark{ color:#5faee3;} +.mb50{ margin-bottom: 50px;} +.mr50{ margin-right: 50px;} +.ml35{ margin-left:35px;} +input,textarea,select{ border:1px solid #eee; background: #fff; color:#666;} +.edu-name-dark{ max-width:100px; display: block; } +.edu-info-dark{ max-width:345px; display: block; } +.edu-color-grey{ color:#666;} +.edu-color-grey:hover{color:#5faee3;} +.edu-btn-search{ position: absolute; top:0; right:15px;} +.edu-bg-light-blue{ background:#f7f9fd; padding:5px;} +.edu-max-h200{ height:200px; overflow: auto;} +.edu-position{ position: relative;} +.edu-h200-auto{ max-height:200px; overflow:auto;} +.edu-h300-auto{ max-height:300px; overflow:auto;} +.edu-h350-auto{ max-height:350px; overflow:auto;} +.edu-txt-w240{ width:240px; display: block;} +.edu-txt-w280{ width:280px; display: block;} +.edu-txt-w200{ width:200px; display: block;} +a.edu-txt-w140,.edu-txt-w140{ width:141px; display: inline-block;} +a.edu-txt-w100,.edu-txt-w100{ width:100px; display: inline-block;} +.edu-txt-w50{ width:50px;} +.edu-con-top{ padding:10px 0; background:#fff; border-bottom:1px solid #eee;font-size:16px; } +.edu-con-top h2{ font-size:16px;} +.edu-form-label{display: inline-block; width:60px;text-align: right; line-height: 40px; font-weight: normal;} +.edu-form-border{ border:1px solid #ddd;} +.edu-form-noborder,input.edu-form-noborder{ border:none; outline:none;} +.edu-w245{ width: 245px; } +a.edu-btn{display: inline-block;border:none; padding:0 12px;color: #666!important;border:1px solid #ccc; text-align:center;font-size: 14px; height: 29px;line-height: 29px; border-radius:3px; font-weight: bold;letter-spacing:1px;} +a:hover.edu-btn{ border:1px solid #5faee3; color: #5faee3!important;} +.edu-cir-grey{ display: inline-block; padding:0px 5px; color:#666; background:#eaeaea; text-align: center; border-radius:15px; font-size:12px; line-height:20px!important;} +a.edu-filter-cir-grey{display: inline-block; padding:0px 15px; color:#666; border:1px solid #ddd; text-align: center; border-radius:3px; font-size:12px; height:25px; line-height:25px;} +a:hover.edu-filter-cir-grey,a.edu-filter-cir-grey.active{ border:1px solid #3498db; color:#3498db; } +.edu-filter-btn{display: inline-block; padding:0px 10px; color:#666; background:#eee; text-align: center; border-radius:3px; font-size:12px; height:25px; line-height:25px;} +.edu-filter-btn-blue{background:#ebf6fe; color:#3498db;} +.edu-filter-btn-orange{background:#ffeee8; color:#ff5055;} +.edu-filter-btn-red{background:#fee4e5; color:#d72e36;} +.edu-filter-btn-green{background:#e4f3ec; color:#6fbb9d;} +.edu-filter-btn-yellow{background:#fdefde; color:#ef9324;} +.edu-filter-btn-danger{background:#d72e36; color:#fff;} +.edu-pop-table{ width: 100%; border:1px solid #eee; border-bottom:none; background:#fff; color:#888;} +.edu-pop-table tr{ height:40px; line-height: 40px; } +.edu-pop-table tr.edu-bg-grey{ background:#f5f5f5;} +.edu-txt-center{ text-align: center;} +.edu-pop-table tr th{ color:#333;border-bottom:1px solid #eee; } +.edu-pop-table tr td{border-bottom:1px solid #eee;} +.edu-pop-table.table-line tr td,.edu-pop-table.table-line tr th{ border-right:1px solid #eee;} +.edu-pop-table.table-line tr td:last-child,.edu-pop-table.table-line tr th:last-child{border-right:none;} +.edu-line{ border-bottom:1px solid #eee;} +table.table-th-grey th{ background:#f5f5f5;} +table.table-pa5 th,table.table-pa5 td{ padding:0 5px;} +.panel-comment_item .orig_cont-red{ border:solid 2px #cc0000; border-radius:10px; padding:4px;color:#999;margin-top:-1px; } + +.alert-red{ background-color: #f2dede;border-color: #eed3d7; color: #d14f4d; text-align: left!important;} +.eud-pointer{ cursor:pointer;} +.edu-bg-grey{ background:#f6f6f6; width:90%; min-width:700px; color:#666;} + +/* 与课程通用框架和tab 17/05/11 bylinda*/ +.edu-class-con{ width:50%; margin:0px auto; font-size:14px; padding:50px 0;} +.edu-con-bg01{ width: 100%; background:#fff;} +.edu-class-box{ width:100%;} +.edu-class-container{ width: 1200px; margin:10px auto 20px;} +.edu-class-top{ background:#fff; padding:20px;} +.edu-class-top-info{ } +.edu-class-top-img{ width:260px; height: 140px;} +/* tab */ +.edu-tab{ width: 100%; background:#fff; } +#edu-tab-nav{height:47px;background: #fff; } +#edu-tab-nav li {float:left; width: 170px; text-align:center;height: 47px;line-height: 47px; position: relative; } +.edu-tab-fa{ position: absolute; top:45px; left:85px; color: #fff;} +#edu-tab-nav li a{font-size:14px; } +.edu-tab-hover {border-bottom:3px solid #5faee3; background: #fff; } +.edu-tab-hover .edu-tab-fa{ color: #5faee3;} +.edu-tab-hover a{ color:#5faee3; font-weight:bold;} +.undis {display:none;} +.dis {display:block;} +.edu-tab-con-box{ padding:15px; max-height:1200px; overflow: auto; color:#666; line-height: 2.0; background:#fff;} + +/* 审核 17/05/11 bylinda*/ +.admin-con-box { padding:15px;} +a.edu-ad-user{ } +.edu-ad-user img{width:80px; height: 80px; border-radius:100px;} +.edu-renzheng-img{ width:200px;} +.admin-bg-grey{ background:#fafbfb; } + + +