cleaned up, added threadreplies, added info
This commit is contained in:
@@ -1,34 +1,24 @@
|
|||||||
class BlogpostsController < ApplicationController
|
class BlogpostsController < ApplicationController
|
||||||
|
|
||||||
|
before_filter :set_post, except: [:index, :new, :create]
|
||||||
|
before_filter :auth, except: [:index, :show]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@posts = Blogpost.all.reverse
|
@posts = Blogpost.all.reverse
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@post = Blogpost.find(params[:id])
|
|
||||||
@comment = Comment.new(blogpost: @post)
|
@comment = Comment.new(blogpost: @post)
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
if mod?
|
|
||||||
@post = Blogpost.new
|
@post = Blogpost.new
|
||||||
else
|
|
||||||
flash[:alert] = "You are not allowed to create a new post!"
|
|
||||||
redirect_to blogposts_path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@post = Blogpost.find(params[:id])
|
|
||||||
if mod?
|
|
||||||
else
|
|
||||||
flash[:alert] = "You are not allowed to edit this post!"
|
|
||||||
redirect_to @post
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if mod?
|
|
||||||
@post = Blogpost.new(post_params)
|
@post = Blogpost.new(post_params)
|
||||||
@post.user_author = current_user
|
@post.user_author = current_user
|
||||||
if @post.save
|
if @post.save
|
||||||
@@ -37,36 +27,25 @@ class BlogpostsController < ApplicationController
|
|||||||
flash[:alert] = "Error creating blogpost"
|
flash[:alert] = "Error creating blogpost"
|
||||||
render action: "new"
|
render action: "new"
|
||||||
end
|
end
|
||||||
else
|
|
||||||
flash[:alert] = "You are not allowed to create new posts"
|
|
||||||
redirect_to blog_path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@post = Blogpost.find(params[:id])
|
|
||||||
if mod? || @comment.author.is?(current_user)
|
|
||||||
@post.user_editor = current_user
|
@post.user_editor = current_user
|
||||||
if @post.update_attributes(post_params([:user_editor]))
|
@post.attributes = post_params([:user_editor])
|
||||||
|
if @post.save
|
||||||
redirect_to @post, notice: 'Post has been updated.'
|
redirect_to @post, notice: 'Post has been updated.'
|
||||||
else
|
else
|
||||||
flash[:alert] = "There was a problem while updating the post"
|
flash[:alert] = "There was a problem while updating the post"
|
||||||
render action: "edit"
|
render action: "edit"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@post = Blogpost.find(params[:id])
|
|
||||||
if mod?
|
|
||||||
if @post.destroy
|
if @post.destroy
|
||||||
flash[:notice] = "Post deleted!"
|
flash[:notice] = "Post deleted!"
|
||||||
else
|
else
|
||||||
flash[:alert] = "There was a problem while deleting this Post"
|
flash[:alert] = "There was a problem while deleting this Post"
|
||||||
end
|
end
|
||||||
else
|
|
||||||
flash[:alert] = "You are not allowed to delete this Post"
|
|
||||||
end
|
|
||||||
redirect_to blogposts_path
|
redirect_to blogposts_path
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -78,4 +57,18 @@ class BlogpostsController < ApplicationController
|
|||||||
a += add
|
a += add
|
||||||
params.require(:blogpost).permit(a)
|
params.require(:blogpost).permit(a)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_post
|
||||||
|
if params[:id]
|
||||||
|
@post = Blogpost.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def auth
|
||||||
|
unless mod?
|
||||||
|
flash[:alert] = "You are not allowed to edit posts!"
|
||||||
|
redirect_to @post ? @post : blogposts_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -29,7 +29,9 @@ class CommentsController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
@comment = Comment.find(params[:id])
|
@comment = Comment.find(params[:id])
|
||||||
if mod? || @comment.author.is?(current_user)
|
if mod? || @comment.author.is?(current_user)
|
||||||
if @comment.update_attributes(comment_params)
|
@comment.user_editor = current_user
|
||||||
|
@comment.attributes = comment_params
|
||||||
|
if @comment.save
|
||||||
flash[:notice] = "Comment updated!"
|
flash[:notice] = "Comment updated!"
|
||||||
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}"
|
redirect_to blogpost_path(@comment.blogpost) + "#comment-#{@comment.id}"
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -12,7 +12,8 @@ class ForumthreadsController < ApplicationController
|
|||||||
def update
|
def update
|
||||||
if mod? || @thread.author.is?(current_user)
|
if mod? || @thread.author.is?(current_user)
|
||||||
@thread.user_editor = current_user
|
@thread.user_editor = current_user
|
||||||
if @thread.update_attributes thread_params([:user_editor])
|
@thread.attributes = thread_params([:user_editor])
|
||||||
|
if @thread.save
|
||||||
redirect_to @thread, notice: 'Post has been updated.'
|
redirect_to @thread, notice: 'Post has been updated.'
|
||||||
else
|
else
|
||||||
flash[:alert] = "There was a problem while updating the post"
|
flash[:alert] = "There was a problem while updating the post"
|
||||||
|
|||||||
68
app/controllers/info_controller.rb
Normal file
68
app/controllers/info_controller.rb
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
class InfoController < ApplicationController
|
||||||
|
|
||||||
|
before_filter :set_info, except: [:index, :new, :create]
|
||||||
|
before_filter :auth, except: [:index, :show]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@info = Info.all.sort_by{|i| i.title}
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@info = Info.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def edit
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@info = Info.new(info_params)
|
||||||
|
if @info.save
|
||||||
|
redirect_to @info, notice: 'Info has been created.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "Error creating info"
|
||||||
|
render action: "new"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@info.attributes = info_params()
|
||||||
|
if @info.save
|
||||||
|
redirect_to @info, notice: 'Info has been updated.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "There was a problem while updating the info"
|
||||||
|
render action: "edit"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
if @info.destroy
|
||||||
|
flash[:notice] = "Info deleted!"
|
||||||
|
else
|
||||||
|
flash[:alert] = "There was a problem while deleting this info"
|
||||||
|
end
|
||||||
|
redirect_to info_index_path
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def info_params(add = [])
|
||||||
|
a = [:title, :content]
|
||||||
|
a += add
|
||||||
|
params.require(:info).permit(a)
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_info
|
||||||
|
@info = Info.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def auth
|
||||||
|
unless mod?
|
||||||
|
flash[:alert] = "You are not allowed to edit info!"
|
||||||
|
redirect_to @info ? @info : info_index_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,3 +1,65 @@
|
|||||||
class ThreadrepliesController < ApplicationController
|
class ThreadrepliesController < ApplicationController
|
||||||
|
|
||||||
|
def edit
|
||||||
|
@reply = Threadreply.find(params[:id])
|
||||||
|
if mod? || @reply.author.is?(current_user)
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to edit this reply"
|
||||||
|
redirect_to @reply.thread
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
thread = Forumthread.find(params[:forumthread_id])
|
||||||
|
if thread.can_write?(current_user)
|
||||||
|
@reply = Threadreply.new(reply_params)
|
||||||
|
@reply.user_author = current_user
|
||||||
|
@reply.forumthread = thread
|
||||||
|
if @reply.save
|
||||||
|
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}", notice: 'Reply created!'
|
||||||
|
else
|
||||||
|
flash[:alert] = "Could not create reply."
|
||||||
|
redirect_to Blogpost.find(params[:forumthread_id])
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to create replies."
|
||||||
|
redirect_to Blogpost.find(params[:forumthread_id])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@reply = Threadreply.find(params[:id])
|
||||||
|
if mod? || @reply.author.is?(current_user)
|
||||||
|
if @reply.update_attributes(reply_params)
|
||||||
|
flash[:notice] = "Reply updated!"
|
||||||
|
redirect_to forumthread_path(@reply.thread) + "#reply-#{@reply.id}"
|
||||||
|
else
|
||||||
|
flash[:alert] = "There was a problem while updating your reply"
|
||||||
|
render action: "edit"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to edit this reply"
|
||||||
|
redirect_to @reply.thread
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@reply = Threadreply.find(params[:id])
|
||||||
|
if mod? || @reply.author.is?(current_user)
|
||||||
|
if @reply.destroy
|
||||||
|
flash[:notice] = "Reply deleted!"
|
||||||
|
else
|
||||||
|
flash[:alert] = "There was a problem while deleting this reply"
|
||||||
|
end
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to delete this reply"
|
||||||
|
end
|
||||||
|
redirect_to @reply.thread
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def reply_params
|
||||||
|
params.require(:threadreply).permit(:content)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
class Comment < ActiveRecord::Base
|
class Comment < ActiveRecord::Base
|
||||||
|
|
||||||
|
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
|
||||||
|
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
|
||||||
|
|
||||||
validates_presence_of :content, :author, :blogpost
|
validates_presence_of :content, :author, :blogpost
|
||||||
validates_length_of :content, in: 4..1000
|
validates_length_of :content, in: 4..1000
|
||||||
|
|||||||
6
app/models/info.rb
Normal file
6
app/models/info.rb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class Info < ActiveRecord::Base
|
||||||
|
self.table_name = "info"
|
||||||
|
|
||||||
|
validates_presence_of :title, :content
|
||||||
|
|
||||||
|
end
|
||||||
@@ -5,4 +5,4 @@
|
|||||||
<%= f.text_area :content, :label => false, input_html: {class: "full-width vertical"} %>
|
<%= f.text_area :content, :label => false, input_html: {class: "full-width vertical"} %>
|
||||||
<p><%= f.submit "Update Post", class: "btn blue left" %></p>
|
<p><%= f.submit "Update Post", class: "btn blue left" %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p><%= button_to "Delete post", @post, :method => "delete", :confirm => "Delete post & comments forever?", class: "btn red right" %></p>
|
<p><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %></p>
|
||||||
@@ -4,4 +4,4 @@
|
|||||||
<%= f.input :content, label: false, as: "text", placeholder: "Comment" %>
|
<%= f.input :content, label: false, as: "text", placeholder: "Comment" %>
|
||||||
<p><%= f.submit "Update Comment", class: "btn blue left" %></p>
|
<p><%= f.submit "Update Comment", class: "btn blue left" %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", confirm: "Delete comment forever?", class: "btn red right" %></p>
|
<p><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %></p>
|
||||||
@@ -34,4 +34,4 @@
|
|||||||
</table>
|
</table>
|
||||||
<p><%= f.submit "Update group", class: "btn blue" %></p>
|
<p><%= f.submit "Update group", class: "btn blue" %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<p><%= button_to "Delete group", @post, :method => "delete", :confirm => "Delete group?\nForums + Threads will not be accessible!", class: "btn red right" %></p>
|
<p><%= button_to "Delete group", @post, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right" %></p>
|
||||||
@@ -1,8 +1,22 @@
|
|||||||
<h1>Edit thread</h1>
|
<h1>Edit thread</h1>
|
||||||
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
|
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → New thread
|
||||||
<%= simple_form_for [@thread.forum, @thread] do |f|%>
|
<%= form_for @thread do |f|%>
|
||||||
<%= f.input :title, label: false %>
|
<table>
|
||||||
<%= f.text_area :content, label: false, input_html: {class: "full-width vertical"} %>
|
<% if mod? %>
|
||||||
<%= f.submit "Update thread", class: "btn blue left" %>
|
<tr>
|
||||||
|
<td><%= f.label :sticky %></td>
|
||||||
|
<td><%= f.check_box :sticky %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td><%= f.label :locked %></td>
|
||||||
|
<td><%= f.check_box :locked %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
<div id="form_inputs">
|
||||||
|
<%= f.text_field :title, placeholder: "Title" %>
|
||||||
|
</div>
|
||||||
|
<%= f.text_area :content, placeholder: "Text" %>
|
||||||
|
<p><%= f.submit "Update thread", class: "btn blue" %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= button_to "Delete thread", [@thread.forum, @thread], :method => "delete", :confirm => "Delete thread & comments forever?", class: "btn red right" %>
|
<%= button_to "Delete thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %>
|
||||||
@@ -14,11 +14,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="replies">
|
<div id="replies">
|
||||||
<h3><%= "#{pluralize(@thread.replies.length, 'reply')}." %></h3>
|
<h3><%= "#{pluralize(@thread.replies.length, 'reply')}." %></h3>
|
||||||
<% @thread.replies.each do |c| %>
|
<% @thread.replies.each do |reply| %>
|
||||||
Reply<%# render "threadreplies/reply", :c => c %>
|
<%= render partial: "threadreplies/reply", locals: {reply: reply} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% unless @thread.can_read?(current_user) %>
|
<% if @thread.can_write?(current_user) %>
|
||||||
new
|
<%= render partial: "threadreplies/new", locals: {reply: Threadreply.new(forumthread: @thread)} %>
|
||||||
<%# render "threadreplies/new" %>
|
<% else %>
|
||||||
|
You cannot reply here.
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
7
app/views/info/edit.html.erb
Normal file
7
app/views/info/edit.html.erb
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<h1>Edit Info</h1>
|
||||||
|
<%= form_for @info do |f|%>
|
||||||
|
<%= f.text_field :title, :label => false %>
|
||||||
|
<%= f.text_area :content, :label => false, input_html: {class: "full-width vertical"} %>
|
||||||
|
<p><%= f.submit "Update Info", class: "btn blue left" %></p>
|
||||||
|
<% end %>
|
||||||
|
<p><%= button_to "Delete Info", @info, method: "delete", data: {confirm: "Delete Info forever?"}, class: "btn red right" %></p>
|
||||||
9
app/views/info/index.html.erb
Normal file
9
app/views/info/index.html.erb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<h1>Info</h1>
|
||||||
|
<ul>
|
||||||
|
<% @info.each do |info| %>
|
||||||
|
<li><%= link_to info.title, info %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
<% if mod? %>
|
||||||
|
<%= link_to "New Info", new_info_path, class: "btn blue" %>
|
||||||
|
<% end %>
|
||||||
6
app/views/info/new.html.erb
Normal file
6
app/views/info/new.html.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<h1>New Info</h1>
|
||||||
|
<%= form_for @info, url: info_index_path do |f|%>
|
||||||
|
<%= f.text_field :title, placeholder: "Title" %>
|
||||||
|
<%= f.text_area :content, placeholder: "Text", input_html: {class: "full-width vertical"} %>
|
||||||
|
<p><%= f.submit "Create Info", class: "btn blue left" %></p>
|
||||||
|
<% end %>
|
||||||
3
app/views/info/show.html.erb
Normal file
3
app/views/info/show.html.erb
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<%= link_to "Info", info_index_path %> → <%= @info.title %>
|
||||||
|
<h1><%= @info.title %></h1>
|
||||||
|
<div class="post"><%= render_md(@info.content).html_safe %></div>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<ul>
|
<ul>
|
||||||
<%= link_to statics_path do %><li>Home</li><% end %>
|
<%= link_to statics_path do %><li>Home</li><% end %>
|
||||||
<%= link_to blogposts_path do %><li>News</li><% end %>
|
<%= link_to blogposts_path do %><li>News</li><% end %>
|
||||||
<%= link_to root_path do %><li>Info</li><% end %>
|
<%= link_to info_index_path do %><li>Info</li><% end %>
|
||||||
<%= link_to forums_path do %><li>Forums</li><% end %>
|
<%= link_to forums_path do %><li>Forums</li><% end %>
|
||||||
<%= link_to users_path do %><li>Users</li><% end %>
|
<%= link_to users_path do %><li>Users</li><% end %>
|
||||||
<%= link_to donate_statics_path do %><li>Donate</li><% end %>
|
<%= link_to donate_statics_path do %><li>Donate</li><% end %>
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
Hi <%= @user.name %>!
|
<div style="font-family: 'Oswald','Calibri','Arial','DejaVu Sans','Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif; background: #F2F2F2">
|
||||||
|
<div style="color: rgb(63, 63, 63); width: 600px; max-width: 100%; padding: 2em; margin: auto">
|
||||||
|
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>
|
||||||
|
|
||||||
<% if @mcpw %>
|
<div>
|
||||||
<div>
|
|
||||||
|
<% if @mcpw %>
|
||||||
|
<div>
|
||||||
<p>
|
<p>
|
||||||
<font color="red">
|
<font color="red">
|
||||||
<b>NEVER USE THE SAME PASSWORD TWICE!</b>
|
<b>NEVER USE THE SAME PASSWORD TWICE!</b>
|
||||||
@@ -12,21 +16,28 @@ Hi <%= @user.name %>!
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<font color="red">
|
<font color="red">
|
||||||
You used your minecraft password on our website. We could have stolen it easily!<br>
|
You used your minecraft password on our website. <b>Do not do that</b>. It's just stupid.
|
||||||
</font>
|
</font>
|
||||||
<i>(But we didn't)</i>
|
|
||||||
</p>
|
</p>
|
||||||
<% end %>
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
<p>Please click this link to confirm your registration:
|
<p>Please click this link to confirm your registration:
|
||||||
<div style="background-color: #eeeeee; padding: 1em; margin: 0; text-align: center;" width="100%">
|
</p>
|
||||||
|
<div width="100%" style="background-color: #ddd; padding: 1em; margin: 0; text-align: center;">
|
||||||
<%= link_to "confirm registration", confirm_user_path(@user, code: @user.email_token, only_path: false), style: "text-decoration: none; color: #f2f2f2; padding: 0.5em 2em; background-color: #4096EE; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; display: inline-block; text-transform: uppercase;" %>
|
<%= link_to "confirm registration", confirm_user_path(@user, code: @user.email_token, only_path: false), style: "text-decoration: none; color: #f2f2f2; padding: 0.5em 2em; background-color: #4096EE; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; display: inline-block; text-transform: uppercase;" %>
|
||||||
</div>
|
</div>
|
||||||
</p>
|
<p></p>
|
||||||
|
|
||||||
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_path(role: "staff", only_path: false) %> in-game.</p>
|
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_path(role: "staff", only_path: false) %> in-game.</p>
|
||||||
<p>Your Redstoner team</p>
|
<p>Your Redstoner team</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
<i style="color: #555;">If you did not sign up on redstoner.com you can safely ignore this email</i>
|
</div>
|
||||||
|
<div style="background: none repeat scroll 0% 0% rgb(68, 68, 68); width: 100%; padding: 2em; color: rgb(255, 255, 255); margin:auto; text-align: center;">
|
||||||
|
<p><i>If you did not sign up on redstoner.com you can safely ignore this email!</i>
|
||||||
|
</p>
|
||||||
|
<p>You can contact us via: <%= link_to "Website", "root_path" %> | <%= link_to "Twitter", "https://twitter.com/RedstonerServer" %> | <%= link_to "Google+", "https://google.com/+Redstoner" | <%= link_to "Email", "mailto:redstonerserver+website@gmail.com" %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
4
app/views/threadreplies/_new.html.erb
Normal file
4
app/views/threadreplies/_new.html.erb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<%= form_for [reply.thread, reply] do |f| %>
|
||||||
|
<%= f.text_area :content, placeholder: "Text" %>
|
||||||
|
<p><%= f.submit "Reply", class: "btn blue" %></p>
|
||||||
|
<% end %>
|
||||||
12
app/views/threadreplies/_reply.html.erb
Normal file
12
app/views/threadreplies/_reply.html.erb
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<div class="item-group thread-reply with-avatar" id="reply-<%= reply.id %>">
|
||||||
|
<%= link_to(image_tag(reply.author.avatar_url(64), class: "avatar"), reply.author, title: reply.author.ign) %>
|
||||||
|
<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>
|
||||||
|
<%= link_to "edit", edit_forumthread_threadreply_path(reply.thread, reply), class: "editlink" if mod? || thread.author.is?(current_user) %>
|
||||||
|
</div>
|
||||||
|
<div class="items">
|
||||||
|
<div class="item content">
|
||||||
|
<%= render_md(reply.content).html_safe %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
6
app/views/threadreplies/edit.html.erb
Normal file
6
app/views/threadreplies/edit.html.erb
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<%= link_to @reply.thread.forum.group, forumgroup_path(@reply.thread.forum.group) %> → <%= link_to @reply.thread.forum, @reply.thread.forum %> → <%= link_to @reply.thread %> → Edit reply
|
||||||
|
<h1>Edit reply</h1>
|
||||||
|
<%= form_for [@reply.thread, @reply] do |f| %>
|
||||||
|
<%= f.text_area :content, placeholder: "Text" %>
|
||||||
|
<p><%= f.submit "Reply", class: "btn blue" %></p>
|
||||||
|
<% end %>
|
||||||
@@ -11,7 +11,7 @@ Site::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :roles
|
resources :info
|
||||||
|
|
||||||
resources :users do
|
resources :users do
|
||||||
member do
|
member do
|
||||||
@@ -23,18 +23,20 @@ Site::Application.routes.draw do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources :forums, path: 'forums'
|
|
||||||
resources :forumthreads, path: '/forums/threads'
|
|
||||||
resources :forumgroups, path: 'forums/groups'
|
resources :forumgroups, path: 'forums/groups'
|
||||||
|
resources :forums, path: 'forums'
|
||||||
|
resources :forumthreads, path: '/forums/threads' do
|
||||||
|
resources :threadreplies, path: '/forums/threads/replies'
|
||||||
|
end
|
||||||
|
|
||||||
get '/status' => 'status#show'
|
# get '/status' => 'status#show'
|
||||||
|
|
||||||
get "logout" => 'sessions#destroy'
|
|
||||||
get 'login' => 'sessions#new'
|
get 'login' => 'sessions#new'
|
||||||
get 'signup' => 'users#new'
|
|
||||||
post 'login' => 'sessions#create'
|
post 'login' => 'sessions#create'
|
||||||
|
get "logout" => 'sessions#destroy'
|
||||||
|
get 'signup' => 'users#new'
|
||||||
|
|
||||||
post 'paypal' => 'paypal#create'
|
# post 'paypal' => 'paypal#create'
|
||||||
|
|
||||||
root to: 'statics#index'
|
root to: 'statics#index'
|
||||||
end
|
end
|
||||||
8
db/migrate/11_create_info.rb
Normal file
8
db/migrate/11_create_info.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class CreateInfo < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :info do |t|
|
||||||
|
t.string :title
|
||||||
|
t.text :content
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
85
db/schema.rb
85
db/schema.rb
@@ -9,36 +9,36 @@
|
|||||||
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
||||||
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 10) do
|
ActiveRecord::Schema.define(version: 11) do
|
||||||
|
|
||||||
create_table "blogposts", :force => true do |t|
|
create_table "blogposts", force: true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "content"
|
t.text "content"
|
||||||
t.integer "user_author_id"
|
t.integer "user_author_id"
|
||||||
t.integer "user_editor_id"
|
t.integer "user_editor_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "comments", :force => true do |t|
|
create_table "comments", force: true do |t|
|
||||||
t.text "content"
|
t.text "content"
|
||||||
t.integer "user_author_id"
|
t.integer "user_author_id"
|
||||||
t.integer "user_editor_id"
|
t.integer "user_editor_id"
|
||||||
t.integer "blogpost_id"
|
t.integer "blogpost_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "forumgroups", :force => true do |t|
|
create_table "forumgroups", force: true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.integer "position"
|
t.integer "position"
|
||||||
t.integer "role_read_id"
|
t.integer "role_read_id"
|
||||||
t.integer "role_write_id"
|
t.integer "role_write_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "forums", :force => true do |t|
|
create_table "forums", force: true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.integer "position"
|
t.integer "position"
|
||||||
t.integer "role_read_id"
|
t.integer "role_read_id"
|
||||||
@@ -46,67 +46,72 @@ ActiveRecord::Schema.define(:version => 10) do
|
|||||||
t.integer "forumgroup_id"
|
t.integer "forumgroup_id"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "forumthreads", :force => true do |t|
|
create_table "forumthreads", force: true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "content"
|
t.text "content"
|
||||||
t.boolean "sticky", :default => false
|
t.boolean "sticky", default: false
|
||||||
t.boolean "locked", :default => false
|
t.boolean "locked", default: false
|
||||||
t.integer "user_author_id"
|
t.integer "user_author_id"
|
||||||
t.integer "user_editor_id"
|
t.integer "user_editor_id"
|
||||||
t.integer "forum_id"
|
t.integer "forum_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "register_tokens", :primary_key => "uuid", :force => true do |t|
|
create_table "info", force: true do |t|
|
||||||
t.string "token", :limit => 6, :null => false
|
t.string "title"
|
||||||
t.string "email", :null => false
|
t.text "content"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "roles", :force => true do |t|
|
create_table "register_tokens", primary_key: "uuid", force: true do |t|
|
||||||
|
t.string "token", limit: 6, null: false
|
||||||
|
t.string "email", null: false
|
||||||
|
end
|
||||||
|
|
||||||
|
create_table "roles", force: true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.integer "value"
|
t.integer "value"
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "sessions", :force => true do |t|
|
create_table "sessions", force: true do |t|
|
||||||
t.string "session_id", :null => false
|
t.string "session_id", null: false
|
||||||
t.text "data"
|
t.text "data"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "sessions", ["session_id"], :name => "index_sessions_on_session_id"
|
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
|
||||||
add_index "sessions", ["updated_at"], :name => "index_sessions_on_updated_at"
|
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
|
||||||
|
|
||||||
create_table "threadreplies", :force => true do |t|
|
create_table "threadreplies", force: true do |t|
|
||||||
t.text "content"
|
t.text "content"
|
||||||
t.integer "user_author_id"
|
t.integer "user_author_id"
|
||||||
t.integer "user_editor_id"
|
t.integer "user_editor_id"
|
||||||
t.integer "forumthread_id"
|
t.integer "forumthread_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", force: true do |t|
|
||||||
t.string "uuid", :null => false
|
t.string "uuid", null: false
|
||||||
t.string "name", :null => false
|
t.string "name", null: false
|
||||||
t.string "password_digest", :null => false
|
t.string "password_digest", null: false
|
||||||
t.string "ign", :null => false
|
t.string "ign", null: false
|
||||||
t.string "email", :null => false
|
t.string "email", null: false
|
||||||
t.text "about"
|
t.text "about"
|
||||||
t.string "last_ip"
|
t.string "last_ip"
|
||||||
t.string "skype"
|
t.string "skype"
|
||||||
t.boolean "skype_public", :default => false
|
t.boolean "skype_public", default: false
|
||||||
t.string "youtube"
|
t.string "youtube"
|
||||||
t.string "youtube_channelname"
|
t.string "youtube_channelname"
|
||||||
t.string "twitter"
|
t.string "twitter"
|
||||||
t.boolean "donor", :default => false
|
t.boolean "donor", default: false
|
||||||
t.string "email_token"
|
t.string "email_token"
|
||||||
t.boolean "confirmed", :default => false
|
t.boolean "confirmed", default: false
|
||||||
t.datetime "last_seen"
|
t.datetime "last_seen"
|
||||||
t.integer "role_id", :null => false
|
t.integer "role_id", null: false
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", null: false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user