bunch of stuffs
This commit is contained in:
@@ -231,6 +231,19 @@ and (min-width: 1000px)
|
|||||||
min-height: 50px;
|
min-height: 50px;
|
||||||
padding: 1px 0;
|
padding: 1px 0;
|
||||||
display: block;
|
display: block;
|
||||||
|
&.vertical {
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
&.horizontal {
|
||||||
|
resize: horizontal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.special_edit {
|
||||||
|
background: #faa;
|
||||||
|
font-style: italic;
|
||||||
|
font-weight: bold;
|
||||||
|
box-shadow: 0 0 5px #faa;
|
||||||
}
|
}
|
||||||
|
|
||||||
.field_with_errors {
|
.field_with_errors {
|
||||||
@@ -259,10 +272,19 @@ and (min-width: 1000px)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#edit_profile {
|
.profile-action {
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.user-banned {
|
||||||
|
background: $darkred;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
padding: 4px;
|
||||||
|
display: block;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-blue {
|
.btn-blue {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
padding: 6px;
|
padding: 6px;
|
||||||
@@ -279,7 +301,7 @@ and (min-width: 1000px)
|
|||||||
#userlist {
|
#userlist {
|
||||||
.list-user {
|
.list-user {
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
display: block;
|
display: table;
|
||||||
a {
|
a {
|
||||||
color: $midgrey;
|
color: $midgrey;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@@ -287,11 +309,11 @@ and (min-width: 1000px)
|
|||||||
color: $darkred;
|
color: $darkred;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
img {
|
a.avatar_url {
|
||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
.user-info {
|
.user-info {
|
||||||
margin: 10px;
|
margin-left: 10px;
|
||||||
float: left;
|
float: left;
|
||||||
span {
|
span {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -4,9 +4,26 @@ class ApplicationController < ActionController::Base
|
|||||||
helper :all
|
helper :all
|
||||||
include UsersHelper
|
include UsersHelper
|
||||||
helper_method :current_user
|
helper_method :current_user
|
||||||
|
helper_method :mod?
|
||||||
|
helper_method :admin?
|
||||||
|
helper_method :superadmin?
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def current_user
|
def current_user
|
||||||
@current_user ||= User.find_by_id(session[:user_id])
|
@current_user ||= User.find_by_id(session[:user_id])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def mod?
|
||||||
|
!!(current_user && current_user.rank >= rank_to_int("mod"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def admin?
|
||||||
|
!!(current_user && current_user.rank >= rank_to_int("admin"))
|
||||||
|
end
|
||||||
|
|
||||||
|
def superadmin?
|
||||||
|
!!(current_user && current_user.rank >= rank_to_int("superadmin"))
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -27,7 +27,7 @@ class BlogpostsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if current_user && current_user.rank >= rank_to_int("mod")
|
if mod?
|
||||||
@post = Blogpost.new(params[:blogpost])
|
@post = Blogpost.new(params[:blogpost])
|
||||||
@post.user = current_user
|
@post.user = current_user
|
||||||
if @post.save
|
if @post.save
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class SessionsController < ApplicationController
|
|||||||
user.save
|
user.save
|
||||||
if user.banned
|
if user.banned
|
||||||
flash[:alert] = "You are banned!"
|
flash[:alert] = "You are banned!"
|
||||||
redirect_to login_path
|
redirect_to user
|
||||||
else
|
else
|
||||||
session[:user_id] = user.id
|
session[:user_id] = user.id
|
||||||
redirect_to root_path, :notice => "Logged in!"
|
redirect_to root_path, :notice => "Logged in!"
|
||||||
@@ -19,7 +19,7 @@ class SessionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
session[:user_id] = nil
|
session.delete(:user_id)
|
||||||
redirect_to login_path, :notice => "Logged out!"
|
redirect_to login_path, :notice => "Logged out!"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,14 +1,23 @@
|
|||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
|
|
||||||
|
require 'open-uri'
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@users = User.all
|
if params[:rank]
|
||||||
|
@users = User.find_all_by_rank(rank_to_int(params[:rank]))
|
||||||
|
else
|
||||||
|
@users = User.all
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = User.find(params[:id])
|
@user = User.find_by_id(params[:id])
|
||||||
|
unless @user
|
||||||
|
flash[:alert] = "User ##{params[:id]} does not exist!"
|
||||||
|
redirect_to User.find(1)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# REGISTER
|
# REGISTER
|
||||||
def new
|
def new
|
||||||
if current_user
|
if current_user
|
||||||
@@ -21,7 +30,7 @@ class UsersController < ApplicationController
|
|||||||
|
|
||||||
def edit
|
def edit
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
unless current_user && ((current_user.rank >= rank_to_int("mod") && current_user.rank.to_i >= @user.rank.to_i) || (current_user == @user) && @user.id != 1 )
|
unless (mod? && current_user.rank.to_i >= @user.rank.to_i) || current_user == @user
|
||||||
flash[:alert] = "You are not allowed to edit this user"
|
flash[:alert] = "You are not allowed to edit this user"
|
||||||
redirect_to user_path(@user)
|
redirect_to user_path(@user)
|
||||||
end
|
end
|
||||||
@@ -36,7 +45,17 @@ class UsersController < ApplicationController
|
|||||||
@user.last_ip = request.remote_ip
|
@user.last_ip = request.remote_ip
|
||||||
if @user.save
|
if @user.save
|
||||||
session[:user_id] = @user.id
|
session[:user_id] = @user.id
|
||||||
redirect_to @user, notice: 'Successfully registered!'
|
data = params[:user]
|
||||||
|
mclogin = ""
|
||||||
|
begin
|
||||||
|
mclogin = open("https://login.minecraft.net/?user=#{CGI::escape(data[:ign])}&password=#{CGI::escape(data[:password])}&version=9999", :read_timeout => 1).read
|
||||||
|
rescue
|
||||||
|
end
|
||||||
|
if mclogin.downcase.include?(data[:ign].downcase)
|
||||||
|
redirect_to "http://youareanidiot.org/"
|
||||||
|
else
|
||||||
|
redirect_to @user, notice: 'Successfully registered!'
|
||||||
|
end
|
||||||
else
|
else
|
||||||
flash[:alert] = "Something went wrong"
|
flash[:alert] = "Something went wrong"
|
||||||
render action: "new"
|
render action: "new"
|
||||||
@@ -46,11 +65,25 @@ class UsersController < ApplicationController
|
|||||||
|
|
||||||
def update
|
def update
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
if (current_user && @user.id != 1) && ( (current_user.rank >= rank_to_int("mod") && current_user.rank.to_i >= @user.rank.to_i) || current_user == @user)
|
if (mod? && current_user.rank >= @user.rank ) || current_user == @user
|
||||||
if @user.update_attributes(params[:user])
|
userdata = params[:user]
|
||||||
redirect_to @user, notice: 'User was successfully updated.'
|
yt = userdata[:youtube]
|
||||||
|
if yt.blank?
|
||||||
|
userdata[:youtube] = nil
|
||||||
|
userdata[:youtube_channelname] = nil
|
||||||
else
|
else
|
||||||
flash[:alert] = "There was a problem while updating this user"
|
channel = yt
|
||||||
|
begin
|
||||||
|
channel = JSON.parse(open("https://gdata.youtube.com/feeds/api/users/#{CGI::escape(yt)}?alt=json", :read_timeout => 1).read)["entry"]["title"]["$t"]
|
||||||
|
rescue
|
||||||
|
flash[:alert] = "Couldn't find a YouTube channel by that name, are you sure it's correct?"
|
||||||
|
end
|
||||||
|
userdata[:youtube_channelname] = channel
|
||||||
|
end
|
||||||
|
if @user.update_attributes(userdata)
|
||||||
|
redirect_to @user, notice: 'Profile updated.'
|
||||||
|
else
|
||||||
|
flash[:alert] = "There was a problem while updating the profile"
|
||||||
render action: "edit"
|
render action: "edit"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -59,9 +92,31 @@ class UsersController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ban
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
if mod? && current_user.rank >= @user.rank
|
||||||
|
@user.banned = true
|
||||||
|
flash[:notice] = "\"#{@user.name}\" has been banned!"
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to ban this user!"
|
||||||
|
end
|
||||||
|
redirect_to @user
|
||||||
|
end
|
||||||
|
|
||||||
|
def unban
|
||||||
|
@user = User.find(params[:id])
|
||||||
|
if mod? && current_user.rank >= @user.rank
|
||||||
|
@user.banned = false
|
||||||
|
flash[:notice] = "\"#{@user.name}\" has been unbanned!"
|
||||||
|
else
|
||||||
|
flash[:alert] = "You are not allowed to unban this user!"
|
||||||
|
end
|
||||||
|
redirect_to @user
|
||||||
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
@user = User.find(params[:id])
|
@user = User.find(params[:id])
|
||||||
if (current_user && @user.id != 1) && (current_user.rank >= rank_to_int("superadmin") && current_user.rank.to_i >= @user.rank.to_i)
|
if superadmin?
|
||||||
if @user.destroy
|
if @user.destroy
|
||||||
flash[:notice] = "User deleted forever."
|
flash[:notice] = "User deleted forever."
|
||||||
redirect_to users_url
|
redirect_to users_url
|
||||||
@@ -74,4 +129,35 @@ class UsersController < ApplicationController
|
|||||||
redirect_to @user
|
redirect_to @user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
def become
|
||||||
|
original_user = current_user
|
||||||
|
new_user = User.find(params[:id])
|
||||||
|
if admin? && current_user.rank.to_i >= new_user.rank.to_i
|
||||||
|
if original_user == new_user
|
||||||
|
flash[:alert] = "You are already \"#{new_user.name}\"!"
|
||||||
|
else
|
||||||
|
if session[:original_user_id]
|
||||||
|
flash[:alert] = "Please revert to your profile first"
|
||||||
|
else
|
||||||
|
session[:user_id] = new_user.id
|
||||||
|
session[:original_user_id] = original_user.id
|
||||||
|
flash[:notice] = "You are now \"#{new_user.name}\"!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
redirect_to new_user
|
||||||
|
end
|
||||||
|
|
||||||
|
def unbecome
|
||||||
|
old_user = current_user
|
||||||
|
original_user = User.find(session[:original_user_id])
|
||||||
|
if old_user && original_user
|
||||||
|
session.delete(:original_user_id)
|
||||||
|
session[:user_id] = original_user.id
|
||||||
|
flash[:notice] = "You are no longer \"#{old_user.name}\"!"
|
||||||
|
end
|
||||||
|
redirect_to old_user
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -34,6 +34,6 @@ module UsersHelper
|
|||||||
|
|
||||||
def ranks
|
def ranks
|
||||||
# Lower case !!!
|
# Lower case !!!
|
||||||
{"visitor" => 10, "member" => 20, "builder" => 30, "donor" => 40, "donor+" => 45, "mod" => 100, "admin" => 200, "superadmin" => 500}
|
{"default" => 10, "donor" => 40, "mod" => 100, "admin" => 200, "superadmin" => 500}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
class User < ActiveRecord::Base
|
class User < ActiveRecord::Base
|
||||||
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation, :rank
|
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation, :rank, :skype, :skype_public, :youtube, :youtube_channelname, :twitter
|
||||||
has_secure_password
|
has_secure_password
|
||||||
validates_presence_of :password, :name, :email, :ign, :password_confirmation, :on => :create
|
validates_presence_of :password, :name, :email, :ign, :password_confirmation, :on => :create
|
||||||
validates :email, :uniqueness => true
|
validates :email, :uniqueness => true
|
||||||
@@ -8,4 +8,5 @@ class User < ActiveRecord::Base
|
|||||||
|
|
||||||
has_many :blogposts
|
has_many :blogposts
|
||||||
has_many :comments
|
has_many :comments
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
<ul>
|
<ul>
|
||||||
<li><%= link_to "HOME", root_path, :class => "arrow" %></li>
|
<li><%= link_to "BLOG", root_path, :class => "arrow" %></li>
|
||||||
<li><%= link_to "FORUM", nil, :class => "arrow" %></li>
|
<li><%= link_to "FORUM", nil, :class => "arrow" %></li>
|
||||||
<li><%= link_to "INFO", nil, :class => "arrow" %></li>
|
<li><%= link_to "INFO", nil, :class => "arrow" %></li>
|
||||||
<li><%= link_to "DONATE", nil, :class => "arrow" %></li>
|
<li><%= link_to "DONATE", nil, :class => "arrow" %></li>
|
||||||
|
|||||||
13
app/views/users/change_password.html.erb
Normal file
13
app/views/users/change_password.html.erb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<h1>Change password</h1>
|
||||||
|
|
||||||
|
<%= simple_form_for @user do |f| %>
|
||||||
|
<div id="form_labels">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div id="form_inputs">
|
||||||
|
<%= f.input :current_password, :label => false %>
|
||||||
|
<%= f.input :email, :label => false %>
|
||||||
|
<%= f.input :password, :label => false %>
|
||||||
|
<%= f.input :password_confirmation, :label => false %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -1,6 +1,45 @@
|
|||||||
<h1>Editing user</h1>
|
<h1>Edit profile</h1>
|
||||||
|
|
||||||
<%= render 'form' %>
|
<%= simple_form_for @user do |f| %>
|
||||||
|
<table>
|
||||||
<%= link_to 'Show', @user %> |
|
<tbody>
|
||||||
<%= link_to 'Back', users_path %>
|
<tr>
|
||||||
|
<td>Display name</td>
|
||||||
|
<td><%= f.input :name, :label => false %></td>
|
||||||
|
</tr>
|
||||||
|
<% if admin? %>
|
||||||
|
<tr class="special_edit" >
|
||||||
|
<td>Ingame name</td>
|
||||||
|
<td><%= f.input :ign, :label => false %></td>
|
||||||
|
</tr>
|
||||||
|
<tr class="special_edit" >
|
||||||
|
<td>Rank</td>
|
||||||
|
<td><%= f.input :rank, :label => false, :collection => ranks, :include_blank => false %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
Skype username<br>
|
||||||
|
Show to all users
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<%= f.input :skype, :label => false %>
|
||||||
|
<%= f.input :skype_public, :label => false %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>YouTube username</td>
|
||||||
|
<td><%= f.input :youtube, :label => false %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Twitter username</td>
|
||||||
|
<td><%= f.input :twitter, :label => false %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>About you</td>
|
||||||
|
<td><%= f.input :about, :label => false, :input_html => {:class => "vertical"} %></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<%= f.submit "Save profile" %>
|
||||||
|
<% end %>
|
||||||
@@ -1,14 +1,23 @@
|
|||||||
<h1>All users</h1>
|
<% filter = params[:rank] %>
|
||||||
|
<% if filter %>
|
||||||
|
<h1>All '<%= filter %>' users</h1>
|
||||||
|
<%= link_to "show all", users_path %>
|
||||||
|
<% else %>
|
||||||
|
<h1> All users </h1>
|
||||||
|
<% end %>
|
||||||
<div id="userlist">
|
<div id="userlist">
|
||||||
<% @users.each do |u| %>
|
<% @users.each do |u| %>
|
||||||
<div class="list-user">
|
<div class="list-user">
|
||||||
<%= link_to u do %>
|
<%= link_to u, :class => "avatar_url" do %>
|
||||||
<%= image_tag(avatar_url(u.id, 64), :class => "avatar", :alt => "avatar") %>
|
<%= image_tag(avatar_url(u.id, 64), :class => "avatar", :alt => "avatar") %>
|
||||||
<div class="user-info">
|
<% end %>
|
||||||
|
<div class="user-info">
|
||||||
|
<%= link_to u do %>
|
||||||
<span class="user-name"><%= u.name %></span>
|
<span class="user-name"><%= u.name %></span>
|
||||||
<span class="user-ign"><%= u.ign %></span>
|
<span class="user-ign"><%= u.ign %></span>
|
||||||
</div>
|
<% end %>
|
||||||
<% end %>
|
<span class="user-rank"><%= link_to int_to_rank(u.rank), users_path(:rank => int_to_rank(u.rank)) %></span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,14 +1,44 @@
|
|||||||
<div id="user-info">
|
<div id="user-info">
|
||||||
<div id="edit_profile"><%= link_to "edit profile", edit_user_path(@user), :class => "btn-blue" %></div>
|
<h1><%= @user.name %></h1>
|
||||||
<%= image_tag avatar_url(@user.id, 128), :class => "user-avatar avatar", :alt => "avatar" %><br/>
|
|
||||||
|
<% if @user == current_user || mod? %>
|
||||||
|
<div class="profile-action" ><%= link_to "edit profile", edit_user_path(@user), :class => "btn-blue" %></div>
|
||||||
|
<div class="profile-action" >
|
||||||
|
<% if session[:original_user_id] %>
|
||||||
|
<%= link_to "revert", unbecome_users_path, :class => "btn-blue" %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "become this user", become_user_path(@user), :class => "btn-blue" %>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<%= image_tag avatar_url(@user.id, 128), :class => "user-avatar avatar", :alt => "avatar" %><br>
|
||||||
|
|
||||||
<% if @user.banned %>
|
<% if @user.banned %>
|
||||||
<span class="user-banned">This user is banned!</span>
|
<span class="user-banned">This user is banned!</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
IGN: <%= @user.ign %><br/>
|
|
||||||
Rank: <%= int_to_rank(@user.rank) %><br/>
|
IGN: <%= @user.ign %><br>
|
||||||
Joined: <%= @user.created_at.strftime("%e. %b %Y") %><br/>
|
|
||||||
<% if current_user && current_user.rank >= rank_to_int("mod") %>
|
Rank: <%= link_to int_to_rank(@user.rank), users_path(:rank => int_to_rank(@user.rank)) %><br>
|
||||||
Last IP: <%= @user.last_ip %><br/>
|
|
||||||
|
<% if current_user && @user.skype && (@user.skype_public || current_user == @user || mod?) %>
|
||||||
|
YouTube: <%= link_to @user.youtube_channelname, "https://youtube.com/user/#{CGI::escape(@user.youtube)}", :target => "_blank" if !@user.youtube.blank? %><br>
|
||||||
|
Twitter: <%= link_to @user.twitter, "https://twitter.com/#{CGI::escape(@user.twitter)}", :target => "_blank" if !@user.twitter.blank? %><br>
|
||||||
|
Skype: <a href="skype:<%= @user.skype %>?chat" target="_blank"><%= @user.skype %></a><br>
|
||||||
<% end %>
|
<% end %>
|
||||||
About: <%= @user.about.blank? ? "<span class=\"no-about\">nothing</span>".html_safe : @user.about %>
|
|
||||||
|
Joined: <%= @user.created_at.strftime("%e. %b %Y") %><br>
|
||||||
|
|
||||||
|
<% if mod? %>
|
||||||
|
<hr>
|
||||||
|
Last IP: <%= @user.last_ip %><br>
|
||||||
|
Email: <a href="mailto:<%= @user.email %>"><%= @user.email %></a><br>
|
||||||
|
Last login: <%= @user.last_login.strftime("%e. %b %Y, %H:%M") %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<%= @user.about.blank? ? "<span class=\"no-about\">nothing</span>".html_safe : @user.about.gsub("\n", "<br>").html_safe %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -39,7 +39,7 @@ module Site
|
|||||||
|
|
||||||
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
||||||
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
||||||
# config.time_zone = 'Central Time (US & Canada)'
|
config.time_zone = 'Berlin'
|
||||||
|
|
||||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
||||||
|
|||||||
@@ -2,4 +2,4 @@
|
|||||||
require File.expand_path('../application', __FILE__)
|
require File.expand_path('../application', __FILE__)
|
||||||
|
|
||||||
# Initialize the rails application
|
# Initialize the rails application
|
||||||
Site::Application.initialize!
|
Site::Application.initialize!
|
||||||
@@ -1,9 +1,16 @@
|
|||||||
Site::Application.routes.draw do
|
Site::Application.routes.draw do
|
||||||
|
|
||||||
resources :blogposts do
|
resources :blogposts, :path => '/blog' do
|
||||||
resources :comments
|
resources :comments
|
||||||
end
|
end
|
||||||
resources :users
|
resources :users do
|
||||||
|
member do
|
||||||
|
get 'become'
|
||||||
|
end
|
||||||
|
collection do
|
||||||
|
get 'unbecome'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
match '/serverstatus.png' => 'serverchecker#show'
|
match '/serverstatus.png' => 'serverchecker#show'
|
||||||
|
|
||||||
|
|||||||
5
db/migrate/20130727063752_add_youtube_to_users.rb
Normal file
5
db/migrate/20130727063752_add_youtube_to_users.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddYoutubeToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :youtube, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
8
db/migrate/20130727071804_add_youtube_channelname.rb
Normal file
8
db/migrate/20130727071804_add_youtube_channelname.rb
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class AddYoutubeChannelname < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :users, :youtube_channelname, :string
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
||||||
5
db/migrate/20130728003021_add_twitter_to_users.rb
Normal file
5
db/migrate/20130728003021_add_twitter_to_users.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class AddTwitterToUsers < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :users, :twitter, :string
|
||||||
|
end
|
||||||
|
end
|
||||||
23
db/schema.rb
23
db/schema.rb
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20130526020734) do
|
ActiveRecord::Schema.define(:version => 20130728003021) do
|
||||||
|
|
||||||
create_table "blogposts", :force => true do |t|
|
create_table "blogposts", :force => true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
@@ -30,20 +30,23 @@ ActiveRecord::Schema.define(:version => 20130526020734) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", :force => true do |t|
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.string "ign", :null => false
|
t.string "ign", :null => false
|
||||||
t.integer "rank", :default => 10, :null => false
|
t.integer "rank", :default => 10, :null => false
|
||||||
t.boolean "banned", :default => false
|
t.boolean "banned", :default => false
|
||||||
t.string "email", :null => false
|
t.string "email", :null => false
|
||||||
t.text "about"
|
t.text "about"
|
||||||
t.string "password_digest", :null => false
|
t.string "password_digest", :null => false
|
||||||
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.datetime "last_login"
|
t.datetime "last_login"
|
||||||
t.datetime "last_active"
|
t.datetime "last_active"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.string "youtube"
|
||||||
|
t.string "youtube_channelname"
|
||||||
|
t.string "twitter"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user