survey/app/views/admin/surveys/set_answers.html.erb

95 lines
3.4 KiB
Plaintext

<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/wrap-nav" %>
<%= stylesheet_link_tag "lib/main-list" %>
<% end %>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "jquery-ui-custom.js" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker" %>
<%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %>
<%= javascript_include_tag "lib/member/textarea-lang-btn.js" %>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "survey.js" %>
<% end %>
<%= form_for @survey, url: admin_survey_path(@survey), html: {class: "form-horizontal main-forms"} do |f| %>
<fieldset>
<div class="input-area">
<div class="attributes">
<div class="attributes-header clearfix">
<h4><%= @survey.title %> <%= t('survey.set_answers') %></h4>
</div>
</div>
<!-- Result Type -->
<div class="control-group" data-type="0">
<label class="control-label muted" for="account"><%= t('survey.result_type') %></label>
<div class="controls">
<%= f.select :result_type, {
t('survey.chart') => QuestionnaireSurvey::ResultChart,
t('survey.extern_link') => QuestionnaireSurvey::ResultExtern,
t('survey.upload_file') => QuestionnaireSurvey::ResultFile
}, {}, :class => "tinput-medium", :onchange=>"OnSelectionChange (this)" %>
</div>
</div>
<!-- Extern Link -->
<div class="control-group <%= (@survey.result_type == 1) ? '' : 'hide' %>" data-type="1">
<label class="control-label muted" for="account"><%= t('survey.extern_link') %></label>
<div class="controls">
<%= f.text_field :extern_link, :style=>"width:80%;", :class=>'post-extern_link' %>
</div>
</div>
<!-- Upload_file -->
<div class="control-group <%= (@survey.result_type == 2) ? '' : 'hide' %>" data-type="2">
<label class="control-label muted" for="account"><%= t('survey.upload_file') %></label>
<div class="controls">
<%= f.file_field :upload_file %>
<% if @survey.upload_file? %>
<div class="controls" data-toggle="buttons-checkbox">
<%= link_to t(:view), @survey.upload_file.url, {:class => 'for_preview btn', :target => '_blank', :title => t(:view), "data-trigger" => :hover} %>
<label class="checkbox inline btn btn-danger fileupload-remove">
<%= f.check_box :remove_upload_file %><%= t('survey.remove_upload_file') %>
</label>
</div>
<% end %>
</div>
</div>
</div>
<div class="form-actions">
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
<%= f.submit t('save'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</fieldset>
<% end %>
<script type="text/javascript">
function OnSelectionChange (select) {
var selectedOption = select.options[select.selectedIndex];
if (selectedOption.value == '1' )
{
$('.control-group[data-type=1]').removeClass('hide');
$('.control-group[data-type=2]').addClass('hide');
}
else if (selectedOption.value == '2' )
{
$('.control-group[data-type=2]').removeClass('hide');
$('.control-group[data-type=1]').addClass('hide');
}
else
{
$('.control-group[data-type=1]').addClass('hide');
$('.control-group[data-type=2]').addClass('hide');
}
}
</script>