From aef1cb31fa3471f2f36ecb2d49f4e26e96a0accc Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Thu, 20 Nov 2014 15:55:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=AE=BE=E7=BD=AE=E5=B8=96=E5=AD=90=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E8=80=85=E5=8F=AF=E4=BF=AE=E6=94=B9=E3=80=81=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=B8=96=E5=AD=90=202.=E8=AE=BE=E7=BD=AE=E6=96=B0?= =?UTF-8?q?=E5=BB=BA=E3=80=81=E4=BF=AE=E6=94=B9=E5=B8=96=E5=AD=90=E6=97=B6?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E6=9C=80=E5=A4=A7=E9=95=BF=E5=BA=A6=203.?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9D=83=E9=99=90=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/forum.rb | 2 +- app/models/memo.rb | 4 ++-- app/views/forums/_form.html.erb | 6 +++-- app/views/forums/index.html.erb | 24 ++++++++++++++------ app/views/forums/show.html.erb | 23 +++++++++++++------ app/views/memos/edit.html.erb | 39 ++++++++++++++++++++++----------- 6 files changed, 66 insertions(+), 32 deletions(-) diff --git a/app/models/forum.rb b/app/models/forum.rb index e0592723e..61ba528a0 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -30,7 +30,7 @@ class Forum < ActiveRecord::Base def destroyable_by? user # user && user.logged? && Forum.find(self.forum_id).creator_id == user.id || user.admin? - user.admin? + self.creator == user || user.admin? end # Updates topic_count, memo_count and last_memo_id attributes for +board_id+ diff --git a/app/models/memo.rb b/app/models/memo.rb index b02564834..847795b4f 100644 --- a/app/models/memo.rb +++ b/app/models/memo.rb @@ -88,11 +88,11 @@ class Memo < ActiveRecord::Base def editable_by? user # user && user.logged? || (self.author == usr && usr.allowed_to?(:edit_own_messages, project)) - user.admin? + (user && self.author == user) || user.admin? end def destroyable_by? user - (user && user.logged? && (Forum.find(self.forum_id).creator_id == user.id) ) || user.admin? + (user && self.author == user) || user.admin? #self.author == user || user.admin? end diff --git a/app/views/forums/_form.html.erb b/app/views/forums/_form.html.erb index 9b3519b05..ac9c298ff 100644 --- a/app/views/forums/_form.html.erb +++ b/app/views/forums/_form.html.erb @@ -15,7 +15,7 @@ <% end %>
(<%= l(:label_forums_max_length) %>)
++ (<%= l(:label_forums_max_length) %>) +
公共贴吧 | -<%= l(:label_user_location) %> : | ++ + <%= l(:label_user_location) %> : + + | - <% if User.current.logged? %> - <%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %> - <% end %> - + <% if User.current.logged? %> + <%= link_to( l(:label_forum_new), new_forum_path, :class => 'icon icon-add') %> + <% end %> |
@@ -24,8 +27,15 @@
|
<%= link_to request.host()+"/forums", forums_path %> | -<%= link_to l(:field_homepage), home_path %> > <%= link_to "公共贴吧", forums_path %> | ++ + <%= link_to request.host()+"/forums", forums_path %> + + | ++ <%= link_to l(:field_homepage), home_path %> > + <%= link_to "公共贴吧", forums_path %> + |