forked from jacknudt/trustieforge
parent
ca9da99f7e
commit
60be338848
|
@ -3,7 +3,7 @@ class BidsController < ApplicationController
|
|||
#Added by young
|
||||
menu_item l(:label_homework), :only => [:edit, :udpate]
|
||||
menu_item :respond
|
||||
menu_item :project, :only => [:show_project,:show_results]
|
||||
menu_item :project, :only => [:show_project,:show_results, :new_submit_homework]
|
||||
menu_item :homework_respond, :only => :homework_respond
|
||||
menu_item :homework_statistics, :only => :homework_statistics
|
||||
#Ended by young
|
||||
|
@ -713,24 +713,42 @@ class BidsController < ApplicationController
|
|||
render :action => 'edit'
|
||||
end
|
||||
end
|
||||
|
||||
def new_submit_homework
|
||||
#render html to prepare create submit homework
|
||||
find_bid
|
||||
render :layout => 'base_homework'
|
||||
end
|
||||
|
||||
def add_homework
|
||||
if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0)
|
||||
# homework = HomeworkAttach.create(:bid_id => @bid.id, :user_id => User.current.id)
|
||||
# homework.save_attachments(params[:attachments] || (params[:bid] && params[:bid][:uploads]))
|
||||
@homework = HomeworkAttach.new
|
||||
@homework.safe_attributes = params[:homeworkattach]
|
||||
@homework.bid_id = @bid.id
|
||||
@homework.user_id = User.current.id
|
||||
@homework.save_attachments(params[:attachments])
|
||||
@homework.save
|
||||
render_attachment_warning_if_needed(@homework)
|
||||
if @homework.save
|
||||
@homework_flag = l(:label_bidding_homework_succeed)
|
||||
else
|
||||
@homework_flag = l(:label_bidding_homework_failed)
|
||||
end
|
||||
if @homework.attachments.empty?
|
||||
@homework.delete
|
||||
flash[:error] = l(:no_attachmens_allowed)
|
||||
@homework_flag = l(:no_attachmens_allowed)
|
||||
# else
|
||||
end
|
||||
end
|
||||
@homework_list = @bid.homeworks
|
||||
@homework = HomeworkAttach.new
|
||||
respond_to do |format|
|
||||
format.html{
|
||||
redirect_to project_for_bid_path, notice: @homework_flag.to_s
|
||||
}
|
||||
format.js
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
class HomeworkAttach < ActiveRecord::Base
|
||||
attr_accessible :bid_id, :user_id
|
||||
|
||||
include Redmine::SafeAttributes
|
||||
belongs_to :user
|
||||
belongs_to :bid
|
||||
|
||||
safe_attributes "bid_id",
|
||||
"user_id"
|
||||
acts_as_attachable
|
||||
|
||||
end
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
|
||||
fileSpan.find('a.remove-upload')
|
||||
.attr({
|
||||
"data-remote": true,
|
||||
"data-method": 'delete',
|
||||
href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
|
||||
})
|
||||
.off('click');
|
||||
var fileSpan = $('#attachments_<%= j params[:attachment_id] %>');
|
||||
<% if @attachment.new_record? %>
|
||||
fileSpan.hide();
|
||||
alert("<%= escape_javascript @attachment.errors.full_messages.join(', ') %>");
|
||||
<% else %>
|
||||
$('<input>', { type: 'hidden', name: 'attachments[<%= j params[:attachment_id] %>][token]' } ).val('<%= j @attachment.token %>').appendTo(fileSpan);
|
||||
fileSpan.find('a.remove-upload')
|
||||
.attr({
|
||||
"data-remote": true,
|
||||
"data-method": 'delete',
|
||||
href: '<%= j attachment_path(@attachment, :attachment_id => params[:attachment_id], :format => 'js') %>'
|
||||
})
|
||||
.off('click');
|
||||
<% end %>
|
||||
|
|
|
@ -1,21 +1,33 @@
|
|||
<%= render_flash_messages %>
|
||||
<div id="put-bid-form" style="display: none">
|
||||
<%= form_for "bid_for_save", :remote=>true, :url => {:controller => 'bids', :action => 'add_homework'},
|
||||
:update => "bidding_project_list",
|
||||
:complete => '$("#put-bid-form").hide();' do |f| %>
|
||||
<%= form_for HomeworkAttach.new, :url => {:controller => 'bids', :action => 'add_homework'}, :update => "bidding_project_list", :complete => '$("#put-bid-form").hide();', :html => {:multipart => true, :id => 'add_homework_form'} do |f| %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @homework} %>
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= submit_tag l(:button_create),
|
||||
:onclick => "return true;"
|
||||
%>
|
||||
<% end %>
|
||||
<script type="text/javascript">
|
||||
function j_submit () {
|
||||
alert('start')
|
||||
var submit_homework = function(){
|
||||
$('#add_homework_form').clone().attr('action', '<%= url_for({:controller => "bids", :action => "add_homework"})+".js" %>').ajaxSubmit()
|
||||
};
|
||||
alert('stop')
|
||||
$.globalEval(submit_homework());
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
<% if User.current.logged? && (!Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, @bid.courses.first.id).first.roles&Role.where('id = ? or id = ? or id =?',5, 10, 7)).size >0) %>
|
||||
<div class='icon icon-add'>
|
||||
<%= toggle_link l(:label_commit_homework), 'put-bid-form' %>
|
||||
<%= link_to l(:label_commit_homework), new_submit_homework_path, :onclick => "$('#put-bid-form').slideToggle(); this.blur(); return false;" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<!-- fq -->
|
||||
<%= render_flash_messages %>
|
||||
<%= form_tag(:controller => 'bids', :action => "show_project", :method => :get) do %>
|
||||
<div class="project-search-block">
|
||||
<table width="100%" valign="center">
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
$('#bidding_project_list').html('<%= escape_javascript(render(:partial => 'homework_list', :locals => {:homework => @homework_list})) %>');
|
||||
$('#put-bid-form-partial').html(' <%= escape_javascript( render( :partial => 'attachments/form', :locals => {:container => @homework}) )%>')
|
||||
$('#put-bid-form-partial').html(' <%= escape_javascript( render( :partial => 'attachments/form') )%>')
|
||||
$('#flash_notice').remove()
|
||||
$("#project_id").val("请选择项目");
|
||||
$("#bid_message").val( "<%= l(:label_bid_reason) %>" );
|
||||
$("#put-bid-form").hide();
|
||||
$("#put-bid-form").hide();
|
||||
alert('<%= @homework_flag %>');
|
|
@ -0,0 +1,15 @@
|
|||
<h3><%= l :label_bidding_homework %></h3>
|
||||
<div id="put-bid-form">
|
||||
<%= form_for HomeworkAttach.new, :method => :post, :url => {:controller => 'bids', :action => 'add_homework'}, :update => "bidding_project_list", :complete => '$("#put-bid-form").hide();', :html => {:multipart => true} do |f| %>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to (t :button_back), project_for_bid_homework_path %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,58 +1,58 @@
|
|||
<div class="project-block">
|
||||
<div class="img-tag">
|
||||
<%= content_tag('div', tag('img', {:src => '../images/logo-only_med.png', :class => 'img_ta'}, false, false), :class => 'img-tag') %>
|
||||
</div>
|
||||
<div class="wiki-description">
|
||||
<p>
|
||||
<span>Claimed by </span><%= content_tag('a', project.name) %> | <span>Analyzed about 11 hours ago</span>
|
||||
</p>
|
||||
<p>
|
||||
<%= textilizable(project.short_description, :project => project) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="information">
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "9.23M") %><%= content_tag('span', "lines of codes") %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "963") %><%= content_tag('span', "current contributors") %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "1 day") %><%= content_tag('span', "since last commits") %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "12,169") %><%= content_tag('span', "users on trustie2") %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="reviews">
|
||||
<%= content_tag('a', tag('img', {:src => '../images/pai.png', :class => 'img-ta'}, false, false), :class => 'img-tag3') %>
|
||||
<%= content_tag('div', "Vert High Activity", :class => 'img-tag4') %>
|
||||
<%= content_tag('div', tag('img', {:src => '../images/stars_ro.png', :class => 'img-ta'}, false, false), :class => 'img-tag2') %>
|
||||
<%= content_tag('div', "#{WatchersOfProjects.watcher_count(project)}Reviews", :class => 'img-tag1') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add-info">
|
||||
<div class="main-language">
|
||||
<%= content_tag('a', 'Mostly written in C++') %>
|
||||
</div>
|
||||
<div class="licences">
|
||||
<%= content_tag('a', 'Licenses:') %><%= content_tag('span', 'GPL-2.0+, LGPL, MPL-1.1') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tags">
|
||||
<%= tag('img', {:src => "../images/user.png"}, false, false) %>
|
||||
<% tags = ProjectTags.find_tag(project.id)
|
||||
tags.each do |t_tag|
|
||||
content = t_tag.tag.content
|
||||
description = t_tag.description -%>
|
||||
<%= content_tag('a', content, :class => 'tag', :title => description) %>
|
||||
<% end -%>
|
||||
<%= content_tag('a', 'css', :class => 'tag') %>
|
||||
<%= content_tag('a', 'web_browser', :class => 'tag') %>
|
||||
<%= content_tag('a', 'development', :class => 'tag') %>
|
||||
<%= content_tag('a', 'client', :class => 'tag') %>
|
||||
<%= content_tag('a', 'web', :class => 'tag') %>
|
||||
<%= content_tag('a', 'xhtml', :class => 'tag') %>
|
||||
<%= content_tag('a', 'tabbed', :class => 'tag') %>
|
||||
<%= content_tag('a', 'and more') %>
|
||||
</div>
|
||||
<div class="project-block">
|
||||
<div class="img-tag">
|
||||
<%= content_tag('div', tag('img', {:src => '../images/logo-only_med.png', :class => 'img_ta'}, false, false), :class => 'img-tag') %>
|
||||
</div>
|
||||
<div class="wiki-description">
|
||||
<p>
|
||||
<span>Claimed by </span><%= content_tag('a', project.name) %> | <span>Analyzed about 11 hours ago</span>
|
||||
</p>
|
||||
<p>
|
||||
<%= textilizable(project.short_description, :project => project) %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="information">
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "9.23M") %><%= content_tag('span', "lines of codes") %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "963") %><%= content_tag('span', "current contributors") %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "1 day") %><%= content_tag('span', "since last commits") %>
|
||||
</p>
|
||||
<p class="stats">
|
||||
<%= content_tag('a', "12,169") %><%= content_tag('span', "users on trustie2") %>
|
||||
</p>
|
||||
</div>
|
||||
<div class="reviews">
|
||||
<%= content_tag('a', tag('img', {:class => 'img-ta'}, false, false), :class => 'img-tag3') %>
|
||||
<%= content_tag('div', "Vert High Activity", :class => 'img-tag4') %>
|
||||
<%= content_tag('div', tag('img', {:src => '../images/stars_ro.png', :class => 'img-ta'}, false, false), :class => 'img-tag2') %>
|
||||
<%= content_tag('div', "#{WatchersOfProjects.watcher_count(project)}Reviews", :class => 'img-tag1') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="add-info">
|
||||
<div class="main-language">
|
||||
<%= content_tag('a', 'Mostly written in C++') %>
|
||||
</div>
|
||||
<div class="licences">
|
||||
<%= content_tag('a', 'Licenses:') %><%= content_tag('span', 'GPL-2.0+, LGPL, MPL-1.1') %>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tags">
|
||||
<%= tag('img', {:src => "../images/user.png"}, false, false) %>
|
||||
<% tags = ProjectTags.find_tag(project.id)
|
||||
tags.each do |t_tag|
|
||||
content = t_tag.tag.content
|
||||
description = t_tag.description -%>
|
||||
<%= content_tag('a', content, :class => 'tag', :title => description) %>
|
||||
<% end -%>
|
||||
<%= content_tag('a', 'css', :class => 'tag') %>
|
||||
<%= content_tag('a', 'web_browser', :class => 'tag') %>
|
||||
<%= content_tag('a', 'development', :class => 'tag') %>
|
||||
<%= content_tag('a', 'client', :class => 'tag') %>
|
||||
<%= content_tag('a', 'web', :class => 'tag') %>
|
||||
<%= content_tag('a', 'xhtml', :class => 'tag') %>
|
||||
<%= content_tag('a', 'tabbed', :class => 'tag') %>
|
||||
<%= content_tag('a', 'and more') %>
|
||||
</div>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
:html => { :accesskey => Redmine::AccessKeys.key_for(:new_issue) }, :class => 'icon icon-add' %>
|
||||
|
||||
<%= link_to l(:label_query), '#', :class => 'icon icon-help',
|
||||
:onclick => '$("#custom_query").toggle(); ' if User.current.logged? %>
|
||||
:onclick => '$("#custom_query").slideToggle(); ' if User.current.logged? %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
<%= csrf_meta_tag %>
|
||||
<%= favicon %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'application', 'nyan', :media => 'all' %>
|
||||
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
|
||||
<%= javascript_heads %>
|
||||
<%= heads_for_theme %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<%= form_for(@mome_new, url: forum_memos_path) do |f| %>
|
||||
<%= form_for(@mome_new, url: forum_memos_path, :html => {:multipart => true}) do |f| %>
|
||||
<%= f.hidden_field :subject, :required => true, value: @memo.subject %>
|
||||
<%= f.hidden_field :forum_id, :required => true, value: @memo.forum_id %>
|
||||
<%= f.hidden_field :parent_id, :required => true, value: @memo.id %>
|
||||
|
@ -8,7 +8,7 @@
|
|||
|
||||
<script type="text/javascript">var ckeditor=CKEDITOR.replace('editor01');</script>
|
||||
<p><%= l(:label_attachment_plural) %><br />
|
||||
<%= render :partial => 'attachments/form', :locals => {:container => @mome_new} %>
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
<%= f.submit value: l(:label_reply_plural), class: "replies" %>
|
||||
<% end %>
|
|
@ -1331,6 +1331,7 @@ zh:
|
|||
label_bidding_succeed: 应标成功
|
||||
label_bidding_contest_succeed: 竞赛提交成功 #added by bai
|
||||
label_bidding_homework_succeed: 作业提交成功 #added by bai
|
||||
label_bidding_homework_failed: 作业提交失败 #added by bai
|
||||
label_bidding_fail: 应标失败,该项目已经应标
|
||||
label_bidding_homework_fail: 作业提交失败,该作业已经被提交!
|
||||
|
||||
|
|
|
@ -466,7 +466,8 @@ RedmineApp::Application.routes.draw do
|
|||
match 'calls/:id/show_project', :controller => 'bids', :action => 'show_project', :as => 'project_for_bid'
|
||||
match 'calls/:id/show_project_homework', :controller => 'bids', :action => 'show_project_homework', :as => 'project_for_bid_homework' # by huang
|
||||
match 'calls/:id/add', :controller => 'bids', :action => 'add'
|
||||
match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework'
|
||||
match 'calls/:id/add_homework', :controller => 'bids', :action => 'add_homework', via: :post
|
||||
match 'calls/:id/new_submit_homework', to: 'bids#new_submit_homework', via: :get, as: 'new_submit_homework'
|
||||
match 'words/add_project_respond', :controller => 'words', :action => 'add_project_respond'
|
||||
match 'words/:id/leave_project_message', :controller => 'words', :action => 'leave_project_message'
|
||||
|
||||
|
@ -499,7 +500,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'
|
||||
match 'projects/:id/respond', :to => 'projects#project_respond', :via => :post
|
||||
match 'calls/:id/manage',:to => 'bids#manage',:via => [:get,:post]
|
||||
match 'project/course', :to => 'projects#course', :as => 'course' #nyan
|
||||
match 'project/course', :to => 'projects#course', :as => 'course'
|
||||
|
||||
#added by william
|
||||
# match 'calls/:id/set_results',:controller => 'bids', :action => 'set_results',:via => [:get,:post],:as => 'set_results'
|
||||
|
|
|
@ -141,7 +141,7 @@ function uploadAndAttachFiles(files, inputEl) {
|
|||
|
||||
var sizeExceeded = false;
|
||||
$.each(files, function() {
|
||||
if (this.size && maxFileSize && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
|
||||
if (this.size && maxFileSize != null && this.size > parseInt(maxFileSize)) {sizeExceeded=true;}
|
||||
});
|
||||
if (sizeExceeded) {
|
||||
window.alert(maxFileSizeExceeded);
|
||||
|
|
|
@ -211,7 +211,7 @@ div.forums-line{
|
|||
}
|
||||
|
||||
div.forums-info{
|
||||
background-image: url(../images/sidebar/forums.png);
|
||||
/*background-image: url(../images/sidebar/forums.png); */
|
||||
border-bottom: solid 1px #15bccf;
|
||||
height: 100px;
|
||||
width: 214px;
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
@media only screen and (-webkit-min-device-pixel-ratio: 2),
|
||||
only screen and (min-device-pixel-ratio: 2) {
|
||||
#header > h1 {
|
||||
background-image:ol url(../images/logo-2x.png);
|
||||
/*background-image:ol url(../images/logo-2x.png);*/
|
||||
background-size: 43px 30px;
|
||||
}
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ a.root {
|
|||
|
||||
a.img-tag3{
|
||||
float: left;
|
||||
background-image: url("../images/pai.png");
|
||||
/*background-image: url("../images/pai.png");*/
|
||||
background-position: 0px 0px;
|
||||
background-repeat: no-repeat;
|
||||
position: absolute;
|
||||
|
@ -1891,7 +1891,7 @@ div.tableline{
|
|||
*
|
||||
* @2013-09-27
|
||||
/*added by bai*/
|
||||
input[type="submit"] {
|
||||
input[type="submit"], .button_submit {
|
||||
padding-bottom: 5px;
|
||||
width: auto;
|
||||
height: 25px;
|
||||
|
|
Loading…
Reference in New Issue