parent
86cb496f3f
commit
96504d6806
@ -0,0 +1,10 @@
|
||||
module HomeworkAttachHelper
|
||||
def attach_delete(project)
|
||||
if User.current.logged? && (User.current.admin? || (!Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.nil? && (Member.where('user_id = ? and project_id = ?', User.current.id, project.bid.courses.first.id).first.roles&Role.where('id = ? or id = ?', 3, 7)).size >0) || project.user_id == User.current.id)
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -0,0 +1,36 @@
|
||||
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=raw l(:label_new_homework)%> </p>
|
||||
<div class="box">
|
||||
<%= @homework.attachments.count %>
|
||||
<%= form_for(@homework) do |f|%>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong>标 题:</strong>
|
||||
<%= f.text_field :name, :required => true, :size => 60, :style => "width:490px;"%>
|
||||
</p>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong style="vertical-align: top">描 述:</strong>
|
||||
<span style="margin-left:-10px;padding-right: 20px;">
|
||||
<%= f.text_area :description, :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</span>
|
||||
</p>
|
||||
<p style="padding-left: 60px">
|
||||
<fieldset style="text-align: left;">
|
||||
<p style="padding-left: 60px">
|
||||
<% options = {:author => true, :deletable => attach_delete(@homework)} %>
|
||||
<%= render :partial => 'attachments/links',
|
||||
:locals => {:attachments => @homework.attachments, :options => options} %>
|
||||
</p>
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
</p>
|
||||
<p style="padding-left: 60px;padding-top: 10px;">
|
||||
<span >
|
||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||
</span>
|
||||
</p>
|
||||
<% end %>
|
||||
</div>
|
@ -1,32 +1,34 @@
|
||||
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=raw l(:label_new_homework)%> </p>
|
||||
<div class="box tabular">
|
||||
<div class="box">
|
||||
<%= form_for('new_form', :remote => true, :method => :post,
|
||||
:url => {:controller => 'homework_attach',
|
||||
:action => 'create',
|
||||
:user_id => User.current.id,
|
||||
:bid_id => @bid
|
||||
}) do |f|%>
|
||||
<p>
|
||||
<strong>标题:</strong>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong>标 题:</strong>
|
||||
<%= f.text_field "name", :required => true, :size => 60, :style => "width:490px;" %>
|
||||
</p>
|
||||
<p>
|
||||
<strong style="vertical-align: top">描述:</strong>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<strong style="vertical-align: top">描 述:</strong>
|
||||
<span style="margin-left:-10px;padding-right: 20px;">
|
||||
<%= f.text_area "description", :rows => 8, :class => 'wiki-edit', :style => "font-size:small;width:490px;margin-left:10px;" %>
|
||||
</span>
|
||||
</p>
|
||||
<fieldset>
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p id="put-bid-form-partial">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<span style="padding-left: 60px">
|
||||
<%= submit_tag t(:label_new), :sta => 0, :class => "enterprise"%>
|
||||
<%= submit_tag t(:label_memo_create), :sta => 1, :class => "enterprise"%>
|
||||
<p style="padding-left: 60px">
|
||||
<fieldset style="text-align: left;">
|
||||
<legend>
|
||||
<%= l(:label_attachment_plural) %>
|
||||
</legend>
|
||||
<p style=" padding: 3px 0 3px 0;padding-left: 50px; clear:left;">
|
||||
<%= render :partial => 'attachments/form' %>
|
||||
</p>
|
||||
</fieldset>
|
||||
</p>
|
||||
<p style="padding-left: 60px;padding-top: 10px;">
|
||||
<span >
|
||||
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>
|
||||
</span>
|
||||
</p>
|
||||
<% end %>
|
||||
|
Loading…
Reference in new issue