修改课程资源文件视图BUG
This commit is contained in:
parent
a20feafa4e
commit
f741b0581c
|
@ -35,8 +35,8 @@ class FilesController < ApplicationController
|
|||
|
||||
if params[:project_id]
|
||||
@isproject = true
|
||||
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
||||
@containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
|
||||
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
||||
render :layout => !request.xhr?
|
||||
elsif params[:course_id]
|
||||
@isproject = false
|
||||
|
|
|
@ -37,7 +37,7 @@ class CourseJournalsForMessage < ActiveRecord::Base
|
|||
}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
||||
acts_as_activity_provider :author_key => :user_id,
|
||||
:timestamp => "#{self.table_name}.updated_on",
|
||||
:find_options => {:include => :course }
|
||||
:find_options => {:include => :course }
|
||||
|
||||
|
||||
has_many :acts, :class_name => 'Activity', :as => :act, :dependent => :destroy
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<div class="project-block">
|
||||
<div class="course-block">
|
||||
<div class="img-tag-2">
|
||||
<% if get_avatar?(project)%>
|
||||
<%= image_tag(url_to_avatar(project), :class => "avatar2") %>
|
||||
<% if get_avatar?(course)%>
|
||||
<%= image_tag(url_to_avatar(course), :class => "avatar2") %>
|
||||
<% else %>
|
||||
<%= image_tag('../images/avatars/Project/course.jpg', :class => "avatar2") %>
|
||||
<%= image_tag('../images/avatars/course/course.jpg', :class => "avatar2") %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="wiki-description">
|
||||
<p >
|
||||
<%= content_tag('span',"#{l(:label_bid_show_course_name)}:", :class => "course-font")%>
|
||||
<%= content_tag('span', link_to("#{@project.name}", project_path(@project), :class => "info"))%>
|
||||
<%= content_tag('span', link_to("#{@course.name}", course_path(@course), :class => "info"))%>
|
||||
</p>
|
||||
<p >
|
||||
<%= content_tag('span', "#{l(:label_institution_name)}:", :class => "course-font")%>
|
||||
<% @admin = @project.project_infos%>
|
||||
<% @admin = @course.course_infos%>
|
||||
<%if @admin&&@admin.first&&@admin.first.user&&@admin.first.user.user_extensions%>
|
||||
<!-- <%= @admin.first.user.user_extensions.occupation %> -->
|
||||
<%# unless @project.course_extra.school.nil? %>
|
||||
<%= @project.course_extra.teacher.user_extensions.school.try(:name) %>
|
||||
<%# unless @course.course_extra.school.nil? %>
|
||||
<%= @course.course_extra.teacher.user_extensions.school.try(:name) %>
|
||||
<%# end %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
@ -33,41 +33,39 @@
|
|||
|
||||
<div class="information_for_course" >
|
||||
<p class="stats">
|
||||
<%= content_tag('span', link_to("#{@project.homeworks.count}", homework_project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_task, :count => @project.homeworks.count)) %>
|
||||
<%= content_tag('span', link_to("#{@course.homeworks.count}", homework_course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_task, :count => @course.homeworks.count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<% files_count = @project.attachments.count %>
|
||||
<% @project.versions.each do |version| %>
|
||||
<% files_count = @course.attachments.count %>
|
||||
<% @course.versions.each do |version| %>
|
||||
<% files_count += version.attachments.count %>
|
||||
<% end %>
|
||||
<%= content_tag('span', link_to(files_count, project_files_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', link_to(files_count, course_files_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_data,:count => files_count)) %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('span', "#{garble @project.members.count}", :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_member, :count => @project.members.count)) %>
|
||||
<%= content_tag('span', "#{garble @course.members.count}", :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_member, :count => @course.members.count)) %>
|
||||
</p>
|
||||
|
||||
<!--gcm-->
|
||||
<p class="stats">
|
||||
|
||||
<%= content_tag('span', link_to("#{@project_activity_count[@project.id]}", project_path(@project)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @project_activity_count[@project.id])) %>
|
||||
<%= content_tag('span', link_to("#{@course_activity_count[@course.id]}", course_path(@course)), :class => "info") %>
|
||||
<%= content_tag('span', l(:label_x_activity, :count => @course_activity_count[@course.id])) %>
|
||||
</p>
|
||||
<!--gcm-->
|
||||
|
||||
<div class="buttons_for_course" style="margin-top:30px;margin-left:144px">
|
||||
<span class="info"></span>
|
||||
<% if @project.project_type==Project::ProjectType_course %>
|
||||
<% if(course_endTime_timeout? @project) %>
|
||||
<% if(course_endTime_timeout? @project) %>
|
||||
<span class="font_lighter">
|
||||
课程学期已结束
|
||||
</span>
|
||||
<% else %>
|
||||
<%= join_in_course_for_list(@project, User.current,['regular'])%>
|
||||
<% end -%>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<%= join_in_course_for_list(@project, User.current,['regular'])%>
|
||||
<% end -%>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -75,18 +73,18 @@
|
|||
<div class="add-info">
|
||||
<div class="main-language" style="margin-left: 30px;margin-top:-10px">
|
||||
<%= content_tag "span","#{l(:label_duration_time)}:", :class => "course-font"%>
|
||||
<%= get_course_term @project %>
|
||||
<%= get_course_term @course %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="add-info" style="margin-left: 30px; margin-top: -20px">
|
||||
<%= content_tag "span", "#{l(:label_course_brief_introduction)}:", :class => "course-font" %>
|
||||
<%= content_tag "div", project.short_description, :class => "brief_introduction", :title => project.short_description %>
|
||||
<%= content_tag "div", course.short_description, :class => "brief_introduction", :title => course.short_description %>
|
||||
</div>
|
||||
|
||||
<div class="tags">
|
||||
<div id="tags">
|
||||
<%= image_tag( "/images/sidebar/tags.png") %>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => @project,:object_flag => "2",:non_list_all => true }%>
|
||||
<%= render :partial => 'tags/tag_name', :locals => {:obj => @course,:object_flag => "9",:non_list_all => true }%>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/course", :controller => 'courses', :action => 'course', :course_type => 1 %> </a></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'course', :course_type => 1 %></td>
|
||||
<td style="padding-left: 8px"><a><%= link_to request.host()+"/course", :controller => 'courses', :action => 'index', :course_type => 1 %> </a></td>
|
||||
<td ><%=link_to l(:field_homepage), home_path %> > <%=link_to l(:label_course_practice), :controller => 'courses', :action => 'index', :course_type => 1 %></td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
|
|
|
@ -4,21 +4,12 @@
|
|||
<%= form_tag(course_files_path(course), :multipart => true,:remote => false,:method => :post,:name=>"upload_form", :class => "tabular") do %>
|
||||
<div class="box">
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
<% if attachmenttypes.any? %>
|
||||
<td><%= l(:attachment_type) %></label></td>
|
||||
<td>
|
||||
<%= select_tag "attachment_type",
|
||||
options_from_collection_for_select(attachmenttypes, "id",
|
||||
"typeName", 2), {style: 'width:100px'} %>
|
||||
</td>
|
||||
<% end %>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
<% if attachmenttypes.any? %>
|
||||
<%= l(:attachment_type) %></label>
|
||||
<%= select_tag "attachment_type",
|
||||
options_from_collection_for_select(attachmenttypes, "id",
|
||||
"typeName", 2), {style: 'width:100px'} %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<p><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p>
|
||||
|
|
|
@ -59,8 +59,40 @@
|
|||
}
|
||||
|
||||
|
||||
function attachment_contenttypes_searchex(value) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
|
||||
|
||||
function attachtype_edit(value) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
|
||||
function course_attachmenttypes_searchex(value) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
type: "POST",
|
||||
|
@ -70,22 +102,11 @@
|
|||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
}
|
||||
|
||||
function attachment_contenttypes_searchex(value) {
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function course_attachment_contenttypes_searchex(value) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
|
@ -96,24 +117,11 @@
|
|||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function attachtype_edit(value) {
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
type: $('#attachment_browse').val(),
|
||||
contentType: encodeURIComponent(value)
|
||||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
}
|
||||
|
||||
function course_attachtype_edit(value) {
|
||||
<% if @course%>
|
||||
$.ajax({
|
||||
|
||||
url: '<%=getattachtype_course_files_path(course_id: @course)%>',
|
||||
type: "POST",
|
||||
data: {
|
||||
|
@ -122,9 +130,11 @@
|
|||
}
|
||||
|
||||
}).complete(eval_ajax);
|
||||
<%end%>
|
||||
}
|
||||
|
||||
function attachmenttypes_change(id, type) {
|
||||
<% if @project%>
|
||||
$.ajax({
|
||||
url: '<%=updateType_attachments_path%>',
|
||||
type: "POST",
|
||||
|
@ -134,6 +144,7 @@
|
|||
}
|
||||
|
||||
}).complete(function (xhr, textStatus) {
|
||||
|
||||
if (textStatus == 'success') {
|
||||
$.ajax({
|
||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>',
|
||||
|
@ -149,6 +160,8 @@
|
|||
alert('An error has occurred');
|
||||
}
|
||||
});
|
||||
<%end%>
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -1126,6 +1126,7 @@ en:
|
|||
|
||||
label_joined_course: Joined Courses
|
||||
label_created_course: Created Courses
|
||||
label_borad_course: Course Borad
|
||||
|
||||
#huang
|
||||
label_file_new: Download
|
||||
|
|
|
@ -242,8 +242,8 @@ ActiveRecord::Schema.define(:version => 20140606028512) do
|
|||
t.string "code"
|
||||
t.integer "time"
|
||||
t.string "extra"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "location"
|
||||
t.string "term"
|
||||
t.string "string"
|
||||
|
@ -257,7 +257,7 @@ ActiveRecord::Schema.define(:version => 20140606028512) do
|
|||
t.integer "attachmenttype", :default => 2
|
||||
t.integer "lft"
|
||||
t.integer "rgt"
|
||||
t.boolean "is_public", :default => true
|
||||
t.integer "is_public", :limit => 1, :default => 1
|
||||
t.integer "inherit_members", :limit => 1, :default => 1
|
||||
end
|
||||
|
||||
|
|
|
@ -108,7 +108,9 @@ Redmine::AccessControl.map do |map|
|
|||
map.permission :select_course_modules, {:courses => :modules}, :require => :member
|
||||
map.permission :view_course_journals_for_messages, {:gantts => [:show, :update]}, :read => true
|
||||
|
||||
map.course_module :course do
|
||||
map.course_module :files do |map|
|
||||
map.permission :manage_files, {:files => [:new, :create]}, :require => :loggedin
|
||||
map.permission :view_files, {:files => :index, :versions => :download}, :read => true
|
||||
end
|
||||
#end
|
||||
|
||||
|
@ -415,7 +417,7 @@ Redmine::Activity.map do |activity|
|
|||
activity.register :journals_for_messages
|
||||
# end
|
||||
#added by nwb
|
||||
activity.register :course_journals_for_messages
|
||||
#activity.register :course_journals_for_messages
|
||||
end
|
||||
|
||||
Redmine::Search.map do |search|
|
||||
|
|
Loading…
Reference in New Issue