Merge branch 'develop' into szzh

This commit is contained in:
sw 2015-01-29 17:44:37 +08:00
commit 2978d9020f
19 changed files with 90 additions and 96 deletions

View File

@ -83,6 +83,12 @@ class PollController < ApplicationController
def destroy
if @poll && @poll.destroy
if @is_teacher
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id}")
else
polls = Poll.where("polls_type = 'Course' and polls_group_id = #{@course.id} and polls_status = 2")
end
@polls = paginateHelper polls,20 #分页
respond_to do |format|
format.js
end

View File

@ -1963,6 +1963,15 @@ module ApplicationHelper
end
def get_technical_title user
#user.user_extensions.technical_title
if user.user_extensions.technical_title == "Professor" || user.user_extensions.technical_title == "教授"
technical_title = l(:label_technicl_title_professor)
elsif user.user_extensions.technical_title == "Associate professor" || user.user_extensions.technical_title == "副教授"
technical_title = l(:label_technicl_title_associate_professor)
elsif user.user_extensions.technical_title == "Lecturer" || user.user_extensions.technical_title == "讲师"
technical_title = l(:label_technicl_title_lecturer)
elsif user.user_extensions.technical_title == "Teaching assistant" || user.user_extensions.technical_title == "助教"
technical_title = l(:label_technicl_title_teaching_assistant)
end
technical_title
end
end

View File

@ -31,6 +31,7 @@
text-align: center;
padding-left: 5px !important;
padding-right: 5px !important;
line-height: 1.9;
}
.span_wping a:hover{ background-color:#03a1b3;}
</style>

View File

@ -21,8 +21,6 @@
<%= call_hook :view_layouts_base_html_head %>
<!-- page specific tags -->
<%= yield :header_tags -%>
<% title1 = @user.user_extensions.technical_title %>
<% language1 = @user.language %>
<script type="text/javascript">
function startXMLHttp()
@ -39,59 +37,11 @@
{
setInterval("startXMLHttp()",5000);
}
function init_title() {
var title = "<%= "#{title1}" %>"
var language = "<%= "#{language1}" %>"
if(language == 'zh') {
switch (title) {
case 'Professor' :
title1 = '教授';
break;
case 'Associate professor' :
title1 = '副教授';
break;
case 'Lecturer' :
title1 = '讲师';
break;
case 'Teaching assistant' :
title1 = '助教';
break;
default :
title1 = title;
break;
}
}
else {
switch (title) {
case '教授' :
title1 = 'Professor';
break;
case '副教授' :
title1 = 'Associate professor';
break;
case '讲师' :
title1 = 'Lecturer';
break;
case '助教' :
title1 = 'Teaching assistant';
break;
default :
title1 = title;
break;
}
}
var obj = document.getElementById('td_tech_title');
if(!(obj == "undefined" || obj == null))
{
obj.innerHTML = title1;
}
}
</script>
</head>
<!--加上 onload="Javascript:t()" 开始定时刷新分数 -->
<body class="<%= h body_css_classes %>" onload="init_title()" >
<body class="<%= h body_css_classes %>">
<div id="wrapper">
<div id="wrapper2">
<div id="wrapper3">
@ -283,10 +233,14 @@
<tr>
<% if @user.user_extensions.identity == 0 %>
<td style=" float: right" width="70px" >
<span style="float: right"> <%= l(:label_technical_title) %></span>
<span style="float: right">
<%= l(:label_technical_title) %>
</span>
</td>
<td class="font_lighter_sidebar" style="padding-left: 0px" width="170px">
<span id = "td_tech_title"></span>
<span id = "td_tech_title">
<%= get_technical_title @user %>
</span>
</td>
<% end %>
</tr>

View File

@ -3,12 +3,25 @@
<%= @project ? l(:label_news_new) : l(:bale_news_notice) %>
</div>
<div class="box tabular">
<p><%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %></p>
<P><span id="title_notice_span">(60个字符以内)</span></P>
<p>
<%= f.text_field :title, :required => true, :size => 60, :style => "width:488px;", :onkeyup => "regexTitle();" %>
</p>
<P>
<span id="title_notice_span">(60个字符以内)</span>
</P>
<!-- <p style="margin-left:-10px;"><%#= f.text_area :summary, :cols => 60, :rows => 2, :style => "width:490px;margin-left:10px;" %></p> -->
<p><%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %></p>
<P><span id="description_notice_span"></span></P>
<p id="attachments_form" style="margin-left:-10px;"><label style="padding-right: 15px;"><%= l(:label_attachment_plural) %></label><%= render :partial => 'attachments/form', :locals => {:container => @news} %></p>
<p>
<%= f.text_area :description, :required => true, :cols => 60, :rows => 11, :class => 'wiki-edit', :style => "width:490px;", :onkeyup => "regexDescription();" %>
</p>
<P>
<span id="description_notice_span"></span>
</P>
<p id="attachments_form" style="margin-left:-10px;">
<label style="padding-right: 15px;">
<%= l(:label_attachment_plural) %>
</label>
<%= render :partial => 'attachments/form', :locals => {:container => @news} %>
</p>
</div>
<%= wikitoolbar_for 'news_description' %>

View File

@ -83,7 +83,7 @@
<%= render :partial => 'news/form', :locals => {:f => f} %>
<%#= submit_tag l(:button_create), :class => 'whiteButton m3p10 h30', :name => nil %><!-- button-submit -->
<%= link_to l(:button_create), "#", :onclick => 'submitNews();',:onmouseover => 'submitFocus(this);', :class => 'ButtonColor m3p10' %>
|
<%#= preview_link preview_news_path(:project_id => @project), 'news-form', target='preview', {:class => 'whiteButton m3p10'} %>
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()', :class => 'ButtonColor m3p10' %>

View File

@ -39,7 +39,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -36,7 +36,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -20,7 +20,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -16,7 +16,7 @@
<label for="ur_question_require">必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn_submit" data-button="ok" onclick="edit_poll_question($(this),<%= poll_question.id %>);">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="resetQuestion<%=poll_question.id%>();pollQuestionCancel(<%= poll_question.id%>);">

View File

@ -34,7 +34,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -33,7 +33,7 @@
</ul>
</div>
<div class="ur_editor_footer">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn btn_dark btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -13,7 +13,7 @@
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -8,7 +8,7 @@
<label for="ur_question_require">必答</label>
</div>
<div class="ur_editor_footer">
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">
<a class="btn_submit" data-button="ok" onclick="add_poll_question($(this));">
<%= l(:label_button_ok)%>
</a>
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">

View File

@ -23,6 +23,20 @@
$("#new_poll_question").html("<%= escape_javascript(render :partial => 'new_mulit') %>");
$("#poll_questions_title").focus();
}
//添加标题时确定按钮
function add_poll_question(obj)
{
var title = $.trim($("#poll_questions_title").val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//修改标题时确定按钮
function edit_poll_question(obj,id)
{
var title = $.trim($("#poll_questions_title_" + id).val());
if(title.length == 0){alert("标题不能为空");}else{doc.parent().parent().parent().submit();}
}
//问卷头
function pollsCancel(){$("#polls_head_edit").hide();$("#polls_head_show").show();}
function pollsSubmit(doc){

View File

@ -0,0 +1,22 @@
<div class="polls_head">
<h2>所有问卷
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to l(:label_new_poll), new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => "newbtn" %>
<% end%>
</div>
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div><!--列表end-->

View File

@ -1,4 +1 @@
<% if @poll%>
$("#polls_<%= @poll.id%>").remove();
<%else%>
<% end %>
$("#polls").html("<%= escape_javascript(render :partial => 'poll_list') %>");

View File

@ -82,27 +82,5 @@
}
</script>
<div class="polls_content" id="polls" style="width:677px;">
<div class="polls_head">
<h2>所有问卷
<span><%= @obj_count%></span>
</h2>
<% if @is_teacher%>
<%= link_to l(:label_new_poll), new_poll_path(:polls_type => "Course",:polls_group_id => @course.id), :class => "newbtn" %>
<% end%>
</div>
<div class="cl"></div>
<div class="polls_list">
<% @polls.each do |poll|%>
<ul id="polls_<%= poll.id %>">
<%= render :partial => 'poll', :locals => {:poll => poll} %>
</ul>
<div class="cl"></div>
<% end%>
<ul class="wlist">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
</ul>
<div class="cl"></div>
</div><!--列表end-->
<%= render :partial => 'poll_list'%>
</div><!--问卷内容end-->

View File

@ -1,5 +1,5 @@
/* CSS Document */
body{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;}
#content{ font-size:12px !important; font-family:"微软雅黑","宋体" !important; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,textarea{ margin:0; padding:0;}
div,img,tr,td,textarea{ border:0;}
table,tr,td{border:0; cellspacing:0; cellpadding:0;}