Merge remote-tracking branch 'origin/szzh' into szzh
This commit is contained in:
commit
b4bb11bcfa
|
@ -0,0 +1,6 @@
|
||||||
|
#资源类型编辑control
|
||||||
|
class AttachmentTypeEditController < ApplicationController
|
||||||
|
def index
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
|
@ -715,13 +715,14 @@ class BidsController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@bid = Bid.find(params[:id])
|
@bid = Bid.find(params[:id])
|
||||||
|
@project = @bid.courses.first
|
||||||
if @bid.update_attributes(params[:bid])
|
if @bid.update_attributes(params[:bid])
|
||||||
flash[:notice] = l(:label_update_homework_succeed)
|
flash[:notice] = l(:label_update_homework_succeed)
|
||||||
@project = Project.find(params[:course_id])
|
#@project = Project.find(params[:course_id])
|
||||||
redirect_to project_homework_path(@project)
|
redirect_to project_homework_path(@project)
|
||||||
else
|
else
|
||||||
@bid.safe_attributes = params[:bid]
|
@bid.safe_attributes = params[:bid]
|
||||||
render :action => 'edit'
|
render :action => 'edit', :layout =>'base_courses' ,:bid_id=>@bid.id,:project_id =>@project
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@ class FilesController < ApplicationController
|
||||||
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
|
||||||
|
|
||||||
@attachtype = params[:type].to_i
|
@attachtype = params[:type].to_i
|
||||||
|
@contenttype = params[:contentType].to_s
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
|
|
@ -44,9 +44,22 @@ module FilesHelper
|
||||||
File.new(zipfile_name,'w+')
|
File.new(zipfile_name,'w+')
|
||||||
end
|
end
|
||||||
|
|
||||||
def browseByCategory
|
# 判断指定的资源时候符合类型
|
||||||
isCategoryBrowser = 1
|
def isTypeOk(attachment, type, contentType)
|
||||||
#isCategoryBrowser
|
result = false
|
||||||
|
if type != 0
|
||||||
|
if attachment.attachtype == type
|
||||||
|
result = true
|
||||||
|
end
|
||||||
|
else
|
||||||
|
result = true
|
||||||
|
end
|
||||||
|
if result
|
||||||
|
if contentType != l(:attachment_all) && contentType != attachment.suffix_type
|
||||||
|
result = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ module ProjectsHelper
|
||||||
{:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
|
{:name => 'categories', :action => :manage_categories, :partial => 'projects/settings/issue_categories', :label => :label_issue_category_plural},
|
||||||
# {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
|
# {:name => 'wiki', :action => :manage_wiki, :partial => 'projects/settings/wiki', :label => :label_wiki},
|
||||||
{:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
|
{:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
|
||||||
{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
|
#{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural},
|
||||||
{:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
|
{:name => 'activities', :action => :manage_project_activities, :partial => 'projects/settings/activities', :label => :enumeration_activities}
|
||||||
]
|
]
|
||||||
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
|
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
|
||||||
|
@ -145,7 +145,7 @@ module ProjectsHelper
|
||||||
#Added by young
|
#Added by young
|
||||||
def course_settings_tabs
|
def course_settings_tabs
|
||||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
||||||
{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1},
|
#{:name => 'boards', :action => :manage_boards, :partial => 'projects/settings/boards', :label => :label_board_plural, :project_type => 1},
|
||||||
# {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
|
# {:name => 'repositories', :action => :manage_repository, :partial => 'projects/settings/repositories', :label => :label_repository_plural},
|
||||||
{:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural}
|
{:name => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural}
|
||||||
]
|
]
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Mailer < ActionMailer::Base
|
||||||
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
|
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
|
||||||
def issue_add(issue)
|
def issue_add(issue)
|
||||||
redmine_headers 'Project' => issue.project.identifier,
|
redmine_headers 'Project' => issue.project.identifier,
|
||||||
'Issue-Id' => issue.id,
|
'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
|
||||||
'Issue-Author' => issue.author.login
|
'Issue-Author' => issue.author.login
|
||||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||||
message_id issue
|
message_id issue
|
||||||
|
@ -85,7 +85,7 @@ class Mailer < ActionMailer::Base
|
||||||
def issue_edit(journal)
|
def issue_edit(journal)
|
||||||
issue = journal.journalized.reload
|
issue = journal.journalized.reload
|
||||||
redmine_headers 'Project' => issue.project.identifier,
|
redmine_headers 'Project' => issue.project.identifier,
|
||||||
'Issue-Id' => issue.id,
|
'Issue-Id' => (issue.project.issues.index(issue).to_i + 1).to_s,
|
||||||
'Issue-Author' => issue.author.login
|
'Issue-Author' => issue.author.login
|
||||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||||
message_id journal
|
message_id journal
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
|
<p> <label for="attachment_type"><%=l(:attachment_type)%></label>
|
||||||
<%= select_tag "attachment_type", content_tag('option', '') +
|
<%= select_tag "attachment_type",
|
||||||
options_from_collection_for_select(attachmenttypes, "id",
|
options_from_collection_for_select(attachmenttypes, "id",
|
||||||
"typeName") %>
|
"typeName") %>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
<% selAttachType =@attachtype %>
|
<% selAttachType =@attachtype %>
|
||||||
|
<% selContentType =@contenttype %>
|
||||||
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
<% delete_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||||
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
<% edit_allowed = User.current.allowed_to?(:manage_files, @project) %>
|
||||||
<div id="catarory_browse_div" class="catarory_browse_div">
|
<div id="catarory_browse_div" class="catarory_browse_div">
|
||||||
|
@ -27,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.attachtype==selAttachType %>
|
<% if isTypeOk(file,selAttachType,selContentType) %>
|
||||||
<tr class="file <%= cycle("odd", "odd") %>">
|
<tr class="file <%= cycle("odd", "odd") %>">
|
||||||
<td class="filename" style="font-size: 13px; width: 240px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
<td class="filename" style="font-size: 13px; width: 240px; "><%= link_to_attachment file, :download => true, :title => file.filename+"\n"+file.description.to_s, :style => "width: 230px; overflow: hidden; white-space: nowrap;text-overflow: ellipsis;" %></td>
|
||||||
<td class="created_on"><%= format_time(file.created_on) %></td>
|
<td class="created_on"><%= format_time(file.created_on) %></td>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<% if @attachtype==0%>
|
<% if @attachtype==0 && @contenttype==l(:attachment_all)%>
|
||||||
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
|
||||||
<%else%>
|
<%else%>
|
||||||
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');
|
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');
|
||||||
|
|
|
@ -184,13 +184,15 @@
|
||||||
<%= 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) %>
|
<%= 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) %>
|
||||||
|
|
||||||
<% if attachmenttypes.any? %>
|
<% if attachmenttypes.any? %>
|
||||||
<label for="attachment_browse"><%=l(:attachment_browse)%></label>
|
|
||||||
<%= select_tag "attachment_browse", content_tag('option', '') +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
|
<label for="attachment_browse_label"><%=l(:attachment_browse)%></label>
|
||||||
|
<%= select_tag "attachment_browse", content_tag('option',l(:attachment_all)) +options_from_collection_for_select(attachmenttypes, "id", "typeName"),
|
||||||
:onchange=>"attachmenttypes_searchex(this.value)"%>
|
:onchange=>"attachmenttypes_searchex(this.value)"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if sufixtypes.any? %>
|
<% if sufixtypes.any? %>
|
||||||
<label for=""><%=l(:attachment_sufix_browse)%></label>
|
|
||||||
<%= select_tag "attach_sufix_browse", content_tag('option', '') +options_for_select(sufixtypes),
|
<label for="attach_sufix_browse_label"><%=l(:attachment_sufix_browse)%></label>
|
||||||
|
<%= select_tag "attach_sufix_browse", content_tag('option', l(:attachment_all)) +options_for_select(sufixtypes),
|
||||||
:onchange=>"attachment_contenttypes_searchex(this.value)"%>
|
:onchange=>"attachment_contenttypes_searchex(this.value)"%>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
@ -204,8 +206,8 @@
|
||||||
attachments_autocomplete_path(:format => 'js'),
|
attachments_autocomplete_path(:format => 'js'),
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => :post) do %>
|
:method => :post) do %>
|
||||||
<%= label_tag(:attach_search, "按关键字搜索:") %>
|
<%= label_tag(:atext_field_tagttach_search, "按关键字搜索:") %>
|
||||||
<%= text_field_tag(:attach_search) %>
|
<%= (:attach_search) %>
|
||||||
<%#= submit_tag("Search") %>
|
<%#= submit_tag("Search") %>
|
||||||
<% end -%>
|
<% end -%>
|
||||||
<%= form_tag attach_relation_path(:format => 'js'),
|
<%= form_tag attach_relation_path(:format => 'js'),
|
||||||
|
@ -286,7 +288,8 @@
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function attachmenttypes_searchex(value) {
|
function attachmenttypes_searchex(value) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' + encodeURIComponent(value),
|
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
|
||||||
|
+ encodeURIComponent(value) + "&contentType=" + $('#attach_sufix_browse').val(),
|
||||||
type: "POST"
|
type: "POST"
|
||||||
|
|
||||||
}).complete(function (xhr, textStatus) {
|
}).complete(function (xhr, textStatus) {
|
||||||
|
@ -295,13 +298,14 @@
|
||||||
} else if (textStatus == 'error') {
|
} else if (textStatus == 'error') {
|
||||||
alert('error');
|
alert('error');
|
||||||
}
|
}
|
||||||
;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function attachment_contenttypes_searchex(value) {
|
function attachment_contenttypes_searchex(value) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type=' + encodeURIComponent(value),
|
|
||||||
|
url: '<%=getattachtype_project_files_path(project_id: @project)%>' + '?type='
|
||||||
|
+ $('#attachment_browse').val() + "&contentType=" + encodeURIComponent(value),
|
||||||
type: "POST"
|
type: "POST"
|
||||||
|
|
||||||
}).complete(function (xhr, textStatus) {
|
}).complete(function (xhr, textStatus) {
|
||||||
|
|
|
@ -132,6 +132,7 @@ en:
|
||||||
|
|
||||||
actionview_instancetag_blank_option: Please select
|
actionview_instancetag_blank_option: Please select
|
||||||
|
|
||||||
|
attachment_all: "All"
|
||||||
attachment_browse: "Attachment Content Browse"
|
attachment_browse: "Attachment Content Browse"
|
||||||
attachment_sufix_browse: "Attachment Type Browse"
|
attachment_sufix_browse: "Attachment Type Browse"
|
||||||
attachment_type: "Attachment Type"
|
attachment_type: "Attachment Type"
|
||||||
|
|
|
@ -140,6 +140,7 @@ zh:
|
||||||
|
|
||||||
actionview_instancetag_blank_option: 请选择
|
actionview_instancetag_blank_option: 请选择
|
||||||
|
|
||||||
|
attachment_all: "全部"
|
||||||
attachment_sufix_browse: "文件类型"
|
attachment_sufix_browse: "文件类型"
|
||||||
attachment_browse: "内容类型"
|
attachment_browse: "内容类型"
|
||||||
attachment_type: '资源分类'
|
attachment_type: '资源分类'
|
||||||
|
|
|
@ -1840,7 +1840,7 @@ a.remove-upload:hover {text-decoration:none !important;}
|
||||||
|
|
||||||
/*gcm upload file count and deleteall*/
|
/*gcm upload file count and deleteall*/
|
||||||
#upload_file_count #count {color:red; font-size:1.5em;}
|
#upload_file_count #count {color:red; font-size:1.5em;}
|
||||||
span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:21px;text-decoration:none;}
|
span.add_attachment .remove_all {background:none;background: url(../images/delete.png) no-repeat 1px 50%; width:1px; display:inline-block;position:absolute;right:61px;text-decoration:none;}
|
||||||
|
|
||||||
|
|
||||||
div.fileover { background-color: lavender; }
|
div.fileover { background-color: lavender; }
|
||||||
|
|
Loading…
Reference in New Issue