download access
This commit is contained in:
parent
0416902cde
commit
5cae2010c1
|
@ -34,9 +34,9 @@ class Memo < ActiveRecord::Base
|
|||
"forum_id",
|
||||
"last_memo_id",
|
||||
"lock",
|
||||
"sticky",
|
||||
"parent_id",
|
||||
"replies_count",
|
||||
"sticky"
|
||||
"replies_count"
|
||||
|
||||
after_create :add_author_as_watcher, :reset_counters!
|
||||
# after_update :update_memos_forum
|
||||
|
@ -67,10 +67,6 @@ class Memo < ActiveRecord::Base
|
|||
end
|
||||
forum.reset_counters!
|
||||
end
|
||||
|
||||
def sticky=(arg)
|
||||
write_attribute :sticky, (arg == true || arg.to_s == 'true' ? true : false)
|
||||
end
|
||||
|
||||
def sticky?
|
||||
sticky == 1
|
||||
|
@ -90,10 +86,14 @@ class Memo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def destroyable_by? user
|
||||
user && user.logged? && Forum.find(self.forum_id).creator_id == user.id || user.admin?
|
||||
(user && user.logged? && (Forum.find(self.forum_id).creator_id == user.id) ) || user.admin?
|
||||
#self.author == user || user.admin?
|
||||
end
|
||||
|
||||
def deleted_attach_able_by? user
|
||||
(user && user.logged? && (self.author == user) ) || user.admin?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def add_author_as_watcher
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
<%= raw @memo.content %>
|
||||
<p>
|
||||
<% if @memo.attachments.any?%>
|
||||
<% options = {:author => true} %>
|
||||
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => @memo.attachments, :options => options} %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<!-- <div class="wiki">< %=h reply.content.html_safe %></div> -->
|
||||
<p>
|
||||
<% if reply.attachments.any?%>
|
||||
<% options = {:author => true, :deletable => false} %>
|
||||
<% options = {:author => true, :deletable => reply.deleted_attach_able_by?(User.current) } %>
|
||||
<%= render :partial => 'attachments/links', :locals => {:attachments => reply.attachments, :options => options} %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
|
Loading…
Reference in New Issue