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

This commit is contained in:
cxt 2016-06-03 18:02:41 +08:00
commit fe22cfa5c5
12 changed files with 86 additions and 73 deletions

View File

@ -563,13 +563,23 @@ class OrganizationsController < ApplicationController
# 设置为名师
def set_excellent_teacher
@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
# 取消名师
def reset_excellent_teacher
@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
def hide_org_subfield

View File

@ -584,7 +584,7 @@ class UsersController < ApplicationController
end
if !params[:search].nil?
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
@course = @user.courses.where("is_delete = 0 and #{Course.table_name}.id != #{homework.course_id}").select { |course| @user.allowed_to?(:as_teacher,course)}
end

View File

@ -115,7 +115,7 @@ class WechatService
data = {
touser:openid,
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",
data:{
first: {
@ -143,7 +143,7 @@ class WechatService
data = {
touser:openid,
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",
data:{
first: {
@ -181,7 +181,7 @@ class WechatService
data = {
touser:uw.openid,
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",
data:{
first: {

View File

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

View File

@ -9,7 +9,7 @@
<ul class="por_hotbar_left fl">
<% if acts.count > 1 %>
<% 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 %>
<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 %>
@ -57,7 +57,7 @@
<% if acts.count > 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 %>
<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 %>
@ -106,7 +106,7 @@
<%# if acts.count > 3 %>
<% 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 %>
<div class="por_hotbar_right fl">
<% if get_image_path_from_content(document.content).nil? %>

View File

@ -30,7 +30,7 @@
<% 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" %>
<% 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>
</div>
<% elsif act.org_act_type == "News" %>
@ -131,7 +131,7 @@
<%= render :partial => 'organizations/link_subfield_more', :locals => {:field => field} %>
</h2>
<% 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 %>
<% org_subfield_id = params[:org_subfield_id] %>
<% iamge_path = get_image_path_from_content(document.content) %>

View File

@ -9,7 +9,7 @@
<div class="por_post_left fl">
<div class="por_post_leftbar ">
<% 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 %>
<% 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" %>
@ -70,52 +70,51 @@
<%=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 %>
<% unless acts[1..5].nil? %>
<% acts[1..5].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' && activity.org_act_id != @organization.home_id %>
<% document = activity.org_act %>
<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>
</ul>
<% else activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<ul class="por_post_list">
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% end %>
</ul>
<% else %>
<ul class="por_post_list">
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_path(message.board,message), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_path(message.board, message), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% end %>
</ul>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = News.find(activity.org_act_id) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<ul class="por_post_list">
<li><%= link_to "<span class='post_icons_grey fl'></span>#{news.title}".html_safe, news_path(news), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
</ul>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
<% unless acts[1..5].nil? %>
<% acts[1..5].each do |activity| %>
<% if activity.container_type == 'Organization' && activity.org_act_type == 'OrgDocumentComment' %>
<% document = activity.org_act %>
<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>
</ul>
<% else activity.container_type == 'OrgSubfield' %>
<% if activity.org_act_type == 'Message' and activity.org_act_id and Message.where("id=#{activity.org_act_id}").count > 0 %>
<% message = Message.find(activity.org_act_id) %>
<% if message.board.org_subfield_id %>
<ul class="por_post_list">
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_url_in_org(message.board.id, message.id), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% end %>
</ul>
<% else %>
<ul class="por_post_list">
<% if message.parent_id.nil? %> <!--+"(帖子标题)"-->
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.subject}".html_safe, board_message_path(message.board,message), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% else %>
<li><%= link_to "<span class='post_icons_grey fl'></span>#{message.parent.subject}".html_safe, board_message_path(message.board, message), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
<% end %>
</ul>
<% end %>
<% end %>
<% if activity.org_act_type == 'News' and News.where("id=?", activity.org_act_id).count > 0 %>
<% news = News.find(activity.org_act_id) %>
<% iamge_path = get_image_path_from_content(news.description) %>
<ul class="por_post_list">
<li><%= link_to "<span class='post_icons_grey fl'></span>#{news.title}".html_safe, news_path(news), class: 'por_hidden_w390 link-black', :target => "_blank" %></li>
</ul>
<% end %>
<% end %>
<% end %>
<% end %>
</div>
<% unless acts[6..19].nil? %>
<div class="fl">
<ul class="por_post_right por_post_list">
<% 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 %>
<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' %>

View File

@ -3,20 +3,22 @@
<% if containers.blank? %>
<p class="fontGrey2 f14 mt10 mb5">该模块暂时没有相关内容</p>
<% else %>
<% container = containers.first %>
<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" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<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"} %>
</li>
<ul>
<% container = containers.first %>
<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" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<div class="cl"></div>
<%=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>
<% containers[1..4].each do |container| %>
<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" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<div class="cl"></div>
</li>
<% end %>
<% containers[1..4].each do |container| %>
<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" %>
<p class="fr por_time">活跃度<a class="ml5" ><%= static_project_score(container.project_score) %></a></p>
<div class="cl"></div>
</li>
<% end %>
</ul>
<% end %>
</div><!--por_projects end-->

View File

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

View File

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

View File

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

View File

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