This commit is contained in:
jomo
2014-04-21 01:46:31 +02:00
parent 9f120fde22
commit 67d9cbbecb
4 changed files with 4 additions and 6 deletions
+1 -3
View File
@@ -4,8 +4,6 @@ class Forumthread < ActiveRecord::Base
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id" belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
has_many :threadreplies has_many :threadreplies
validates_presence_of :title, :author, :forum validates_presence_of :title, :author, :forum
validates_presence_of :content validates_presence_of :content
validates_length_of :content, in: 5..10000 validates_length_of :content, in: 5..10000
@@ -37,6 +35,6 @@ class Forumthread < ActiveRecord::Base
end end
def can_write?(user) def can_write?(user)
forum.can_write?(user) && (!locked? || mod?) forum.can_write?(user) && (!locked? || user.mod?)
end end
end end
+1 -1
View File
@@ -3,7 +3,7 @@
<%= link_to(image_tag(@thread.author.avatar_url(64), class: "avatar"), @thread.author, title: @thread.author.ign) %> <%= link_to(image_tag(@thread.author.avatar_url(64), class: "avatar"), @thread.author, title: @thread.author.ign) %>
<div class="header"> <div class="header">
<%= render partial: "users/username", locals: { user: @thread.author } %> <time><%= link_to @thread.created_at.strftime("%e. %b %Y, %H:%m"), p %></time> <%= render partial: "users/username", locals: { user: @thread.author } %> <time><%= link_to @thread.created_at.strftime("%e. %b %Y, %H:%m"), p %></time>
<%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if mod? %> <%= link_to "edit", edit_forumthread_path( @thread), class: "editlink" if (@thread.author.is?(current_user) || mod?) %>
</div> </div>
<div class="items"> <div class="items">
<div class="item content"> <div class="item content">
@@ -3,7 +3,7 @@
Hi <%= @user.name %>! Hi <%= @user.name %>!
<p>Thank you for registering on Redstoner.com!</p> <p>Thank you for registering on Redstoner.com!</p>
<p>To use your account, you need to <%= link_to "confirm", confirm_user_path(@user, code: @user.email_token, only_path: false) %>your email address.</p> <p>To use your account, you need to <%= link_to "confirm", confirm_user_path(@user, code: @user.email_token, only_path: false) %> your email address.</p>
<div> <div>
+1 -1
View File
@@ -2,7 +2,7 @@
<%= link_to(image_tag(reply.author.avatar_url(64), class: "avatar"), reply.author, title: reply.author.ign) %> <%= link_to(image_tag(reply.author.avatar_url(64), class: "avatar"), reply.author, title: reply.author.ign) %>
<div class="header"> <div class="header">
<%= render partial: "users/username", locals: { user: reply.author } %> <time><%= link_to reply.created_at.strftime("%e. %b %Y, %H:%m"), "#reply-#{reply.id}" %></time> <%= render partial: "users/username", locals: { user: reply.author } %> <time><%= link_to reply.created_at.strftime("%e. %b %Y, %H:%m"), "#reply-#{reply.id}" %></time>
<%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || thread.author.is?(current_user) %> <%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || reply.thread.author.is?(current_user) %>
</div> </div>
<div class="items"> <div class="items">
<div class="item content"> <div class="item content">