parent
b27b3e0a5a
commit
f79679f05a
|
@ -16,12 +16,32 @@ class HomeworkAttachController < ApplicationController
|
||||||
percent_m.to_s + "%"
|
percent_m.to_s + "%"
|
||||||
end
|
end
|
||||||
@jours = @homework.journals_for_messages.order("created_on DESC")
|
@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||||
|
@limit = 10
|
||||||
|
@feedback_count = @jours.count
|
||||||
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
|
@offset ||= @feedback_pages.offset
|
||||||
|
@jour = @jours[@offset, @limit]
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroyjours
|
def destroy
|
||||||
@homework = HomeworkAttach.find(params[:homework_id])
|
@journal_destroyed = JournalsForMessage.delete_message(params[:object_id])
|
||||||
JournalsForMessage.delete_message(params[:object_id])
|
respond_to do |format|
|
||||||
redirect_to homework_attach_path(@homework)
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def addjours
|
||||||
|
@homework = HomeworkAttach.find(params[:jour_id])
|
||||||
|
@homework.addjours User.current.id, params[:new_form][:user_message],0
|
||||||
|
@jours = @homework.journals_for_messages.order("created_on DESC")
|
||||||
|
@limit = 10
|
||||||
|
@feedback_count = @jours.count
|
||||||
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
|
@offset ||= @feedback_pages.offset
|
||||||
|
@jour = @jours[@offset, @limit]
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -9,4 +9,9 @@ class HomeworkAttach < ActiveRecord::Base
|
||||||
"user_id"
|
"user_id"
|
||||||
acts_as_attachable
|
acts_as_attachable
|
||||||
|
|
||||||
|
def addjours user_id,message,status = 0
|
||||||
|
jfm = self.journals_for_messages.build(:user_id => user_id,:notes =>message,:status => status)
|
||||||
|
jfm.save
|
||||||
|
jfm
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
<!-- fq -->
|
||||||
|
<style>
|
||||||
|
input[type="submit"].bid_btn {
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 60px;/*modified by ming*/
|
||||||
|
height: 25px;
|
||||||
|
line-height: 19px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: rgb(0, 0, 0);
|
||||||
|
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||||
|
padding: 0px 0px 4px 0px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid rgb(148, 148, 148);
|
||||||
|
box-shadow: none;
|
||||||
|
text-shadow: none;
|
||||||
|
margin-top: -10px;
|
||||||
|
/*margin-right: -4px;*/
|
||||||
|
}
|
||||||
|
input[type="button"].bid_btn {
|
||||||
|
width: 60px;/*modified by ming*/
|
||||||
|
height: 25px;
|
||||||
|
line-height: 19px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: rgb(0, 0, 0);
|
||||||
|
background: buttonface;/*url("/images/button/bg103.jpg") no-repeat scroll left top transparent;*/
|
||||||
|
padding: 0px 0px 4px 0px;
|
||||||
|
border-radius: 2px;
|
||||||
|
border: 1px solid rgb(148, 148, 148);
|
||||||
|
box-shadow: none;
|
||||||
|
text-shadow: none;
|
||||||
|
margin-top: -10px;
|
||||||
|
margin-right: -2px;
|
||||||
|
}
|
||||||
|
textarea:focus {
|
||||||
|
border: #d5dee9 1px solid;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script type="text/javascript" language="javascript">
|
||||||
|
function clearInfo(id, content) {
|
||||||
|
var text = $('#' + id);
|
||||||
|
if (text.val() == content) {
|
||||||
|
$('#' + id).val('');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showInfo(id, content) {
|
||||||
|
var text = $('#' + id);
|
||||||
|
if (text.val() == '') {
|
||||||
|
$('#' + id).val(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<%= form_for('new_form', :remote => true, :method => :post,
|
||||||
|
:url => {:controller => 'homework_attach',
|
||||||
|
:action => 'addjours',
|
||||||
|
:jour_id => homework_attach.id,
|
||||||
|
:sta => sta}) do |f|%>
|
||||||
|
|
||||||
|
<div id = 'pre_show'>
|
||||||
|
<%= render :partial => 'words/pre_show', :locals => {:content => @content} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% if User.current.logged? %>
|
||||||
|
<table border="0" width="525px" align="center" >
|
||||||
|
<tr>
|
||||||
|
<td><%= f.text_area 'user_message', :rows => 3, :cols => 65, :value => "#{l(:label_leave_a_message)}",
|
||||||
|
:onfocus => "clearInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
|
||||||
|
:onblur => "showInfo('new_form_user_message','#{l(:label_leave_a_message)}')",
|
||||||
|
:style => "resize: none;", :class => 'noline'%></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<%= f.text_field :reference_user_id, :style=>"display:none"%>
|
||||||
|
<table border="0" width="525px" align="center">
|
||||||
|
<tr>
|
||||||
|
<td align="right"> <%= submit_tag l(:button_leave_meassge),
|
||||||
|
:name => nil , :class => "enterprise",
|
||||||
|
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||||
|
:onmouseover => "this.style.backgroundPosition = 'left -31px'"%>
|
||||||
|
<%= submit_tag l(:button_clear), :name => nil, :class => "enterprise",
|
||||||
|
:onclick => "clearMessage('new_form_user_message');",
|
||||||
|
:onmouseout => "this.style.backgroundPosition = 'left top'",
|
||||||
|
:onmouseover => "this.style.backgroundPosition = 'left -31px'" %> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<% else %>
|
||||||
|
<div style="font-size: 14px;margin:10px;text-align: center">
|
||||||
|
<%= l(:label_user_login_tips) %>
|
||||||
|
<%= link_to l(:label_user_login_new), signin_path %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<!-- fq -->
|
||||||
|
<% unless content.nil?%>
|
||||||
|
<table width="60%" style="margin-left: 60px;">
|
||||||
|
<tr>
|
||||||
|
<td> <%= textilizable content %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= hidden_field_tag 'reference_content', params[:reference_content], :value => content%></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,64 @@
|
||||||
|
<script>
|
||||||
|
var W3CDOM = document.createElement && document.getElementsByTagName;
|
||||||
|
|
||||||
|
window.onload = setMaxLength;
|
||||||
|
|
||||||
|
function setMaxLength() {
|
||||||
|
if (!W3CDOM) return;
|
||||||
|
var textareas = document.getElementsByTagName('textarea');
|
||||||
|
for (var i=0;i<textareas.length;i++) {
|
||||||
|
var textarea = textareas[i];
|
||||||
|
setMaxLengthItem(textareas[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function setMaxLengthItem(textarea){
|
||||||
|
if (textarea.getAttribute('maxlength')) {
|
||||||
|
var counter = document.createElement('div');
|
||||||
|
counter.className = 'counter';
|
||||||
|
var counterClone = counter.cloneNode(true);
|
||||||
|
counterClone.innerHTML = '<span>0</span>/'+textarea.getAttribute('maxlength');
|
||||||
|
textarea.parentNode.insertBefore(counterClone,textarea.nextSibling);
|
||||||
|
textarea.relatedElement = counterClone.getElementsByTagName('span')[0];
|
||||||
|
textarea.onkeyup = textarea.onchange = checkMaxLength;
|
||||||
|
textarea.onkeyup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function checkMaxLength() {
|
||||||
|
var maxLength = this.getAttribute('maxlength');
|
||||||
|
var currentLength = this.value.length;
|
||||||
|
if (currentLength > maxLength)
|
||||||
|
this.relatedElement.className = 'toomuch';
|
||||||
|
else
|
||||||
|
this.relatedElement.className = '';
|
||||||
|
this.relatedElement.firstChild.nodeValue = currentLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<% if jour.size > 0 %>
|
||||||
|
<ul class="message-for-user">
|
||||||
|
<% for journal in jour%>
|
||||||
|
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
||||||
|
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
||||||
|
<span class="body">
|
||||||
|
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
||||||
|
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
|
||||||
|
<div> <%= textilizable journal.notes%> </div>
|
||||||
|
<span class="font_lighter"><%= l(:label_bids_published) %>
|
||||||
|
<%= time_tag(journal.created_on).html_safe %>
|
||||||
|
<%= l(:label_bids_published_ago) %>
|
||||||
|
</span>
|
||||||
|
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||||
|
<span>
|
||||||
|
|
||||||
|
<% if journal.user==User.current|| User.current.admin? %>
|
||||||
|
<%= link_to(l(:label_bid_respond_delete), {:controller => 'homework_attach', :action => 'destroy', :object_id => journal, :user_id => journal.user},
|
||||||
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
||||||
|
<% end %>
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
|
@ -0,0 +1,4 @@
|
||||||
|
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour =>@jour, :state => false} )) %>');
|
||||||
|
$('#pre_show').html('<%= escape_javascript(render(:partial => 'pre_show', :locals => {:content => nil})) %>');
|
||||||
|
$('#new_form_user_message').val("");
|
||||||
|
$('#new_form_reference_user_id').val("");
|
|
@ -0,0 +1,11 @@
|
||||||
|
<% if @journal_destroyed.nil? %>
|
||||||
|
alert('<%=l(:notice_failed_delete)%>');
|
||||||
|
<% elsif (['Principal','Project', 'Bid', 'Contest', 'Softapplication','HomeworkAttach'].include? @journal_destroyed.jour_type)%>
|
||||||
|
var destroyedItem = $('#word_li_<%=@journal_destroyed.id%>')
|
||||||
|
destroyedItem.fadeOut(600,function(){
|
||||||
|
destroyedItem.remove();
|
||||||
|
});
|
||||||
|
<% else %>
|
||||||
|
$('#message').html('<%= escape_javascript(render(:partial => 'showjour', :locals => {:jour => @jour, :state => false})) %>');
|
||||||
|
$('#new_form_reference_user_id').val("");
|
||||||
|
<% end %>
|
|
@ -1,4 +1,4 @@
|
||||||
<%= render_flash_messages %>
|
|
||||||
<style>
|
<style>
|
||||||
.softapplication-img .soft-application {
|
.softapplication-img .soft-application {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
<div style="height: 50px">
|
<div style="height: 50px">
|
||||||
<div style="font-size: 15px"><strong>作业评论:</strong></div>
|
<div style="font-size: 15px"><strong>作业评论:</strong></div>
|
||||||
<div style="padding-left: 210px">评分:
|
<div style="text-align: center;">评分:
|
||||||
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
<%= rating_for @homework, dimension: :quality, class: 'rateable div_inline' %>
|
||||||
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
<span style="font-size: 11px">(您可以重新打分,打分结果以最后一次打分为主!)</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -113,36 +113,13 @@
|
||||||
|
|
||||||
<!--提示登录后对应用进行评价-->
|
<!--提示登录后对应用进行评价-->
|
||||||
<div id='leave-message'>
|
<div id='leave-message'>
|
||||||
<% if User.current.logged? %>
|
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0} %>
|
||||||
<% else %>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- 留言列表区 -->
|
<!-- 留言列表区 -->
|
||||||
<ul class="message-for-user">
|
<div id="message" style="font-size: 14px;">
|
||||||
<% for journal in @jours%>
|
<%= render :partial => 'showjour', :locals => {:jour => @jours} %>
|
||||||
<li id='word_li_<%= journal.id.to_s %>' class="outer-message-for-user">
|
</div>
|
||||||
<span class="portrait"><%= image_tag(url_to_avatar(journal.user), :class => "avatar") %></span>
|
|
||||||
<span class="body">
|
|
||||||
<span class="user"><%= link_to journal.user, user_path(journal.user)%></span>
|
|
||||||
<span class="font_lighter"><% label = l(:label_contest_requirement) %></span>
|
|
||||||
<div> <%= textilizable journal.notes%> </div>
|
|
||||||
<span class="font_lighter"><%= l(:label_bids_published) %>
|
|
||||||
<%= time_tag(journal.created_on).html_safe %>
|
|
||||||
<%= l(:label_bids_published_ago) %>
|
|
||||||
</span>
|
|
||||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
|
||||||
<span>
|
|
||||||
<% if journal.user==User.current|| User.current.admin? %>
|
|
||||||
<%= link_to(l(:label_bid_respond_delete), {:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => journal.user},
|
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "delete", :title => l(:button_delete)) %>
|
|
||||||
<% end %>
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
<div style="clear: both;"></div>
|
|
||||||
</li>
|
|
||||||
<% end %>
|
|
||||||
</ul>
|
|
||||||
<div>
|
<div>
|
||||||
<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %>
|
<%#= link_to '返回竞赛页面', show_softapplication_contest_path(@softapplication.contest) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,6 +23,7 @@ RedmineApp::Application.routes.draw do
|
||||||
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
delete 'apply_project_masters', :to => 'apply_project_masters#delete'
|
||||||
|
|
||||||
resources :homework_attach
|
resources :homework_attach
|
||||||
|
match 'homework_attach/addjours', :controller => 'homework_attach', :action => 'addjours', :via => [:get,:post]
|
||||||
resources :open_source_projects do
|
resources :open_source_projects do
|
||||||
collection do
|
collection do
|
||||||
match 'search', via: [:get, :post]
|
match 'search', via: [:get, :post]
|
||||||
|
|
Loading…
Reference in New Issue