seminar/app/views/admin/seminar_review_results/edit.html.erb

133 lines
7.4 KiB
Plaintext
Raw Normal View History

<style type="text/css">
.text_wrap{
background: #98fffa;
max-height: 20em;
overflow-wrap: break-word;
overflow: scroll;
padding: 0 1.5em;
}
.text_wrap h4{
text-align: center;
}
object{
width: 100%;
}
</style>
<%= form_for @seminar_signup_contribute, url: admin_seminar_review_result_path(@seminar_signup_contribute), html: {class: "form-horizontal main-forms"} do |f| %>
<% seminar_signup = @seminar_signup_contribute.seminar_signup %>
<% referer_url = request.referer %>
<fieldset>
<% render :partial => "admin/seminars/get_display_fields" %>
<% @field_name_translations.each_with_index do |trans,i|%>
<% next unless @display_field.include?(@field_names[i]) %>
<div class="control-group">
<div class="control-label"><%=trans%></div>
<div class="controls">
<% val = "" %>
<% names = @field_names[i].split(".") %>
<% if names[0] == "seminar_signup_field_set" %>
<% if names[1] == "name" %>
<% val = seminar_signup.name %>
<% elsif names[1] == 'status' %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% elsif names[1] != 'recaptcha' %>
<% val = seminar_signup.send("#{names[1]}") %>
<% end %>
<% elsif names[0] == "default" %>
<% if names[2] == "name" %>
<% val = seminar_signup.name %>
<% elsif names[2] == "tel" %>
<% val = seminar_signup.tel %>
<% elsif names[2] == "registration_status" %>
<% val = t("seminar.registration_status_#{seminar_signup.status}") if !seminar_signup.status.blank? %>
<% end %>
<% elsif names[0] == "seminar_signup_field_custom" || names[0] == "seminar_signup_fields" %>
<% val = seminar_signup.seminar_signup_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
<% elsif names[0] == "seminar_signup_contributes" %>
<% if names[1] == "file" %>
<% seminar_signup_contribute = @seminar_signup_contribute %>
<% description = seminar_signup_contribute.description.to_s %>
<% if @seminar.enable_summary_choice
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
else
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
end
end %>
<% file_path = seminar_signup_contribute.file.path %>
<% file_title = (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) %>
<% filename = seminar_signup_contribute.disp_filename %>
<% file_url = seminar_signup_contribute.file.url %>
<% file_extname = File.extname(file_path) %>
<% if (file_extname.match(/pdf/i) rescue false) %>
<% val = "<object data=\"#{file_url}\" type=\"application/pdf\" title=\"#{file_title}\" height=\"500\">
<a href=\"#{file_url}\" title=\"#{file_title}\">#{file_title}</a>
<embed src=\"#{file_url}\" title=\"#{file_title}\" type=\"application/pdf\" />
</object>" %>
<% elsif (file_extname.match(/(jpg|jpeg|png|gif|bmp)/i) rescue false) %>
<% val = "<a title=\"#{t("seminar.view_original_image")}\" href=\"#{file_url}\" target=\"_blank\"><img src=\"#{file_url}\"alt=\"#{file_title}\" height=\"500\"></a>" %>
<% else %>
<% file_content = File.read(file_path) rescue "" %>
<% if file_content.is_utf8? %>
<% file_content = file_content.gsub(/(\r\n|\n)/,"<br>")%>
<% val = "<div class=\"text_wrap\"><a class=\"pull-right\" href=\"#{file_url}\" title=\"#{t(:download)}\" download=\"#{filename}\">#{t(:download)}</a><div style=\"clear: both;\"></div><h4>#{file_title}</h4>#{file_content}</div>"%>
<% else %>
<% val = link_to( file_title, file_url , {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>filename} ) if seminar_signup_contribute.file.file %>
<% end %>
<% end %>
<% else %>
<% if names[1] == "description" %>
<% description = @seminar_signup_contribute.send(names[1]) %>
<% if @seminar.enable_summary_choice
if (description.to_s.to_i.to_s == description)
description = @seminar.summary_chioices[description.to_i] rescue description
else
description = description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue description
end
end %>
<% val = description %>
<% else %>
<% val = @seminar_signup_contribute.send(names[1]).to_s %>
<% end %>
<% end %>
<% elsif names[0] == "seminar_submission_fields" %>
<% val = @seminar_signup_contribute.seminar_submission_values.where(:key=>names[1]).first.get_value_by_locale(I18n.locale) rescue "" %>
<% seminar_submission_field = seminar_signup.seminar_main.seminar_submission_fields.where(:key=>names[1]).first %>
<% if seminar_submission_field && seminar_submission_field.markup == "seminar_preferred_session"
seminar_submission_value = @seminar_signup_contribute.seminar_submission_values.where(:key=>names[1]).first
val = "<span data-id=\"#{seminar_submission_value.id rescue ''}\">#{(seminar_submission_value.get_value_by_locale(I18n.locale) rescue "")}</span>"
end %>
<% elsif names[0] == "seminar_signup" %>
<% val = (seminar_signup.send("display_"+names[1]) rescue seminar_signup.send(names[1])) rescue nil %>
<% elsif names[0] == "seminar_review_result" %>
<% val = @seminar_signup_contribute.send(names[1]) rescue "" %>
<% end %>
<%= val.html_safe %>
</div>
</div>
<% end %>
<!-- Input Area -->
<div class="input-area">
<%= f.fields_for :seminar_review_result,@seminar_review_result do |f| %>
<div class="control-group">
<%= f.label :abstract_number,:class=>"control-label" %>
<div class="controls"><%= f.text_field :abstract_number %></div>
</div>
<div class="control-group">
<%= f.label :presentation_type,:class=>"control-label" %>
<div class="controls">
<% SeminarReviewResult::PRESENTATION_TYPES.each do |v| %>
<label><%= f.radio_button :presentation_type, v %><%=v%></label>
<% end %>
</div>
</div>
<% end %>
</div>
<%= hidden_field_tag :referer_url, referer_url %>
<!-- Form Actions -->
<div class="form-actions">
<%= f.submit t('submit'), class: 'btn btn-primary' %>
<%= link_to t('cancel'), referer_url, :class=>"btn" %>
</div>
</fieldset>
<% end %>