Merge branch 'Poll' of http://repository.trustie.net/xianbo/trustie2 into Poll
This commit is contained in:
commit
e49dfefefb
|
@ -85,10 +85,22 @@ class PollController < ApplicationController
|
|||
end
|
||||
|
||||
def statistics_result
|
||||
@poll = Poll.find(params[:id])
|
||||
poll_questions = @poll.poll_questions
|
||||
@poll_questions = paginateHelper poll_questions, 5
|
||||
respond_to do |format|
|
||||
format.html{render :layout => 'base_courses'}
|
||||
end
|
||||
end
|
||||
|
||||
def get_poll_totalcount poll_question
|
||||
@total_questions_count = poll_question.poll_votes.count
|
||||
end
|
||||
|
||||
def get_poll_everycount poll_answer
|
||||
@every_answer_count = poll_answer.poll_votes.count
|
||||
end
|
||||
|
||||
|
||||
#添加单选题
|
||||
def create_poll_question
|
||||
|
@ -120,8 +132,7 @@ class PollController < ApplicationController
|
|||
#修改单选题
|
||||
def update_poll_question
|
||||
@poll_question = PollQuestion.find params[:poll_question]
|
||||
@poll = @poll_question.poll
|
||||
|
||||
#@poll = @poll_question.poll
|
||||
@poll_question.is_necessary = params[:is_necessary]=="true" ? 1 : 0
|
||||
@poll_question.question_title = params[:poll_questions_title].nil? || params[:poll_questions_title].empty? ? l(:label_enter_single_title) : params[:poll_questions_title]
|
||||
################处理选项
|
||||
|
|
|
@ -116,8 +116,8 @@ class ProjectsController < ApplicationController
|
|||
joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id").joins("LEFT JOIN #{ProjectScore.table_name} ON #{Project.table_name}.id = #{ProjectScore.table_name}.project_id").
|
||||
where("#{Project.table_name}.project_type = ? ", Project::ProjectType_project)
|
||||
|
||||
@project_count = @projects_all.count
|
||||
@project_pages = Paginator.new @project_count, per_page_option, params['page']
|
||||
@poll_questions_count = @projects_all.count
|
||||
@poll_questions_pages = Paginator.new @project_count, per_page_option, params['page']
|
||||
|
||||
#gcm activity count
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ module PollHelper
|
|||
false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
#获取文本题答案
|
||||
def get_anwser_vote_text(question_id,user_id)
|
||||
pv = PollVote.find_by_poll_question_id_and_user_id(question_id,user_id)
|
||||
|
@ -47,4 +47,20 @@ module PollHelper
|
|||
true
|
||||
end
|
||||
end
|
||||
|
||||
#统计答题百分比
|
||||
def statistics_result_percentage(e, t)
|
||||
return e*100/t
|
||||
end
|
||||
|
||||
def options_show p
|
||||
case p
|
||||
when 1
|
||||
"单选题"
|
||||
when 2
|
||||
"多选题"
|
||||
else
|
||||
"问答题"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
<div class="ur_table_result">
|
||||
<table border="0" cellspacing="0" cellpadding="0" >
|
||||
<tbody>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327"><%= l(:label_poll_options) %> </td>
|
||||
<td class="td42"><%= l(:label_poll_subtotal) %> </td>
|
||||
<td class="td287"><%= l(:label_poll_proportion) %> </td>
|
||||
</tr>
|
||||
<% poll_question.poll_answers.each do |poll_answer| %>
|
||||
<tr>
|
||||
<td class="td327"><%= poll_answer.answer_text %> </td>
|
||||
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
|
||||
<td class="td287">
|
||||
<div class="Bar">
|
||||
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, @poll.users.count) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
|
||||
</div>
|
||||
<%= statistics_result_percentage(poll_answer.poll_votes.count, @poll.users.count) %>%</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
|
||||
<td class="td42"><%= poll_question.poll_votes.count %></td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
@ -1,33 +1,28 @@
|
|||
<div><!--编辑多选start-->
|
||||
<%= form_for("",:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%><!--编辑多选start-->
|
||||
<div class="ur_editor checkbox">
|
||||
<div class="ur_editor_title">
|
||||
<label >问题: </label>
|
||||
<input class="ur_question_title" type="text" name="title" placeholder="请输入多选题题标题"/>
|
||||
<input type="checkbox" name="required" value="true" checked=""/>
|
||||
<label >必答</label>
|
||||
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
||||
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入单选题标题" value="<%= poll_question.question_title%>"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
||||
<label>必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>选项 <span class="ur_index">01</span>: </label>
|
||||
<input type="text" name="option" placeholder="新建选项"/>
|
||||
<a class="icon_add" title="向下插入选项"></a>
|
||||
<a class="icon_remove" title="删除"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label >选项 <span class="ur_index">01</span>: </label>
|
||||
<input type="text" name="option" placeholder="新建选项"/>
|
||||
<a class="icon_add" title="向下插入选项"></a>
|
||||
<a class="icon_remove" title="删除"></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
|
||||
<li class='ur_item'>
|
||||
<label>选项<span class='ur_index'></span>:</label>
|
||||
<input type='text' name='question_answer[<%= poll_answer.id %>]' placeholder='新建选项' value="<%= poll_answer.answer_text%>"/>
|
||||
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
|
||||
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
<% end%>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel">取消</a>
|
||||
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="pollQuestionCancel(<%= poll_question.id%>);">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div><!--编辑多选 end-->
|
||||
</div><!--编辑多选 end-->
|
||||
<% end%>
|
|
@ -1,18 +1,21 @@
|
|||
<%= form_for("",:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%>
|
||||
<div class="ur_editor textarea"> <!--编辑多行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input id="ur_question_title" class="ur_question_title" contenteditable="true" type="text" name="title" placeholder="请输入多行文字标题"/>
|
||||
<input type="checkbox" name="required" value="true" id="ur_question_require" checked=""/>
|
||||
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
||||
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title_<%=poll_question.id%>" placeholder="请输入多行文字标题" value="<%= poll_question.question_title%>"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_toolbar">
|
||||
<label>尺寸:</label>
|
||||
<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,
|
||||
<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>
|
||||
<!--<label>尺寸:</label>-->
|
||||
<!--<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,-->
|
||||
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel">取消</a>
|
||||
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑多行文字end-->
|
||||
</div><!--编辑多行文字end-->
|
||||
<% end%>
|
|
@ -1,13 +1,17 @@
|
|||
<%= form_for("",:url => update_poll_question_poll_index_path(:poll_question => poll_question.id),:remote => true) do |f|%>
|
||||
<div class="ur_editor text "> <!--编辑单行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input id="ur_question_title_1" class="ur_question_title" contenteditable="true" type="text" name="title" placeholder="请输入单行文字标题"/>
|
||||
<input type="checkbox" name="required" value="true" id="ur_question_require_2" checked=""/>
|
||||
<input type="hidden" name="question_type" value="<%= poll_question.question_type%>"/>
|
||||
<input id="poll_questions_title_<%=poll_question.id%>" class="ur_question_title" contenteditable="true" type="text"
|
||||
name="poll_questions_title" placeholder="请输入单行文字标题" value="<%= poll_question.question_title%>"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" <%= poll_question.is_necessary == 1 ? "checked" : ""%>/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel">取消</a>
|
||||
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="pollQuestionCancel(<%= poll_question.id%>);">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑单行文字end-->
|
||||
</div><!--编辑单行文字end-->
|
||||
<% end%>
|
|
@ -1,6 +1,5 @@
|
|||
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
|
||||
<div>
|
||||
<!--编辑单选start-->
|
||||
<!--新建单选start-->
|
||||
<div class="ur_editor radio">
|
||||
<div class="ur_editor_title">
|
||||
<label>问题: </label>
|
||||
|
@ -35,11 +34,10 @@
|
|||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().parent().remove();">取消</a>
|
||||
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<!--编辑单选 end-->
|
||||
</div>
|
||||
<% end%>
|
|
@ -1,33 +1,41 @@
|
|||
<div><!--编辑多选start-->
|
||||
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%><!--新建多选start-->
|
||||
<div class="ur_editor checkbox">
|
||||
<div class="ur_editor_title">
|
||||
<label >问题: </label>
|
||||
<label>问题: </label>
|
||||
<input type="hidden" name="question_type" value="2"/>
|
||||
<input class="ur_question_title" type="text" name="poll_questions_title" id="poll_questions_title" placeholder="请输入多选题题标题"/>
|
||||
<input type="checkbox" name="required" value="true" checked=""/>
|
||||
<label >必答</label>
|
||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||
<label>必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_content">
|
||||
<ul>
|
||||
<li class="ur_item">
|
||||
<label>选项 <span class="ur_index">01</span>: </label>
|
||||
<input type="text" name="option" placeholder="新建选项"/>
|
||||
<a class="icon_add" title="向下插入选项"></a>
|
||||
<a class="icon_remove" title="删除"></a>
|
||||
<li class='ur_item'>
|
||||
<label>选项<span class='ur_index'></span>:</label>
|
||||
<input type='text' name='question_answer[0]' placeholder='新建选项'/>
|
||||
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
|
||||
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li class="ur_item">
|
||||
<label >选项 <span class="ur_index">01</span>: </label>
|
||||
<input type="text" name="option" placeholder="新建选项"/>
|
||||
<a class="icon_add" title="向下插入选项"></a>
|
||||
<a class="icon_remove" title="删除"></a>
|
||||
<div class='cl'></div>
|
||||
<li class='ur_item'>
|
||||
<label>选项<span class='ur_index'></span>:</label>
|
||||
<input type='text' name='question_answer[1]' placeholder='新建选项'/>
|
||||
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
|
||||
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<div class='cl'></div>
|
||||
<li class='ur_item'>
|
||||
<label>选项<span class='ur_index'></span>:</label>
|
||||
<input type='text' name='question_answer[2]' placeholder='新建选项'/>
|
||||
<a class='icon_add' title='向下插入选项' onclick='add_single_answer($(this));'></a>
|
||||
<a class='icon_remove' title='删除' onclick='remove_single_answer($(this))'></a>
|
||||
</li>
|
||||
<div class='cl'></div>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn btn_dark btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel">取消</a>
|
||||
<a class="btn btn_dark btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn btn_light btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div><!--编辑多选 end-->
|
||||
<% end%><!--编辑多选 end-->
|
|
@ -1,18 +1,21 @@
|
|||
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
|
||||
<div class="ur_editor textarea"> <!--编辑多行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行文字标题"/>
|
||||
<input type="checkbox" name="required" value="true" id="ur_question_require" checked=""/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
<input type="hidden" name="question_type" value="4"/>
|
||||
<input id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入多行文字标题"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||
<label>必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_toolbar">
|
||||
<label>尺寸:</label>
|
||||
<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,
|
||||
<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>
|
||||
<!--<label>尺寸:</label>-->
|
||||
<!--<label>宽 <input name="cols" type="number" min="1" value="60"> 字</label>,-->
|
||||
<!--<label>高 <input name="rows" type="number" min="1" value="5"> 行</label>-->
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel">取消</a>
|
||||
<a class="btn_submit" data-button="ok" onclick="$(this).parent().parent().parent().submit();">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑多行文字end-->
|
||||
</div><!--编辑多行文字end-->
|
||||
<% end%>
|
|
@ -1,13 +1,16 @@
|
|||
<div class="ur_editor text "> <!--编辑单行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="title" placeholder="请输入单行文字标题"/>
|
||||
<input type="checkbox" name="required" value="true" id="ur_question_require_2" checked=""/>
|
||||
<label for="ur_question_require">必答</label>
|
||||
</div>
|
||||
<div class="ur_editor_footer">
|
||||
<a class="btn_submit" data-button="ok">确定</a>
|
||||
<a class="btn_cancel" data-button="cancel">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑单行文字end-->
|
||||
<%= form_for PollQuestion.new,:url =>create_poll_question_poll_path(@poll.id),:remote => true do |f|%>
|
||||
<div class="ur_editor text "> <!--编辑单行文字start-->
|
||||
<div class="ur_editor_title">
|
||||
<label for="ur_question_title">问题: </label>
|
||||
<input type="hidden" name="question_type" value="3"/>
|
||||
<input id="poll_questions_title" class="ur_question_title" contenteditable="true" type="text" name="poll_questions_title" placeholder="请输入单行文字标题"/>
|
||||
<input type="checkbox" name="is_necessary" value="true" checked/>
|
||||
<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>
|
||||
<a class="btn_cancel" data-button="cancel" onclick="$(this).parent().parent().parent().remove();">取消</a>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--编辑单行文字end-->
|
||||
<% end%>
|
|
@ -1,10 +1,26 @@
|
|||
<% poll.poll_questions.each do |poll_question|%>
|
||||
<div id="poll_questions_<%= poll_question.id%>">
|
||||
<div id="show_poll_questions_<%= poll_question.id %>">
|
||||
<%= render :partial => 'show_MC', :locals => {:poll_question => poll_question} %>
|
||||
<% if poll_question.question_type == 1%>
|
||||
<%= render :partial => 'show_MC', :locals => {:poll_question => poll_question} %>
|
||||
<% elsif poll_question.question_type == 2%>
|
||||
<%= render :partial => 'show_MCQ', :locals => {:poll_question => poll_question} %>
|
||||
<% elsif poll_question.question_type == 3%>
|
||||
<%= render :partial => 'show_single', :locals => {:poll_question => poll_question} %>
|
||||
<% elsif poll_question.question_type == 4%>
|
||||
<%= render :partial => 'show_mulit', :locals => {:poll_question => poll_question} %>
|
||||
<% end%>
|
||||
</div>
|
||||
<div id="edit_poll_questions_<%= poll_question.id %>" style="display: none;">
|
||||
<%= render :partial => 'edit_MC', :locals => {:poll_question => poll_question} %>
|
||||
<% if poll_question.question_type == 1%>
|
||||
<%= render :partial => 'edit_MC', :locals => {:poll_question => poll_question} %>
|
||||
<% elsif poll_question.question_type == 2%>
|
||||
<%= render :partial => 'edit_MCQ', :locals => {:poll_question => poll_question} %>
|
||||
<% elsif poll_question.question_type == 3%>
|
||||
<%= render :partial => 'edit_single', :locals => {:poll_question => poll_question} %>
|
||||
<% elsif poll_question.question_type == 4%>
|
||||
<%= render :partial => 'edit_mulit', :locals => {:poll_question => poll_question} %>
|
||||
<% end%>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
|
@ -60,6 +60,19 @@
|
|||
<body>
|
||||
<div class=" polls_content polls_edit" id="polls">
|
||||
|
||||
<!-- 头部 -->
|
||||
<div id="polls_head_show" style="display: none;">
|
||||
<%= render :partial => 'show_head', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
<div id="polls_head_edit">
|
||||
<%= render :partial => 'edit_head', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'poll_content', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
|
||||
<div class="tabs_1">
|
||||
<ul class="tabs_list">
|
||||
<li class="tab_item02 " >
|
||||
|
@ -86,19 +99,6 @@
|
|||
<div class="cl"></div>
|
||||
</div><!--选项 end-->
|
||||
|
||||
<!-- 头部 -->
|
||||
<div id="polls_head_show">
|
||||
<%= render :partial => 'show_head', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
<div id="polls_head_edit" style="display: none;">
|
||||
<%= render :partial => 'edit_head', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
|
||||
<!-- 问题 -->
|
||||
<div id="poll_content">
|
||||
<%= render :partial => 'poll_content', :locals => {:poll => @poll}%>
|
||||
</div>
|
||||
|
||||
<!-- 新增问题 -->
|
||||
<div id="new_poll_question">
|
||||
</div>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="ur_required" title="必答">*</span>
|
||||
<%end%>
|
||||
|
||||
(单选题)
|
||||
</div>
|
||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
|
|
|
@ -1,28 +1,31 @@
|
|||
<div class="ur_question_item checkbox ur_editor02">
|
||||
<div class="ur_title">
|
||||
<span class="title_index">第2题:</span> 多选题 <span class="ur_required" title="必答">*</span>
|
||||
<span class="title_index">
|
||||
第<%= poll_question.question_number%>题:
|
||||
</span>
|
||||
<%= poll_question.question_title %>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="ur_required" title="必答">*</span>
|
||||
<%end%>
|
||||
(多选题)
|
||||
</div>
|
||||
<a href="#" class="ur_icon_de" title="删除"></a>
|
||||
<a href="#" class="ur_icon_edit" title="编辑"></a>
|
||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<table class="ur_table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<label ><input class="ur_checkbox" type="checkbox" value="新建选项" > 新建选项 </label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr >
|
||||
<td>
|
||||
<label ><input class="ur_checkbox" type="checkbox" value="新建选项" > 新建选项 </label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label ><input class="ur_checkbox" type="checkbox" value="新建选项" > 新建选项 </label>
|
||||
</td>
|
||||
</tr>
|
||||
<% poll_question.poll_answers.reorder("answer_position").each do |poll_answer| %>
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<input class="ur_radio" type="checkbox" name="<%= poll_question %>" value="<%= poll_answer.answer_text%>" >
|
||||
<%= poll_answer.answer_text%>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
<div class="ur_question_item textarea ur_editor02">
|
||||
<div class="ur_preview">
|
||||
<div class="ur_title">
|
||||
<span class="title_index">第4题:</span> 多行主观
|
||||
<span class="title_index">
|
||||
第<%= poll_question.question_number%>题:
|
||||
</span>
|
||||
<%= poll_question.question_title %>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="ur_required" title="必答">*</span>
|
||||
<%end%>
|
||||
(多行主观)
|
||||
</div>
|
||||
<a href="#" class="ur_icon_de" title="删除"></a>
|
||||
<a href="#" class="ur_icon_edit" title="编辑"></a>
|
||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<textarea class="ur_textbox" rows="5" cols="60"></textarea>
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
<div class="ur_question_item text ur_editor02 ">
|
||||
<div class="ur_title">
|
||||
<span class="title_index">第3题:</span> 单行文字
|
||||
<span class="title_index">
|
||||
第<%= poll_question.question_number%>题:
|
||||
</span>
|
||||
<%= poll_question.question_title %>
|
||||
<%if poll_question.is_necessary == 1%>
|
||||
<span class="ur_required" title="必答">*</span>
|
||||
<%end%>
|
||||
(单行文字)
|
||||
</div>
|
||||
<a href="#" class="ur_icon_de" title="删除"></a>
|
||||
<a href="#" class="ur_icon_edit" title="编辑"></a>
|
||||
<%= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
|
||||
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
|
||||
<a class="ur_icon_edit" title="编辑" onclick="pollQuestionEdit(<%= poll_question.id%>);"></a>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_inputs">
|
||||
<input class="ur_text ur_textbox" type="text" size="" maxlength=""value="">
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
$("#new_poll_question").html("");
|
||||
$("#poll_content").append("<div id='poll_questions_<%= @poll_questions.id%>'>" +
|
||||
"<div id='show_poll_questions_<%= @poll_questions.id %>'>" +
|
||||
"<% if @poll_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_questions.id %>' style='display: none;'>" +
|
||||
"<% if @poll_questions.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% elsif @poll_questions.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_questions}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"</div>");
|
||||
|
||||
|
|
|
@ -2,211 +2,37 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>问卷调查_问卷结果</title>
|
||||
<title><%= l(:label_poll_result) %></title>
|
||||
<%= stylesheet_link_tag 'polls', :media => 'all' %>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="polls_content polls_box" id="polls">
|
||||
<div class="ur_page_head" >
|
||||
<h1 class="ur_page_title">某问卷统计</h1>
|
||||
<h1 class="ur_page_title"><%= @poll.polls_name %> <%= l(:label_poll) %></h1>
|
||||
</div>
|
||||
|
||||
|
||||
<% @poll_questions.each do |poll_question| %>
|
||||
<div class="">
|
||||
<ol>
|
||||
<li class="ur_question_item">
|
||||
<div class="ur_title_result">
|
||||
<span class="title_index">第1题:</span>问题描述问题描述 <span class="title_index">[单选题]</span>
|
||||
<span class="title_index">第<%= poll_question.question_number %>题:</span><%= poll_question.question_title %>
|
||||
<span class="title_index">[<%= options_show(poll_question.question_type) %>]</span>
|
||||
</div>
|
||||
<div class="ur_table_result">
|
||||
<table border="0" cellspacing="0" cellpadding="0" >
|
||||
<tbody>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">选项 </td>
|
||||
<td class="td42">小计 </td>
|
||||
<td class="td287">比例 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第一选项 </td>
|
||||
<td class="td42">24 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第二选项 </td>
|
||||
<td class="td42">1 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第三选项 </td>
|
||||
<td class="td42">1</td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">本题有效填写人次 </td>
|
||||
<td class="td42">26</td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<li class="ur_question_item">
|
||||
<div class="ur_title_result">
|
||||
<span class="title_index">第1题:</span>问题描述问题描述 <span class="title_index">[单选题]</span>
|
||||
</div>
|
||||
<div class="ur_table_result">
|
||||
<table border="0" cellspacing="0" cellpadding="0" >
|
||||
<tbody>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">选项 </td>
|
||||
<td class="td42">小计 </td>
|
||||
<td class="td287">比例 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第一选项 </td>
|
||||
<td class="td42">24 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第二选项 </td>
|
||||
<td class="td42">1 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第三选项 </td>
|
||||
<td class="td42">1</td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">本题有效填写人次 </td>
|
||||
<td class="td42">26</td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<li class="ur_question_item">
|
||||
<div class="ur_title_result">
|
||||
<span class="title_index">第1题:</span>问题描述问题描述 <span class="title_index">[单选题]</span>
|
||||
</div>
|
||||
<div class="ur_table_result">
|
||||
<table border="0" cellspacing="0" cellpadding="0" >
|
||||
<tbody>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">选项 </td>
|
||||
<td class="td42">小计 </td>
|
||||
<td class="td287">比例 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第一选项 </td>
|
||||
<td class="td42">24 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第二选项 </td>
|
||||
<td class="td42">1 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第三选项 </td>
|
||||
<td class="td42">1</td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">本题有效填写人次 </td>
|
||||
<td class="td42">26</td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<li class="ur_question_item">
|
||||
<div class="ur_title_result">
|
||||
<span class="title_index">第1题:</span>问题描述问题描述 <span class="title_index">[单选题]</span>
|
||||
</div>
|
||||
<div class="ur_table_result">
|
||||
<table border="0" cellspacing="0" cellpadding="0" >
|
||||
<tbody>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">选项 </td>
|
||||
<td class="td42">小计 </td>
|
||||
<td class="td287">比例 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第一选项 </td>
|
||||
<td class="td42">24 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第二选项 </td>
|
||||
<td class="td42">1 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第三选项 </td>
|
||||
<td class="td42">1</td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">本题有效填写人次 </td>
|
||||
<td class="td42">26</td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<li class="ur_question_item">
|
||||
<div class="ur_title_result">
|
||||
<span class="title_index">第1题:</span>问题描述问题描述 <span class="title_index">[单选题]</span>
|
||||
</div>
|
||||
<div class="ur_table_result">
|
||||
<table border="0" cellspacing="0" cellpadding="0" >
|
||||
<tbody>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">选项 </td>
|
||||
<td class="td42">小计 </td>
|
||||
<td class="td287">比例 </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第一选项 </td>
|
||||
<td class="td42">24 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:75%;"></span></div> 75% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第二选项 </td>
|
||||
<td class="td42">1 </td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="td327">第三选项 </td>
|
||||
<td class="td42">1</td>
|
||||
<td class="td287"><div class="Bar"><span style="width:3.13%;"></span></div>3.13% </td>
|
||||
</tr>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327">本题有效填写人次 </td>
|
||||
<td class="td42">26</td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
<%= render :partial =>'choice_show', :locals =>{ :poll_question => poll_question } %>
|
||||
</li>
|
||||
</ol>
|
||||
<% 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 class="ur_buttons">
|
||||
<!--<a href="#" class=" ur_button" >上一页</a>-->
|
||||
<!--<a href="#" class="ur_button" >下一页</a>-->
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="ur_progress_text">答题已完成 <strong class="ur_progress_number">0%</strong> </div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</div><!--问卷内容end-->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,6 +1,22 @@
|
|||
$("#poll_questions_<%= @poll_question.id%>").html("<div id='show_poll_questions_<%= @poll_question.id %>'>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% if @poll_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_single', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'show_mulit', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>" +
|
||||
"<div id='edit_poll_questions_<%= @poll_question.id %>' style='display: none;'>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% if @poll_question.question_type == 1%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MC', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 2%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 3%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_single', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% elsif @poll_question.question_type == 4%>" +
|
||||
"<%= escape_javascript(render :partial => 'edit_mulit', :locals => {:poll_question => @poll_question}) %>" +
|
||||
"<% end%>" +
|
||||
"</div>");
|
||||
|
|
|
@ -2253,5 +2253,10 @@ zh:
|
|||
label_new_answer: 新建选项
|
||||
label_poll_title: 问卷标题
|
||||
label_poll_description: 问卷描述
|
||||
label_poll_options: 选项
|
||||
label_poll_subtotal: 小计
|
||||
label_poll_proportion: 比例
|
||||
label_poll_valid_commit: 本题有效填写人次
|
||||
label_poll_result: 问卷调查_问卷统计
|
||||
|
||||
|
||||
|
|
50
db/schema.rb
50
db/schema.rb
|
@ -23,6 +23,18 @@ ActiveRecord::Schema.define(:version => 20150114022710) do
|
|||
add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type"
|
||||
add_index "activities", ["user_id"], :name => "index_activities_on_user_id"
|
||||
|
||||
create_table "api_keys", :force => true do |t|
|
||||
t.string "access_token"
|
||||
t.datetime "expires_at"
|
||||
t.integer "user_id"
|
||||
t.boolean "active", :default => true
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "api_keys", ["access_token"], :name => "index_api_keys_on_access_token"
|
||||
add_index "api_keys", ["user_id"], :name => "index_api_keys_on_user_id"
|
||||
|
||||
create_table "applied_projects", :force => true do |t|
|
||||
t.integer "project_id", :null => false
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -1056,6 +1068,14 @@ ActiveRecord::Schema.define(:version => 20150114022710) do
|
|||
t.string "description"
|
||||
end
|
||||
|
||||
create_table "social_groups", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "softapplications", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
|
@ -1271,6 +1291,36 @@ ActiveRecord::Schema.define(:version => 20150114022710) do
|
|||
add_index "versions", ["project_id"], :name => "versions_project_id"
|
||||
add_index "versions", ["sharing"], :name => "index_versions_on_sharing"
|
||||
|
||||
create_table "voting_choices", :force => true do |t|
|
||||
t.integer "poll_id", :null => false
|
||||
t.string "text", :null => false
|
||||
t.datetime "created_on", :null => false
|
||||
t.integer "position", :default => 1
|
||||
end
|
||||
|
||||
add_index "voting_choices", ["poll_id"], :name => "choices_poll_id"
|
||||
|
||||
create_table "voting_polls", :force => true do |t|
|
||||
t.integer "project_id", :null => false
|
||||
t.string "question", :null => false
|
||||
t.datetime "created_on", :null => false
|
||||
t.boolean "revote"
|
||||
end
|
||||
|
||||
add_index "voting_polls", ["project_id"], :name => "polls_project_id"
|
||||
|
||||
create_table "voting_votes", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.integer "poll_id", :null => false
|
||||
t.integer "choice_id", :null => false
|
||||
t.datetime "created_on", :null => false
|
||||
end
|
||||
|
||||
add_index "voting_votes", ["choice_id"], :name => "votes_choice_id"
|
||||
add_index "voting_votes", ["poll_id"], :name => "votes_poll_id"
|
||||
add_index "voting_votes", ["user_id", "poll_id"], :name => "votes_user_poll_unique", :unique => true
|
||||
add_index "voting_votes", ["user_id"], :name => "votes_user_id"
|
||||
|
||||
create_table "watchers", :force => true do |t|
|
||||
t.string "watchable_type", :default => "", :null => false
|
||||
t.integer "watchable_id", :default => 0, :null => false
|
||||
|
|
Loading…
Reference in New Issue