idk, lots

This commit is contained in:
jomo
2014-02-01 00:56:50 +01:00
parent 86452ea00b
commit 02f9664624
30 changed files with 1467 additions and 54 deletions

11
Gemfile
View File

@@ -2,28 +2,22 @@ source 'https://rubygems.org'
gem 'rails', '3.2.12'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
gem 'jquery-rails'
gem 'therubyracer'
gem 'bcrypt-ruby', '~> 3.0.0' # To use ActiveModel has_secure_password
gem 'bcrypt-ruby', '~> 3.0.0' # To use ActiveModel's has_secure_password
gem 'simple_form'
gem 'sanitize'
gem 'github-markdown'
gem 'hirb' #pretty console output
gem 'rb-readline', '~> 0.4.2'
gem 'rest-client'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
@@ -31,6 +25,7 @@ group :development do
gem 'webrick'
gem 'better_errors'
gem 'binding_of_caller'
gem 'rails-erd'
end
# To use Jbuilder templates for JSON

View File

@@ -36,6 +36,7 @@ GEM
binding_of_caller (0.7.1)
debug_inspector (>= 0.0.1)
builder (3.0.4)
choice (0.1.6)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@@ -81,6 +82,11 @@ GEM
activesupport (= 3.2.12)
bundler (~> 1.0)
railties (= 3.2.12)
rails-erd (1.1.0)
activerecord (>= 3.0)
activesupport (>= 3.0)
choice (~> 0.1.6)
ruby-graphviz (~> 1.0.4)
railties (3.2.12)
actionpack (= 3.2.12)
activesupport (= 3.2.12)
@@ -93,6 +99,9 @@ GEM
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.4)
rest-client (1.6.7)
mime-types (>= 1.16)
ruby-graphviz (1.0.9)
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
sass (3.2.9)
@@ -135,7 +144,9 @@ DEPENDENCIES
hirb
jquery-rails
rails (= 3.2.12)
rails-erd
rb-readline (~> 0.4.2)
rest-client
sanitize
sass-rails (~> 3.2.3)
simple_form

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 168 B

View File

@@ -9,4 +9,19 @@ and (max-width: 999px)
display: block;
font-size: 0.7em;
}
#head {
text-align: left;
}
#main-content {
padding: 30px 5px;
}
.editlink {
float: right;
opacity: 1;
margin-right: 0;
}
}

View File

@@ -20,7 +20,7 @@ and (min-width: 0px) //TODO
body {
background-image: url('/assets/bg.png');
background-color: #F0F2F2;
background-color: #F2F2F2;
color: #222;
}
@@ -54,20 +54,14 @@ and (min-width: 0px) //TODO
#head {
background-image: url('/assets/head_bg.png');
width: 100%;
max-width: 1000px;
margin: auto;
position: relative;
text-align: center;
#logo {
float: left;
margin: 10px;
max-width: 100%;
img {
max-width: 100%;
height: auto;
}
}
#userinfo {
float: right;
position: absolute;
top: 0;
right: 0;
margin: 10px;
img.avatar {
border: 1px solid #000;
@@ -134,9 +128,8 @@ and (min-width: 0px) //TODO
}
#main-content {
padding: 30px;
padding: 30px 100px;
width: 100%;
max-width: 1000px;
margin: auto;
h1 {
@@ -309,6 +302,11 @@ and (min-width: 0px) //TODO
margin: 0;
}
select {
text-indent: 0.01px;
text-overflow: "";
}
input , select, textarea {
margin: 4px;
vertical-align: middle;
@@ -430,6 +428,7 @@ and (min-width: 0px) //TODO
border: none;
font-size: 12px;
line-height: normal;
display: inline-block;
&[disabled], &[disabled]:hover {
box-shadow: 0 0 5px #ddd inset;
color: #ddd;

View File

@@ -1,6 +1,11 @@
/* General CSS for all screens */
/* Global CSS for all screen sizes */
body {
margin: 0;
padding: 0;
font: 14px/1.6 'Oswald','Calibri','Arial','DejaVu Sans', 'Open Sans','Lucida Sans','Lucida Grande','Lucida Sans Unicode',sans-serif;
}
}

View File

@@ -29,7 +29,7 @@ class BlogpostsController < ApplicationController
def create
if mod?
@post = Blogpost.new(params[:blogpost] ? params[:blogpost].slice(:title, :content) : {})
@post = Blogpost.new(params[:blogpost].slice(:title, :content))
@post.user_author = current_user
if @post.save
redirect_to @post, notice: 'Post has been created.'

View File

@@ -4,18 +4,40 @@ class ForumthreadsController < ApplicationController
redirect_to forum_path(f.forumgroup, f)
end
def show
@thread = Forumthread.find(params[:id])
render text: @thread.content
end
def new
@forum = Forum.find(params[:id])
if @forum && current_user && (@forum.group.role_read.nil? || @forum.group.role_read <= current_user.role) && (@forum.role_read.nil? || @forum.role_read <= current_user.role)
@thread = Forumthread.new(forum: @forum)
else
flash[:alert] = "You are not allowed to create a new thread here!"
redirect_to @forum
end
end
def create
flash[:alert] = "Not yet ;("
redirect_to forum_path(params[:id])
@forum = Forum.find(params[:id])
if (confirmed? && (@forum.group.role_read || Role.get(:default))<= current_user.role && (@forum.group.role_write || Role.get(:default))<= current_user.role && (@forum.role_read || Role.get(:default))<= current_user.role && (@forum.group.role_write || Role.get(:default))<= current_user.role)
@thread = Forumthread.new(mod? ? params[:forumthread] : params[:forumthread].slice(:title, :content))
@thread.user_author = current_user
@thread.forum = @forum
if @thread.save
flash[:notice] = "Thread created!"
redirect_to @thread
return
else
flash[:alert] = "Seomthing went wrong while creating your thread."
render "new"
return
end
else
flash[:alert] = "You are not allowed to create a thread here!"
redirect_to @forum
end
end

View File

@@ -0,0 +1,9 @@
class StaticsController < ApplicationController
def index
end
def donate
end
end

View File

@@ -37,11 +37,18 @@ require 'open-uri'
if current_user
@user = User.find(params[:id])
code = params[:code]
if @user && @user == current_user && code && @user.confirm_code == code
if @user && @user.is?(current_user) && code && @user.confirm_code == code
if @user.role == Role.get(:unconfirmed)
@user.role = Role.get :default
@user.save
flash[:notice] = "Registration confirmed."
if @user.save
flash[:notice] = "Registration mail confirmed."
redirect_to edit_user_path(@user)
return
else
flash[:alert] = "Something went wrong, please contact us ingame."
redirect_to @user
return
end
elsif @user.role < Role.get(:unconfirmed)
flash[:alert] = "Your account has been banned or removed"
else

View File

@@ -3,12 +3,12 @@ class Forumthread < 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"
attr_accessible :name, :content, :sticky, :locked, :user_author, :user_editor, :forum
attr_accessible :title, :content, :sticky, :locked, :user_author, :user_editor, :forum
validates_presence_of :name
validates_presence_of :title
validates_presence_of :content
def to_s
name
title
end
end

View File

@@ -13,13 +13,14 @@ class User < ActiveRecord::Base
validates_length_of :password, in: 8..256, :on => :create
validates_length_of :name, in: 3..20
validates_length_of :about, maximum: 5000
validates_length_of :ign, minimum: 2
validates_length_of :ign, minimum: 2, maximum: 100
validates :email, uniqueness: {case_sensitive: false}, format: {with: /^\S+@\S+\.[a-z]{2,}$/i, message: "That doesn't look like an email adress."}
validates :name, uniqueness: {case_sensitive: false}, format: {with: /^[a-z\d\-_ ]+$/i, message: "Allowed characters: a-z0-9, dashes, underscores and spaces"}
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /^[a-z\d_]+$/i, message: "That is probably not your username."}
validate :ign_is_not_skull, :ign_is_not_mojang, :ign_has_paid, :ign_has_correct_case
validate :ign_is_not_skull, :ign_has_paid, :ign_has_correct_case
validate :ign_is_not_mojang, on: :create
has_many :blogposts
has_many :comments
@@ -72,7 +73,11 @@ class User < ActiveRecord::Base
end
def ign_is_not_mojang
errors.add(:ign, "If that's really you, contact <a href='/users?role=staff'>us</a> in-game.") if ["mollstam", "carlmanneh", "MinecraftChick", "Notch", "jeb_", "xlson", "jonkagstrom", "KrisJelbring", "marc", "Marc_IRL", "MidnightEnforcer", "YoloSwag4Lyfe", "EvilSeph", "Grumm", "Dinnerbone", "geuder", "eldrone", "JahKob", "BomBoy", "MansOlson", "pgeuder", "91maan90", "vubui", "PoiPoiChen", "mamirm", "eldrone", "_tomcc"].include?(self.ign)
if self.ign.start_with?("mojang_secret_ign_")
self.ign = self.ign[18..-1]
else
errors.add(:ign, "If that's really you, contact <a href='/users?role=staff'>us</a> in-game.") if ["mollstam", "carlmanneh", "MinecraftChick", "Notch", "jeb_", "xlson", "jonkagstrom", "KrisJelbring", "marc", "Marc_IRL", "MidnightEnforcer", "YoloSwag4Lyfe", "EvilSeph", "Grumm", "Dinnerbone", "geuder", "eldrone", "JahKob", "BomBoy", "MansOlson", "pgeuder", "91maan90", "vubui", "PoiPoiChen", "mamirm", "eldrone", "_tomcc"].include?(self.ign)
end
end
def ign_has_paid

View File

@@ -1,4 +1,4 @@
<%= button_to 'Make new Post', new_blogpost_path, method: "get", class: "btn blue" if mod? %>
<%= link_to 'Make new Post', new_blogpost_path, class: "btn blue" if mod? %>
<div id="posts">
<% @posts.each do |p| %>
<div class="post" id="post-<%= p.id %>">

View File

@@ -8,9 +8,7 @@
<div class="forums">
<% group.forums.each do |f| %>
<div class="forum">
<%= link_to f.name, f %>
</div>
<%= link_to f.name, f, class: "forum" %>
<% end %>
</div>

View File

@@ -1,11 +1,11 @@
<%= link_to "Forums", forums_path %> → <%= link_to @forum.group, @forum.group %> → <%= link_to @forum %>
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= link_to @forum %>
<h1><%= @forum.name %></h1>
<%= link_to "New thread", new_forumthread_path, class: "btn blue" %>
<div id="forum_threads">
<% @threads.each do |thread| %>
<div class="group" id="thread-<%= thread.id %>">
<div class="header">
<%= thread.name %>
<%= link_to thread.title, forumthread_path(thread) %>
</div>
</div>
<% end %>

View File

@@ -1,18 +1,17 @@
<%= link_to @forum.group, @forum.group %> → <%= link_to @forum, @forum %> → New thread
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= link_to @forum, @forum %> → New thread
<h1>New thread</h1>
<%= simple_form_for @thread do |f|%>
<div id="form_labels">
<%= f.label :title %>
<%= f.label :sticky if mod? %>
<%= f.label :locked if mod? %>
<%= f.label :content, "Text" %>
</div>
<div id="form_inputs">
<%= f.input :title, placeholder: "Title" %>
<%= f.input :sticky, as: :select, collection: [["No", false], ["Yes", true]], include_blank: false if mod? %>
<%= f.input :locked, as: :select, collection: [["No", false], ["Yes", true]], include_blank: false if mod? %>
<%= f.input :content, placeholder: "Text" %>
</div>
<% if mod? %>
<%= f.input :sticky %> <%= f.label :sticky %>
<%= f.input :locked %> <%= f.label :locked %>
<% end %>
<%= f.submit "Create forum", class: "btn blue" %><br>
Yea i know this is ugly :D
<% end %>

View File

@@ -17,6 +17,7 @@
<div id="menu">
<ul>
<%= link_to root_path do %><li>Home</li><% end %>
<%= link_to blogposts_path do %><li>Blog</li><% end %>
<%= link_to users_path do %><li>Users</li><% end %>
<%= link_to root_path do %><li>Info</li><% end %>
<%= link_to forums_path do %><li>Forums</li><% end %>

View File

@@ -7,8 +7,8 @@
</div>
<div id="form_inputs">
<%= text_field_tag :email, nil, placeholder: "email@example.com" %>
<%= password_field_tag :password, nil, placeholder: "••••••" %>
<div><%= text_field_tag :email, nil, placeholder: "email@example.com" %></div>
<div><%= password_field_tag :password, nil, placeholder: "••••••" %></div>
</div>
<%= submit_tag "Log in", class: "btn blue" %>

View File

@@ -0,0 +1,41 @@
<h1>Donate</h1>
<h3>via PayPal</h3>
<p>Donating keeps us motivated to do all the hard work and pay our bills for new hardware, etc.</p>
<p>We appreciate every amount of donation but we do have two special ranks:</p>
<ul>
<li>$5 or more: Donator
<li>$20 or more: Donator+
</ul>
</p>
<h3>Perks for you</h3>
<p>For <i>Donator</i> and <i>Donator+</i></p>
<ul>
<li>The warm feeling of donating and a big thank you!
<li>commands <i>/speed</i> and <i>/enchant</i>
<li>A $ suffix in chat (bold for Donor+)
<li>The name over your head gets a special color
<li>A sign with your name &amp; head at <i>/warp donors</i>
</ul>
<div class="donations">
<div class="donation">
<h1>Donate to Redstone Sheep</h1>
<h4>Sheep is our admin. He fixes everything &amp; keeps the server running.</h4>
<form target="_top" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input name="custom" type="text" placeholder="Your Minecraft name" value="<%= current_user.try(:ign) %>">
<input value="_s-xclick" name="cmd" type="hidden">
<input value="HPWLQLL87GTHC" name="hosted_button_id" type="hidden">
<input value="Donate" name="Donate" type="submit">
</form>
</div>
<div class="donation">
<h1>Donate to PanFritz</h1>
<h4>Pan hosts the Server.</h4>
<form target="_top" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<input name="custom" type="text" placeholder="Your Minecraft name" value="<%= current_user.try(:ign) %>">
<input value="_s-xclick" name="cmd" type="hidden">
<input value="SW8TJLDK9FX3W" name="hosted_button_id" type="hidden">
<input value="Donate" name="Donate" type="submit">
</form>
</div>
</div>

View File

@@ -0,0 +1,4 @@
<div id="delete_me" class="delete_me"> <!-- delete this div -->
<h1>The loneliest page in the world</h1>
<iframe width="420" height="315" src="//www.youtube.com/embed/N3O20EOE-p4?theme=light&color=red" frameborder="0" allowfullscreen></iframe>
</div>

View File

@@ -56,7 +56,7 @@
<% if !@user.twitter.blank? %>
<tr>
<td>Twitter</td>
<td><%= link_to @user.twitter, "https://twitter.com/#{CGI.escape(@user.twitter)}", :target => "_blank" %></td>
<td><%= link_to "@#{@user.twitter}", "https://twitter.com/#{CGI.escape(@user.twitter)}", :target => "_blank" %></td>
</tr>
<% end %>
<tr>

View File

@@ -4,6 +4,13 @@ Site::Application.routes.draw do
resources :comments
end
resources :statics, only: [:index, :donate], path: '' do
collection do
get 'donate'
get 'index'
end
end
resources :roles
resources :users do
@@ -16,7 +23,7 @@ Site::Application.routes.draw do
end
end
resources :forums, path: 'forums', as: 'forums' do
resources :forums, path: 'forums' do
collection do
resources :forumgroups, path: 'groups'
end
@@ -34,5 +41,5 @@ Site::Application.routes.draw do
post 'paypal' => 'paypal#create'
root to: 'blogposts#index'
root to: 'statics#index'
end

View File

@@ -32,7 +32,7 @@ deleted_user = User.create!(
User.create!(
name: "Redstone Sheep",
ign: "noobkackboon",
ign: "redstone_sheep",
email: "theredstonesheep@gmail.com",
about: "Hi, I am the admin :)",
password: "123456789",

BIN
erd.pdf Normal file

Binary file not shown.

11
jd-gui.cfg Normal file
View File

@@ -0,0 +1,11 @@
[Manifest]
Version=2
[RecentDirectories]
LoadPath=/home/moo/.minecraft/versions/13w47e/
SavePath=/home/moo/.minecraft/versions/13w47e/src/
[Decompilation]
LastUri=
[GUI]
MainWindowPosition=626,132 872x666 Maximized
[RecentFiles]
Path0=/home/moo/.minecraft/versions/13w47e/13w47e.jar

View File

@@ -0,0 +1,9 @@
{
"folders":
[
{
"follow_symlinks": true,
"path": "/home/moo/redstoner/rails/site"
}
]
}

1275
redstoner.sublime-workspace Normal file

File diff suppressed because it is too large Load Diff