cxt_course
cxt 9 years ago
commit fe22cfa5c5

@ -563,13 +563,23 @@ class OrganizationsController < ApplicationController
# 设置为名师 # 设置为名师
def set_excellent_teacher def set_excellent_teacher
@ex_teacher = User.find(params[:user]) @ex_teacher = User.find(params[:user])
params[:type] == "student" ? @ex_teacher.update_column(:excellent_student, 1) : @ex_teacher.update_column(:excellent_teacher, 1) @ex_teacher.update_column(:excellent_teacher, 1)
end end
# 取消名师 # 取消名师
def reset_excellent_teacher def reset_excellent_teacher
@ex_teacher = User.find(params[:user]) @ex_teacher = User.find(params[:user])
params[:type] == "student" ? @ex_teacher.update_column(:excellent_student, 0) : @ex_teacher.update_column(:excellent_teacher, 0) @ex_teacher.update_column(:excellent_teacher, 0)
end
def set_excellent_student
@ex_student = User.find(params[:user])
@ex_student.update_column(:excellent_student, 1)
end
def reset_excellent_student
@ex_student = User.find(params[:user])
@ex_student.update_column(:excellent_student, 0)
end end
def hide_org_subfield def hide_org_subfield

@ -584,7 +584,7 @@ class UsersController < ApplicationController
end end
if !params[:search].nil? if !params[:search].nil?
search = "%#{params[:search].to_s.strip.downcase}%" search = "%#{params[:search].to_s.strip.downcase}%"
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)} @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id} and (#{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p)",:p=>search).select { |course| @user.allowed_to?(:as_teacher,course)}
else else
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)} @course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
end end

@ -115,7 +115,7 @@ class WechatService
data = { data = {
touser:openid, touser:openid,
template_id:template_id, template_id:template_id,
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}",
topcolor:"#FF0000", topcolor:"#FF0000",
data:{ data:{
first: { first: {
@ -143,7 +143,7 @@ class WechatService
data = { data = {
touser:openid, touser:openid,
template_id:template_id, template_id:template_id,
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}?response_type=code&scope=snsapi_base&state=123#wechat_redirect", url:"#{Setting.protocol}://#{Setting.host_name}/assets/wechat/app.html#/#{type}/#{id}",
topcolor:"#FF0000", topcolor:"#FF0000",
data:{ data:{
first: { first: {
@ -181,7 +181,7 @@ class WechatService
data = { data = {
touser:uw.openid, touser:uw.openid,
template_id:Wechat.config.binding_succ_notice, template_id:Wechat.config.binding_succ_notice,
url:"https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities&response_type=code&scope=snsapi_base&state=123#wechat_redirect", url:"#{Setting.protocol}://#{Setting.host_name}/wechat/user_activities",
topcolor:"#FF0000", topcolor:"#FF0000",
data:{ data:{
first: { first: {

@ -21,10 +21,10 @@
<li><a href="<%= register_url_without_domain %>" target="_blank" class=" ">注册</a></li> <li><a href="<%= register_url_without_domain %>" target="_blank" class=" ">注册</a></li>
</ul> </ul>
<% end %> <% end %>
<div class="por_search fr"> <!--<div class="por_search fr">-->
<input type="text" class="pro_input_search fl" value="00000" /> <!--<input type="text" class="pro_input_search fl" value="00000" />-->
<a href="javascript:void(0);" class="por_search_btn fl"></a> <!--<a href="javascript:void(0);" class="por_search_btn fl"></a>-->
</div> <!--</div>-->
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

@ -9,7 +9,7 @@
<ul class="por_hotbar_left fl"> <ul class="por_hotbar_left fl">
<% if acts.count > 1 %> <% if acts.count > 1 %>
<% acts[1..2].each do |activity| %> <% acts[1..2].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<li> <li>
<%= link_to "<span class='por_icons_hot fl'>热门推荐</span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %> <%= link_to "<span class='por_icons_hot fl'>热门推荐</span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %>
@ -57,7 +57,7 @@
<% if acts.count > 3 %> <% if acts.count > 3 %>
<% activity = acts[3] %> <% activity = acts[3] %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<li> <li>
<%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %> <%= link_to document.title, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hot_title link-black', :target => "_blank", :title => document.title %>
@ -106,7 +106,7 @@
<%# if acts.count > 3 %> <%# if acts.count > 3 %>
<% activity = acts.first %> <% activity = acts.first %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<div class="por_hotbar_right fl"> <div class="por_hotbar_right fl">
<% if get_image_path_from_content(document.content).nil? %> <% if get_image_path_from_content(document.content).nil? %>

@ -30,7 +30,7 @@
<% else %> <% else %>
<%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %> <%= link_to image_tag("/files/uploads/image#{iamge_path}", :width => "140", :height => "100"), board_message_url_in_org(activity.board_id, activity.id), :target => "_blank", :class =>"fl" %>
<% end %> <% end %>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.description, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %> <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => activity.id, :content=> activity.content, :maxheight => 80, :maxwordsnum => 56, :maxwidth => 0, :cl => "por_course_txt fl"} %>
<span class=" por_course_time"><%= time_from_now activity.updated_on %></span> <span class=" por_course_time"><%= time_from_now activity.updated_on %></span>
</div> </div>
<% elsif act.org_act_type == "News" %> <% elsif act.org_act_type == "News" %>
@ -131,7 +131,7 @@
<%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %> <%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %>
</h2> </h2>
<% org_acts.first(4).each do |activity| %> <% org_acts.first(4).each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<% org_subfield_id = params[:org_subfield_id] %> <% org_subfield_id = params[:org_subfield_id] %>
<% iamge_path = get_image_path_from_content(document.content) %> <% iamge_path = get_image_path_from_content(document.content) %>

@ -9,7 +9,7 @@
<div class="por_post_left fl"> <div class="por_post_left fl">
<div class="por_post_leftbar "> <div class="por_post_leftbar ">
<% activity = acts.first %> <% activity = acts.first %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<% if get_image_path_from_content(document.content).nil? %> <% if get_image_path_from_content(document.content).nil? %>
<%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %> <%= link_to image_tag("/images/default_blank/mo-3.jpg", :width => "299", :height => "246"), org_document_comment_path(:id => document.id, :organization_id => document.organization.id), :target => "_blank" %>
@ -70,10 +70,10 @@
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %> <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => news.id, :content=> news.description, :maxheight => 40, :maxwordsnum => 60, :maxwidth => 0, :cl => "por_post_txt"} %>
<% end %> <% end %>
<% end %> <% end %>
</div>
<% unless acts[1..5].nil? %> <% unless acts[1..5].nil? %>
<% acts[1..5].each do |activity| %> <% acts[1..5].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<ul class="por_post_list"> <ul class="por_post_list">
<li><%= link_to "<span class='post_icons_grey fl'></span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li> <li><%= link_to "<span class='post_icons_grey fl'></span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
@ -110,12 +110,11 @@
<% end %> <% end %>
<% end %> <% end %>
</div> </div>
</div>
<% unless acts[6..19].nil? %> <% unless acts[6..19].nil? %>
<div class="fl"> <div class="fl">
<ul class="por_post_right por_post_list"> <ul class="por_post_right por_post_list">
<% acts[6..19].each do |activity| %> <% acts[6..19].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %> <% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %> <% document = activity.org_act %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w270 link-black', :target => "_blank" %></li> <li><%= link_to "<span class='post_icons_grey fl'></span>#{document.title}".html_safe, org_document_comment_path(:id => document.id, :organization_id => document.organization.id), class: 'por_hidden_w270 link-black', :target => "_blank" %></li>
<% else activity.container_type == 'OrgSubfield' %> <% else activity.container_type == 'OrgSubfield' %>

@ -3,12 +3,13 @@
<% if containers.blank? %> <% if containers.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p> <p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %> <% else %>
<ul>
<% container = containers.first %> <% container = containers.first %>
<li class="por_project_li"> <li class="por_project_li">
<%= link_to "<span class='post_icons_grey fl'></span>#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %> <%= link_to "<span class='post_icons_grey fl'></span>#{container.name}".html_safe, project_path(container), :class => "por_hidden_w205 link-black fl", :title => container.name, :target => "_blank" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p> <p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<div class="cl"></div> <div class="cl"></div>
<%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => container.id, :content=> container.description, :maxheight => 40, :maxwordsnum => 48, :maxwidth => 0, :cl => "por_project_p"} %> <%=render :partial =>"organizations/organization_content_extension", :locals => {:user_activity_id => container.id, :content=> container.description, :maxheight => 40, :maxwordsnum => 55, :maxwidth => 0, :cl => "por_project_p"} %>
</li> </li>
<% containers[1..4].each do |container| %> <% containers[1..4].each do |container| %>
@ -18,5 +19,6 @@
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<% end %> <% end %>
</ul>
<% end %> <% end %>
</div><!--por_projects end--> </div><!--por_projects end-->

@ -33,12 +33,12 @@
function hide(content, id){ function hide(content, id){
if (content.text() == '设为学霸') if (content.text() == '设为学霸')
$.ajax({ $.ajax({
url: "/organizations/set_excellent_teacher?user=" + id + "&type=student", url: "/organizations/set_excellent_student?user=" + id ,
type: "post" type: "post"
}); });
else else
$.ajax({ $.ajax({
url: "/organizations/reset_excellent_teacher?user=" + id + "&type=student", url: "/organizations/reset_excellent_student?user=" + id ,
type: "post" type: "post"
}); });
} }

@ -0,0 +1 @@
$("#hide_<%= @ex_student.id %>").text("设为学霸");

@ -1 +1 @@
$("#hide_<%= @ex_teacher.id %>").text(<%= params[:type]== "student" ? "设为学霸" : "设为名师"%>); $("#hide_<%= @ex_teacher.id %>").text("设为名师");

@ -0,0 +1 @@
$("#hide_<%= @ex_student.id %>").text("取消设置");
Loading…
Cancel
Save