orbit-basic/vendor/built_in_modules/faq/app/views/panel/faq/back_end/qas/_form.html.erb

229 lines
7.0 KiB
Plaintext

<div id= "poststuff">
<% # encoding: utf-8 %>
<%= f.error_messages %>
<!--Widget start-->
<div id="sub-wiget">
<div id="widget-status" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting the announcement state">
<a class="action"><i class="icon-exclamation-sign icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-star"></i><%= t(:status) %></h3>
<div class="widget-content clear">
<div class="controls">
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= f.check_box :is_top %>
<%= t('top') %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= f.check_box :is_hot %>
<%= t('hot') %>
<% end -%>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= f.check_box :is_hidden %>
<%= t('hide') %>
<% end -%>
</div>
</div>
</div>
<div id="widget-tags" class="widget-box widget-size-300">
<div class="widget-action clear tip" title="Setting">
<a class="action"><i class="icon-cog icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-tag"></i><%= t('nccu.tags') %></h3>
<div class="widget-content clear form-horizontal">
<% @tags.each do |tag| %>
<%= content_tag :label,:class => "checkbox inline" do -%>
<%= check_box_tag 'qa[tag_ids][]', tag.id, @qa.tag_ids.include?(tag.id)%>
<%= tag.name %>
<%= hidden_field_tag 'qa[tag_ids][]', '' %>
<% end %>
<% end %>
</div>
</div>
</div>
<!--Wiget End-->
<!--Post Start-->
<div id="post-body">
<div id="post-body-content" class="clear">
<%= f.label :category ,t(:category)%>
<%= f.select :qa_category_id, @qa_categorys.collect {|t| [ t.title, t.id ]} %>
<ul class="nav nav-tabs">
<% @site_valid_locales.each_with_index do |locale, i| %>
<li <%= ( i == 0 ) ? "class=active" : '' %>><a data-toggle="tab" href=".<%= locale %>"><%= I18nVariable.from_locale(locale) %></a></li>
<% end %>
</ul>
<div class="tab-content">
<% @site_valid_locales.each_with_index do |locale, i| %>
<div class="<%= locale %> fade tab-pane <%= ( i == 0 ) ? "in active" : '' %>">
<div class="title">
<%= f.label :title , t('faq.question') %>
<%= f.fields_for :title_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_field locale, :class=>'post-title', :value => (@qa.title_translations[locale] rescue nil) %>
<% end %>
</div>
<div class="editor">
<%= f.label :answer ,t('faq.answer') %>
<%= f.fields_for :answer_translations do |f| %>
<%= I18nVariable.from_locale(locale) %>
<%= f.text_area locale, :style=>"width:100%", :class => 'tinymce_textarea', :value => (@qa.answer_translations[locale] rescue nil) %>
<% end %>
</div>
</div>
<% end %>
</div>
<div class="main-wiget">
<div id="widget-link" class="widget-box">
<div class="widget-action clear tip" title="Add a reference link">
<a class="action"><i class="icon-exclamation-sign icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-link"></i><%= t(:link) %></h3>
<div class="widget-content">
<div id='qa_links' class="qa_links_block">
<table class="table table-condensed">
<thead>
<tr>
<th><%= t('nccu.url') %></th>
<th><%= t('nccu.link_name') %></th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="4">
<div id='add_qa_link' class="info_input qa_links_block">
<%= hidden_field_tag 'qa_link_field_count', @qa.qa_links.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @qa.qa_links.each_with_index do |qa_link, i| %>
<%= f.fields_for :qa_links, qa_link do |f| %>
<%= render :partial => 'form_qa_link', :object => qa_link, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<div id="widget-file" class="widget-box">
<div class="widget-action clear tip" title="Added to the file">
<a class="action"><i class="icon-exclamation-sign icon-white"></i></a>
</div>
<h3 class="widget-title"><i class="icons-paperclip"></i><%= t('nccu.file') %></h3>
<div class="widget-content">
<div id='qa_files' class="qa_files_block">
<table class="table table-condensed">
<thead>
<tr>
<th><%= t('nccu.selected_file') %></th>
<th><%= t('nccu.file_name') %></th>
<th><%= t('nccu.file_description') %></th>
<th class="span1"></th>
</tr>
</thead>
<tfoot>
<tr>
<td style="text-align:center" colspan="4">
<div id='add_qa_file' class="info_input qa_files_block">
<%= hidden_field_tag 'qa_file_field_count', @qa.qa_files.count %>
<a class="add"><span class="btn btn-primary btn-small"><i class="icon-plus icon-white"></i><%= t(:add) %></span></a>
<p><%= t("sys.limit_of_upload_file_size",:best_size => '3MB') %></p>
<p><%= t("sys.preview_only_for_img") %></p>
</div>
</td>
</tr>
</tfoot>
<tbody>
<% @qa.qa_files.each_with_index do |qa_file, i| %>
<%= f.fields_for :qa_files, qa_file do |f| %>
<%= render :partial => 'form_qa_file', :object => qa_file, :locals => {:f => f, :i => i} %>
<% end %>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<!--Post End-->
</div>
<div class="form-actions">
<%= hidden_field_tag 'page', params[:page] if !params[:page].blank? %>
<%= f.submit t('submit'), :class=>'btn btn-primary' %>
<%= link_to t('cancel'), get_go_back, :class=>"btn" %>
</div>
</div>
<% content_for :page_specific_javascript do %>
<%= javascript_include_tag "faq/qa_form" %>
<%= javascript_include_tag "inc/jquery.imagesloaded.js" %>
<script>
$(document).ready(function() {
$('#add_qa_link a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_qa_links", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_qa_link', f, :qa_links) %>").replace(old_id, new_id));
});
$('#add_qa_file a.add').live('click', function(){
var new_id = $(this).prev().attr('value');
var old_id = new RegExp("new_qa_files", "g");
$(this).prev().attr('value', parseInt(new_id) + 1);
$(this).parents('table').append(("<%= escape_javascript(add_attribute 'form_qa_file', f, :qa_files) %>").replace(old_id, new_id));
});
$('.for_preview').popover({ html : true });
});
</script>
<% end %>