Merge branch 'master' into 'master'
Edit singup's uploaded filename display. Edit email contents of file upload or edit. See merge request spen/seminar!47
This commit is contained in:
commit
93cfa14e46
|
@ -515,7 +515,13 @@ class SeminarsController < ApplicationController
|
||||||
signup = SeminarSignup.where(id:update_params['seminar_signup_id']).first
|
signup = SeminarSignup.where(id:update_params['seminar_signup_id']).first
|
||||||
seminar_id = signup.seminar_main_id
|
seminar_id = signup.seminar_main_id
|
||||||
@seminar = SeminarMain.where(id:seminar_id).first
|
@seminar = SeminarMain.where(id:seminar_id).first
|
||||||
send_mail('add_file',signup.email,seminar_id)
|
host_url = Site.first.root_url
|
||||||
|
if host_url == "http://"
|
||||||
|
host_url = request.protocol + request.host_with_port
|
||||||
|
end
|
||||||
|
extra_text = "<br>"+render_to_string("seminars/con_email_contents",:locals=>{:@seminar=>@seminar,
|
||||||
|
:@con=>@con,:@host_url=>host_url},:layout=>false)
|
||||||
|
send_mail('add_file',signup.email,seminar_id,extra_text)
|
||||||
seminar_reviews = SeminarReview.where(:seminar_main_id=>signup.seminar_main_id).to_a
|
seminar_reviews = SeminarReview.where(:seminar_main_id=>signup.seminar_main_id).to_a
|
||||||
seminar_reviews.each{|sr| sr.save}
|
seminar_reviews.each{|sr| sr.save}
|
||||||
@seminar = signup.seminar_main
|
@seminar = signup.seminar_main
|
||||||
|
@ -559,7 +565,13 @@ class SeminarsController < ApplicationController
|
||||||
signup = SeminarSignup.where(id:update_params['seminar_signup_id']).first
|
signup = SeminarSignup.where(id:update_params['seminar_signup_id']).first
|
||||||
seminar_id = signup.seminar_main_id
|
seminar_id = signup.seminar_main_id
|
||||||
@seminar = SeminarMain.where(id:seminar_id).first
|
@seminar = SeminarMain.where(id:seminar_id).first
|
||||||
send_mail('edit_file',signup.email,seminar_id)
|
host_url = Site.first.root_url
|
||||||
|
if host_url == "http://"
|
||||||
|
host_url = request.protocol + request.host_with_port
|
||||||
|
end
|
||||||
|
extra_text = "<br>"+render_to_string("seminars/con_email_contents",:locals=>{:@seminar=>@seminar,
|
||||||
|
:@con=>@con,:@host_url=>host_url},:layout=>false)
|
||||||
|
send_mail('edit_file',signup.email,seminar_id,extra_text)
|
||||||
seminar_reviews = SeminarReview.where(:seminar_main_id=>signup.seminar_main_id).to_a
|
seminar_reviews = SeminarReview.where(:seminar_main_id=>signup.seminar_main_id).to_a
|
||||||
seminar_reviews.each{|sr| sr.save}
|
seminar_reviews.each{|sr| sr.save}
|
||||||
@seminar = signup.seminar_main
|
@seminar = signup.seminar_main
|
||||||
|
|
|
@ -8,6 +8,7 @@ class SeminarSignupContribute
|
||||||
field :presentation_type , type: String , default: ""
|
field :presentation_type , type: String , default: ""
|
||||||
field :sort_number , type: Integer, default: 10000
|
field :sort_number , type: Integer, default: 10000
|
||||||
mount_uploader :file, AssetUploader
|
mount_uploader :file, AssetUploader
|
||||||
|
field :filename, type: String
|
||||||
field :description
|
field :description
|
||||||
field :preferred_session
|
field :preferred_session
|
||||||
field :final_session
|
field :final_session
|
||||||
|
@ -40,4 +41,25 @@ class SeminarSignupContribute
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
before_save do
|
||||||
|
self.update_filename
|
||||||
|
end
|
||||||
|
def update_filename
|
||||||
|
if self.title.blank?
|
||||||
|
self.filename = self.file.file.filename rescue ''
|
||||||
|
else
|
||||||
|
if self.file.file
|
||||||
|
self.filename = self.title.sub(/#{::Regexp.escape(File.extname(self.title))}$/,'') + File.extname(self.file.file.filename)
|
||||||
|
else
|
||||||
|
self.filename = self.title
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.filename
|
||||||
|
end
|
||||||
|
def disp_filename
|
||||||
|
if self.filename.nil?
|
||||||
|
self.class.where(:id=>self.id).update_all(:filename=>self.update_filename)
|
||||||
|
end
|
||||||
|
self.filename
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -56,6 +56,7 @@
|
||||||
end %>
|
end %>
|
||||||
<% file_path = seminar_signup_contribute.file.path %>
|
<% 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) %>
|
<% 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_url = seminar_signup_contribute.file.url %>
|
||||||
<% file_extname = File.extname(file_path) %>
|
<% file_extname = File.extname(file_path) %>
|
||||||
<% if (file_extname.match(/pdf/i) rescue false) %>
|
<% if (file_extname.match(/pdf/i) rescue false) %>
|
||||||
|
@ -69,9 +70,9 @@
|
||||||
<% file_content = File.read(file_path) rescue "" %>
|
<% file_content = File.read(file_path) rescue "" %>
|
||||||
<% if file_content.is_utf8? %>
|
<% if file_content.is_utf8? %>
|
||||||
<% file_content = file_content.gsub(/(\r\n|\n)/,"<br>")%>
|
<% file_content = file_content.gsub(/(\r\n|\n)/,"<br>")%>
|
||||||
<% val = "<div class=\"text_wrap\"><a class=\"pull-right\" href=\"#{file_url}\" title=\"#{t(:download)}\">#{t(:download)}</a><div style=\"clear: both;\"></div><h4>#{file_title}</h4>#{file_content}</div>"%>
|
<% 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 %>
|
<% else %>
|
||||||
<% val = link_to( file_title, file_url , {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} ) if seminar_signup_contribute.file.file %>
|
<% 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 %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -141,7 +141,7 @@
|
||||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||||
end
|
end
|
||||||
end %>
|
end %>
|
||||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
|
<%= link_to seminar_signup_contribute.disp_filename , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= val[0].html_safe.to_s rescue "" %>
|
<%= val[0].html_safe.to_s rescue "" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||||
end
|
end
|
||||||
end %>
|
end %>
|
||||||
<%= link_to (seminar_signup_contribute.title.blank? ? File.basename(seminar_signup_contribute.file.path) : seminar_signup_contribute.title) , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %>
|
<%= link_to seminar_signup_contribute.disp_filename , seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= val.html_safe.to_s rescue "" %>
|
<%= val.html_safe.to_s rescue "" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -6,3 +6,4 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= t('seminar.email_add_file_content') %>
|
<%= t('seminar.email_add_file_content') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
|
|
@ -6,3 +6,4 @@
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= t('seminar.email_edit_file_content') %>
|
<%= t('seminar.email_edit_file_content') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= (@data['extra_text'] rescue "").to_s.html_safe %>
|
|
@ -0,0 +1,47 @@
|
||||||
|
<style>
|
||||||
|
.signup_infos td:first-child {
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<%
|
||||||
|
data2 = @seminar.seminar_submission_field_sets.select{|v| v.field_name=='description'}[0]
|
||||||
|
show2 = !(data2.disabled) rescue false
|
||||||
|
name2 = data2['name'][I18n.locale]
|
||||||
|
description = ""
|
||||||
|
if show2
|
||||||
|
description = @con.description.to_s
|
||||||
|
if @seminar.enable_summary_choice
|
||||||
|
if (@con.description.to_s.to_i.to_s == @con.description)
|
||||||
|
description = @seminar.summary_chioices[@con.description.to_i] rescue @con.description
|
||||||
|
else
|
||||||
|
description = @con.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue @con.description
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
seminar_submission_fields = @seminar.seminar_submission_fields.where(:disabled=>false)
|
||||||
|
%>
|
||||||
|
<h3><%= @seminar.title rescue nil %></h3>
|
||||||
|
<table id="signup_infos">
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<%= I18n.t('seminar_signup.file_name') %>:
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="<%= @host_url %><%= @con.file.url %>" target="_blank" download="<%= @con.disp_filename %>"><%= @con.disp_filename %></a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% if show2 %>
|
||||||
|
<tr>
|
||||||
|
<td><%= name2.present? ? "#{name2}:" : '' %> </td>
|
||||||
|
<td><%= description.html_safe %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% seminar_submission_fields.each do |sf| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= sf.title.present? ? "#{sf.title}:" : '' %> </td>
|
||||||
|
<td><%= sf.seminar_submission_values.where(:seminar_signup_contribute_id=>@con.id).first.get_value_by_locale(I18n.locale) rescue "" %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
|
@ -54,17 +54,23 @@
|
||||||
@seminar_signup.seminar_signup_contributes.each do |seminar_signup_contribute|
|
@seminar_signup.seminar_signup_contributes.each do |seminar_signup_contribute|
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= seminar_signup_contribute.title %></td>
|
<% if show1 %>
|
||||||
<% description = seminar_signup_contribute.description.to_s %>
|
<td><%= seminar_signup_contribute.title %></td>
|
||||||
<% if @seminar.enable_summary_choice
|
<% end %>
|
||||||
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
<% if show2 %>
|
||||||
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
|
<% description = seminar_signup_contribute.description.to_s %>
|
||||||
else
|
<% if @seminar.enable_summary_choice
|
||||||
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
if (seminar_signup_contribute.description.to_s.to_i.to_s == seminar_signup_contribute.description)
|
||||||
end
|
description = @seminar.summary_chioices[seminar_signup_contribute.description.to_i] rescue seminar_signup_contribute.description
|
||||||
end %>
|
else
|
||||||
<td><%= description.html_safe %></td>
|
description = seminar_signup_contribute.description.map{|i| @seminar.summary_chioices[i.to_i] rescue "" }.join("<br>") rescue seminar_signup_contribute.description
|
||||||
<td><%= link_to File.basename(seminar_signup_contribute.file.path), seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text} if seminar_signup_contribute.file.file %></td>
|
end
|
||||||
|
end %>
|
||||||
|
<td><%= description.html_safe %></td>
|
||||||
|
<% end %>
|
||||||
|
<% if show3 %>
|
||||||
|
<td><%= link_to seminar_signup_contribute.disp_filename, seminar_signup_contribute.file.url, {:target => '_blank', :title => Nokogiri::HTML(description.gsub("<br>"," , ")).text, :download=>seminar_signup_contribute.disp_filename} if seminar_signup_contribute.file.file %></td>
|
||||||
|
<% end %>
|
||||||
<% if seminar_submission_field %>
|
<% if seminar_submission_field %>
|
||||||
<td><%= seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field=>seminar_submission_field).first.get_value_by_locale(I18n.locale) %></td>
|
<td><%= seminar_signup_contribute.seminar_submission_values.where(:seminar_submission_field=>seminar_submission_field).first.get_value_by_locale(I18n.locale) %></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
Loading…
Reference in New Issue