提交后也可以修改问卷
This commit is contained in:
parent
b9311bef94
commit
cba4929179
|
@ -39,17 +39,17 @@ class PollController < ApplicationController
|
|||
end
|
||||
end
|
||||
#已提交问卷的用户不能再访问该界面
|
||||
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
|
||||
else
|
||||
@can_edit_poll = @poll.user != User.current && ((!has_commit_poll?(@poll.id,User.current.id)) || User.current.admin?)
|
||||
# if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
# redirect_to poll_index_url(:polls_type => "Course", :polls_group_id => @course.id)
|
||||
# else
|
||||
@can_edit_poll = @poll.user != User.current
|
||||
@percent = get_percent(@poll,User.current)
|
||||
@poll_questions = @poll.poll_questions
|
||||
@left_nav_type = 7
|
||||
respond_to do |format|
|
||||
format.html {render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
#end
|
||||
end
|
||||
|
||||
def new
|
||||
|
@ -298,11 +298,11 @@ class PollController < ApplicationController
|
|||
#提交答案
|
||||
def commit_answer
|
||||
pq = PollQuestion.find(params[:poll_question_id])
|
||||
if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
@percent = get_percent(@poll,User.current)
|
||||
render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
|
||||
return
|
||||
end
|
||||
# if has_commit_poll?(@poll.id,User.current.id) && (!User.current.admin?)
|
||||
# @percent = get_percent(@poll,User.current)
|
||||
# render :json => {:text => "ok" ,:percent => format("%.2f" ,@percent)}
|
||||
# return
|
||||
# end
|
||||
if pq.question_type == 1
|
||||
#单选题
|
||||
pv = PollVote.find_by_poll_question_id_and_user_id(params[:poll_question_id],User.current.id)
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
<div>
|
||||
<div title="<%= poll_name %>">
|
||||
<div style="width: 600px;float: left;">
|
||||
<% if has_commit %>
|
||||
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
|
||||
<% else %>
|
||||
<%# if has_commit %>
|
||||
<%#= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
|
||||
<%# else %>
|
||||
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :class => "polls_title polls_title_w fl c_dblue mw550", :title => "#{poll_name}" %>
|
||||
<% end %>
|
||||
<%# end %>
|
||||
<% if poll.polls_status == 1 %>
|
||||
<span class="exercise_status_nop fl mt3"></span>
|
||||
<% elsif poll.polls_status == 2 %>
|
||||
|
@ -67,13 +67,13 @@
|
|||
<% else%>
|
||||
<% if poll.polls_status == 2%>
|
||||
<div>
|
||||
<% if has_commit%>
|
||||
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
|
||||
<span class="exercise_status_com fl ml5"></span>
|
||||
<%else%>
|
||||
<%# if has_commit%>
|
||||
<%#= link_to (index.to_i+1).to_s+". "+poll_name, poll_result_poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
|
||||
<!--<span class="exercise_status_com fl ml5"></span>-->
|
||||
<%#else%>
|
||||
<%= link_to (index.to_i+1).to_s+". "+poll_name, poll_path(poll.id), :title => "#{poll_name}", :class => "polls_title polls_title_st fl c_dblue mw550"%>
|
||||
<span class="exercise_status_nocom fl ml5"></span>
|
||||
<%end%>
|
||||
<span class="<%= has_commit ? 'exercise_status_com' : 'exercise_status_nocom' %> fl ml5"></span>
|
||||
<%#end%>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="mt10">
|
||||
|
|
|
@ -241,7 +241,7 @@
|
|||
}
|
||||
}
|
||||
</script>
|
||||
<textarea class="fillInput" placeholder="在此填入答案" type="text" style="height:54px" value="<%= get_anwser_vote_text(pq.id, User.current.id).html_safe %>" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>></textarea>
|
||||
<textarea class="fillInput" placeholder="在此填入答案" type="text" style="height:54px" onblur="onblur_<%= pq.id %>(this);" <%= @can_edit_poll ? "" : "disabled=disabled" %>><%= get_anwser_vote_text(pq.id, User.current.id).html_safe %></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue