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

192 lines
10 KiB
Plaintext

<script id="template-survery" type="text/x-tmpl">
<div class="attributes" data-index="${_l}" data-question="${_ques}">
<div class="attributes-header clearfix">
<a class="btn btn-mini pull-right btn-danger delete" href="#"><i class="icon-trash"></i> <%= t('survey_question.delete') %></a>
<input class="should_destroy" id="${_destroy[0]}" name="${_destroy[1]}" type="hidden">
<input id="${_sequence[0]}" class="sequence" name="${_sequence[1]}" type="hidden" value="${_sequence[2]}">
{{if _id}}
<input id="${_id[0]}" name="${_id[1]}" type="hidden" value="${_id[2]}">
{{/if}}
<h4><b></b> Q<span>${_length}</span> <i class="icon-caret-up"></i> <span class="questions-title">${_title_translations[3].<%= @primary_locale %>}</span></h4>
</div>
<div class="attributes-body">
<div class="control-group">
<label class="control-label muted" for=""><%= t('survey_question.title') %></label>
<div class="controls">
<div class="input-append">
<div class="tab-content">
<div class="tab-pane fade active in" id="${_title_translations[2]+'_<%= @primary_locale %>'}">
<input class="span4 q-title" id="${_title_translations[0]+'_<%= @primary_locale %>'}" name="${_title_translations[1]+'[<%= @primary_locale %>]'}" type="text" value="${_title_translations[3].<%= @primary_locale %>}" />
</div>
<div class="tab-pane fade" id="${_title_translations[2]+'_<%= @secondary_locale %>'}">
<input class="span4 q-title" id="${_title_translations[0]+'_<%= @secondary_locale %>'}" name="${_title_translations[1]+'[<%= @secondary_locale %>]'}" type="text" value="${_title_translations[3].<%= @secondary_locale %>}" />
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn change-title <%= ( i == 0 ) ? "active" : '' %>" href="${'#'+_title_translations[2]+'_<%= locale %>'}" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label muted"><%= t('survey_question.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 change-title <%= ( i == 0 ) ? "active" : '' %>" href="${'#'+_description_translations[2]+'_<%= locale %>'}" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
</div>
<div class="tab-pane fade active in" id="${_description_translations[2]+'_<%= @primary_locale %>'}">
<textarea class="resizable" id="${_description_translations[0]+'_<%= @primary_locale %>'}" name="${_description_translations[1]+'[<%= @primary_locale %>]'}" rows="3">${_description_translations[3].<%= @primary_locale %>}</textarea>
</div>
<div class="tab-pane fade" id="${_description_translations[2]+'_<%= @secondary_locale %>'}">
<textarea class="resizable" id="${_description_translations[0]+'_<%= @secondary_locale %>'}" name="${_description_translations[1]+'[<%= @secondary_locale %>]'}" rows="3">${_description_translations[3].<%= @secondary_locale %>}</textarea>
</div>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for=""><%= t('survey_question.type') %> </label>
<div class="controls">
<select class="type-selector" id="${_type[0]}" name="${_type[1]}" >
<option value="0" {{if _type[2] == 0}}selected="selected"{{/if}}><%= t('survey_question.oneline') %></option>
<option value="1" {{if _type[2] == 1}}selected="selected"{{/if}}><%= t('survey_question.multiline') %></option>
<option value="2" {{if _type[2] == 2}}selected="selected"{{/if}}><%= t('survey_question.radio') %></option>
<option value="3" {{if _type[2] == 3}}selected="selected"{{/if}}><%= t('survey_question.check') %></option>
<option value="4" {{if _type[2] == 4}}selected="selected"{{/if}}><%= t('survey_question.select') %></option>
<option value="5" {{if _type[2] == 5}}selected="selected"{{/if}}><%= t('survey_question.radiogroup') %></option>
<option value="6" {{if _type[2] == 6}}selected="selected"{{/if}}><%= t('survey_question.datetime') %></option>
</select>
</div>
</div>
<div class="field-type" style="display: none">
<div class="control-group rgl">
<label for="" class="control-label muted"><%= t('survey_question.radiogroup_label') %></label>
<div class="controls add-input">
<div class="add-target">
<p class="add-btn">
<a href="#" class="btn btn-mini btn-primary"><i class="icons-plus"></i> <%= t('survey_question.add') %></a>
</p>
</div>
</div>
</div>
<hr />
<div class="control-group options">
<label for="" class="control-label muted"><%= t('survey_question.options_lists') %></label>
<div class="controls add-input">
<div class="add-target">
<p class="add-btn">
<a href="#" class="btn btn-mini btn-primary"><i class="icons-plus"></i> <%= t('survey_question.add') %></a>
</p>
</div>
</div>
</div>
<div class="control-group allow">
<div class="controls">
<label class="checkbox">
<input name="${_custom_option[1]}" type="hidden" value="${_custom_option[2] << 0}" />
<input id="${_custom_option[0]}" type="checkbox" {{if _custom_option[2]}} checked="checked" {{/if}} />
<%= t('survey_question.custom_option') %>
</label>
</div>
</div>
</div>
<div class="control-group date-format" style="display:none;">
<label class="control-label muted" for=""><%= t('survey_question.datetimeformat') %> </label>
<div class="controls">
<select id="${_dateformat[0]}" name="${_dateformat[1]}">
<option value="yyyy/MM/dd hh:mm" {{if _dateformat[2] == 'yyyy/MM/dd hh:mm'}}selected="selected"{{/if}}>YYYY/MM/DD HH:MM</option>
<option value="yyyy/MM/dd" {{if _dateformat[2] == 'yyyy/MM/dd'}}selected="selected"{{/if}}>YYYY/MM/DD</option>
<option value="yyyy/MM" {{if _dateformat[2] == 'yyyy/MM'}}selected="selected"{{/if}}>YYYY/MM</option>
<option value="yyyy" {{if _dateformat[2] == 'yyyy'}}selected="selected"{{/if}}>YYYY</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label muted" for="redirectMode"></label>
<div class="controls">
<label class="checkbox">
<input name="${_is_required[1]}" type="hidden" value="${_is_required[2] << 0}" />
<input id="${_is_required[0]}" type="checkbox" {{if _is_required[2]}} checked="checked" {{/if}} />
<%= t('survey_question.is_required') %>
</label>
</div>
</div>
</div>
</div>
</script>
<script id="template-survery-option" type="text/x-tmpl">
{{if _className == 'rgl'}}
<div class="input-append" data-question-option="${_ques}">
{{if _radiogroups_id}}
<input type="hidden" value="${_radiogroups_id[1]}" name="${_radiogroups_id[0]}" />
<input type="hidden" class="should_destroy_option" name="${_destroy[0]}" />
{{/if}}
<div class="tab-content">
<div class="tab-pane fade active in" id="${_radiogroups[2]+'<%= @primary_locale %>'}">
<input type="text" class="span4" id="${_radiogroups[0]+'<%= @primary_locale %>'}" name="${_radiogroups[1]+'[<%= @primary_locale %>]'}" value="${_radiogroups[3].<%= @primary_locale %>}" />
</div>
<div class="tab-pane fade" id="${_radiogroups[2]+'<%= @secondary_locale %>'}">
<input type="text" class="span4" id="${_radiogroups[0]+'<%= @secondary_locale %>'}" name="${_radiogroups[1]+'[<%= @secondary_locale %>]'}" value="${_radiogroups[3].<%= @secondary_locale %>}" />
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn change-title <%= ( i == 0 ) ? "active" : '' %>" href="${'#'+_radiogroups[2]+'_<%= locale %>'}" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
<a href="#" class="btn remove-input">
<i class="icon-trash"></i>
</a>
</div>
</div>
{{else}}
<div class="input-append" data-question-option="${_ques}">
{{if _options_id}}
<input type="hidden" value="${_options_id[1]}" name="${_options_id[0]}" />
<input type="hidden" class="should_destroy_option" name="${_destroy[0]}" />
{{/if}}
<div class="tab-content">
<div class="tab-pane fade active in" id="${_option[2]+'<%= @primary_locale %>'}">
<input type="text" class="span4" id="${_option[0]+'<%= @primary_locale %>'}" name="${_option[1]+'[<%= @primary_locale %>]'}" value="${_option[3].<%= @primary_locale %>}" />
</div>
<div class="tab-pane fade" id="${_option[2]+'<%= @secondary_locale %>'}">
<input type="text" class="span4" id="${_option[0]+'<%= @secondary_locale %>'}" name="${_option[1]+'[<%= @secondary_locale %>]'}" value="${_option[3].<%= @secondary_locale %>}" />
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% @site_in_use_locales.each_with_index do |locale, i| %>
<a class="btn change-title <%= ( i == 0 ) ? "active" : '' %>" href="${'#'+_option[2]+'<%= locale %>'}" data-toggle="tab"><%= t(locale.to_s) %></a>
<% end %>
<a href="#" class="btn remove-input">
<i class="icon-trash"></i>
</a>
</div>
<div style="margin-left:10px; display:inline;">
<input type="number" name="${_points[1]}" id="${_points[0]}" class="span1" value="${_points[3]}" />
<label for="${_points[0]}" class="radio inline" style="padding-left: 5px;">Points</label>
</div>
</div>
{{/if}}
</script>