event_ann/app/views/admin/event_news/import.html.erb

87 lines
3.7 KiB
Plaintext
Raw Normal View History

2020-07-13 08:04:57 +00:00
<% content_for :page_specific_javascript do %>
<script type="text/javascript" src="/assets/validator.js"></script>
<% end %>
<form action="<%= admin_event_ann_importeanns_path %>" method="post" class="form-horizontal main-forms" id="import-eanns-xls" enctype="multipart/form-data">
<h3 style="padding-left: 30px;"><%= t("event_ann.export_to_excel") %></h3>
<div class="control-group">
<div class="controls">
<a href="<%= admin_event_ann_export_excel_path(:format => "xlsx") %>"><%= t("event_ann.export_all_eanns") %></a>
</div>
</div>
<h3 style="padding-left: 30px;"><%= t("event_ann.import_from_excel") %></h3>
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<div class="input-area">
<% if @module_app.categories.count > 0 %>
<div class="control-group">
<div class="controls">
<a href="<%= admin_event_ann_excel_format_path(:format => "xlsx") %>"><%= t("event_ann.download_example_sheet_here") %></a>
</div>
</div>
<div class="control-group">
<label for="import-eanns" class="control-label muted"><%= t("upload") %></label>
<div class="controls">
<input type="file" id="import-eanns" name="import_file" data-fv-validation="required;mustbexls;" data-fv-messages="Cannot be empty; Must be an excel file.;" />
<span class="help-block"><%= t("event_ann.please_create_tags_cats") %></span>
</div>
</div>
<% else %>
<div class="control-group">
<div class="controls">
<h4><%= t("event_ann.create_atleast_one_cat") %></h4>
</div>
</div>
<% end %>
</div>
<% if @module_app.categories.count > 0 %>
<div class="form-actions">
<input type="submit" value="<%= t("restful_actions.import") %>" class="btn btn-primary">
</div>
<% end %>
</form>
<!-- import from wp xml -->
<form action="<%= admin_event_ann_import_from_wp_path %>" method="post" class="form-horizontal main-forms" id="import-eanns-wp-xml" enctype="multipart/form-data">
<h3 style="padding-left: 30px;"><%= t("event_ann.import_from_wp_xml") %></h3>
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<div class="input-area">
<div class="control-group">
<label for="import-eanns-wp-xml" class="control-label muted"><%= t("upload") %></label>
<div class="controls">
<input type="file" id="import-eanns-wp-xml" name="import_xml" data-fv-validation="required;mustbexml;" data-fv-messages="Cannot be empty; Must be an XML file.;" />
</div>
</div>
</div>
<div class="form-actions">
<input type="submit" value="<%= t("restful_actions.import") %>" class="btn btn-primary">
</div>
</form>
<!-- <form action="<%#= admin_event_ann_import_from_xml_path %>" method="post" class="form-horizontal main-forms" id="import-eanns-xml" enctype="multipart/form-data">
<h3 style="padding-left: 30px;">Import from XML</h3>
<%#= hidden_field_tag :authenticity_token, form_authenticity_token %>
<div class="input-area">
<div class="control-group">
<label for="import-eanns" class="control-label muted">URL :</label>
<div class="controls">
<input type="text" id="import-eanns" name="import_xml" data-fv-validation="required;url;" data-fv-messages="Cannot be empty; Must be an URL.;" />
</div>
</div>
</div>
<div class="form-actions">
<input type="submit" value="Import" class="btn btn-primary">
</div>
</form> -->
<script type="text/javascript">
var form = new FormValidator($("#import-eanns-xls"));
form.validate_functions.mustbexls = function(val){
var t = val.split("."),
ext = t[t.length - 1];
return (ext == "xls" || ext == "xlsx")
}
var form = new FormValidator($("#import-eanns-wp-xml"));
form.validate_functions.mustbexml = function(val){
var t = val.split("."),
ext = t[t.length - 1];
return (ext == "xml")
}
</script>