课程资源文件密级BUG修正

This commit is contained in:
nwb 2014-07-14 15:15:28 +08:00
parent 0950ac2329
commit 2a1a051362
4 changed files with 69 additions and 51 deletions

View File

@ -92,6 +92,22 @@ class RepositoriesController < ApplicationController
end end
def create def create
if params[:repository_scm].to_s == 'Gitlab'
# add by nwb
# 增加对gitlab版本库的支持
attrs = pickup_extra_info
@repository = Repository.factory(params[:repository_scm])
@repository.safe_attributes = params[:repository]
if attrs[:attrs_extra].keys.any?
@repository.merge_extra_info(attrs[:attrs_extra])
end
@repository.project = @project
if request.post? && @repository.save
redirect_to settings_project_path(@project, :tab => 'repositories')
else
render :action => 'new'
end
else # 原逻辑
##xianbo ##xianbo
@root_path=RepositoriesHelper::ROOT_PATH @root_path=RepositoriesHelper::ROOT_PATH
@repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git" @repository_name=User.current.login.to_s+"/"+params[:repository][:identifier]+".git"
@ -144,6 +160,7 @@ class RepositoriesController < ApplicationController
end end
end end
end end
end
def edit def edit
end end

View File

@ -35,7 +35,7 @@
</tr> </tr>
<% end -%> <% end -%>
<% container.attachments.each do |file| %> <% container.attachments.each do |file| %>
<%if file.is_public == 0 && !User.current.member_of?(@project)%> <%if file.is_public == 0 && !User.current.member_of_course?(@course)%>
<%next%> <%next%>
<%end%> <%end%>
<tr class="file <%= cycle("odd", "odd") %>"> <tr class="file <%= cycle("odd", "odd") %>">

View File

@ -28,7 +28,7 @@
<% @containers.each do |container| %> <% @containers.each do |container| %>
<% next if container.attachments.empty? -%> <% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %> <% container.attachments.each do |file| %>
<% if file.is_public == 0 && !User.current.member_of?(@project) %> <% if file.is_public == 0 && !User.current.member_of_course?(@course) %>
<% next %> <% next %>
<% end %> <% end %>
<% if isTypeOk(file, selAttachType, selContentType) %> <% if isTypeOk(file, selAttachType, selContentType) %>

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended to check this file into your version control system. # It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140711012924) do ActiveRecord::Schema.define(:version => 20140714021812) do
create_table "activities", :force => true do |t| create_table "activities", :force => true do |t|
t.integer "act_id", :null => false t.integer "act_id", :null => false
@ -379,6 +379,7 @@ ActiveRecord::Schema.define(:version => 20140711012924) do
t.text "description" t.text "description"
t.datetime "created_on" t.datetime "created_on"
t.integer "user_id", :default => 0 t.integer "user_id", :default => 0
t.integer "is_public", :default => 1
end end
add_index "documents", ["category_id"], :name => "index_documents_on_category_id" add_index "documents", ["category_id"], :name => "index_documents_on_category_id"