增加tab页切换的js

This commit is contained in:
sw 2014-06-10 14:27:55 +08:00
parent 787e043650
commit 67c9fefba6
3 changed files with 38 additions and 26 deletions

View File

@ -9,12 +9,10 @@ module HomeworkAttachHelper
end
#作业添加、编辑界面的tab页
def homework_settings_tabs f
@project = Project.find 76
@f = f
tabs = [{:name => 'info', :action => :edit_homework, :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
{:name => 'members', :action => :homework_member, :partial => 'homework_attach/homework_member', :label => :label_member_plural}
tabs = [{:name => 'info', :partial => 'homework_attach/edit_homework', :label => :label_information_plural},
{:name => 'members', :partial => 'homework_attach/homework_member', :label => :label_member_plural}
]
#tabs.select {|tab| User.current.allowed_to?(tab[:action], @homework)}
end
#作业可选成员列表分页

View File

@ -2,12 +2,12 @@
<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;" %>
<%= 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;" %>
<%= 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">

View File

@ -1,3 +1,13 @@
<script type="text/javascript">
function switchTab(ProTag) {
var display_index = 3 - ProTag;
document.getElementById("tab" + ProTag).className = "selected";
document.getElementById("tab" + display_index).className = "";
document.getElementById("content" + ProTag).style.display = "";
document.getElementById("content" + display_index).style.display = "none";
}
</script>
<p style="font-weight: bold; color: rgb(237,137,36)" xmlns="http://www.w3.org/1999/html"> <%=h l(:label_new_homework)%> </p>
<div class="box">
<%= form_for('new_form', :method => :post,
@ -6,26 +16,30 @@
:user_id => User.current.id,
:bid_id => @bid
}) 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;">
<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>
<div class="tabs">
<ul>
<li>
<a id = "tab1" href="#" class = "selected" onclick="switchTab(1);this.blur();return false;">
<%= l(:label_information_plural) %>
</a>
</li>
<li>
<a id="tab2" href="#" onclick="switchTab(2); this.blur(); return false;">
<%= l(:label_member_plural) %>
</a>
</li>
</ul>
</div>
<div id="content1">
<%= render :partial => "new_homework",:locals => {:f => f} %>
</div>
<div id="content2">
<%= render :partial => "homework_member" %>
</div>
<p style="padding-left: 60px;padding-top: 10px;">
<span >
<%= submit_tag t(:label_button_ok), :sta => 0, :class => "enterprise"%>