diff --git a/README.rdoc b/README.rdoc index 7c36f23..1524f99 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,261 +1,2 @@ -== Welcome to Rails - -Rails is a web-application framework that includes everything needed to create -database-backed web applications according to the Model-View-Control pattern. - -This pattern splits the view (also called the presentation) into "dumb" -templates that are primarily responsible for inserting pre-built data in between -HTML tags. The model contains the "smart" domain objects (such as Account, -Product, Person, Post) that holds all the business logic and knows how to -persist themselves to a database. The controller handles the incoming requests -(such as Save New Account, Update Product, Show Post) by manipulating the model -and directing data to the view. - -In Rails, the model is handled by what's called an object-relational mapping -layer entitled Active Record. This layer allows you to present the data from -database rows as objects and embellish these data objects with business logic -methods. You can read more about Active Record in -link:files/vendor/rails/activerecord/README.html. - -The controller and view are handled by the Action Pack, which handles both -layers by its two parts: Action View and Action Controller. These two layers -are bundled in a single package due to their heavy interdependence. This is -unlike the relationship between the Active Record and Action Pack that is much -more separate. Each of these packages can be used independently outside of -Rails. You can read more about Action Pack in -link:files/vendor/rails/actionpack/README.html. - - -== Getting Started - -1. At the command prompt, create a new Rails application: - rails new myapp (where myapp is the application name) - -2. Change directory to myapp and start the web server: - cd myapp; rails server (run with --help for options) - -3. Go to http://localhost:3000/ and you'll see: - "Welcome aboard: You're riding Ruby on Rails!" - -4. Follow the guidelines to start developing your application. You can find -the following resources handy: - -* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html -* Ruby on Rails Tutorial Book: http://www.railstutorial.org/ - - -== Debugging Rails - -Sometimes your application goes wrong. Fortunately there are a lot of tools that -will help you debug it and get it back on the rails. - -First area to check is the application log files. Have "tail -f" commands -running on the server.log and development.log. Rails will automatically display -debugging and runtime information to these files. Debugging info will also be -shown in the browser on requests from 127.0.0.1. - -You can also log your own messages directly into the log file from your code -using the Ruby logger class from inside your controllers. Example: - - class WeblogController < ActionController::Base - def destroy - @weblog = Weblog.find(params[:id]) - @weblog.destroy - logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!") - end - end - -The result will be a message in your log file along the lines of: - - Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1! - -More information on how to use the logger is at http://www.ruby-doc.org/core/ - -Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are -several books available online as well: - -* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe) -* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide) - -These two books will bring you up to speed on the Ruby language and also on -programming in general. - - -== Debugger - -Debugger support is available through the debugger command when you start your -Mongrel or WEBrick server with --debugger. This means that you can break out of -execution at any point in the code, investigate and change the model, and then, -resume execution! You need to install ruby-debug to run the server in debugging -mode. With gems, use sudo gem install ruby-debug. Example: - - class WeblogController < ActionController::Base - def index - @posts = Post.all - debugger - end - end - -So the controller will accept the action, run the first line, then present you -with a IRB prompt in the server window. Here you can do things like: - - >> @posts.inspect - => "[#nil, "body"=>nil, "id"=>"1"}>, - #"Rails", "body"=>"Only ten..", "id"=>"2"}>]" - >> @posts.first.title = "hello from a debugger" - => "hello from a debugger" - -...and even better, you can examine how your runtime objects actually work: - - >> f = @posts.first - => #nil, "body"=>nil, "id"=>"1"}> - >> f. - Display all 152 possibilities? (y or n) - -Finally, when you're ready to resume execution, you can enter "cont". - - -== Console - -The console is a Ruby shell, which allows you to interact with your -application's domain model. Here you'll have all parts of the application -configured, just like it is when the application is running. You can inspect -domain models, change values, and save to the database. Starting the script -without arguments will launch it in the development environment. - -To start the console, run rails console from the application -directory. - -Options: - -* Passing the -s, --sandbox argument will rollback any modifications - made to the database. -* Passing an environment name as an argument will load the corresponding - environment. Example: rails console production. - -To reload your controllers and models after launching the console run -reload! - -More information about irb can be found at: -link:http://www.rubycentral.org/pickaxe/irb.html - - -== dbconsole - -You can go to the command line of your database directly through rails -dbconsole. You would be connected to the database with the credentials -defined in database.yml. Starting the script without arguments will connect you -to the development database. Passing an argument will connect you to a different -database, like rails dbconsole production. Currently works for MySQL, -PostgreSQL and SQLite 3. - -== Description of Contents - -The default directory structure of a generated Ruby on Rails application: - - |-- app - | |-- assets - | |-- images - | |-- javascripts - | `-- stylesheets - | |-- controllers - | |-- helpers - | |-- mailers - | |-- models - | `-- views - | `-- layouts - |-- config - | |-- environments - | |-- initializers - | `-- locales - |-- db - |-- doc - |-- lib - | `-- tasks - |-- log - |-- public - |-- script - |-- test - | |-- fixtures - | |-- functional - | |-- integration - | |-- performance - | `-- unit - |-- tmp - | |-- cache - | |-- pids - | |-- sessions - | `-- sockets - `-- vendor - |-- assets - `-- stylesheets - `-- plugins - -app - Holds all the code that's specific to this particular application. - -app/assets - Contains subdirectories for images, stylesheets, and JavaScript files. - -app/controllers - Holds controllers that should be named like weblogs_controller.rb for - automated URL mapping. All controllers should descend from - ApplicationController which itself descends from ActionController::Base. - -app/models - Holds models that should be named like post.rb. Models descend from - ActiveRecord::Base by default. - -app/views - Holds the template files for the view that should be named like - weblogs/index.html.erb for the WeblogsController#index action. All views use - eRuby syntax by default. - -app/views/layouts - Holds the template files for layouts to be used with views. This models the - common header/footer method of wrapping views. In your views, define a layout - using the layout :default and create a file named default.html.erb. - Inside default.html.erb, call <% yield %> to render the view using this - layout. - -app/helpers - Holds view helpers that should be named like weblogs_helper.rb. These are - generated for you automatically when using generators for controllers. - Helpers can be used to wrap functionality for your views into methods. - -config - Configuration files for the Rails environment, the routing map, the database, - and other dependencies. - -db - Contains the database schema in schema.rb. db/migrate contains all the - sequence of Migrations for your schema. - -doc - This directory is where your application documentation will be stored when - generated using rake doc:app - -lib - Application specific libraries. Basically, any kind of custom code that - doesn't belong under controllers, models, or helpers. This directory is in - the load path. - -public - The directory available for the web server. Also contains the dispatchers and the - default HTML files. This should be set as the DOCUMENT_ROOT of your web - server. - -script - Helper scripts for automation and generation. - -test - Unit and functional tests along with fixtures. When using the rails generate - command, template test files will be generated for you and placed in this - directory. - -vendor - External libraries that the application depends on. Also includes the plugins - subdirectory. If the app has frozen rails, those gems also go here, under - vendor/rails/. This directory is in the load path. +== Redstoner.com +I'm too lazy to write something here :D \ No newline at end of file diff --git a/app/assets/images/bg.png b/app/assets/images/bg.png new file mode 100644 index 0000000..46b8066 Binary files /dev/null and b/app/assets/images/bg.png differ diff --git a/app/assets/images/bg2.png b/app/assets/images/bg2.png new file mode 100644 index 0000000..f998ec4 Binary files /dev/null and b/app/assets/images/bg2.png differ diff --git a/app/assets/images/head_bg.png b/app/assets/images/head_bg.png new file mode 100644 index 0000000..e1ba2e0 Binary files /dev/null and b/app/assets/images/head_bg.png differ diff --git a/app/assets/images/logo.png b/app/assets/images/logo.png index ebce703..82df6d0 100644 Binary files a/app/assets/images/logo.png and b/app/assets/images/logo.png differ diff --git a/app/assets/javascripts/confirm.js b/app/assets/javascripts/app.js similarity index 74% rename from app/assets/javascripts/confirm.js rename to app/assets/javascripts/app.js index 8cdab5e..5fa243f 100644 --- a/app/assets/javascripts/confirm.js +++ b/app/assets/javascripts/app.js @@ -1,6 +1,9 @@ $(function(){ + $('[data-confirm]').click(function(){ var c = confirm($(this).attr('data-confirm')); if (!c) return false; }) + + $('#flash').delay(3000).fadeOut('slow'); }) \ No newline at end of file diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index e8f53e9..f59c271 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -10,8 +10,5 @@ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD // GO AFTER THE REQUIRES BELOW. // -//= #require jquery -//= #require jquery_ujs -//= #require_tree . //= require jquery -//= require confirm \ No newline at end of file +//= require app \ No newline at end of file diff --git a/app/assets/stylesheets/screen.css.scss b/app/assets/stylesheets/screen.css.scss index 151887d..9e12849 100644 --- a/app/assets/stylesheets/screen.css.scss +++ b/app/assets/stylesheets/screen.css.scss @@ -17,6 +17,10 @@ and (min-width: 1000px) overflow-y: scroll; } + body { + background-image: url('/assets/bg.png'); + } + a { transition: color 0.25s; color: $darkred; @@ -25,67 +29,39 @@ and (min-width: 1000px) color: #F00; } } - #notice { - background: #8e8; + #flash { text-align: center; padding: 10px; - border-bottom: 3px dashed #8d8; - font-weight: bold; - } - #alert { - background: #ebb; - text-align: center; - padding: 10px; - border-bottom: 3px dashed #fdd; font-weight: bold; + position: fixed; + top: 0; + left: 0; + right: 0; + &.notice { + background: #8e8; + border-bottom: 3px dashed #8d8; + } + &.alert { + background: #ebb; + border-bottom: 3px dashed #fdd; + } } #head { - width: 100%; - height: 50px; - background: $lightgrey; - border-bottom: 10px solid $darkgrey; - vertical-align: middle; - font-weight: bold; - box-shadow: 0 0 2px; - z-index: 99; - position: relative; + width: 800px; + margin: -10px auto 20px auto; + padding: 20px 13px 13px 13px; + background-image: url('/assets/head_bg.png'); + box-shadow: 0 0 10px -7px inset; + border-bottom: 1px solid #fff; + border-radius: 0 0 10px 10px; + overflow: hidden; #logo { - margin: 9px; - margin-left: 20px; - height: 32px; - width: 32px; float: left; - background: url('/assets/logo.png'); - } - a { - color: $midgrey; - &:hover { - color: $darkred; - } - } - #menu { - margin: auto; - display: table; - ul { - float: left; - margin-top: 0; - li { - float: left; - height: 100%; - margin: auto 10px; - display: block; - font-size: 2.3em; - } - } } #userinfo { float: right; padding: 0 10px; - margin-top: 6px; - text-align: right; - &.logged-out { - margin-top: 2px; - } + margin-top: 14px; img.avatar { border: 1px solid #000; border-radius: 16px; @@ -103,6 +79,30 @@ and (min-width: 1000px) line-height: 1em; } } + a { + color: $midgrey; + &:hover { + color: $darkred; + } + } + #menu { + width: 100%; + background: url('/assets/head_bg.png') #fff; + input { + display: inline; + } + ul { + float: left; + margin-top: 0; + li { + float: left; + height: 100%; + margin: auto 10px; + display: block; + font-size: 1.5em; + } + } + } } img.user-avatar { border: 1px solid #000; @@ -133,53 +133,50 @@ and (min-width: 1000px) h1 { font-weight: normal; - font-size: 400%; + font-size: 200%; margin: 0; color: #888; text-shadow: 0 1px #999; } } - #posts { - #post { - margin-bottom: 50px; - #post-title { - margin-bottom: 10px; - h2 { - font-weight: normal; - color: #700; - text-transform: uppercase; - display: inline; - font-size: 250%; - } - .comment-counter { - float: right; + .post { + margin-bottom: 50px; + .post-title { + margin-bottom: 10px; + word-wrap: break-word; + h2 { + font-weight: normal; + color: #700; + text-transform: uppercase; + display: inline; + font-size: 200%; + } + .comment-counter { + float: right; + } + } + .post-info { + border-bottom: 2px dashed #999; + color: #888; + a { + color: #755; + &:hover{ + color: #d55; } } } - } - - .post-info { - border-bottom: 2px dashed #999; - color: #888; - a { - color: #755; - &:hover{ - color: #d55; + .post-content { + margin-top: 10px; + clear: both; + word-wrap: break-word; + overflow: hidden; + img { + max-width: 100%; } } } - #post-content { - margin-top: 10px; - clear: both; - word-wrap: break-word; - overflow: hidden; - img { - max-width: 100%; - } - } - #comments { margin: 50px 0 0 40px; .comment { @@ -350,8 +347,34 @@ and (min-width: 1000px) width: 100%; } + .clear { + clear: both; + display: block; + visibility: hidden; + } - + #forum_groups { + .group { + margin: 10px 0; + .header { + background: #ddd; + border-radius: 5px 5px 0 0; + padding: 5px 10px; + border-bottom: 1px solid #ccc; + } + .forums { + border: 1px solid #ddd; + border-top: none; + border-bottom: none; + .forum { + display: block; + font-weight: bold; + padding: 5px 10px; + border-bottom: 1px solid #ddd; + } + } + } + } } \ No newline at end of file diff --git a/app/controllers/forumgroups_controller.rb b/app/controllers/forumgroups_controller.rb new file mode 100644 index 0000000..2cb3a8b --- /dev/null +++ b/app/controllers/forumgroups_controller.rb @@ -0,0 +1,6 @@ +class ForumgroupsController < ApplicationController + + def index + @groups = Forumgroup.all.sort{|s| s[:position]} + end +end \ No newline at end of file diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb new file mode 100644 index 0000000..82573fd --- /dev/null +++ b/app/controllers/forums_controller.rb @@ -0,0 +1,2 @@ +class ForumsController < ApplicationController +end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 6a829a9..f3b15f7 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,8 +1,9 @@ class SessionsController < ApplicationController + require 'resolv' def create user = User.find_by_email(params[:email]) if user && user.authenticate(params[:password]) - user.last_ip = request.remote_ip + user.last_ip = "#{request.remote_ip} | #{Resolv.getname(request.remote_ip)}" user.last_login = Time.now user.save if user.banned diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d45d2b4..25a981e 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -11,17 +11,17 @@ require 'open-uri' end def show - @user = User.find_by_id(params[:id]) + @user = User.find(params[:id]) unless @user - flash[:alert] = "User ##{params[:id]} does not exist!" + flash[:alert] = "User \"#{params[:id]}\" does not exist!" redirect_to User.find(1) end end - # REGISTER + # SIGNUP def new if current_user - flash[:notice] = "You are already registered!" + flash[:notice] = "You are already signed up!" redirect_to user_path(current_user.id) else @user = User.new @@ -38,7 +38,7 @@ require 'open-uri' def create if current_user - flash[:notice] = "You are already registered!" + flash[:notice] = "You are already signed up!" redirect_to current_user else @user = User.new(params[:user]) @@ -56,7 +56,7 @@ require 'open-uri' if mclogin.downcase.include?(data[:ign].downcase) redirect_to "http://youareanidiot.org/" else - redirect_to @user, notice: 'Successfully registered!' + redirect_to edit_user_path(@user), notice: 'Successfully signed up!' end else flash[:alert] = "Something went wrong" diff --git a/app/helpers/forum_helper.rb b/app/helpers/forum_helper.rb new file mode 100644 index 0000000..cfbd978 --- /dev/null +++ b/app/helpers/forum_helper.rb @@ -0,0 +1,2 @@ +module ForumHelper +end diff --git a/app/helpers/forums_helper.rb b/app/helpers/forums_helper.rb new file mode 100644 index 0000000..2e531fd --- /dev/null +++ b/app/helpers/forums_helper.rb @@ -0,0 +1,2 @@ +module ForumsHelper +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index 696ce4c..6bf993e 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -34,6 +34,6 @@ module UsersHelper def ranks # Lower case !!! - {"default" => 10, "donor" => 40, "mod" => 100, "admin" => 200, "superadmin" => 500} + {"banned" => 1, "unconfirmed" => 5, "default" => 10, "donor" => 40, "mod" => 100, "admin" => 200, "superadmin" => 500} end end \ No newline at end of file diff --git a/app/models/forum.rb b/app/models/forum.rb new file mode 100644 index 0000000..9805c64 --- /dev/null +++ b/app/models/forum.rb @@ -0,0 +1,3 @@ +class Forum < ActiveRecord::Base + belongs_to :forumgroup +end diff --git a/app/models/forumgroup.rb b/app/models/forumgroup.rb new file mode 100644 index 0000000..a3ca2a4 --- /dev/null +++ b/app/models/forumgroup.rb @@ -0,0 +1,3 @@ +class Forumgroup < ActiveRecord::Base + has_many :forums +end diff --git a/app/models/user.rb b/app/models/user.rb index 8ed7def..e3700fe 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -2,7 +2,7 @@ class User < ActiveRecord::Base attr_accessible :name, :ign, :email, :about, :password, :password_confirmation, :rank, :skype, :skype_public, :youtube, :youtube_channelname, :twitter has_secure_password validates_presence_of :password, :name, :email, :ign, :password_confirmation, :on => :create - validates :email, :uniqueness => true + validates :email, uniqueness: {case_sensitive: false} validates :name, :uniqueness => true validates :ign, :uniqueness => true diff --git a/app/views/blogposts/index.html.erb b/app/views/blogposts/index.html.erb index 8189858..4c78ebf 100644 --- a/app/views/blogposts/index.html.erb +++ b/app/views/blogposts/index.html.erb @@ -1,9 +1,8 @@ -

Blog

<% @posts.each do |p| %> -
-
-

<%= link_to p.title, p %>

+
+
+

<%= link_to truncate(p.title, length: 60, omission: " …"), p %>

<%= link_to pluralize(p.comments.count, "Comment"), p %> @@ -11,7 +10,7 @@ -
+
<%= RbbCode.new.convert(p.text).html_safe %>
diff --git a/app/views/blogposts/show.html.erb b/app/views/blogposts/show.html.erb index 81f20b2..934a5fc 100644 --- a/app/views/blogposts/show.html.erb +++ b/app/views/blogposts/show.html.erb @@ -1,15 +1,19 @@ -

<%= @post.title %>

- -
- <%= RbbCode.new.convert(@post.text).html_safe %> -
-
- <% @post.comments.each do |c| %> - <%= render "comments/comment", :c => c %> - <% end %> - <%= render "comments/new" %> +
+
+

<%= @post.title %>

+
+ +
+ <%= RbbCode.new.convert(@post.text).html_safe %> +
+
+ <% @post.comments.each do |c| %> + <%= render "comments/comment", :c => c %> + <% end %> + <%= render "comments/new" %> +
\ No newline at end of file diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index 6290e23..630846a 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -4,5 +4,5 @@ <% end %> -
<%= h(c.text).gsub("\n", "
").html_safe %>
+
<%= h(c.text).gsub(/(\w*[\r\n]){3,}/, "\n\n").gsub("\n", "
").html_safe %>
\ No newline at end of file diff --git a/app/views/forumgroups/index.html.erb b/app/views/forumgroups/index.html.erb new file mode 100644 index 0000000..12ebe60 --- /dev/null +++ b/app/views/forumgroups/index.html.erb @@ -0,0 +1,18 @@ +
+ <% @groups.each do |g| %> +
+
+ <%= g.name %> +
+ +
+ <% g.forums.sort{|s| s[:position]}.each do |f| %> +
+ <%= f.name %> +
+ <% end %> +
+ +
+ <% end %> +
\ No newline at end of file diff --git a/app/views/layouts/_head.html.erb b/app/views/layouts/_head.html.erb index fed91d4..125a702 100644 --- a/app/views/layouts/_head.html.erb +++ b/app/views/layouts/_head.html.erb @@ -1,7 +1,5 @@ +
\ No newline at end of file diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index a482d90..d808417 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -9,8 +9,8 @@ <%= render "/layouts/head" %> -<%= "
#{alert}
".html_safe if alert %> -<%= "
#{notice}
".html_safe if notice %> +<%= "
#{alert}
".html_safe if alert %> +<%= "
#{notice}
".html_safe if notice %>
<%= yield %>
diff --git a/app/views/users/edit.html.erb b/app/views/users/edit.html.erb index 21702c8..e4189fb 100644 --- a/app/views/users/edit.html.erb +++ b/app/views/users/edit.html.erb @@ -3,6 +3,10 @@ <%= simple_form_for @user do |f| %> + + + + diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index a7d7fed..9a24f16 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -12,33 +12,63 @@ <% end %> - <%= image_tag avatar_url(@user.id, 128), :class => "user-avatar avatar", :alt => "avatar" %>
- - <% if @user.banned %> + <% if @user.rank.to_i == rank_to_int("banned") %> This user is banned! <% end %> - - IGN: <%= @user.ign %>
- - Rank: <%= link_to int_to_rank(@user.rank), users_path(:rank => int_to_rank(@user.rank)) %>
- - <% 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? %>
- Twitter: <%= link_to @user.twitter, "https://twitter.com/#{CGI::escape(@user.twitter)}", :target => "_blank" if !@user.twitter.blank? %>
- Skype: <%= @user.skype %>
+ <% if @user.rank.to_i == rank_to_int("unconfirmed") %> + This user hasn't confirmed his email yet! <% end %> - Joined: <%= @user.created_at.strftime("%e. %b %Y") %>
- - <% if mod? %> -
- Last IP: <%= @user.last_ip %>
- Email: <%= @user.email %>
- Last login: <%= @user.last_login.strftime("%e. %b %Y, %H:%M") %> - <% end %> - -
- - <%= @user.about.blank? ? "nothing".html_safe : @user.about.gsub("\n", "
").html_safe %> +<%= image_tag avatar_url(@user.id, 128), :class => "user-avatar avatar", :alt => "avatar" %> +
<%= image_tag avatar_url(@user.id, 128), :class => "user-avatar avatar", :alt => "avatar" %>
Display name <%= f.input :name, :label => false %>
+ + + + + + + + + + <% if current_user && !@user.skype.blank? && (@user.skype_public || current_user == @user || mod?) %> + + + + + <% end %> + <% if !@user.youtube.blank? && @user.youtube_channelname.blank? %> + + + + + <% end %> + <% if !@user.twitter.blank? %> + + + + + <% end %> + + + + + <% if mod? || current_user == @user %> + + + + + + + + + + + + + <% end %> + +
IGN<%= @user.ign %>
Rank<%= link_to int_to_rank(@user.rank), users_path(:rank => int_to_rank(@user.rank)) %>
Skype<%= @user.skype %>
YouTube<%= link_to @user.youtube_channelname, "https://youtube.com/user/#{CGI::escape(@user.youtube)}", :target => "_blank" %>
Twitter<%= link_to @user.twitter, "https://twitter.com/#{CGI::escape(@user.twitter)}", :target => "_blank" %>
Joined<%= @user.created_at.strftime("%e. %b %Y") %>
Last IP<%= @user.last_ip %>
Email<%= mail_to @user.email, @user.email, :subject => "Redstoner" %>
Last login<%= @user.last_login.strftime("%e. %b %Y, %H:%M") %>
+
+ <%= @user.about.blank? ? "nothing".html_safe : h(@user.about).gsub("\n", "
").html_safe %>
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index d86c882..e3b8e08 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -12,15 +12,18 @@ Site::Application.routes.draw do end end + resources :forumgroups, :as => 'forums', :path => '/forums' do + + end + match '/serverstatus.png' => 'serverchecker#show' get "logout" => 'sessions#destroy' get 'login' => 'sessions#new' - get 'register' => 'users#new' + get 'signup' => 'users#new' post 'login' => 'sessions#create' post 'paypal' => 'paypal#create' - root :to => 'blogposts#index' end \ No newline at end of file diff --git a/db/migrate/20130802051129_add_forumgroups.rb b/db/migrate/20130802051129_add_forumgroups.rb new file mode 100644 index 0000000..565f5b0 --- /dev/null +++ b/db/migrate/20130802051129_add_forumgroups.rb @@ -0,0 +1,9 @@ +class AddForumgroups < ActiveRecord::Migration + def change + create_table :forumgroups do |t| + t.string :name + t.integer :position + t.timestamps + end + end +end \ No newline at end of file diff --git a/db/migrate/20130802051521_create_forums.rb b/db/migrate/20130802051521_create_forums.rb new file mode 100644 index 0000000..d7017ad --- /dev/null +++ b/db/migrate/20130802051521_create_forums.rb @@ -0,0 +1,11 @@ +class CreateForums < ActiveRecord::Migration + def change + create_table :forums do |t| + t.string "name" + t.integer "position" + t.references :forumgroup + + t.timestamps + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a1f6757..26ec139 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130728003021) do +ActiveRecord::Schema.define(:version => 20130802051521) do create_table "blogposts", :force => true do |t| t.string "title" @@ -29,6 +29,21 @@ ActiveRecord::Schema.define(:version => 20130728003021) do t.datetime "updated_at", :null => false end + create_table "forumgroups", :force => true do |t| + t.string "name" + t.integer "position" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "forums", :force => true do |t| + t.string "name" + t.integer "position" + t.integer "forumgroup_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "users", :force => true do |t| t.string "name", :null => false t.string "ign", :null => false diff --git a/db/seeds.rb b/db/seeds.rb index d61c4a8..3b8c43a 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -1,24 +1,6 @@ # This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # -deleted_user = User.new({ - name: "Deleted user", - ign: "Steve", - email: "example@example.com", - about: "Hey, apparently, I do no longer exist. This is just a placeholder profile", - password: "D6^w,:A})@/y>@$18u%D2,_@Se{%>$=,14Nc>#Oz4.[eP$X0p'1fW'%=60H{7]i'H);oX(epMK5B2>/l]t(!_T3p,,]e@Uh%]Vq%[~)_~$?=[6S#8%H&JOd#/#|PRH2/q?!]%(#1;6&_*u&%-+&G-dP*j,1x+@+.6]#6{H$]=I", - password_confirmation: "D6^w,:A})@/y>@$18u%D2,_@Se{%>$=,14Nc>#Oz4.[eP$X0p'1fW'%=60H{7]i'H);oX(epMK5B2>/l]t(!_T3p,,]e@Uh%]Vq%[~)_~$?=[6S#8%H&JOd#/#|PRH2/q?!]%(#1;6&_*u&%-+&G-dP*j,1x+@+.6]#6{H$]=I", - rank: 10 - }) -deleted_user.update_attribute("skype", "echo123") -deleted_user.update_attribute("skype_public", true) -deleted_user.update_attribute("last_ip", "0.0.0.0") -deleted_user.update_attribute("last_login", Time.utc(0).to_datetime) -deleted_user.update_attribute("last_active", Time.utc(0).to_datetime) -deleted_user.update_attribute("created_at", Time.utc(0).to_datetime) -deleted_user.update_attribute("updated_at", Time.utc(0).to_datetime) -deleted_user.save - User.create( name: "Redstone Sheep", ign: "noobkackboon", diff --git a/test/fixtures/forumgroups.yml b/test/fixtures/forumgroups.yml new file mode 100644 index 0000000..c63aac0 --- /dev/null +++ b/test/fixtures/forumgroups.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/fixtures/forums.yml b/test/fixtures/forums.yml new file mode 100644 index 0000000..c63aac0 --- /dev/null +++ b/test/fixtures/forums.yml @@ -0,0 +1,11 @@ +# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html + +# This model initially had no columns defined. If you add columns to the +# model remove the '{}' from the fixture names and add the columns immediately +# below each fixture, per the syntax in the comments below +# +one: {} +# column: value +# +two: {} +# column: value diff --git a/test/functional/forum_controller_test.rb b/test/functional/forum_controller_test.rb new file mode 100644 index 0000000..143a13c --- /dev/null +++ b/test/functional/forum_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ForumControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/functional/forums_controller_test.rb b/test/functional/forums_controller_test.rb new file mode 100644 index 0000000..601a839 --- /dev/null +++ b/test/functional/forums_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ForumsControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/forum_test.rb b/test/unit/forum_test.rb new file mode 100644 index 0000000..a6f90e4 --- /dev/null +++ b/test/unit/forum_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ForumTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/forumgroup_test.rb b/test/unit/forumgroup_test.rb new file mode 100644 index 0000000..381763e --- /dev/null +++ b/test/unit/forumgroup_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class ForumgroupTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/unit/helpers/forum_helper_test.rb b/test/unit/helpers/forum_helper_test.rb new file mode 100644 index 0000000..16106f5 --- /dev/null +++ b/test/unit/helpers/forum_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ForumHelperTest < ActionView::TestCase +end diff --git a/test/unit/helpers/forums_helper_test.rb b/test/unit/helpers/forums_helper_test.rb new file mode 100644 index 0000000..deebfb0 --- /dev/null +++ b/test/unit/helpers/forums_helper_test.rb @@ -0,0 +1,4 @@ +require 'test_helper' + +class ForumsHelperTest < ActionView::TestCase +end