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

177 lines
7.7 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" %>
<%= stylesheet_link_tag "survey" %>
<% 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" %>
<%= javascript_include_tag "trigger_option.js" %>
<% end %>
<%= f.error_messages %>
<div class="input-area">
<div class="attributes">
<div class="attributes-header clearfix">
<h4>Basic</h4>
</div>
<div class="attributes-body">
</div>
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t(:category) %></label>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
<!-- Tiltle -->
<div class="control-group">
<label class="control-label muted" for=""><%= t('survey.title') %></label>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade <%= ( i == 0 ) ? "active in" : '' %>" id="title_<%= locale %>">
<%= f.fields_for :title_translations do |f| %>
<%= f.text_field locale, :value => (@survey.title_translations[locale] rescue nil), :placeholder=>"#{t("survey.title")}" %>
<% end %>
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#title_<%= locale %>" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
</div>
<!-- Description -->
<div class="control-group">
<label class="control-label muted"><%= t('survey.description') %></label>
<div class="controls">
<div class="tab-content textarea-lang">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#textarea_<%= locale %>_0" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade in <%= ( i == 0 ) ? "active" : '' %>" id="textarea_<%= locale %>_0">
<%= f.fields_for :description_translations do |f| %>
<%= f.text_area locale, :class=>'resizable', :value => (@survey.description_translations[locale] rescue nil), :placeholder => "#{t("survey.description")}", :rows=>"3" %>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
<!-- start date -->
<div class="control-group">
<label class="control-label muted" for="account"><%= t('survey.postdate') %></label>
<div class="controls">
<%= f.datetime_picker :postdate, :value => @survey.postdate, :new_record => @survey.new_record? %>
</div>
</div>
<!-- end date -->
<div class="control-group">
<label class="control-label muted" for="account"><%= t('survey.deadline') %></label>
<div class="controls">
<%= f.datetime_picker :deadline, :value => @survey.deadline, :new_record => @survey.new_record? %>
</div>
</div>
<!-- needs login -->
<div class="control-group">
<%= f.label :needs_login, t("survey.needs_login"), :class=>"control-label muted" %>
<div class="controls">
<label class="checkbox">
<%= f.check_box :needs_login %>
</label>
</div>
</div>
<div class="control-group <%='hide' if !(f.object.needs_login)%>" id="answer_repeat_block">
<%= f.label :answer_repeat, t("survey.same_user_can_answer_repeatedly"), :class=>"control-label muted" %>
<div class="controls">
<label class="checkbox">
<%= f.check_box :answer_repeat %>
</label>
</div>
</div>
<!-- redirect mode -->
<div class="control-group">
<label class="control-label muted" for="redirectMode"><%= t('survey.redirect_mode') %></label>
<div class="controls">
<label class="checkbox">
<!-- <input name="survey[redirect_mode]" type="hidden" value="0" />
<input id="survey_redirect_mode" name="survey[redirect_mode]" type="checkbox" value="1" /> -->
<%= f.check_box :redirect_mode, :id =>'survey_redirect_mode' %>
<%= t('survey.is_external') %>
</label>
</div>
</div>
<!-- redirect url -->
<div class="control-group redirect-url hide">
<label class="control-label muted" for="survey_redirect_url"><%= t('survey.extern_link') %></label>
<div class="controls">
<%= f.text_field :redirect_url, :class=>"input-xlarge", :placeholder=>"Redirect URL" %>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="enable_consent_feature"><%= t('survey.enable_consent_feature') %></label>
<div class="controls">
<%= f.check_box :enable_consent_feature, :id =>'enable_consent_feature' %>
</div>
</div>
<div class="control-group enable_consent_feature <%= 'hide' unless @survey.enable_consent_feature %>">
<label class="control-label muted" for="consent_contents"><%= t('survey.consent_contents') %></label>
<div class="controls">
<div class="tab-content textarea-lang">
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn <%= ( i == 0 ) ? "active" : '' %>" href="#textarea_<%= locale %>_consent_0" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
<% @site_in_use_locales.each_with_index do |locale, i| %>
<div class="tab-pane fade in <%= ( i == 0 ) ? "active" : '' %>" id="textarea_<%= locale %>_consent_0">
<%= f.fields_for :consent_contents_translations do |f| %>
<%= f.text_area locale, :class=>'resizable', :value => (@survey.consent_contents_translations[locale] rescue nil), :placeholder => "#{t("survey.consent_contents")}", :rows=>"3" %>
<% end %>
</div>
<% end %>
</div>
</div>
</div>
</div>
<!-- questions -->
<div class="questions">
</div>
</div>
<div class="form-actions">
<button type="button" class="btn btn-success add-question"><%= t('survey.add') %></button>
<%= f.submit t('save'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
<%= render :partial => "questions" %>
<script type="text/javascript">
editQuestion(<%= @sqs.to_json.html_safe %>);
$("#questionnaire_survey_needs_login").click(function(){
$("#answer_repeat_block").toggleClass("hide");
})
$("#enable_consent_feature").click(function(){
$(".enable_consent_feature").toggleClass("hide");
$(".enable_consent_feature .btn.active").click();
})
</script>