diff --git a/Gemfile b/Gemfile
index dadae27..afac3de 100644
--- a/Gemfile
+++ b/Gemfile
@@ -21,6 +21,7 @@ gem 'newrelic_rpm', '~> 3.7.2.195'
gem 'will_paginate', '~> 3.0.5'
gem 'dynamic_form', '~> 1.1.4'
gem 'country_code_select', '~> 1.0.1'
+gem 'active_link_to', '~> 1.0.2'
gem 'rmagick', '~> 2.13.2', require: false
gem 'sprockets', '~> 2.2.1'
@@ -45,8 +46,10 @@ group :development do
gem 'capistrano-bundler', '~> 1.1.2'
gem 'capistrano-rails', '~> 1.1'
gem 'capistrano3-unicorn', '~> 0.1.1'
+ gem 'better_errors', '~> 1.1.0'
+ gem 'binding_of_caller', '~> 0.7.2'
gem 'annotate', '~> 2.6.2'
- gem 'quiet_assets'
+ gem 'quiet_assets', '~> 1.0.2'
end
group :test do
diff --git a/Gemfile.lock b/Gemfile.lock
index af37a29..dc86ebb 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -14,6 +14,8 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
+ active_link_to (1.0.2)
+ actionpack
activemodel (3.2.17)
activesupport (= 3.2.17)
builder (~> 3.0.0)
@@ -33,6 +35,11 @@ GEM
rake (>= 0.8.7)
arel (3.0.3)
bbcoder (1.0.1)
+ better_errors (1.1.0)
+ coderay (>= 1.0.0)
+ erubis (>= 2.6.6)
+ binding_of_caller (0.7.2)
+ debug_inspector (>= 0.0.1)
bitters (0.9.3)
bourbon (>= 3.1)
sass (>= 3.2)
@@ -86,6 +93,7 @@ GEM
activesupport (>= 3.0)
dalli (2.7.0)
database_cleaner (1.2.0)
+ debug_inspector (0.0.2)
debugger (1.6.6)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
@@ -265,8 +273,11 @@ PLATFORMS
x86-mingw32
DEPENDENCIES
+ active_link_to (~> 1.0.2)
annotate (~> 2.6.2)
bbcoder (~> 1.0.1)
+ better_errors (~> 1.1.0)
+ binding_of_caller (~> 0.7.2)
bitters (~> 0.9.3)
bluecloth (~> 2.2.0)
bourbon (~> 3.1.8)
@@ -298,7 +309,7 @@ DEPENDENCIES
oj (~> 2.5.5)
poltergeist (~> 1.5.0)
pry-debugger (~> 0.2.2)
- quiet_assets
+ quiet_assets (~> 1.0.2)
rails (~> 3.2.17)
rmagick (~> 2.13.2)
rspec-rails (~> 2.14.1)
diff --git a/app/assets/images/layout/forum-category-highlight.png b/app/assets/images/layout/forum-category-highlight.png
new file mode 100644
index 0000000..0d00675
Binary files /dev/null and b/app/assets/images/layout/forum-category-highlight.png differ
diff --git a/app/assets/images/layout/forum-category.png b/app/assets/images/layout/forum-category.png
new file mode 100644
index 0000000..61f4eaa
Binary files /dev/null and b/app/assets/images/layout/forum-category.png differ
diff --git a/app/assets/images/logo-icon.png b/app/assets/images/logo-icon.png
new file mode 100644
index 0000000..dcd3211
Binary files /dev/null and b/app/assets/images/logo-icon.png differ
diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js
index 2631fab..f1e4c06 100644
--- a/app/assets/javascripts/local.js
+++ b/app/assets/javascripts/local.js
@@ -191,10 +191,12 @@ function findUser(source) {
return false;
}
-function QuoteText(id) {
+function QuoteText(id, type) {
+ type = type || 'posts';
+
$.ajax({
type: "GET",
- url: "/posts/quote/" + id + ".js",
+ url: "/" + type + "/quote/" + id + ".js",
dataType: "script"
});
}
diff --git a/app/assets/stylesheets/_variables.scss b/app/assets/stylesheets/_variables.scss
index 9291d45..a0529f1 100644
--- a/app/assets/stylesheets/_variables.scss
+++ b/app/assets/stylesheets/_variables.scss
@@ -42,6 +42,7 @@ $base-border-radius: em(3);
Colours
*/
+$red: #de8650;
$green: #1f7f5c;
$blue: #5a9aa8;
$purple: #6a5a8c;
@@ -87,7 +88,7 @@ $navbar-text: white;
$flash-text: white;
$flash-notice: #5a9aa8;
$flash-success: #1f7f5c;
-$flash-warning: #de8650;
+$flash-warning: $red;
$flash-error: #e56c69;
$input-primary: white;
diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss
index 4484d7e..d926447 100644
--- a/app/assets/stylesheets/application.css.scss
+++ b/app/assets/stylesheets/application.css.scss
@@ -24,6 +24,8 @@
@import "components/flashes";
@import "components/comments";
@import "components/gather";
+@import "components/breadcrumbs";
+@import "components/pagination";
/*
Layout
@@ -35,6 +37,7 @@
@import "layout/body";
@import "layout/sidebar";
@import "layout/footer";
+@import "layout/helpers";
/*
Pages
@@ -42,3 +45,4 @@
@import "pages/news";
@import "pages/contests";
+@import "pages/forums";
diff --git a/app/assets/stylesheets/components/_breadcrumbs.scss b/app/assets/stylesheets/components/_breadcrumbs.scss
new file mode 100644
index 0000000..0a20a41
--- /dev/null
+++ b/app/assets/stylesheets/components/_breadcrumbs.scss
@@ -0,0 +1,16 @@
+/*
+ Breadcrumbs
+*/
+
+.breadcrumbs {
+ @include span-columns(12);
+ margin-bottom: em(20);
+
+ a {
+ display: inline-block;
+ }
+
+ .fa {
+ margin: 0 em(10);
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/components/_forms.scss b/app/assets/stylesheets/components/_forms.scss
index c67c203..e2c9149 100644
--- a/app/assets/stylesheets/components/_forms.scss
+++ b/app/assets/stylesheets/components/_forms.scss
@@ -127,7 +127,8 @@ form.square {
line-height: em(16);
}
- input {
+ input,
+ textarea {
@include span-columns(9);
}
}
diff --git a/app/assets/stylesheets/components/_pagination.scss b/app/assets/stylesheets/components/_pagination.scss
new file mode 100644
index 0000000..db5869a
--- /dev/null
+++ b/app/assets/stylesheets/components/_pagination.scss
@@ -0,0 +1,8 @@
+/*
+ Pagination
+*/
+
+.pagination {
+ @include span-columns(12);
+ margin: em(20) 0;
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/layout/_body.scss b/app/assets/stylesheets/layout/_body.scss
index 3acbb97..39a496a 100644
--- a/app/assets/stylesheets/layout/_body.scss
+++ b/app/assets/stylesheets/layout/_body.scss
@@ -1,10 +1,24 @@
+/*
+ Main Containers
+*/
+
+html,
body {
margin: 0;
padding: 0;
+ width: 100%;
+ min-height: 100%;
+}
+
+body {
background: $dark-blue;
@include background-image(linear-gradient($dark-blue, $medium-gray));
}
+#container {
+ min-height: 100%;
+}
+
%container-padded {
padding: 0 em(20);
}
@@ -17,13 +31,16 @@ body {
@extend %container-padded;
}
-#content,
-#forums {
+#content {
@include span-columns(12);
background: $light-blue;
padding-top: em(20);
}
+#forums {
+ @include span-columns(12);
+}
+
#main {
@include span-columns(9);
}
@@ -32,14 +49,3 @@ body {
@include span-columns(3);
@include omega();
}
-
-img.flag {
- display: inline-block;
- vertical-align: - em(6);
- margin-right: em(10);
-}
-
-.actions-bottom {
- @include span-columns(12);
- margin-top: em(20);
-}
\ No newline at end of file
diff --git a/app/assets/stylesheets/layout/_helpers.scss b/app/assets/stylesheets/layout/_helpers.scss
new file mode 100644
index 0000000..7d35bb1
--- /dev/null
+++ b/app/assets/stylesheets/layout/_helpers.scss
@@ -0,0 +1,37 @@
+/*
+ Global Helpers
+*/
+
+img.flag {
+ display: inline-block;
+ vertical-align: - em(6);
+ margin-right: em(10);
+}
+
+.actions-bottom {
+ @include span-columns(12);
+ margin-top: em(20);
+}
+
+fieldset {
+ border: em(2) solid $light-gray;
+
+ > br:first-child,
+ > br:last-child {
+ display: none;
+ }
+
+ legend {
+ padding: 0 em(10);
+
+ &+br {
+ display: none;
+ }
+ }
+
+ blockquote {
+ border: 0;
+ padding: 0;
+ margin: 0;
+ }
+}
diff --git a/app/assets/stylesheets/layout/_navigation.scss b/app/assets/stylesheets/layout/_navigation.scss
index d903343..65f94da 100644
--- a/app/assets/stylesheets/layout/_navigation.scss
+++ b/app/assets/stylesheets/layout/_navigation.scss
@@ -7,6 +7,7 @@
background-color: $background-primary;
height: em(60);
max-height: em(60);
+
nav {
@include outer-container;
}
@@ -42,6 +43,7 @@ ul.navigation {
padding: em(22);
float: left;
border-right: em(1) solid $navbar-border;
+
&:hover,
&.active {
background-color: $navbar-secondary;
@@ -86,6 +88,10 @@ ul.navigation {
li {
border-bottom: em(1) solid lighten($navbar-secondary, 10%);
+ &:first-child {
+ border-top: em(1) solid lighten($navbar-secondary, 10%);
+ }
+
&:last-child {
border-bottom: none;
}
diff --git a/app/assets/stylesheets/mixins/_buttons.scss b/app/assets/stylesheets/mixins/_buttons.scss
index 7a4b715..ccd74f4 100644
--- a/app/assets/stylesheets/mixins/_buttons.scss
+++ b/app/assets/stylesheets/mixins/_buttons.scss
@@ -19,4 +19,16 @@
button,
a.button {
@include button;
+
+ &.tiny {
+ background-color: transparentize($green, .5);
+ border-radius: em(14);
+ height: em(25);
+ padding: em(1) em(12);
+ margin: 0 em(10) 0 0;
+
+ &:hover {
+ color: $light-gray;
+ }
+ }
}
diff --git a/app/assets/stylesheets/pages/_forums.scss b/app/assets/stylesheets/pages/_forums.scss
new file mode 100644
index 0000000..5c646ff
--- /dev/null
+++ b/app/assets/stylesheets/pages/_forums.scss
@@ -0,0 +1,178 @@
+/*
+ Forums
+*/
+
+#forums {
+ /*
+ Buttons
+ */
+
+ .controls {
+ @include span-columns(12);
+ }
+}
+
+/*
+ Categories
+*/
+
+div#categories {
+
+ /*
+ Tables
+ */
+
+ table.category {
+ table-layout: auto;
+ }
+
+ .bullet {
+ width: 10%;
+ background: image-url('layout/forum-category.png') center center no-repeat;
+
+ &.highlight {
+ background-image: image-url('layout/forum-category-highlight.png');
+ }
+ }
+
+ .forum {
+ width: 45%;
+ padding-right: em(10);
+ }
+
+ .actions {
+ width: 10%;
+ text-align: center;
+ }
+
+ .topics,
+ .posts {
+ width: 10%;
+ }
+
+ .last {
+ width: 15%;
+ }
+}
+
+/*
+ Topics
+*/
+
+#topics {
+ table-layout: auto;
+ margin-bottom: em(40);
+
+ .topic {
+ width: 55%;
+ }
+
+ .author {
+ width: 10%;
+ }
+
+ .replies,
+ .views {
+ width: 10%;
+ }
+
+ .last {
+ width: 15%;
+ }
+}
+
+.statistics {
+ margin: em(20) 0;
+
+ h4 {
+ margin-bottom: 1em;
+ }
+}
+
+#topic {
+
+ .controls {
+ margin-top: em(20);
+ }
+
+ #reply {
+ display: none;
+ }
+}
+
+/*
+ Posts
+*/
+
+#posts {
+ @include span-columns(12);
+ margin-top: em(20);
+
+ .post {
+ @include span-columns(12);
+ border-top: em(3) solid $light-gray;
+ padding: em(20) 0;
+
+ &:last-child {
+ border-bottom: em(3) solid $light-gray;
+ margin-bottom: em(40);
+ }
+
+ .avatar {
+ @include span-columns(3);
+
+ h5 {
+ text-align: center;
+ margin-bottom: 1em;
+ }
+
+ .image,
+ .team {
+ @include span-columns(12);
+ text-align: center;
+ margin-bottom: em(10);
+ }
+
+ .admin {
+ color: $red;
+ }
+ }
+
+ .content {
+ @include span-columns(9);
+ @include omega;
+
+ .text,
+ .signature {
+ @include span-columns(12);
+ padding: em(20) 0;
+ }
+ }
+
+ .header {
+ @include span-columns(12);
+
+ .time {
+ @include span-columns(6);
+ }
+
+ .posts {
+ @include span-columns(6);
+ text-align: right;
+ }
+ }
+
+ .actions {
+ @include span-columns(12);
+
+ .user {
+ @include span-columns(3);
+ }
+
+ .reply {
+ @include span-columns(9);
+ @include omega;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/assets/stylesheets/pages/_news.scss b/app/assets/stylesheets/pages/_news.scss
index 1b82c92..24a15cd 100644
--- a/app/assets/stylesheets/pages/_news.scss
+++ b/app/assets/stylesheets/pages/_news.scss
@@ -14,12 +14,26 @@ div.article {
.author {
@include span-columns(6);
+
+ a {
+ font-weight: bold;
+ }
}
- .actions {
+ .comments {
@include span-columns(6);
@include omega;
text-align: right;
+
+ .fa {
+ margin-right: em(10);
+ }
+ }
+
+ .actions {
+ @include span-columns(12);
+ @include omega;
+ margin-top: em(10);
}
&:first-child {
@@ -50,4 +64,4 @@ div.article-links {
padding-left: em(10);
}
}
-}
\ No newline at end of file
+}
diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb
index 554c273..bb9d523 100644
--- a/app/controllers/comments_controller.rb
+++ b/app/controllers/comments_controller.rb
@@ -1,5 +1,5 @@
class CommentsController < ApplicationController
- before_filter :get_comment, only: [:raw, :edit, :update, :destroy]
+ before_filter :get_comment, only: [:raw, :quote, :edit, :update, :destroy]
respond_to :html, :js
def index
@@ -47,6 +47,9 @@ class CommentsController < ApplicationController
redirect_to_back
end
+ def quote
+ end
+
private
def get_comment
diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb
index d4107f6..bf13ad8 100644
--- a/app/controllers/forums_controller.rb
+++ b/app/controllers/forums_controller.rb
@@ -46,13 +46,13 @@ class ForumsController < ApplicationController
def up
raise AccessError unless @forum.can_update? cuser
- @forum.move_up :category_id => @forum.category.id
+ @forum.move_up(category_id: @forum.category.id)
redirect_to_back
end
def down
raise AccessError unless @forum.can_update? cuser
- @forum.move_down :category_id => @forum.category.id
+ @forum.move_down(category_id: @forum.category.id)
redirect_to_back
end
diff --git a/app/models/concerns/extra.rb b/app/models/concerns/extra.rb
new file mode 100644
index 0000000..55093b9
--- /dev/null
+++ b/app/models/concerns/extra.rb
@@ -0,0 +1,76 @@
+module Extra
+ extend ActiveSupport::Concern
+
+ CODING_HTML = 0
+ CODING_BBCODE = 1
+ CODING_MARKDOWN = 2
+
+ included do
+ def codings
+ {
+ CODING_HTML => "Plain HTML",
+ CODING_BBCODE => "BBCode",
+ CODING_MARKDOWN => "Markdown"
+ }
+ end
+
+ def check_params(params, filter)
+ (params.instance_of?(Array) ? params : params.keys).each do |key|
+ return false unless filter.include? key.to_sym
+ end
+ return true
+ end
+
+ def error_messages
+ self.errors.full_messages.uniq
+ end
+
+ def bbcode_to_html(text)
+ Sanitize.clean(text.to_s).bbcode_to_html.gsub(/\n|\r\n/, "
").html_safe
+ end
+
+ def move_up(scope, column = "position")
+ n = 0
+ objects = self.class.all(conditions: scope, order: column)
+ binding.pry
+ objects.each do |item|
+ if item.id == id and n > 0
+ old_position = item.read_attribute(:column)
+ item.update_attribute(column, objects.fetch(n-1).read_attribute(:column))
+ objects.fetch(n-1).update_attribute(column, old_position)
+ end
+ n = n + 1
+ end
+ end
+
+ def move_down(scope, column = "position")
+ n = 0
+ objects = self.class.all(conditions: scope, order: column)
+ binding.pry
+ objects.each do |item|
+ if item.id == id and n < (objects.length-1)
+ old_position = item.read_attribute(:column)
+ item.update_attribute(column, objects.fetch(n+1).read_attribute(:column))
+ objects.fetch(n+1).update_attribute(column, old_position)
+ end
+ n = n + 1
+ end
+ end
+
+ def can_show? cuser
+ true
+ end
+
+ def can_create? cuser
+ true
+ end
+
+ def can_update? cuser
+ true
+ end
+
+ def can_destroy? cuser
+ true
+ end
+ end
+end
\ No newline at end of file
diff --git a/app/models/forum.rb b/app/models/forum.rb
index 0eb9c3a..1331234 100644
--- a/app/models/forum.rb
+++ b/app/models/forum.rb
@@ -13,6 +13,7 @@
class Forum < ActiveRecord::Base
include Extra
+
BANS = 8
TRASH = 12
diff --git a/app/models/topic.rb b/app/models/topic.rb
index 0c0fd68..fc405ca 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -30,7 +30,7 @@ class Topic < ActiveRecord::Base
has_many :posts, :order => "id ASC", :dependent => :destroy
has_many :view_counts, :as => :viewable, :dependent => :destroy
- scope :basic, :include => [:latest, {:forum => :forumer}, :user]
+ scope :basic, :include => [:latest, { forum: :forumer }, :user]
scope :ordered, :order => "state DESC, posts.id DESC"
scope :recent,
:conditions => "forumers.id IS NULL AND posts.id = (SELECT id FROM posts AS P WHERE P.topic_id = topics.id ORDER BY id DESC LIMIT 1)",
@@ -39,7 +39,7 @@ class Topic < ActiveRecord::Base
scope :latest_page,
lambda { |page| {:limit => "#{(page-1)*LATEST_PER_PAGE}, #{(page-1)*LATEST_PER_PAGE+LATEST_PER_PAGE}"} }
- validates_presence_of :user_id, :forum_id
+ validates_presence_of :user_id, :forum_id
validates_length_of :title, :in => 1..50
validates_length_of :first_post, :in => 1..10000, :on => :create
diff --git a/app/models/user.rb b/app/models/user.rb
index 570ac8d..7190a16 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -27,6 +27,7 @@ require File.join(Rails.root, 'vendor', 'plugins', 'acts_as_versioned', 'lib', '
class User < ActiveRecord::Base
include Extra
+
VERIFICATION_TIME = 604800
attr_protected :id, :created_at, :updated_at, :lastvisit, :lastip, :password, :version
diff --git a/app/views/application/_navigation.html.erb b/app/views/application/_navigation.html.erb
index 1cae1f4..6ab9ab2 100644
--- a/app/views/application/_navigation.html.erb
+++ b/app/views/application/_navigation.html.erb
@@ -1,8 +1,8 @@
diff --git a/app/views/articles/_article.html.erb b/app/views/articles/_article.html.erb
index 62c2346..05a24f0 100644
--- a/app/views/articles/_article.html.erb
+++ b/app/views/articles/_article.html.erb
@@ -13,14 +13,19 @@
<%= namelink(article.user) %> on <%= longtime article.created_at %>
+
+
<% if article.can_update? cuser %>
- <%= link_to 'Edit', edit_article_path(article) %> |
+ <%= link_to 'Edit', edit_article_path(article), class: 'button tiny' %>
<% end %>
<% if article.can_destroy? cuser %>
- <%= link_to 'Destroy', article, confirm: 'Are you sure?', method: :delete %> |
+ <%= link_to 'Destroy', article, confirm: 'Are you sure?', method: :delete, class: 'button tiny' %>
<% end %>
- <%= link_to "History", article_versions_path(article) %> |
- <%= link_to "Comments: #{article.comments.count}", article %>
+ <%= link_to "History", article_versions_path(article), class: 'button tiny' %>
diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb
index b500805..7959fc2 100644
--- a/app/views/comments/_comment.html.erb
+++ b/app/views/comments/_comment.html.erb
@@ -11,7 +11,7 @@
<% if cuser %>
[
- <%= link_to_function 'Q', "QuoteText('comments', #{comment.id}, '#{comment.user}')" %>
+ <%= link_to_function 'Q', "QuoteText(#{comment.id}, 'comments')" %>
<% if comment.can_update? cuser %>
<%= link_to 'E', edit_comment_path(comment) %>
<% end %>
diff --git a/app/views/comments/_new.html.erb b/app/views/comments/_new.html.erb
index 8afa1d7..4faef68 100644
--- a/app/views/comments/_new.html.erb
+++ b/app/views/comments/_new.html.erb
@@ -1,4 +1,4 @@
-