This commit is contained in:
BOHUNG 2020-03-19 17:30:30 +08:00
parent 31feee3e79
commit 365eefb1ee
2 changed files with 12 additions and 12 deletions

View File

@ -6,7 +6,7 @@ class Writing
belongs_to :member_profile
field :lab_title, :as=>:slug_title, localize: true
field :writing_title, :as=>:slug_title, localize: true
field :location, localize: true
field :participating_professor, localize: true
field :participating_student, localize: true
@ -24,8 +24,8 @@ class Writing
# paginates_per 10
has_many :lab_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :lab_files, :allow_destroy => true
has_many :writing_files, :autosave => true, :dependent => :destroy
accepts_nested_attributes_for :writing_files, :allow_destroy => true
before_validation :add_http
@ -45,7 +45,7 @@ class Writing
fields_to_show = [
"year",
"lab_title",
"writing_title",
"location"
]
@ -70,7 +70,7 @@ class Writing
pd_data = []
fields_to_show.collect do |t|
if t == "lab_title"
if t == "writing_title"
pd_data << { "data_title" => "<a href='#{OrbitHelper.url_to_plugin_show(p.to_param,'personal_writing')}' title='#{p.send(t)}' target='_blank'>#{p.send(t)}" }
else
pd_data << { "data_title" => p.send(t) }
@ -93,9 +93,9 @@ class Writing
value = I18n.t(self.language) rescue ""
when "file"
files = []
self.lab_files.each do |lab_file|
url = lab_file.file.url
title = (lab_file.title.blank? ? File.basename(lab_file.file.path) : lab_file.title)
self.writing_files.each do |writing_file|
url = writing_file.file.url
title = (writing_file.title.blank? ? File.basename(writing_file.file.path) : writing_file.title)
files << "<li><a href='#{url}'' target='_blank'>#{title}</li>"
end
value = files.join("")

View File

@ -1,12 +1,12 @@
<% @labs.each do |writing| %>
<% @writings.each do |writing| %>
<tr id="<%= dom_id writing %>" class="<%= writing.is_hidden ? "checkHide" : "" %>">
<td><%= writing.year %></td>
<td>
<%= link_to writing.lab_title, OrbitHelper.url_to_plugin_show(writing.to_param,'personal_writing'), target: "blank"%>
<%= link_to writing.writing_title, OrbitHelper.url_to_plugin_show(writing.to_param,'personal_writing'), target: "blank"%>
<div class="quick-edit">
<ul class="nav nav-pills hide">
<li><%= link_to t('edit'), edit_admin_lab_path(writing) %></li>
<li><%= link_to t(:delete_), admin_lab_path(id: writing.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
<li><%= link_to t('edit'), edit_admin_writing_path(writing) %></li>
<li><%= link_to t(:delete_), admin_writing_path(id: writing.id), method: :delete, remote: true, data: { confirm: 'Are you sure?' } %></li>
</ul>
</div>
</td>