课程讨论区(未完)
This commit is contained in:
parent
b79a50ce2f
commit
470f45becd
|
@ -877,7 +877,7 @@ class UsersController < ApplicationController
|
|||
#显示更多用户课程
|
||||
def user_courses4show
|
||||
@page = params[:page].to_i + 1
|
||||
@courses = @user.courses.visible.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
|
||||
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5).offset(@page * 5)
|
||||
end
|
||||
|
||||
#显示更多用户项目
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
</div>
|
||||
<div>
|
||||
<div class="fileTagWrap" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
|
||||
<%#= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:course => @course,:tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="re_con_top">
|
||||
|
|
|
@ -1,82 +1,124 @@
|
|||
<% attachmenttypes = @project.attachmenttypes %>
|
||||
<% sufixtypes = @project.contenttypes %>
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2"><%= l(:lable_file_sharingarea) %></h2>
|
||||
</div>
|
||||
|
||||
<div class="content-title-top">
|
||||
<%#= link_to(l(:label_attachment_new), 'javascript:void(0);', :onclick=>"$('#file_buttons').slideToggle();", :class => 'icon icon-add') if User.current.allowed_to?(:manage_files, @project) %>
|
||||
<div class="clearfix"></div>
|
||||
<div id="file_buttons" class="nhidden">
|
||||
<%= link_to(l(:label_upload_files), 'javascript:void(0);', :class => 'icon m5p5 button_submit', :onclick => "$('#relation_file_div').slideUp();$('#upload_file_div').slideToggle('slow');") if User.current.allowed_to?(:manage_files, @project) %>
|
||||
<%= link_to(l(:label_relation_files), 'javascript:void(0);', :onclick => "$('#upload_file_div').slideUp();$('#relation_file_div').slideToggle();", :class => 'icon m5p5 button_submit') if User.current.allowed_to?(:manage_files, @project) %>
|
||||
<p></p>
|
||||
<div id="upload_file_div" class="relation_file_div <%= !@flag.nil?&&@flag=="true" ? '' : 'hidden'%>">
|
||||
<%= render :partial => 'new', locals: {project: @project} %>
|
||||
</div>
|
||||
<div id="relation_file_div" class="relation_file_div hidden">
|
||||
<fieldset>
|
||||
<legend><%= l(:label_search)%></legend>
|
||||
<%= form_tag(
|
||||
attachments_autocomplete_path(:format => 'js'),
|
||||
:remote => true,
|
||||
:method => :post) do %>
|
||||
<%= label_tag(:attach_search, l(:label_search_by_keyword)) %>
|
||||
<%= text_field_tag(:attach_search) %>
|
||||
<%#= submit_tag("Search") %>
|
||||
<% end -%>
|
||||
<%= form_tag attach_relation_path(:format => 'js'),
|
||||
method: :post,
|
||||
remote: true,
|
||||
id: "relation_file_form",
|
||||
:class => 'hidden' do %>
|
||||
<%= hidden_field_tag(:class_name, 'Project') %>
|
||||
<%= hidden_field_tag(:class_id, params[:project_id]) %>
|
||||
<div id="relation_file">
|
||||
</div>
|
||||
<div class="kclearfix" style='margin-top: 10px;'>
|
||||
<%= submit_tag(l(:button_add)) -%>
|
||||
</div>
|
||||
<% end -%>
|
||||
</fieldset>
|
||||
<div class="line_under" style="margin:20px 0px;"></div>
|
||||
</div>
|
||||
<script>
|
||||
$(function(){
|
||||
$("#RSide").removeAttr("id")
|
||||
$("#container").css('width',"1000px")
|
||||
});
|
||||
function searchone4reload(fileid){
|
||||
var url = "<%= searchone4reload_project_files_path(@project)%>";
|
||||
var data = {};data.fileid=fileid;
|
||||
$.ajax({
|
||||
url:url,dataType:'text',data:data,success:function(text){
|
||||
var container_file_div = $("#container_files_"+fileid);
|
||||
container_file_div.after(text);
|
||||
container_file_div.remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
function show_upload(obj)
|
||||
{
|
||||
switch(obj)
|
||||
{
|
||||
case 1:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 1}) %>');
|
||||
break;
|
||||
case 2:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 2}) %>');
|
||||
break;
|
||||
case 3:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 3}) %>');
|
||||
break;
|
||||
default:
|
||||
$('#ajax-modal').html('<%= escape_javascript(render :partial => 'upload_show_project',:locals => {:project => @project,:project_attachment_type => 5}) %>');
|
||||
}
|
||||
showModal('ajax-modal', '513px');
|
||||
$('#ajax-modal').siblings().remove();
|
||||
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
$('#ajax-modal').parent().css("top","").css("left","");
|
||||
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||
}
|
||||
|
||||
function closeModal()
|
||||
{
|
||||
hideModal($("#popbox_upload"));
|
||||
}
|
||||
|
||||
function presscss(id)
|
||||
{
|
||||
if(id == "incourse")
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_dblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_dblue");
|
||||
}
|
||||
}
|
||||
function buttoncss()
|
||||
{
|
||||
$('#incourse').attr("class", "re_schbtn b_lblue");
|
||||
$('#insite').attr("class", "re_schbtn b_lblue");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="homepageRight mt0 ml10">
|
||||
<div class="homepageRightBanner">
|
||||
<div class="NewsBannerName">资源库</div>
|
||||
<ul class="resourcesSelect">
|
||||
<li class="resourcesSelected"><a href="javascript:void(0);" class="resourcesIcon"></a>
|
||||
<ul class="resourcesType">
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project)%>','','<%= @q%>','<%= @project.id%>');" class="resourcesTypeAll resourcesGrey">全部</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project)%>','软件版本','<%= @q%>','<%= @project.id%>');" class="softwareIcon postTypeGrey">软件版本</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project)%>','文档','<%= @q%>','<%= @project.id%>');" class="homepagePostTypeAssignment postTypeGrey">文档</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project)%>','代码','<%= @q%>','<%= @project.id%>');" class="codeIcon resourcesGrey">代码</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project)%>','媒体','<%= @q%>','<%= @project.id%>');" class="mediaIcon resourcesGrey">媒体</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project)%>','论文','<%= @q%>','<%= @project.id%>');" class="thesisIcon resourcesGrey">论文</a></li>
|
||||
<li><a href="javascript:void(0);" onclick="search_tag_attachment('<%= search_tag_attachment_course_files_path(@project,:other=>true)%>','其他','<%= @q%>','<%= @project.id%>');" class="othersIcon resourcesGrey">其它</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="resources mt10" style="padding-bottom:5px;">
|
||||
<div class="reTop mb5">
|
||||
<%= form_tag( search_course_files_path(@project), method: 'get',:class => "re_search",:remote=>true) do %>
|
||||
<%= text_field_tag 'name', params[:name], name: "name", :class => 'researchBox fl',:style=>"padding: 0px"%>
|
||||
<%= submit_tag "课内搜索", :class => "blueBtn mr5 fl",:name => "incourse",:id => "incourse" %>
|
||||
<%= submit_tag "全站搜索", :class => "blueBtn mr5 fl",:name => "insite",:id => "insite" %>
|
||||
<!--REDO: 权限测试-->
|
||||
<% if (@project.publish_resource==1 && User.current.member_of?(@project) ) %>
|
||||
<input class="blueBtn fr mr5" value="上传资源" onclick="project_files_upload();">
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
<div class="box" id="files-box">
|
||||
<label for="files-box" style="font-weight:bold;">
|
||||
|
||||
<%= l(:label_files_filter) %>
|
||||
</label>
|
||||
<% if attachmenttypes.any? %>
|
||||
|
||||
<label for="attachment_browse_label">
|
||||
<%= l(:attachment_browse) %>
|
||||
</label>
|
||||
<%= select_tag "attachment_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_from_collection_for_select(attachmenttypes, "id", "typeName",params[:type]),
|
||||
:onchange => "attachmenttypes_searchex(this.value)" %>
|
||||
<% end %>
|
||||
<% if sufixtypes.any? %>
|
||||
|
||||
<label for="attach_sufix_browse_label">
|
||||
<%= l(:attachment_sufix_browse) %>
|
||||
</label>
|
||||
<%= select_tag "attach_sufix_browse", content_tag(:option, l(:attachment_all), :value => '0') +options_for_select(sufixtypes),
|
||||
:onchange => "attachment_contenttypes_searchex(this.value)" %>
|
||||
<% end %>
|
||||
<!-- show_window('light','fade','20%','35%')-->
|
||||
<!--<a href="javascript:void(0)" class="re_fabu f_r b_lblue" onclick="show_upload();">上传资源</a>-->
|
||||
</div>
|
||||
<div>
|
||||
<div class="fileTagWrap" id="files_tag">
|
||||
<%= render :partial => "files/tag_yun", :locals => {:tag_list => @tag_list,:project => @project, :tag_name => @tag_name}%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="re_con_top">
|
||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count%></span> 个资源</p>
|
||||
<p class="f_r" style="color: #808080">
|
||||
<% if @order == "asc" %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% else %>
|
||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:asc"),:class => "f_b c_grey" ,:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||
<%= link_to "下载次数",params.merge(:sort=>"downloads:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"downloads"} %> /
|
||||
<%= link_to "引用次数",params.merge(:sort=>"quotes:asc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"quotes"} %> 排序
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div id="course_list">
|
||||
<%#= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||
</div>
|
||||
</div>
|
||||
<%= javascript_tag "observeSearchfield('attach_search', null, '#{ escape_javascript attachments_autocomplete_path(:project_id => @project.id, :format => 'js') }')" %>
|
||||
|
||||
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||
|
||||
<div id="all_browse_div" class="all_browse_div">
|
||||
<%#= render :partial => 'show_all_attachment' %>
|
||||
<% if (@attachtype==0 && @contenttype=='0') || (@attachtype.nil? && @contenttype.nil?) %>
|
||||
<%= render partial: "show_all_attachment"%>
|
||||
<%else%>
|
||||
<%= render partial: "sort_by_attachtypel"%>
|
||||
<%end%>
|
||||
</div>
|
||||
|
||||
<% html_title(l(:label_attachment_plural)) -%>
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
<div id="popbox_upload" class="mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
|
||||
<div id="popbox_upload" class=" mb10" style="margin-top: -30px;color:#15bccf; font-size:16px;">
|
||||
<div class="upload_con">
|
||||
<h2 style="text-align: center"><%= l(:label_upload_files)%></h2>
|
||||
<div class="upload_box">
|
||||
|
@ -7,12 +7,12 @@
|
|||
<div id="network_issue" style="color: red; display: none;"><%= l(:label_file_upload_error_messages)%></div>
|
||||
|
||||
<%= form_tag(project_files_path(project), :multipart => true,:remote => !ie8?,:name=>"upload_form") do %>
|
||||
<!-- <label style="margin-top:3px;"><#%= l(:label_file_upload)%></label> -->
|
||||
<input type="hidden" name="in_project_toolbar" value="Y">
|
||||
<%= render :partial => 'files/attachement_list',:locals => {:project => project} %>
|
||||
<input type="hidden" name="course_attachment_type" value="<%= project_attachment_type %>">
|
||||
<%= render :partial => 'attachement_list',:locals => {:project => project} %>
|
||||
<div class="cl"></div>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="hideModal();"><%= l(:button_cancel)%></a>
|
||||
<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%= l(:button_confirm)%></a>
|
||||
<a href="javascript:void(0);" class=" fr grey_btn mr40" onclick="closeModal();"><%= l(:button_cancel)%></a>
|
||||
<!--<a id="submit_resource" href="javascript:void(0);" class="blue_btn fr" onclick="submit_resource();"><%#= l(:button_confirm)%></a>-->
|
||||
<%= submit_tag '确定',:onclick=>'submit_resource();',:onfocus=>'this.blur()',:id=>'submit_resource',:class=>'sendSourceText fr' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
<% if @container_type == 0 %>
|
||||
<div id="resource_list">
|
||||
<%= render :partial => 'project_file_new', locals: {project: @project} %>
|
||||
<%= render :partial => 'project_file', locals: {project: @project} %>
|
||||
</div>
|
||||
<% elsif @container_type == 1 %>
|
||||
<div id="resource_list">
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
<% end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5)%>
|
||||
<% courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
|
||||
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
|
||||
<ul>
|
||||
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
|
||||
|
|
|
@ -650,16 +650,28 @@ RedmineApp::Application.routes.draw do
|
|||
match 'issues/update_form', :to => 'issues#update_form', :via => [:put, :post], :as => 'issue_form'
|
||||
|
||||
resources :files, :only => [:index, :new, :create] do
|
||||
member do
|
||||
match "quote_resource_show_project",:via => [:get]
|
||||
end
|
||||
collection do
|
||||
match "getattachtype" , :via => [:get, :post]
|
||||
match "search_project",:via => [:post,:get]
|
||||
#match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post]
|
||||
match "getattachtype", :via => [:get, :post]
|
||||
match "search",:via => [:post,:get]
|
||||
match "searchone4reload",:via => [:post,:get]
|
||||
match "search_tag_attachment", :via => [:post,:get]
|
||||
end
|
||||
member do
|
||||
match "quote_resource_show", :via => [:get]
|
||||
end
|
||||
end
|
||||
|
||||
# resources :files, :only => [:index, :new, :create] do
|
||||
# member do
|
||||
# match "quote_resource_show_project",:via => [:get]
|
||||
# end
|
||||
# collection do
|
||||
# match "getattachtype" , :via => [:get, :post]
|
||||
# match "search_project",:via => [:post,:get]
|
||||
# #match 'getattachtype/:attachtype', :to => 'files#getattachtype', :via => [:get, :post]
|
||||
# end
|
||||
# end
|
||||
|
||||
|
||||
resources :versions, :except => [:index, :show, :edit, :update, :destroy] do
|
||||
collection do
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddPubulishResourceToProjects < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :projects, :publish_resource, :integer, :default => false
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20151231023610) do
|
||||
ActiveRecord::Schema.define(:version => 20160104082423) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -1396,6 +1396,7 @@ ActiveRecord::Schema.define(:version => 20151231023610) do
|
|||
t.integer "forked_from_project_id"
|
||||
t.integer "forked_count"
|
||||
t.integer "commits_count", :default => 0
|
||||
t.integer "publish_resource", :default => 0
|
||||
end
|
||||
|
||||
add_index "projects", ["lft"], :name => "index_projects_on_lft"
|
||||
|
|
Loading…
Reference in New Issue