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

149 lines
6.1 KiB
Plaintext
Raw Normal View History

2014-10-06 05:55:25 +00:00
<% content_for :page_specific_css do %>
<%= stylesheet_link_tag "lib/main-forms" %>
<%= stylesheet_link_tag "lib/wrap-nav" %>
<%= stylesheet_link_tag "lib/main-list" %>
2021-07-08 13:31:27 +00:00
<%= stylesheet_link_tag "survey" %>
2014-10-06 05:55:25 +00:00
<% 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" %>
2021-07-08 13:31:27 +00:00
<%= javascript_include_tag "trigger_option.js" %>
2014-10-06 05:55:25 +00:00
<% end %>
<%= f.error_messages %>
<div class="input-area">
<div class="attributes">
<div class="attributes-header clearfix">
<h4>Basic</h4>
</div>
<div class="attributes-body">
2021-07-08 13:31:27 +00:00
</div>
<!-- Category -->
<div class="control-group">
<label class="control-label muted"><%= t(:category) %></label>
<div class="controls">
<%= select_category(f, @module_app) %>
</div>
</div>
2014-10-06 05:55:25 +00:00
<!-- 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? %>
2014-10-06 05:55:25 +00:00
</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? %>
2014-10-06 05:55:25 +00:00
</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>
2014-10-06 05:55:25 +00:00
<!-- 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>
<!-- 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");
})
2014-10-06 05:55:25 +00:00
</script>