mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-25 12:01:03 +00:00
Added form view styling
Improved articles styling Improved bbcode to html formatting HTML and CSS refactorings Moved Extra into concerns Changed repo URL to read-only for deploys Fixes quotes in comments
This commit is contained in:
parent
cf8a92f628
commit
775f5682a4
42 changed files with 658 additions and 386 deletions
5
Gemfile
5
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
|
||||
|
|
13
Gemfile.lock
13
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)
|
||||
|
|
BIN
app/assets/images/layout/forum-category-highlight.png
Normal file
BIN
app/assets/images/layout/forum-category-highlight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.4 KiB |
BIN
app/assets/images/layout/forum-category.png
Normal file
BIN
app/assets/images/layout/forum-category.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
BIN
app/assets/images/logo-icon.png
Normal file
BIN
app/assets/images/logo-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 275 KiB |
|
@ -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"
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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";
|
||||
|
|
16
app/assets/stylesheets/components/_breadcrumbs.scss
Normal file
16
app/assets/stylesheets/components/_breadcrumbs.scss
Normal file
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Breadcrumbs
|
||||
*/
|
||||
|
||||
.breadcrumbs {
|
||||
@include span-columns(12);
|
||||
margin-bottom: em(20);
|
||||
|
||||
a {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.fa {
|
||||
margin: 0 em(10);
|
||||
}
|
||||
}
|
|
@ -127,7 +127,8 @@ form.square {
|
|||
line-height: em(16);
|
||||
}
|
||||
|
||||
input {
|
||||
input,
|
||||
textarea {
|
||||
@include span-columns(9);
|
||||
}
|
||||
}
|
||||
|
|
8
app/assets/stylesheets/components/_pagination.scss
Normal file
8
app/assets/stylesheets/components/_pagination.scss
Normal file
|
@ -0,0 +1,8 @@
|
|||
/*
|
||||
Pagination
|
||||
*/
|
||||
|
||||
.pagination {
|
||||
@include span-columns(12);
|
||||
margin: em(20) 0;
|
||||
}
|
|
@ -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);
|
||||
}
|
37
app/assets/stylesheets/layout/_helpers.scss
Normal file
37
app/assets/stylesheets/layout/_helpers.scss
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
178
app/assets/stylesheets/pages/_forums.scss
Normal file
178
app/assets/stylesheets/pages/_forums.scss
Normal file
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
76
app/models/concerns/extra.rb
Normal file
76
app/models/concerns/extra.rb
Normal file
|
@ -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/, "<br>").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
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
class Forum < ActiveRecord::Base
|
||||
include Extra
|
||||
|
||||
BANS = 8
|
||||
TRASH = 12
|
||||
|
||||
|
|
|
@ -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)",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
<nav id="menu">
|
||||
<ul class="navigation">
|
||||
<li><%= link_to "News", controller: "articles", action: "news_index" %></li>
|
||||
<li><%= active_link_to "News", root_path, active: ["articles", "news_index"] %></li>
|
||||
<li class="dropdown">
|
||||
<%= link_to "Contests", controller: "contests", action: "current" %>
|
||||
<%= active_link_to "Contests", controller: "contests", action: "current" %>
|
||||
<ul>
|
||||
<li><%= link_to "Historical", "/contests" %></li>
|
||||
<li><%= link_to "NS1 History", "/contests/historical/NS1" %></li>
|
||||
|
@ -10,27 +10,27 @@
|
|||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<%= link_to "Gathers", Gather.last %>
|
||||
<%= active_link_to "Gathers", Gather.last %>
|
||||
<ul>
|
||||
<li><%= link_to "Introduction", article_url(464) %></li>
|
||||
<li><%= link_to "Archives", "/gathers/" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<%= link_to "Articles", articles_url %>
|
||||
<%= active_link_to "Articles", articles_path %>
|
||||
<ul>
|
||||
<li><%= link_to "NS Movies", movies_url %></li>
|
||||
<li><%= link_to "Files", directory_url(Directory::ROOT) %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown">
|
||||
<%= link_to "Forums", forums_url %>
|
||||
<%= active_link_to "Forums", forums_path, active: [["forums", "topics"]] %>
|
||||
<ul>
|
||||
<li><%= link_to "Index", forums_url %></li>
|
||||
<li><%= link_to "Index", forums_path %></li>
|
||||
<li><%= link_to "Rules", "/topics/12" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><%= link_to "Teams", controller: "teams", action: :index %></li>
|
||||
<li><%= link_to "Users", controller: "users", action: :index %></li>
|
||||
<li><%= active_link_to "Teams", controller: "teams", action: :index %></li>
|
||||
<li><%= active_link_to "Users", controller: "users", action: :index %></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
@ -13,14 +13,19 @@
|
|||
<%= namelink(article.user) %> on <%= longtime article.created_at %>
|
||||
</div>
|
||||
|
||||
<div class="comments">
|
||||
<%= link_to article do %>
|
||||
<%= icon 'comments' %> Comments (<%= article.comments.count %>)
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<% 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' %>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="controls">
|
||||
<% 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 %>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<div class="comment-form">
|
||||
<div id="reply" class="comment-form">
|
||||
<h5>New comment</h5>
|
||||
|
||||
<% if cuser %>
|
||||
|
@ -11,7 +11,7 @@
|
|||
<%= f.hidden_field :commentable_id %>
|
||||
<%= f.hidden_field :commentable_type %>
|
||||
<div class="fields">
|
||||
<%= f.text_area :text, rows: 5, cols: 40, id: "textArea" %>
|
||||
<%= f.text_area :text, rows: 5 %>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<%= f.submit 'Post Comment' %>
|
||||
|
|
1
app/views/comments/quote.js.erb
Normal file
1
app/views/comments/quote.js.erb
Normal file
|
@ -0,0 +1 @@
|
|||
$("#reply textarea").append("[quote=<%= @comment.user %>]<%= escape_javascript(@comment.text) %>[/quote]\n");
|
11
app/views/forums/_controls.html.erb
Normal file
11
app/views/forums/_controls.html.erb
Normal file
|
@ -0,0 +1,11 @@
|
|||
<div class="controls">
|
||||
<% if forum.topics.build.can_create? cuser %>
|
||||
<%= link_to 'New Topic', new_topic_url(id: forum.id), class: 'button' %>
|
||||
<% end %>
|
||||
<% if forum.can_update? cuser %>
|
||||
<%= link_to 'Edit Forum', edit_forum_path(forum), class: 'button' %>
|
||||
<% end %>
|
||||
<% if forum.can_destroy? cuser %>
|
||||
<%= link_to 'Destroy Forum', forum, class: 'button', confirm: 'Are you sure?', method: :delete %>
|
||||
<% end %>
|
||||
</div>
|
|
@ -1,46 +1,44 @@
|
|||
<br />
|
||||
|
||||
<div class="forums">
|
||||
<div id="categories">
|
||||
<% @categories.each do |cat| %>
|
||||
<% forums = cuser ? cat.forums.available_to(cuser, Forumer::ACCESS_READ).ordered : cat.forums.public.ordered %>
|
||||
<% next if forums.length == 0 %>
|
||||
|
||||
<h3><%=h cat.name %></h3>
|
||||
<div class="category">
|
||||
<table class="body">
|
||||
<table class="category">
|
||||
<tr>
|
||||
<th colspan="5" class="header">
|
||||
<%= h cat.to_s %>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Forums</th>
|
||||
<th class="center" width="10%">Topics</th>
|
||||
<th class="center" width="10%">Posts</th>
|
||||
<th class="center" width="15%">Last Post</th>
|
||||
<th colspan="2" class="forums">Forums</th>
|
||||
<th class="actions"></th>
|
||||
<th class="topics">Topics</th>
|
||||
<th class="posts">Posts</th>
|
||||
<th class="last">Last Post</th>
|
||||
</tr>
|
||||
|
||||
<% forums.each do |forum| %>
|
||||
<tr>
|
||||
<td class="bullet <%= "hl" if cuser and !forum.read_by? cuser %>"> </td>
|
||||
<td class="bullet <%= "highlight" if cuser and !forum.read_by?(cuser) %>"></td>
|
||||
<td class="forum">
|
||||
<div class="left">
|
||||
<h3 class="desc">
|
||||
<%= namelink forum %>
|
||||
</h3>
|
||||
<h5><%= namelink(forum) %></h5>
|
||||
<%= forum.description %>
|
||||
</div>
|
||||
<div class="right minitext">
|
||||
</td>
|
||||
<td class="actions">
|
||||
<% if forum.can_update? cuser %>
|
||||
<%= link_to "Up", :action => "up", :id => forum %><br />
|
||||
<%= link_to "Down", :action => "down", :id => forum %>
|
||||
<%= link_to action: "up", id: forum do %>
|
||||
<% icon 'arrow-up' %>
|
||||
<% end %>
|
||||
<%= link_to action: "down", id: forum do %>
|
||||
<% icon 'arrow-down' %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</td>
|
||||
<td class="numbers"><%= forum.topics.count %></td>
|
||||
<td class="numbers"><%= forum.posts.count %></td>
|
||||
<td>
|
||||
<td class="topics"><%= forum.topics.count %></td>
|
||||
<td class="posts"><%= forum.posts.count %></td>
|
||||
<td class="last">
|
||||
<% if forum.posts.last %>
|
||||
<%= link_to raw("#{h forum.posts.last.user} <br />#{shortdate forum.posts.last.created_at}"), lastpost(forum.posts.last.topic) %>
|
||||
<%= link_to lastpost(forum.posts.last.topic) do %>
|
||||
<%=h forum.posts.last.user %><br>
|
||||
<%= shortdate(forum.posts.last.created_at) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -48,28 +46,21 @@
|
|||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="category">
|
||||
<table class="body">
|
||||
<tr>
|
||||
<th colspan="5" class="header">
|
||||
Statistics
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="5" class="center">
|
||||
We have total of <b><%= Post.count %></b> posts,
|
||||
<b><%= Topic.count %></b> topics, and <b><%= User.count %></b> users.
|
||||
<div class="statistics">
|
||||
<h4>Statistics</h4>
|
||||
<p>
|
||||
We have total of <strong><%= Post.count %></strong> posts,
|
||||
<strong><%= Topic.count %></strong> topics, and <strong><%= User.count %></strong> users.
|
||||
</p>
|
||||
<p>
|
||||
Our newest member is <%= namelink User.last %> and most active member is <%= namelink User.posts_stats.first %>.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<% if Forum.new.can_create? cuser %>
|
||||
<p>
|
||||
<%= link_to 'New forum', new_forum_path %>
|
||||
<%= link_to 'New forum', new_forum_path, class: "button" %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
|
|
@ -1,75 +1,51 @@
|
|||
<p>
|
||||
<%= link_to "Forums", :action => "index" %> » <%= namelink @forum %>
|
||||
</p>
|
||||
<div class="breadcrumbs">
|
||||
<%= link_to "Forums", action: "index" %> <%= icon 'chevron-right' %> <%= namelink @forum %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<% if @forum.topics.build.can_create? cuser %>
|
||||
<%= link_to 'New Topic', new_topic_url(:id => @forum.id) %>
|
||||
<% end %>
|
||||
<% if @forum.can_update? cuser %>
|
||||
| <%= link_to 'Edit Forum', edit_forum_path(@forum) %>
|
||||
<% end %>
|
||||
<% if @forum.can_destroy? cuser %>
|
||||
| <%= link_to 'Destroy Forum', @forum, :confirm => 'Are you sure?', :method => :delete %>
|
||||
<% end %>
|
||||
</p>
|
||||
<%= render partial: 'controls', locals: { forum: @forum } %>
|
||||
|
||||
<h2><%=h @forum.title %></h2>
|
||||
|
||||
<div class="forums">
|
||||
<div class="category">
|
||||
<table class="body">
|
||||
<table id="topics">
|
||||
<tr>
|
||||
<th colspan="5" class="header">
|
||||
<%= h @forum.title %>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="50%">Topic</th>
|
||||
<th class="center" width="15%">Author</th>
|
||||
<th class="center" width="5%">Replies</th>
|
||||
<th class="center" width="5%">Views</th>
|
||||
<th class="center" width="15%">Last Post</th>
|
||||
<th class="topic">Topic</th>
|
||||
<th class="author">Author</th>
|
||||
<th class="replies">Replies</th>
|
||||
<th class="views">Views</th>
|
||||
<th class="last">Last Post</th>
|
||||
</tr>
|
||||
<% @forum.topics.basic.ordered.each do |topic| %>
|
||||
<tr>
|
||||
<td>
|
||||
<h3>
|
||||
<h5>
|
||||
<% if topic.state == Topic::STATE_STICKY %>
|
||||
<b>Sticky: </b>
|
||||
<% elsif topic.lock %>
|
||||
<b>Locked: </b>
|
||||
<% end %>
|
||||
<%= link_to (h topic), topic, :class => ((cuser and !topic.read_by? cuser) ? "red" : "") %>
|
||||
|
||||
<%= link_to (h topic), topic, class: ((cuser and !topic.read_by? cuser) ? "unread" : "read") %>
|
||||
</h5>
|
||||
|
||||
<% if topic.posts.count > Topic::POSTS_PAGE %>
|
||||
[
|
||||
<% (1..((topic.posts.count/Topic::POSTS_PAGE).ceil+1)).to_a.each do |page| %>
|
||||
Page:
|
||||
<% (1..((topic.posts.count/Topic::POSTS_PAGE).ceil + 1)).to_a.each do |page| %>
|
||||
<%= ", " unless page == 1 %>
|
||||
<%= link_to page, topic_url(topic, :page => page) %>
|
||||
<%= link_to page, topic_url(topic, page: page) %>
|
||||
<% end %>
|
||||
]
|
||||
<% end %>
|
||||
</h3>
|
||||
</td>
|
||||
<td><%= namelink topic.user %></td>
|
||||
<td><%= h topic.posts.count-1 %></td>
|
||||
<td><%= h topic.view_count %></td>
|
||||
<td><%= namelink(topic.user) %></td>
|
||||
<td><%=h topic.posts.count-1 %></td>
|
||||
<td><%=h topic.view_count %></td>
|
||||
<td>
|
||||
<%= link_to raw("#{h topic.posts.last.user} <br />#{shortdate topic.posts.last.created_at}"), lastpost(topic) %>
|
||||
<%= link_to lastpost(topic) do %>
|
||||
<%=h topic.posts.last.user %><br>
|
||||
<%= shortdate(topic.posts.last.created_at) %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</table>
|
||||
</div>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<% if @forum.topics.build.can_create? cuser %>
|
||||
<%= link_to 'New Topic', new_topic_url(:id => @forum.id) %>
|
||||
<% end %>
|
||||
<% if @forum.can_update? cuser %>
|
||||
| <%= link_to 'Edit Forum', edit_forum_path(@forum) %>
|
||||
<% end %>
|
||||
<% if @forum.can_destroy? cuser %>
|
||||
| <%= link_to 'Destroy Forum', @forum, :confirm => 'Are you sure?', :method => :delete %>
|
||||
<% end %>
|
||||
</p>
|
||||
</div>
|
||||
<%= render partial: 'controls', locals: { forum: @forum } %>
|
||||
|
|
|
@ -1,69 +1,58 @@
|
|||
<% if n > 0 or n == -1 %>
|
||||
<tr>
|
||||
<th class="seperator" colspan="2">
|
||||
</th>
|
||||
</tr>
|
||||
<% end %>
|
||||
<div id="post_<%= post.id %>" class="post">
|
||||
<div class="avatar" rowspan="2">
|
||||
<h5>
|
||||
<%= link_to post.user, post.user, class: ("admin" if post.user.admin?) %>
|
||||
</h5>
|
||||
|
||||
<tr>
|
||||
<td class="avatar" rowspan="2">
|
||||
<h3 class="center">
|
||||
<%= link_to post.user, post.user, :class => (post.user.admin? ? "red" : "") %>
|
||||
</h3>
|
||||
|
||||
<%= image_tag post.user.profile.avatar.url, :class => "centered" %>
|
||||
<div class="image">
|
||||
<%= image_tag post.user.profile.avatar.url %>
|
||||
</div>
|
||||
|
||||
<% if post.user.team %>
|
||||
<p class="center">
|
||||
<%= namelink post.user.team %>
|
||||
</p>
|
||||
<% end %>
|
||||
<%= cascade post.user, [["Posts", "posts.count"], "from", "joined"] %>
|
||||
</td>
|
||||
|
||||
<th class="header">
|
||||
<div class="left">
|
||||
<%= cascade post.user, [["Posts", "posts.count"], "from", "joined"] %>
|
||||
</div>
|
||||
|
||||
<div class="content">
|
||||
<div class="header">
|
||||
<div class="time">
|
||||
<a name="post_<%= post.id %>">
|
||||
<%= longtime post.created_at %>
|
||||
<%= longtime(post.created_at) %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
<%= post.number @posts, n %>
|
||||
<div class="posts">
|
||||
<%= link_to "##{post.number(@posts, n)}", "#post_#{post.id}" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="text" id="post_<%= post.id %>">
|
||||
<div class="text">
|
||||
<%= post.text_parsed.html_safe %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="actions center">
|
||||
<%= link_to "Send PM", :controller => "messages", :action => "new", :id => "User", :id2 => post.user %>
|
||||
</td>
|
||||
|
||||
<td class="signature">
|
||||
<div class="left">
|
||||
<%= raw post.user.profile.signature_parsed if post.user.profile.signature_parsed %>
|
||||
</div>
|
||||
|
||||
<div class="signature">
|
||||
<%= post.user.profile.signature_parsed.html_safe if post.user.profile.signature_parsed %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<div class="user">
|
||||
<%= link_to "Send PM", { controller: "messages", action: "new", id: "User", id2: post.user }, class: 'button tiny' %>
|
||||
</div>
|
||||
|
||||
<div class="reply">
|
||||
<div class="right">
|
||||
<% if post.topic.posts.build.can_create? cuser %>
|
||||
<%= link_to_function 'QuoteReply', "QuoteText(#{post.id}); $('tr#reply').fadeIn('slow');" %>
|
||||
<%= link_to_function 'Quote Reply', "QuoteText(#{post.id}); $('#reply').fadeIn('slow')", class: 'button tiny' %>
|
||||
<% end %>
|
||||
<% if post.can_update? cuser %>
|
||||
<%= link_to 'Edit', edit_post_path(post) %>
|
||||
<%= link_to 'Edit', edit_post_path(post), class: 'button tiny' %>
|
||||
<% end %>
|
||||
<% if post.can_destroy? cuser %>
|
||||
<%= link_to 'Delete', post, :confirm => 'Are you sure?', :method => :delete %>
|
||||
<%= link_to 'Delete', post, confirm: 'Are you sure?', method: :delete, class: 'button tiny' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
$("tr#reply").hide();
|
||||
$("tbody#posts").append("<%= escape_javascript(render(:partial => "post", :locals => {:post => @post, :n => -1})) %>");
|
||||
$("#reply").find("textarea").val("").end().hide();
|
||||
$("#posts").append("<%= escape_javascript(render(partial: 'post', locals: { post: @post, n: -1 })) %>");
|
||||
|
|
|
@ -1 +1 @@
|
|||
$("tr#reply textarea").append("[quote=<%= @post.user %>]<%= escape_javascript(@post.text) %>[/quote]\n");
|
||||
$("#reply textarea").append("[quote=<%= @post.user %>]<%= escape_javascript(@post.text) %>[/quote]\n");
|
||||
|
|
7
app/views/topics/_breadcrumbs.html.erb
Normal file
7
app/views/topics/_breadcrumbs.html.erb
Normal file
|
@ -0,0 +1,7 @@
|
|||
<div class="breadcrumbs">
|
||||
<%= link_to "Forums", forums_url %>
|
||||
<%= icon 'chevron-right' %>
|
||||
<%= namelink topic.forum %>
|
||||
<%= icon 'chevron-right' %>
|
||||
<%= namelink topic %>
|
||||
</div>
|
|
@ -1,96 +1,70 @@
|
|||
<p>
|
||||
<%= link_to "Forums", forums_url %> » <%= namelink @topic.forum %> » <%= namelink @topic %>
|
||||
</p>
|
||||
<div id="topic">
|
||||
<%= render partial: 'breadcrumbs', locals: { topic: @topic } %>
|
||||
|
||||
<table id="topic">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<div class="left">
|
||||
<%= namelink @topic %>
|
||||
<% if @posts.length > Topic::POSTS_PAGE %>
|
||||
[<%= will_paginate @posts %>]
|
||||
<h2><%= namelink @topic %></h2>
|
||||
|
||||
<% if @posts.count > Topic::POSTS_PAGE %>
|
||||
<%= will_paginate @posts %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="right">
|
||||
<div class="controls">
|
||||
<% if @newpost.can_create? cuser %>
|
||||
<%= link_to 'Reply', new_post_path(@newpost, :id => @topic) %> |
|
||||
<%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %>
|
||||
<% end %>
|
||||
<% if @topic.can_update? cuser %>
|
||||
<%= link_to 'Edit', edit_topic_path(@topic) %>
|
||||
<%= link_to 'Edit', edit_topic_path(@topic), class: 'button' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<div id="posts">
|
||||
<% @posts.each_with_index do |post, n| %>
|
||||
<%= render partial: "posts/post", locals: { post: post, n: n } %>
|
||||
<% end %>
|
||||
|
||||
<tbody id="posts">
|
||||
<% n = 0; @posts.each do |post| %>
|
||||
<%= render :partial => "posts/post", :locals => {:post => post, :n => n} %>
|
||||
<% n = n + 1 end %>
|
||||
<% if @newpost.errors.count > 0 %>
|
||||
<tr>
|
||||
<td colspan="2" class="center">
|
||||
<% @newpost.error_messages.each do |m| %>
|
||||
<%= h m %><br />
|
||||
<%= h m %><br>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</div>
|
||||
|
||||
<tfoot>
|
||||
<tr id="reply">
|
||||
<td colspan="2">
|
||||
<div class="centered center" style="width: 583px;">
|
||||
<%= form_for(@newpost, :remote => true) do |f| %>
|
||||
<div id="reply">
|
||||
<h5>New Reply</h5>
|
||||
|
||||
<%= form_for(@newpost, remote: true, html: { class: 'square' }) do |f| %>
|
||||
<%= f.error_messages %>
|
||||
<%= f.hidden_field :topic_id %>
|
||||
<p>
|
||||
<%= f.text_area :text, :rows => 13, :cols => 70, :id => "textArea" %>
|
||||
</p>
|
||||
<p>
|
||||
<div class="fields horizontal">
|
||||
<%= f.label "Enter your post text:" %>
|
||||
<%= f.text_area :text, rows: 10 %>
|
||||
</div>
|
||||
<div class="controls horizontal">
|
||||
<%= f.submit 'Post Message' %>
|
||||
</p>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<div class="left minitext">
|
||||
<%= will_paginate @posts %>
|
||||
</div>
|
||||
|
||||
<div class="right minitext">
|
||||
<% if @newpost.can_create? cuser %>
|
||||
<%= link_to_function 'Fast Reply', "$('tr#reply').fadeIn('slow');" %> |
|
||||
<%= link_to 'Reply', new_post_path(@newpost, :id => @topic) %> |
|
||||
<%= link_to_function 'Fast Reply', "$('#reply').fadeIn('slow')", class: 'button' %>
|
||||
<%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %>
|
||||
<% end %>
|
||||
<% if @topic.can_update? cuser %>
|
||||
<%= link_to 'Edit', edit_topic_path(@topic) %>
|
||||
<%= link_to 'Edit', edit_topic_path(@topic), class: 'button' %>
|
||||
<% end %>
|
||||
|
||||
<% if @lock.new_record? and @lock.can_create? cuser %>
|
||||
<%= form_for @lock, :html => {:style => "display:inline"} do |f| %>
|
||||
<%= form_for @lock do |f| %>
|
||||
<%= f.hidden_field :lockable_type %>
|
||||
<%= f.hidden_field :lockable_id %>
|
||||
| <%= link_to_function "Lock", "this.parentNode.submit()" %>
|
||||
<%= link_to_function "Lock", "this.parentNode.submit()", class: 'button' %>
|
||||
<% end %>
|
||||
<% elsif @lock.can_destroy? cuser %>
|
||||
| <%= link_to 'Unlock', @lock, :confirm => 'Are you sure?', :method => :delete %>
|
||||
<%= link_to 'Unlock', @lock, class: 'button', confirm: 'Are you sure?', method: :delete %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<%= link_to "Forums", forums_url %> » <%= namelink @topic.forum %> » <%= namelink @topic %>
|
||||
</p>
|
||||
<%= render partial: 'breadcrumbs', locals: { topic: @topic } %>
|
||||
</div>
|
||||
|
|
|
@ -10,7 +10,7 @@ module Ensl
|
|||
# -- all .rb files in that directory are automatically loaded.
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths += Dir["#{config.root}/app/services/**/"]
|
||||
config.autoload_paths += Dir["#{config.root}/app/services/**/", "#{config.root}/app/models/concerns/"]
|
||||
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
# :all can be used as a placeholder for all plugins nowt explicitly named.
|
||||
|
|
|
@ -5,7 +5,7 @@ set :deploy_via, :remote_cache
|
|||
set :pty, true
|
||||
|
||||
set :scm, :git
|
||||
set :repo_url, 'git@github.com:ENSL/ensl.org.git'
|
||||
set :repo_url, 'https://github.com/ENSL/ensl.org.git'
|
||||
set :keep_releases, 10
|
||||
|
||||
set :rbenv_type, :user
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
require File.expand_path('../application', __FILE__)
|
||||
require 'verification'
|
||||
require 'exceptions'
|
||||
require 'extra'
|
||||
|
||||
ActiveSupport::Deprecation.silenced = true
|
||||
Ensl::Application.initialize!
|
||||
|
|
|
@ -13,6 +13,9 @@ Ensl::Application.routes.draw do
|
|||
resources :categories
|
||||
resources :options
|
||||
resources :polls
|
||||
|
||||
match 'comments/quote'
|
||||
|
||||
resources :comments
|
||||
resources :shoutmsgs
|
||||
resources :teamers
|
||||
|
@ -23,6 +26,10 @@ Ensl::Application.routes.draw do
|
|||
resources :groupers
|
||||
resources :forumers
|
||||
resources :topics
|
||||
|
||||
match 'forums/up'
|
||||
match 'forums/down'
|
||||
|
||||
resources :forums
|
||||
resources :users
|
||||
resources :locks
|
||||
|
@ -46,6 +53,9 @@ Ensl::Application.routes.draw do
|
|||
resources :bans
|
||||
resources :tweets
|
||||
resources :issues
|
||||
|
||||
match 'posts/quote'
|
||||
|
||||
resources :posts
|
||||
resources :brackets
|
||||
|
||||
|
@ -74,9 +84,6 @@ Ensl::Application.routes.draw do
|
|||
|
||||
match 'directories', to: "directories#show", id: 1
|
||||
|
||||
match 'forums/up'
|
||||
match 'forums/down'
|
||||
|
||||
match 'gathers/refresh'
|
||||
match 'gathers/latest/:game', to: "gathers#latest", via: :get
|
||||
match 'gather', to: "gathers#latest", game: "ns2", via: :get
|
||||
|
@ -101,8 +108,6 @@ Ensl::Application.routes.draw do
|
|||
match 'users/logout'
|
||||
match 'users/login'
|
||||
|
||||
match 'posts/quote'
|
||||
|
||||
match 'users/agenda'
|
||||
match 'users/login'
|
||||
match 'users/logout'
|
||||
|
|
66
lib/extra.rb
66
lib/extra.rb
|
@ -1,66 +0,0 @@
|
|||
module Extra
|
||||
CODING_HTML = 0
|
||||
CODING_BBCODE = 1
|
||||
CODING_MARKDOWN = 2
|
||||
|
||||
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 codings
|
||||
{CODING_HTML => "Plain HTML", CODING_BBCODE => "BBCode", CODING_MARKDOWN => "Markdown"}
|
||||
end
|
||||
|
||||
def bbcode_to_html(text)
|
||||
Sanitize.clean(text.to_s).bbcode_to_html.gsub(/\n|\r\n/, "<br />").html_safe
|
||||
end
|
||||
|
||||
def move_up scope, column = "position"
|
||||
n = 0
|
||||
objects = self.class.all :conditions => scope, :order => column
|
||||
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
|
||||
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
|
Loading…
Reference in a new issue