Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
yanxd 2014-05-14 08:52:54 +08:00
commit b4bb11bcfa
14 changed files with 50 additions and 22 deletions

View File

@ -0,0 +1,6 @@
#资源类型编辑control
class AttachmentTypeEditController < ApplicationController
def index
end
end

View File

@ -715,13 +715,14 @@ class BidsController < ApplicationController
def update
@bid = Bid.find(params[:id])
@project = @bid.courses.first
if @bid.update_attributes(params[:bid])
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)
else
@bid.safe_attributes = params[:bid]
render :action => 'edit'
render :action => 'edit', :layout =>'base_courses' ,:bid_id=>@bid.id,:project_id =>@project
end
end

View File

@ -74,6 +74,7 @@ class FilesController < ApplicationController
@containers += @project.versions.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").all.sort
@attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s
respond_to do |format|
format.js

View File

@ -44,9 +44,22 @@ module FilesHelper
File.new(zipfile_name,'w+')
end
def browseByCategory
isCategoryBrowser = 1
#isCategoryBrowser
# 判断指定的资源时候符合类型
def isTypeOk(attachment, type, contentType)
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

View File

@ -32,7 +32,7 @@ module ProjectsHelper
{: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 => '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}
]
tabs.select {|tab| User.current.allowed_to?(tab[:action], @project)}
@ -145,7 +145,7 @@ module ProjectsHelper
#Added by young
def course_settings_tabs
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 => 'members', :action => :manage_members, :partial => 'projects/settings/members', :label => :label_member_plural}
]

View File

@ -63,7 +63,7 @@ class Mailer < ActionMailer::Base
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
def issue_add(issue)
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
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id issue
@ -85,7 +85,7 @@ class Mailer < ActionMailer::Base
def issue_edit(journal)
issue = journal.journalized.reload
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
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
message_id journal

View File

@ -13,7 +13,7 @@
<% if attachmenttypes.any? %>
<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",
"typeName") %>
</p>

View File

@ -1,4 +1,5 @@
<% selAttachType =@attachtype %>
<% selContentType =@contenttype %>
<% delete_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">
@ -27,7 +28,7 @@
<% @containers.each do |container| %>
<% next if container.attachments.empty? -%>
<% container.attachments.each do |file| %>
<% if file.attachtype==selAttachType %>
<% if isTypeOk(file,selAttachType,selContentType) %>
<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="created_on"><%= format_time(file.created_on) %></td>

View File

@ -1,4 +1,4 @@
<% if @attachtype==0%>
<% if @attachtype==0 && @contenttype==l(:attachment_all)%>
$("#all_browse_div").html('<%= j(render partial: "show_all_attachment")%>');
<%else%>
$("#all_browse_div").html('<%= j(render partial: "sort_by_attachtypel")%>');

View File

@ -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) %>
<% 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"),
&nbsp; &nbsp; &nbsp;
<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)"%>
<% end %>
<% if sufixtypes.any? %>
<label for=""><%=l(:attachment_sufix_browse)%></label>
<%= select_tag "attach_sufix_browse", content_tag('option', '') +options_for_select(sufixtypes),
&nbsp;
<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)"%>
<% end %>
@ -204,8 +206,8 @@
attachments_autocomplete_path(:format => 'js'),
:remote => true,
:method => :post) do %>
<%= label_tag(:attach_search, "按关键字搜索:") %>
<%= text_field_tag(:attach_search) %>
<%= label_tag(:atext_field_tagttach_search, "按关键字搜索:") %>
<%= (:attach_search) %>
<%#= submit_tag("Search") %>
<% end -%>
<%= form_tag attach_relation_path(:format => 'js'),
@ -286,7 +288,8 @@
<script type="text/javascript">
function attachmenttypes_searchex(value) {
$.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"
}).complete(function (xhr, textStatus) {
@ -295,13 +298,14 @@
} else if (textStatus == 'error') {
alert('error');
}
;
});
}
function attachment_contenttypes_searchex(value) {
$.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"
}).complete(function (xhr, textStatus) {

View File

@ -132,6 +132,7 @@ en:
actionview_instancetag_blank_option: Please select
attachment_all: "All"
attachment_browse: "Attachment Content Browse"
attachment_sufix_browse: "Attachment Type Browse"
attachment_type: "Attachment Type"

View File

@ -140,6 +140,7 @@ zh:
actionview_instancetag_blank_option: 请选择
attachment_all: "全部"
attachment_sufix_browse: "文件类型"
attachment_browse: "内容类型"
attachment_type: '资源分类'

View File

@ -1840,7 +1840,7 @@ a.remove-upload:hover {text-decoration:none !important;}
/*gcm upload file count and deleteall*/
#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; }