竞赛图片上传
This commit is contained in:
parent
9130111b2c
commit
44e1a09906
|
@ -4,6 +4,9 @@ class ContestsController < ApplicationController
|
|||
include ContestsHelper
|
||||
helper :contest_members
|
||||
helper :users
|
||||
helper :attachments
|
||||
helper :files
|
||||
include AvatarHelper
|
||||
|
||||
before_filter :find_contest, :only => [:show, :settings, :update, :destroy, :contest_activities, :search_member, :private_or_public, :switch_role, :set_invite_code_halt, :renew,
|
||||
:member]
|
||||
|
|
|
@ -93,6 +93,9 @@ class MyController < ApplicationController
|
|||
if params[:course]
|
||||
@course = Course.find params[:course]
|
||||
diskfile = disk_filename('Course', @course.id)
|
||||
elsif params[:contest]
|
||||
@contest = Contest.find params[:contest]
|
||||
diskfile = disk_filename('Contest', @contest.id)
|
||||
elsif params[:project]
|
||||
@project = Project.find params[:project]
|
||||
diskfile = disk_filename('Project', @project.id)
|
||||
|
@ -116,6 +119,9 @@ class MyController < ApplicationController
|
|||
when 'Course'
|
||||
@course = Course.find params[:source_id]
|
||||
diskfile = disk_filename('Course', @course.id)
|
||||
when 'Contest'
|
||||
@contest = Contest.find params[:source_id]
|
||||
diskfile = disk_filename('Contest', @contest.id)
|
||||
when 'Project'
|
||||
@project = Project.find params[:source_id]
|
||||
diskfile = disk_filename('Project', @project.id)
|
||||
|
|
|
@ -15,6 +15,7 @@ class Contest < ActiveRecord::Base
|
|||
has_many :works
|
||||
has_many :contestant_work_projects, :dependent => :destroy
|
||||
has_many :boards, :dependent => :destroy, :order => "position ASC"
|
||||
has_many :files
|
||||
|
||||
|
||||
has_many :news, :dependent => :destroy, :include => :author
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<% if source.id == 786 %>
|
||||
<img src="/images/game/appbanner.jpg" width="968" height="110" id="avatar_image"/>
|
||||
<% else %>
|
||||
<%= image_tag(url_to_avatar(source), :width => "968", :height => "110", :id => "avatar_image", :alt => "竞赛图片")%>
|
||||
<% end %>
|
||||
<% if is_admin %>
|
||||
<a class="banner-inner" href="javascript:void(0)" onclick="$('#upload_contest_logo').click();"></a>
|
||||
<a class="banner-notice" href="javascript:void(0)" onclick="$('#upload_contest_logo').click();">点击替换图片(968*110)</a>
|
||||
<%= file_field_tag 'avatar[image]',
|
||||
:id => 'upload_contest_logo',
|
||||
:class => 'undis upload_file',
|
||||
:size => "1",
|
||||
:multiple => true,
|
||||
:data => {
|
||||
:max_file_size => Setting.upload_avatar_max_size,
|
||||
:max_file_size_message => l(:error_upload_avatar_to_large, :max_size => number_to_human_size(Setting.upload_avatar_max_size.to_i)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||
:type_support_message => l(:error_pic_type),
|
||||
:upload_path => upload_avatar_path(:format => 'js'),
|
||||
:description_placeholder => nil ,# l(:label_optional_description)
|
||||
:source_type => source.class.to_s,
|
||||
:source_id => source.id.to_s,
|
||||
:is_direct => 0
|
||||
} %>
|
||||
<!--</span>-->
|
||||
<%#= content_for(:header_tags) do %>
|
||||
<%#= javascript_include_tag '/javascripts/jq-upload/jquery.ui.widget', '/javascripts/jq-upload/jquery.iframe-transport', '/javascripts/jq-upload/jquery.fileupload', '/javascripts/jq-upload/upload' %>
|
||||
<%# end %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
|
@ -9,11 +9,7 @@
|
|||
|
||||
<div class="cl"></div>
|
||||
<div class="banner-game">
|
||||
<% if @contest.id == 786 %>
|
||||
<img src="/images/game/appbanner.jpg" width="968" height="110"/>
|
||||
<% else %>
|
||||
<img src="/images/game/banner-game.png" width="968" height="110"/>
|
||||
<% end %>
|
||||
<%=render :partial => 'avatar/new_contest_avatar_form', :locals => {source: @contest, is_admin: User.current.admin_of_contest?(@contest) || User.current.admin?} %>
|
||||
</div>
|
||||
<div class="sy_class_info fl">
|
||||
<div class="sy_class_titbox">
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<div id="sy_popup_box" style="width:400px;">
|
||||
<div class="sy_popup_top">
|
||||
<h3 class="fl">上传图片</h3>
|
||||
<a href="javascript:void(0);" class="sy_icons_close fr" onclick="hideModal()"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="sy_popup_con">
|
||||
<div class="uppicBox">
|
||||
<input type="button" class="uppic_btn" onclick="$('#upload_avatar').click();" value="浏览.."/>
|
||||
<%= file_field_tag 'avatar[image]',
|
||||
:id => "upload_avatar",
|
||||
:style => 'display:none;',#added by young
|
||||
:size => "1",
|
||||
:multiple => false,
|
||||
:onchange => 'addInputAvatar(this);',
|
||||
:data => {
|
||||
:max_file_size => Setting.attachment_max_size.to_i.kilobytes,
|
||||
:max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
|
||||
:max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
|
||||
:file_type => Redmine::Configuration['pic_types'].to_s,
|
||||
:type_support_message => l(:error_pic_type),
|
||||
:upload_path => upload_avatar_path(:format => 'js'),
|
||||
:description_placeholder => nil ,# l(:label_optional_description)
|
||||
:source_type => source.class.to_s,
|
||||
:source_id => source.id.to_s,
|
||||
:is_direct => 1
|
||||
} %>
|
||||
<!--<br/>-->
|
||||
<!--<span>只支持jpg,png,gif,大小不超过5M</span>-->
|
||||
</div>
|
||||
|
||||
<div class="cl mb10"></div>
|
||||
<a href="javascript:hideModal();" class=" fr grey_btn mr15 f14"> 取 消</a>
|
||||
<a href="<%= url_for(:controller => 'my', :action => 'save_user_avatar', :source_id => source.id, :source_type => source.class.to_s) %>" data-remote="true" class="blue_btn fr mr10 f14">确 定</a>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function submit_join_course(){
|
||||
|
||||
}
|
||||
|
||||
function disable_contestant_choose(){
|
||||
|
||||
}
|
||||
</script>
|
|
@ -11,11 +11,22 @@
|
|||
<%= favicon %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel','css/contest'%>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify','contest' %>
|
||||
<%= call_hook :view_layouts_base_html_head %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public', 'css/structure','prettify', 'css/courses','css/popup','sy_public','syllabus', 'css/moduel','css/contest'%>
|
||||
<%= javascript_include_tag "course","avatars","header","attachments",'prettify','contest','jq-upload/jquery.ui.widget', 'jq-upload/jquery.iframe-transport', 'jq-upload/jquery.fileupload', 'jq-upload/upload' %>
|
||||
<!-- page specific tags -->
|
||||
<%= yield :header_tags -%>
|
||||
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<!--add by huang-->
|
||||
|
@ -92,17 +103,7 @@
|
|||
</div>
|
||||
<%= call_hook :view_layouts_base_body_bottom %>
|
||||
</body>
|
||||
<!-- MathJax的配置 -->
|
||||
<script type="text/javascript" src="/javascripts/MathJax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
|
||||
<!-- 配置 : 在生成的公式图片上去掉Math定义的右键菜单,$$ $$ \( \) \[ \] 中的公式给予显示-->
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
showMathMenu: false,
|
||||
showMathMenuMSIE: false,
|
||||
tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}
|
||||
});
|
||||
</script>
|
||||
<%= javascript_include_tag 'cookie','project',"avatars", 'header','prettify','select_list_move','attachments' %>
|
||||
|
||||
<script>
|
||||
var blog_artile_list_html = '';
|
||||
$(function(){
|
||||
|
|
|
@ -640,19 +640,12 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
|
||||
resources :boards
|
||||
resources :files, :only => [:index, :new, :create] do
|
||||
collection do
|
||||
match "getattachtype", :via => [:get, :post]
|
||||
match "search",:via => [:post,:get]
|
||||
match "searchone4reload",:via => [:post,:get]
|
||||
match "search_tag_attachment", :via => [:post,:get]
|
||||
end
|
||||
resource :files do
|
||||
member do
|
||||
match "quote_resource_show", :via => [:get]
|
||||
get "file_hidden"
|
||||
post "republish_file"
|
||||
get "update_file_description"
|
||||
post "edit_file_description"
|
||||
|
||||
end
|
||||
collection do
|
||||
|
||||
end
|
||||
end
|
||||
resources :news, :except => [:show, :edit, :update, :destroy]
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 114 KiB After Width: | Height: | Size: 17 KiB |
Loading…
Reference in New Issue