Merge branch 'develop' into cxt_course

cxt_course
cxt 10 years ago
commit 28aa2e5c97

@ -39,17 +39,17 @@ class CoursesController < ApplicationController
end end
limit = 15 limit = 15
course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id) course_org_ids = OrgCourse.find_by_sql("select distinct organization_id from org_courses where course_id = #{params[:id]}").map(&:organization_id)
@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit) #@orgs_not_in_course = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).page(params[:page].to_i || 1).per(limit)
@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count #@org_count = User.current.organizations.where("organizations.id not in (#{course_org_ids.join(',')}) and organizations.name like ?", condition).count
# if course_org_ids.empty? if course_org_ids.empty?
# @orgs_not_in_course = Organization.where("(is_public or creator_id =?) and name like ?",User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @orgs_not_in_course = User.current.organizations.where("name like ?",condition).page((params[:page].to_i || 1)).per(limit)
# @org_count = Organization.where("is_public = 1 or creator_id =?", User.current.id).where("name like ?", condition).count @org_count = @orgs_not_in_course.count
# else else
# course_org_ids = "(" + course_org_ids.join(',') + ")" course_org_ids = "(" + course_org_ids.join(',') + ")"
# @orgs_not_in_course = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?) and name like ?", User.current.id, condition).page((params[:page].to_i || 1)).per(limit) @orgs_not_in_course = User.current.organizations.where("organizations.id not in #{course_org_ids} and organizations.name like ?", condition).page((params[:page].to_i || 1)).per(limit)
# @org_count = Organization.where("id not in #{course_org_ids} and (is_public = 1 or creator_id =?)", User.current.id).where("name like ?", condition).count @org_count = @orgs_not_in_course.empty? ? 0 : @orgs_not_in_course.count
# end end
# @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count @course_count = Project.course_entities.visible.like(params[:name]).page(params[:page]).count
@orgs_page = Paginator.new @org_count, limit,params[:page] @orgs_page = Paginator.new @org_count, limit,params[:page]
@hint_flag = params[:hint_flag] @hint_flag = params[:hint_flag]
#render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json #render :json => {:orgs => @orgs_not_in_course, :count => @org_count}.to_json

@ -230,6 +230,7 @@ class FilesController < ApplicationController
@order = "" @order = ""
@is_remote = false @is_remote = false
if params[:project_id] if params[:project_id]
@page = params[:page] ? params[:page].to_i + 1 : 2
@container_type = 0 @container_type = 0
if params[:sort] if params[:sort]
params[:sort].split(",").each do |sort_type| params[:sort].split(",").each do |sort_type|

@ -412,6 +412,7 @@ class IssuesController < ApplicationController
if params[:issue_id] if params[:issue_id]
@issue_id = params[:issue_id] @issue_id = params[:issue_id]
end end
@priorities = IssuePriority.active
respond_to do |format| respond_to do |format|
format.js format.js
end end

@ -59,6 +59,19 @@ module ApplicationHelper
end end
end end
# 判断组织左侧展开或者隐藏
def is_hide_org_left obj
if obj.nil?
return true
else
if obj.hide == 0
return true
else
return false
end
end
end
# Time 2015-03-24 16:38:05 # Time 2015-03-24 16:38:05
# Author lizanle # Author lizanle
# Description after save后需要进行资源记录的更新 # Description after save后需要进行资源记录的更新

@ -37,7 +37,10 @@
<ul class="mt10"> <ul class="mt10">
<%=labelled_form_for @new_course do |f| %> <%=labelled_form_for @new_course do |f| %>
<input name="copy_course" value="<%=@course.id %>" style="display: none"/> <input name="copy_course" value="<%=@course.id %>" style="display: none"/>
<li class="ml45 mb10"> <a href="javascript:void(0)" class="upimg fl"> <img alt="上传图片" id="avatar_image" src="images/courses/pic_courses.jpg" height="60" width="60"> </a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>--> <li class="ml45 mb10">
<a href="javascript:void(0)" class="upimg fl">
<%= image_tag(url_to_avatar(@new_course), id: "avatar_image", :width =>"60", :height =>"60",:alt=>"上传图片")%>
</a> <!--<a href="javascript:void(0)" class="upbtn fl ml30" onclick="$('#upload_course_logo').click();">上传图片</a>-->
<!--</span>--> <!--</span>-->
<div class="cl"></div> <div class="cl"></div>
</li> </li>

@ -123,7 +123,7 @@
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div id="course_list"> <div id="course_list">
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments, :page=>2} %> <%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
</div> </div>
</div> </div>
<% html_title(l(:label_attachment_plural)) -%> <% html_title(l(:label_attachment_plural)) -%>

@ -45,8 +45,17 @@
<% end %> <% end %>
<% end %> <% end %>
<ul class="wlist"> <% if project_attachments.count == 10%>
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%> <% if params[:action] == 'search_project' %>
</ul> <!--<ul class="wlist">-->
<!--<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => @is_remote, :flag => true%>-->
<!--</ul>-->
<%=link_to "点击展开更多", search_project_project_files_path({:project_id => project.id, :page => @obj_pages.nil? ? @feedback_pages.page + 1 : @obj_pages.page + 1}.merge(params)),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%else%>
<!-- 全站搜索的时候 返回的页码对象是obj_pages,而站内搜索返回的页码对象是feedback_pages -->
<%=link_to "点击展开更多", project_files_path(:project_id => project.id,:page => @page),:id => "show_more_attachments",:remote => "true",:class => "loadMore mt10 f_grey" %>
<%end%>
<% end%>

@ -1,6 +1,21 @@
<% if @issue_id %> //issue详情中回复 <% if @issue_id %> //issue详情中回复
$("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>"); $("#reply_div_<%= @issue_id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => Issue.find( @issue_id),:replies_all_i=>0}) %>");
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>"); $("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => Issue.find( @issue_id)}) %>");
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
sd_create_editor_from_data(<%= @issue.id%>, null, "100%");
issue_desc_editor = KindEditor.create('#issue_description',
{"width":"85%",
"resizeType":0,
"no_label":true,
"at_id":<%= @issue.project_id%>,
"at_type":"Project",
"autoHeightMode":true,
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
"emotionsBasePath":'<%= Setting.host_name%>',
"height":300,
"allowFileManager":true,
"uploadJson":"/kindeditor/upload",
"fileManagerJson":"/kindeditor/filemanager"});
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>"); // $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
$(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)') $(".homepagePostReplyBannerCount").html('回复(<%= Issue.find( @issue_id).journals.count %>)')
sd_create_editor_from_data(<%= @issue.id %>, null, "100%"); sd_create_editor_from_data(<%= @issue.id %>, null, "100%");

@ -37,10 +37,10 @@
<% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %> <% org_activity_field = organization.org_subfields.where('field_type="default" and name="activity" and field_type="default"').first %>
<% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %> <% org_course_field = organization.org_subfields.where('field_type="default" and name="course" and field_type="default"').first %>
<% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %> <% org_project_field = organization.org_subfields.where('field_type="default" and name="project" and field_type="default"').first %>
<div class="homepageLeftMenuBlock" style="display:<%= org_activity_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_activity_field.id %>"> <div class="homepageLeftMenuBlock" style="display:<%= is_hide_org_left(org_activity_field) ? 'block':'none' %>;" id="org_subfield_<%= org_activity_field.id %>">
<%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %> <%= link_to "动态",organization_path(organization), :class => "homepageMenuText" %>
</div> </div>
<div style="display:<%= org_project_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_project_field.id %>"> <div style="display:<%= is_hide_org_left(org_project_field) ? 'block':'none' %>;" id="org_subfield_<%= org_project_field.id %>">
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a> <a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuProjects').slideToggle();">项目</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %> <% if User.current.logged? and User.current.admin_of_org?(organization) %>
@ -54,7 +54,7 @@
</ul> </ul>
</div> </div>
</div> </div>
<div style="display:<%= org_course_field.hide == 0?'block':'none' %>;" id="org_subfield_<%= org_course_field.id %>"> <div style="display:<%= is_hide_org_left(org_course_field) ? 'block':'none' %>;" id="org_subfield_<%= org_course_field.id %>">
<div class="homepageLeftMenuBlock"> <div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a> <a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<% if User.current.logged? and User.current.admin_of_org?(organization) %> <% if User.current.logged? and User.current.admin_of_org?(organization) %>

@ -6,6 +6,9 @@
destroyedItem.fadeOut(600,function(){ destroyedItem.fadeOut(600,function(){
destroyedItem.remove(); destroyedItem.remove();
}); });
<% if @jours_count && @jours_count == 0 %>
$("#user_jour_list").css("padding","0px");
<% end %>
<% else %> <% else %>
<% if @bid && @jours_count %> <% if @bid && @jours_count %>
$('#jours_count').html("<%= @jours_count %>"); $('#jours_count').html("<%= @jours_count %>");

@ -2,7 +2,10 @@
Copyright (C) 2006-2013 Jean-Philippe Lang Copyright (C) 2006-2013 Jean-Philippe Lang
Modified by Jianfeng Tao, to upload one avatar for user*/ Modified by Jianfeng Tao, to upload one avatar for user*/
function addFile(inputEl, file, eagerUpload) {
(function(){
function addFile(inputEl, file, eagerUpload) {
var fileSpan = $('#avatar_file'); var fileSpan = $('#avatar_file');
@ -16,9 +19,9 @@ function addFile(inputEl, file, eagerUpload) {
} }
return 1; return 1;
} }
function ajaxUpload(file, fileSpan, inputEl) { function ajaxUpload(file, fileSpan, inputEl) {
function onLoadstart(e) { function onLoadstart(e) {
fileSpan.removeClass('ajax-waiting'); fileSpan.removeClass('ajax-waiting');
@ -70,16 +73,16 @@ function ajaxUpload(file, fileSpan, inputEl) {
actualUpload(file, fileSpan, inputEl); actualUpload(file, fileSpan, inputEl);
else else
$(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, fileSpan, inputEl)); $(inputEl).parents('form').queue('upload', actualUpload.bind(this, file, fileSpan, inputEl));
} }
ajaxUpload.uploading = 0; ajaxUpload.uploading = 0;
function removeFile() { function removeFile() {
$(this).parent('span').remove(); $(this).parent('span').remove();
return false; return false;
} }
function uploadBlob(blob, uploadUrl, source_type,source_id, options) { function uploadBlob(blob, uploadUrl, source_type,source_id, options) {
var actualOptions = $.extend({ var actualOptions = $.extend({
loadstartEventHandler: $.noop, loadstartEventHandler: $.noop,
@ -107,9 +110,9 @@ function uploadBlob(blob, uploadUrl, source_type,source_id, options) {
cache: false, cache: false,
processData: false processData: false
}); });
} }
function addInputAvatar(inputEl) { window.addInputAvatar = function(inputEl) {
// var clearedFileInput = $(inputEl).clone().val(''); // var clearedFileInput = $(inputEl).clone().val('');
if (inputEl.files) { if (inputEl.files) {
@ -127,10 +130,9 @@ function addInputAvatar(inputEl) {
} }
//clearedFileInput.insertAfter('#avatars_fields'); //clearedFileInput.insertAfter('#avatars_fields');
} }
function uploadAndAttachFiles(files, inputEl) { function uploadAndAttachFiles(files, inputEl) {
var maxFileSize = $(inputEl).data('max-file-size'); var maxFileSize = $(inputEl).data('max-file-size');
var maxFileSizeExceeded = $(inputEl).data('max-file-size-message'); var maxFileSizeExceeded = $(inputEl).data('max-file-size-message');
@ -145,9 +147,9 @@ function uploadAndAttachFiles(files, inputEl) {
uploadAndTypeFiles(files,inputEl); uploadAndTypeFiles(files,inputEl);
//$.each(files, function() {addFile(inputEl, this, true);}); //$.each(files, function() {addFile(inputEl, this, true);});
} }
} }
function uploadAndTypeFiles(files, inputEl) { function uploadAndTypeFiles(files, inputEl) {
var enableType = $(inputEl).data('file-type'); var enableType = $(inputEl).data('file-type');
var typeSupportrdMessage = $(inputEl).data('type-support-message'); var typeSupportrdMessage = $(inputEl).data('type-support-message');
@ -168,29 +170,32 @@ function uploadAndTypeFiles(files, inputEl) {
} else { } else {
window.alert(typeSupportrdMessage + enableType); window.alert(typeSupportrdMessage + enableType);
} }
} }
function handleFileDropEvent(e) {
function handleFileDropEvent(e) {
$(this).removeClass('fileover'); $(this).removeClass('fileover');
blockEventPropagation(e); blockEventPropagation(e);
if ($.inArray('Files', e.dataTransfer.types) > -1) { if ($.inArray('Files', e.dataTransfer.types) > -1) {
uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector')); uploadAndAttachFiles(e.dataTransfer.files, $('input:file.file_selector'));
} }
} }
function dragOverHandler(e) { function dragOverHandler(e) {
$(this).addClass('fileover'); $(this).addClass('fileover');
blockEventPropagation(e); blockEventPropagation(e);
} }
function dragOutHandler(e) { function dragOutHandler(e) {
$(this).removeClass('fileover'); $(this).removeClass('fileover');
blockEventPropagation(e); blockEventPropagation(e);
} }
function setupFileDrop() { function setupFileDrop() {
console.log("setupFileDrop");
$('#avatar_image').on('click', function(){ $('#avatar_image').on('click', function(){
console.log("click"); console.log("click");
}); });
@ -206,6 +211,8 @@ function setupFileDrop() {
}); });
}); });
} }
} }
$(document).ready(setupFileDrop);
})();
$(document).ready(setupFileDrop);

@ -435,6 +435,8 @@ a:hover.search_btn{ background: #0fa9bb;}
.searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;} .searchResourcePopup {border:none; outline:none; background-color:#ffffff; width:184px; height:25px; padding-left:10px; display:inline-block; float:left;}
.searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;} .searchIconPopup{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon.png) 5px -394px no-repeat; display:inline-block; float:left; cursor: pointer;}
.searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;} .searchIconPopup:hover {background:url(../images/homepage_icon.png) 5px -420px no-repeat;}
.searchIcon2{width:31px; height:25px; background-color:#ffffff; background:url(../images/homepage_icon2.png) -180px -273px no-repeat; display:inline-block; float:left; cursor: pointer;}
.searchIcon2:hover {background:url(../images/homepage_icon2.png) -180px -314px no-repeat;}
.courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;} .courseSend {width:390px; height:15px; line-height:15px; margin-bottom:10px;display:block;white-space:nowrap;}
.courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;} .courseSendCheckbox {padding:0px; margin:0px; width:12px; height:12px; margin-right:10px; display:inline-block; margin-top:2px;}
.sendCourseName {font-size:12px; color:#5f6060;display:inline-block} .sendCourseName {font-size:12px; color:#5f6060;display:inline-block}
@ -969,6 +971,12 @@ span.at a{color:#269ac9;text-decoration: none;}
.sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;} .sectionContent span {width:160px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; display:inline-block; height:20px; vertical-align:top;}
.orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;} .orgDirection {width:392px; background-color:#f1f1f1; height:30px; vertical-align:middle; line-height:30px; color:#585858; padding-left:10px;}
.orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;} .orgSendSearch {border:1px solid #dddddd; outline:none; width:262px; height:22px; padding-left:10px; float:left;}
/*新课程、项目资源库*/
.reCon{ margin:5px; width:710px;}
.reTop{width:710px; height:40px; background:#eaeaea; padding:5px;}
.researchBox { width:240px; height:24px; border:1px solid #dddddd; color:#666666; outline:none;}
.blueBtn{ width:60px; height:26px; color:#FFF; border:none; background-color:#269ac9; cursor:pointer; padding-left:0px; text-align:center;}
.blueBtn:hover {background-color:#298fbd;}
/*文本描述展开高度*/ /*文本描述展开高度*/
.maxh360 {max-height: 810px;} .maxh360 {max-height: 810px;}

Loading…
Cancel
Save