many things, comments working.
|
Before Width: | Height: | Size: 265 B |
BIN
app/assets/images/arrow-grey.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 283 B |
BIN
app/assets/images/arrow-red.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 580 B After Width: | Height: | Size: 3.9 KiB |
|
Before Width: | Height: | Size: 6.5 KiB |
@@ -1,3 +0,0 @@
|
||||
// Place all the styles related to the Blogposts controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -1,3 +0,0 @@
|
||||
// Place all the styles related to the Comments controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
||||
@@ -1,69 +0,0 @@
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
p, ol, ul, td {
|
||||
font-family: verdana, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: #eee;
|
||||
padding: 10px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000;
|
||||
&:visited {
|
||||
color: #666;
|
||||
}
|
||||
&:hover {
|
||||
color: #fff;
|
||||
background-color: #000;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
&.field, &.actions {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#notice {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
padding: 2px;
|
||||
background-color: red;
|
||||
display: table;
|
||||
}
|
||||
|
||||
#error_explanation {
|
||||
width: 450px;
|
||||
border: 2px solid red;
|
||||
padding: 7px;
|
||||
padding-bottom: 0;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f0f0f0;
|
||||
h2 {
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
padding: 5px 5px 5px 15px;
|
||||
font-size: 12px;
|
||||
margin: -7px;
|
||||
margin-bottom: 0px;
|
||||
background-color: #c00;
|
||||
color: #fff;
|
||||
}
|
||||
ul li {
|
||||
font-size: 12px;
|
||||
list-style: square;
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,21 @@
|
||||
|
||||
|
||||
$lightgrey: #D1D1D1;
|
||||
$lightergrey: #959595;
|
||||
$midgrey: #787878;
|
||||
$darkgrey: #434343;
|
||||
$darkred: #AB0000;
|
||||
|
||||
|
||||
|
||||
@media only screen
|
||||
and (min-width: 1000px)
|
||||
{
|
||||
|
||||
html {
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
a {
|
||||
transition: color 0.25s;
|
||||
color: $darkred;
|
||||
@@ -19,17 +25,6 @@ and (min-width: 1000px)
|
||||
color: #F00;
|
||||
}
|
||||
}
|
||||
a.arrow {
|
||||
background: url('/assets/arrow-midgrey.png') no-repeat left;
|
||||
color: $midgrey;
|
||||
padding-left: 0.7em;
|
||||
margin: 0.6em;
|
||||
&:hover {
|
||||
background: url('/assets/arrow-darkred.png') no-repeat left;
|
||||
color: $darkred;
|
||||
padding-left: 0.7em;
|
||||
}
|
||||
}
|
||||
#notice {
|
||||
background: #8e8;
|
||||
text-align: center;
|
||||
@@ -54,7 +49,6 @@ and (min-width: 1000px)
|
||||
box-shadow: 0 0 2px;
|
||||
z-index: 99;
|
||||
position: relative;
|
||||
text-shadow: 1px 1px #555;
|
||||
#logo {
|
||||
margin: 9px;
|
||||
margin-left: 20px;
|
||||
@@ -88,10 +82,16 @@ and (min-width: 1000px)
|
||||
float: right;
|
||||
padding: 0 10px;
|
||||
margin-top: 6px;
|
||||
text-align: right;
|
||||
&.logged-out {
|
||||
margin-top: 2px;
|
||||
}
|
||||
img.avatar {
|
||||
border: 1px solid #000;
|
||||
border-radius: 16px;
|
||||
vertical-align: middle;
|
||||
height: 32px;
|
||||
width: 32px;
|
||||
&:hover {
|
||||
box-shadow: 0 0 2px;
|
||||
}
|
||||
@@ -107,7 +107,19 @@ and (min-width: 1000px)
|
||||
img.user-avatar {
|
||||
border: 1px solid #000;
|
||||
border-radius: 4px;
|
||||
height: 128px;
|
||||
width: 128px;
|
||||
}
|
||||
|
||||
img.avatar {
|
||||
image-rendering:optimizeSpeed;
|
||||
image-rendering:-moz-crisp-edges;
|
||||
image-rendering:-o-crisp-edges;
|
||||
image-rendering:optimize-contrast;
|
||||
image-rendering:-webkit-optimize-contrast;
|
||||
-ms-interpolation-mode: nearest-neighbor;
|
||||
}
|
||||
|
||||
span.no-about {
|
||||
color: #888;
|
||||
font-style: italic;
|
||||
@@ -165,6 +177,15 @@ and (min-width: 1000px)
|
||||
|
||||
#comments {
|
||||
margin: 50px 0 0 40px;
|
||||
.comment {
|
||||
margin-bottom: 12px;
|
||||
padding: 15px;
|
||||
box-shadow: 0 0 10px #bbb inset;
|
||||
&.author {
|
||||
background: #dadada;
|
||||
box-shadow: 0 0 10px #a7a7a7 inset;
|
||||
}
|
||||
}
|
||||
textarea {
|
||||
width: 480px;
|
||||
height: 106px;
|
||||
@@ -172,4 +193,77 @@ and (min-width: 1000px)
|
||||
}
|
||||
}
|
||||
|
||||
input {
|
||||
&[type=text], &[type=email], &[type=password] {
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 3px;
|
||||
background: #eee;
|
||||
margin: 4px;
|
||||
box-shadow: 0 0 5px $lightgrey inset;
|
||||
height: 17px;
|
||||
width: 300px;
|
||||
padding: 1px 0;
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
textarea {
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 3px;
|
||||
background: #eee;
|
||||
margin: 4px;
|
||||
box-shadow: 0 0 5px $lightgrey inset;
|
||||
height: 300px;
|
||||
width: 300px;
|
||||
max-width: 100%;
|
||||
min-width: 300px;
|
||||
min-height: 50px;
|
||||
padding: 1px 0;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.field_with_errors {
|
||||
input {
|
||||
&[type=text], &[type=email], &[type=password] {
|
||||
border: 1px solid #f00;
|
||||
box-shadow: 0 0 5px #faa inset;
|
||||
}
|
||||
}
|
||||
.error {
|
||||
color: #f60;
|
||||
}
|
||||
}
|
||||
|
||||
#form_labels {
|
||||
text-align: right;
|
||||
float: left;
|
||||
label {
|
||||
display: block;
|
||||
padding: 0 0 4px 0;
|
||||
margin: 0 4px 4px;
|
||||
height: 17px;
|
||||
}
|
||||
}
|
||||
#form_inputs {
|
||||
|
||||
}
|
||||
|
||||
#edit_profile {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.btn-blue {
|
||||
border: 1px solid;
|
||||
padding: 6px;
|
||||
background: #4096ee;
|
||||
cursor: default;
|
||||
color: #fff;
|
||||
&:hover {
|
||||
box-shadow: 0 0 5px #095fb7 inset;
|
||||
color: #fff;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
class ApplicationController < ActionController::Base
|
||||
protect_from_forgery
|
||||
force_ssl
|
||||
require "Tools"
|
||||
# force_ssl
|
||||
helper :all
|
||||
include ToolsHelper
|
||||
helper_method :current_user
|
||||
|
||||
private
|
||||
def current_user
|
||||
@current_user ||= User.find(session[:user_id]) if session[:user_id]
|
||||
@current_user ||= User.find_by_id(session[:user_id])
|
||||
end
|
||||
helper_method :current_user
|
||||
end
|
||||
end
|
||||
@@ -1,19 +1,14 @@
|
||||
class BlogpostsController < ApplicationController
|
||||
# GET /blogposts
|
||||
# GET /blogposts.json
|
||||
|
||||
def index
|
||||
@posts = Blogpost.all.reverse
|
||||
end
|
||||
|
||||
# GET /blogposts/1
|
||||
# GET /blogposts/1.json
|
||||
def show
|
||||
@post = Blogpost.find(params[:id])
|
||||
@comment = Comment.new(:blogpost_id => @post.id)
|
||||
@comment = Comment.new(:blogpost => @post)
|
||||
end
|
||||
|
||||
# GET /blogposts/new
|
||||
# GET /blogposts/new.json
|
||||
def new
|
||||
@post = Blogpost.new
|
||||
end
|
||||
@@ -26,12 +21,17 @@ class BlogpostsController < ApplicationController
|
||||
# POST /blogposts
|
||||
# POST /blogposts.json
|
||||
def create
|
||||
@post = Blogpost.new(params[:blogpost])
|
||||
@post.user_id = current_user.id unless current_user.nil?
|
||||
if @post.save
|
||||
redirect_to @post, notice: 'Post has been created.'
|
||||
if current_user && current_user.rank >= rank_to_int("mod")
|
||||
@post = Blogpost.new(params[:blogpost])
|
||||
@post.user_id = current_user.id unless current_user.nil?
|
||||
if @post.save
|
||||
redirect_to @post, notice: 'Post has been created.'
|
||||
else
|
||||
render action: "new"
|
||||
end
|
||||
else
|
||||
render action: "new"
|
||||
flash[:alert] = "You are not allowed to create new posts"
|
||||
redirect_to blog_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -53,6 +53,6 @@ class BlogpostsController < ApplicationController
|
||||
@post = Blogpost.find(params[:id])
|
||||
@post.destroy
|
||||
|
||||
redirect_to blogposts_url
|
||||
redirect_to blog_url
|
||||
end
|
||||
end
|
||||
|
||||
@@ -42,13 +42,12 @@ class CommentsController < ApplicationController
|
||||
def create
|
||||
@comment = Comment.new(params[:comment])
|
||||
@comment.user_id = current_user.id
|
||||
respond_to do |format|
|
||||
@comment.blogpost = Blogpost.find(params[:blogpost_id])
|
||||
if @comment.save
|
||||
format.html { redirect_to @comment, notice: 'Comment was successfully created.' }
|
||||
format.json { render json: @comment, status: :created, location: @comment }
|
||||
redirect_to @comment.blogpost, notice: 'Comment was successfully created.'
|
||||
else
|
||||
format.html { render action: "new" }
|
||||
format.json { render json: @comment.errors, status: :unprocessable_entity }
|
||||
flash[:alert] = "There was a problem while saving your comment"
|
||||
redirect_to blogpost_path(params[:blogpost_id])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -59,13 +58,12 @@ class CommentsController < ApplicationController
|
||||
@comment = Comment.find(params[:id])
|
||||
|
||||
respond_to do |format|
|
||||
if @comment.update_attributes(params[:comment])
|
||||
format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @comment.errors, status: :unprocessable_entity }
|
||||
end
|
||||
if @comment.update_attributes(params[:comment])
|
||||
format.html { redirect_to @comment, notice: 'Comment was successfully updated.' }
|
||||
format.json { head :no_content }
|
||||
else
|
||||
format.html { render action: "edit" }
|
||||
format.json { render json: @comment.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class ServercheckerController < ApplicationController
|
||||
def show
|
||||
require "Tools"
|
||||
if Tools.mc_running?
|
||||
|
||||
if mc_running?
|
||||
send_file "app/assets/images/on.png", :type => "image/png", :disposition => "inline"
|
||||
else
|
||||
send_file "app/assets/images/off.png", :type => "image/png", :disposition => "inline"
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
class SessionsController < ApplicationController
|
||||
|
||||
def new
|
||||
|
||||
end
|
||||
|
||||
def create
|
||||
user = User.find_by_email(params[:email])
|
||||
if user && user.authenticate(params[:password])
|
||||
user.last_ip = request.remote_ip
|
||||
user.last_login = Time.now
|
||||
user.save
|
||||
if user.banned
|
||||
flash[:alert] = "You are banned!"
|
||||
@@ -24,6 +20,6 @@ class SessionsController < ApplicationController
|
||||
|
||||
def destroy
|
||||
session[:user_id] = nil
|
||||
redirect_to root_path, :notice => "Logged out!"
|
||||
redirect_to login_path, :notice => "Logged out!"
|
||||
end
|
||||
end
|
||||
@@ -14,12 +14,22 @@ class UsersController < ApplicationController
|
||||
# GET /users/new
|
||||
# GET /users/new.json
|
||||
def new
|
||||
@user = User.new
|
||||
if current_user
|
||||
flash[:alert] = "You are already registered!"
|
||||
redirect_to user_path(current_user.id)
|
||||
else
|
||||
@user = User.new
|
||||
end
|
||||
end
|
||||
|
||||
# GET /users/1/edit
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
if current_user && (current_user.id = params[:id] || current_user.rank >= rank_to_int("mod"))
|
||||
@user = User.find(params[:id])
|
||||
else
|
||||
flash[:alert] = "You are not allwoed to edit this user"
|
||||
redirect_to user_path(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
# POST /users
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
module ApplicationHelper
|
||||
end
|
||||
end
|
||||
2
app/helpers/tools_helper.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
module ToolsHelper
|
||||
end
|
||||
@@ -1,2 +1,39 @@
|
||||
module UsersHelper
|
||||
def avatar_url(user_id)
|
||||
u = User.find_by_id(user_id)
|
||||
u.nil? ? ign = :char : ign = u.ign
|
||||
return "https://minotar.net/avatar/#{ign}/8"
|
||||
end
|
||||
|
||||
def mc_running?
|
||||
host = "play.redstoner.com"
|
||||
port = 25565
|
||||
wait = 300/1000.0 #milliseconds, the .0 is required!!
|
||||
require 'timeout'
|
||||
require 'socket'
|
||||
r = false
|
||||
begin
|
||||
Timeout::timeout(wait) {
|
||||
TCPSocket.new host, port
|
||||
r = true
|
||||
}
|
||||
rescue Exception
|
||||
# could not connect to the server
|
||||
end
|
||||
return r
|
||||
end
|
||||
|
||||
def rank_to_int(rank)
|
||||
r = ranks[rank]
|
||||
end
|
||||
|
||||
def int_to_rank(int)
|
||||
r = ranks.rassoc(int)
|
||||
r.nil? ? "unknown" : r[0].to_s
|
||||
end
|
||||
|
||||
def ranks
|
||||
# Lower case !!!
|
||||
{"visitor" => 10, "member" => 20, "builder" => 30, "donor" => 40, "donor+" => 45, "mod" => 100, "admin" => 200, "superadmin" => 500}
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,4 +3,5 @@ class Blogpost < ActiveRecord::Base
|
||||
validates_presence_of :title, :text, :user
|
||||
belongs_to :user
|
||||
has_many :comments
|
||||
accepts_nested_attributes_for :comments
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class Comment < ActiveRecord::Base
|
||||
attr_accessible :text, :user_id, :blogpost_id
|
||||
attr_accessible :text, :user_id, :blogpost, :post
|
||||
validates_presence_of :text, :user_id, :blogpost_id
|
||||
belongs_to :blogpost
|
||||
belongs_to :user
|
||||
end
|
||||
end
|
||||
@@ -1,7 +1,10 @@
|
||||
class User < ActiveRecord::Base
|
||||
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation
|
||||
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation, :rank
|
||||
has_secure_password
|
||||
validates_presence_of :password, :on => :create
|
||||
validates_presence_of :password, :name, :email, :ign, :password_confirmation, :on => :create
|
||||
validates :email, :uniqueness => true
|
||||
validates :name, :uniqueness => true
|
||||
validates :ign, :uniqueness => true
|
||||
|
||||
has_many :blogposts
|
||||
has_many :comments
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<%= simple_form_for @post do |f|%>
|
||||
<%= f.input :title %>
|
||||
<%= f.input :text %>
|
||||
<%= f.submit %>
|
||||
<%= f.input :title, :label => false %>
|
||||
<%= f.input :text, :label => false %>
|
||||
<%= f.submit "Create Post" %>
|
||||
<% end %>
|
||||
@@ -2,10 +2,19 @@
|
||||
<div id="posts">
|
||||
<% @posts.each do |p| %>
|
||||
<div id="post">
|
||||
<div id="post-title"><h2><%= link_to p.title, p %></h2><span class="comment-counter"><%= link_to pluralize(p.comments.count, "Comment"), p %></span></div>
|
||||
<span class="post-info">by <%= link_to p.user.name, p.user %> on <%= p.created_at.strftime("%e. %b %Y") %></span>
|
||||
<div id="post-content"><%= RbbCode.new.convert(p.text).html_safe %></div>
|
||||
<div id="post-title">
|
||||
<h2><%= link_to p.title, p %></h2>
|
||||
<span class="comment-counter">
|
||||
<%= link_to pluralize(p.comments.count, "Comment"), p %>
|
||||
</span>
|
||||
</div>
|
||||
<span class="post-info">
|
||||
by <%= link_to p.user.name, p.user %> on <%= p.created_at.strftime("%e. %b %Y") %>
|
||||
</span>
|
||||
<div id="post-content">
|
||||
<%= RbbCode.new.convert(p.text).html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<%= link_to 'New Blogpost', new_blogpost_path if current_user && current_user.rank >= Tools.rank_to_int(:mod) %>
|
||||
<%= link_to 'Make new Post', new_blogpost_path if current_user && current_user.rank >= rank_to_int("mod") %>
|
||||
</div>
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
<h1>New Blogpost</h1>
|
||||
<h1>New Post</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<h1><%= @post.title %></h1>
|
||||
<span class="post-info"><%= link_to @post.user.name, @post.user %> on <%= @post.created_at.strftime("%e. %b %Y") %>
|
||||
<% if current_user.rank >= Tools.rank_to_int(:mod) %>
|
||||
<% if current_user && current_user.rank >= rank_to_int("mod") %>
|
||||
- <%= link_to "edit", edit_blogpost_path(@post.id) %>
|
||||
<% end %>
|
||||
</span>
|
||||
@@ -9,19 +9,20 @@
|
||||
</div>
|
||||
<div id="comments">
|
||||
<% @post.comments.each do |c| %>
|
||||
<div class="comment">
|
||||
<div class="comment <%= "author" if c.user == @post.user %>">
|
||||
<span class="comment-info"><%= link_to c.user.name, c.user %> on <%= c.created_at.strftime("%e. %b %Y") %>
|
||||
<% if current_user.rank >= Tools.rank_to_int(:mod) %>
|
||||
<% if current_user && current_user.rank >= rank_to_int("mod") %>
|
||||
- <%= link_to "edit", edit_blogpost_comment_path(c.id) %>
|
||||
<% end %>
|
||||
</span>
|
||||
<div class="comment-content"><%= c.text %></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% if current_user && current_user.rank >= Tools.rank_to_int(:visitor) %>
|
||||
<% if current_user %>
|
||||
<h3>New comment</h3>
|
||||
<%= simple_form_for [@post, @comment] do |f| %>
|
||||
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %><%= f.submit %>
|
||||
<%= f.input :text, :label => false, :as => "text", :placeholder => "Comment" %>
|
||||
<%= f.submit %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
@@ -2,15 +2,16 @@
|
||||
<%= link_to(root_path) do %>
|
||||
<div id="logo"></div>
|
||||
<% end %>
|
||||
<div id="userinfo">
|
||||
<div id="userinfo" <%= "class=\"logged-out\"".html_safe if !current_user %>>
|
||||
<% if !current_user.nil? %>
|
||||
<span id="userinfo-box">
|
||||
<%= link_to current_user.name.truncate(14), current_user %><br/>
|
||||
<%= link_to image_tag("logout.png"), logout_path %>
|
||||
</span>
|
||||
<%= link_to image_tag(Tools.avatar_url(current_user.id, 32), :class => "avatar"), current_user %>
|
||||
<span id="userinfo-box">
|
||||
<%= link_to current_user.name.truncate(14), current_user %><br/>
|
||||
<%= link_to "Logout", logout_path %>
|
||||
</span>
|
||||
<%= link_to image_tag(avatar_url(current_user.id), :class => "avatar size32"), current_user %>
|
||||
<% else %>
|
||||
<%= link_to "Log in", login_path, :action => "new" %>
|
||||
<%= link_to "Log in", login_path, :action => "new" %><br/>
|
||||
<%= link_to "Register", register_path %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="menu">
|
||||
|
||||
|
Before Width: | Height: | Size: 6.5 KiB |
@@ -1,8 +1,14 @@
|
||||
<h1>Log in</h1>
|
||||
<%= form_tag login_path do |f| %>
|
||||
<%= label_tag :email %><br/>
|
||||
<%= text_field_tag :email %><br/>
|
||||
<%= label_tag :password %><br/>
|
||||
<%= password_field_tag :password %><br/>
|
||||
<%= submit_tag %>
|
||||
<div id="form_labels">
|
||||
<%= label_tag :email %>
|
||||
<%= label_tag :password %>
|
||||
</div>
|
||||
|
||||
<div id="form_inputs">
|
||||
<%= text_field_tag :email %>
|
||||
<%= password_field_tag :password %>
|
||||
</div>
|
||||
|
||||
<%= submit_tag "Log in" %>
|
||||
<% end %>
|
||||
@@ -1,8 +0,0 @@
|
||||
<%= simple_form_for @user do |f| %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :ign %>
|
||||
<%= f.input :email %>
|
||||
<%= f.input :password %>
|
||||
<%= f.input :password_confirmation %>
|
||||
<%= f.submit %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<h1>New user</h1>
|
||||
<h1>Register</h1>
|
||||
|
||||
<%= render 'form' %>
|
||||
|
||||
<%= link_to 'Back', users_path %>
|
||||
<%= simple_form_for @user do |f| %>
|
||||
<%= f.input :name %>
|
||||
<%= f.input :ign, label: "Ingame name" %>
|
||||
<%= f.input :email %>
|
||||
<%= f.input :password %>
|
||||
<%= f.input :password_confirmation %>
|
||||
<%= f.submit "Register" %>
|
||||
<% end %>
|
||||
@@ -1,10 +1,14 @@
|
||||
<div id="user-info"%>
|
||||
<%= image_tag Tools.avatar_url(@user.id, 128), :class => "user-avatar", :alt => "avatar" %><br/>
|
||||
<% if @user.banned %>
|
||||
<span class="user-banned">This user is banned!</span>
|
||||
<% end %>
|
||||
IGN: <%= @user.ign %><br/>
|
||||
Rank: <%= Tools.int_to_rank(@user.rank) %><br/>
|
||||
Joined: <%= @user.created_at.strftime("%e. %b %Y") %><br/>
|
||||
Last IP: <%= @user.last_ip %><br/>
|
||||
About: <%= @user.about.blank? ? "<span class=\"no-about\">nothing</span>".html_safe : @user.about %>
|
||||
<div id="user-info">
|
||||
<div id="edit_profile"><%= link_to "edit profile", edit_user_path(@user), :class => "btn-blue" %></div>
|
||||
<%= image_tag avatar_url(@user.id), :class => "user-avatar avatar", :alt => "avatar" %><br/>
|
||||
<% if @user.banned %>
|
||||
<span class="user-banned">This user is banned!</span>
|
||||
<% end %>
|
||||
IGN: <%= @user.ign %><br/>
|
||||
Rank: <%= int_to_rank(@user.rank) %><br/>
|
||||
Joined: <%= @user.created_at.strftime("%e. %b %Y") %><br/>
|
||||
<% if current_user && current_user.rank >= rank_to_int("mod") %>
|
||||
Last IP: <%= @user.last_ip %><br/>
|
||||
<% end %>
|
||||
About: <%= @user.about.blank? ? "<span class=\"no-about\">nothing</span>".html_safe : @user.about %>
|
||||
</div>
|
||||