1.增加点击单选、多选、单行文本、多行文本的js

2.分割问卷标题头
3.增加新增问题的路由及action
This commit is contained in:
sw 2015-01-13 20:13:50 +08:00
parent c84b8f75cc
commit 311d90d565
6 changed files with 51 additions and 19 deletions

View File

@ -81,6 +81,11 @@ class PollController < ApplicationController
end end
end end
#添加单选题
def add_mc
end
private private
def find_poll_and_course def find_poll_and_course
@poll = Poll.find params[:id] @poll = Poll.find params[:id]

View File

@ -2,7 +2,7 @@
<div class="ur_editor checkbox"> <div class="ur_editor checkbox">
<div class="ur_editor_title"> <div class="ur_editor_title">
<label >问题:&nbsp;&nbsp;</label> <label >问题:&nbsp;&nbsp;</label>
<input class="ur_question_title" type="text" name="title" placeholder="请输入问题标题" value="选题"> <input class="ur_question_title" type="text" name="title" placeholder="请输入问题标题" value="选题">
<input type="checkbox" name="required" value="true" checked=""> <input type="checkbox" name="required" value="true" checked="">
<label >必答</label> <label >必答</label>
</div> </div>

View File

@ -0,0 +1,13 @@
<div class="ur_editor ur_title_editor"> <!--编辑头部start-->
<div class="ur_title_editor_title">
<input type="text" name="title" class="input_title" value="问卷标题">
</div>
<div class="ur_title_editor_prefix">
<textarea name="prefix" class="textarea_editor">问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述</textarea>
</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-->

View File

@ -4,6 +4,13 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>问卷调查_问卷编辑</title> <title>问卷调查_问卷编辑</title>
<%= stylesheet_link_tag 'polls', :media => 'all' %> <%= stylesheet_link_tag 'polls', :media => 'all' %>
<script type="text/javascript">
function add_MC(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_MC') %>");}
function add_MCQ(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_MCQ') %>");}
function add_single(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_single') %>");}
function add_mulit(){$("#poll_content").append("<%= escape_javascript(render :partial => 'edit_mulit') %>");}
</script>
</head> </head>
<body> <body>
@ -12,37 +19,38 @@
<div class="tabs_1"> <div class="tabs_1">
<ul class="tabs_list"> <ul class="tabs_list">
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="单选题" class="tab_icon icon_radio">单选题</a> <a title="<%= l(:label_MC) %>" class="tab_icon icon_radio" onclick="add_MC();">
<%= l(:label_MC) %>
</a>
</li> </li>
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="多选题" class=" tab_icon icon_checkbox">多选题</a> <a title="<%= l(:label_MCQ) %>" class=" tab_icon icon_checkbox" onclick="add_MCQ();">
<%= l(:label_MCQ) %>
</a>
</li> </li>
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="单行文字" class="tab_icon icon_text">单行文字</a> <a title="<%= l(:label_single) %>" class="tab_icon icon_text" onclick="add_single();">
<%= l(:label_single) %>
</a>
</li> </li>
<li class="tab_item02 " > <li class="tab_item02 " >
<a title="多行文字" class="tab_icon icon_textarea">多行文字</a> <a title="<%= l(:label_mulit)%>" class="tab_icon icon_textarea" onclick="add_mulit();">
<%= l(:label_mulit)%>
</a>
</li> </li>
</ul> </ul>
<div class="cl"></div> <div class="cl"></div>
</div><!--选项 end--> </div><!--选项 end-->
<div class="ur_editor ur_title_editor"> <!--编辑头部start--> <%= render :partial => 'edit_head'%>
<div class="ur_title_editor_title">
<input type="text" name="title" class="input_title" value="问卷标题"> <div id="poll_content">
</div> </div>
<div class="ur_title_editor_prefix">
<textarea name="prefix" class="textarea_editor">问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述问卷描述</textarea>
</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-->
<div class="ur_buttons"> <div class="ur_buttons">
<a href="#" class="ur_button_submit" >提交</a> <a href="#" class="ur_button_submit" >
<%= l(:label_memo_create)%>
</a>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -2245,4 +2245,9 @@ zh:
label_poll: 问卷调查 label_poll: 问卷调查
label_new_poll: 新建问卷 label_new_poll: 新建问卷
label_statistical_results: 统计结果 label_statistical_results: 统计结果
label_MC: 单选题
label_MCQ: 多选题
label_single: 单行文字
label_mulit: 多行文字

View File

@ -61,6 +61,7 @@ RedmineApp::Application.routes.draw do
resources :poll do resources :poll do
member do member do
get 'statistics_result' get 'statistics_result'
get 'add_mc'
end end
end end