diff --git a/app/assets/images/flags/FX.png b/app/assets/images/flags/FX.png new file mode 100644 index 0000000..f27f411 Binary files /dev/null and b/app/assets/images/flags/FX.png differ diff --git a/app/assets/images/flags/SU.png b/app/assets/images/flags/SU.png new file mode 100644 index 0000000..d9624ca Binary files /dev/null and b/app/assets/images/flags/SU.png differ diff --git a/app/assets/images/flags/UK.png b/app/assets/images/flags/UK.png new file mode 100644 index 0000000..02fa2a1 Binary files /dev/null and b/app/assets/images/flags/UK.png differ diff --git a/app/assets/images/layout/forum-bg-pattern.png b/app/assets/images/layout/forum-bg-pattern.png new file mode 100644 index 0000000..9b0f171 Binary files /dev/null and b/app/assets/images/layout/forum-bg-pattern.png differ diff --git a/app/assets/images/layout/forum-bg-pattern@2x.png b/app/assets/images/layout/forum-bg-pattern@2x.png new file mode 100644 index 0000000..cad04a3 Binary files /dev/null and b/app/assets/images/layout/forum-bg-pattern@2x.png differ diff --git a/app/assets/stylesheets/_variables.scss b/app/assets/stylesheets/_variables.scss index a0529f1..9ab65f4 100644 --- a/app/assets/stylesheets/_variables.scss +++ b/app/assets/stylesheets/_variables.scss @@ -24,11 +24,11 @@ $large-screen-up: new-breakpoint(min-width $large-screen 8); */ $open-sans: "Open Sans", sans-serif; -$monserrat: "Montserrat", sans-serif; +$montserrat: "Montserrat", sans-serif; $sans-serif: $open-sans; $base-font-family: $sans-serif; -$header-font-family: $monserrat; +$header-font-family: $montserrat; /* Sizes diff --git a/app/assets/stylesheets/application.css.scss b/app/assets/stylesheets/application.css.scss index d926447..2f0d4e8 100644 --- a/app/assets/stylesheets/application.css.scss +++ b/app/assets/stylesheets/application.css.scss @@ -26,6 +26,7 @@ @import "components/gather"; @import "components/breadcrumbs"; @import "components/pagination"; +@import "components/tabs"; /* Layout @@ -46,3 +47,6 @@ @import "pages/news"; @import "pages/contests"; @import "pages/forums"; +@import "pages/teams"; +@import "pages/users"; +@import "pages/matches"; diff --git a/app/assets/stylesheets/components/_forms.scss b/app/assets/stylesheets/components/_forms.scss index e2c9149..25c04ac 100644 --- a/app/assets/stylesheets/components/_forms.scss +++ b/app/assets/stylesheets/components/_forms.scss @@ -138,3 +138,24 @@ form.square { @include shift(3); } } + +form.search { + + .query { + @include span-columns(9); + + input { + width: 100%; + } + } + + .controls { + @include span-columns(3); + @include shift(0); + @include omega; + + input { + width: 100%; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/components/_tabs.scss b/app/assets/stylesheets/components/_tabs.scss new file mode 100644 index 0000000..3843abc --- /dev/null +++ b/app/assets/stylesheets/components/_tabs.scss @@ -0,0 +1,56 @@ +/* + Breadcrumbs +*/ + +.tabbed { + $tabs-border-width: em(1); + $tabs-padding-vertical: em(8); + $tabs-padding-horizontal: em(16); + + ul.tabs { + @include span-columns(12); + display: block; + font-family: $montserrat; + height: em(40); + max-height: em(40); + position: relative; + + li { + float: left; + display: block; + background-color: $background-primary; + + a { + border: $tabs-border-width solid $navbar-border; + padding: $tabs-padding-vertical $tabs-padding-horizontal; + float: left; + display: block; + color: white; + } + + &.activeli { + z-index: 100; + background-color: $blue; + + a { + padding-bottom: $tabs-padding-vertical + $tabs-border-width; + border-bottom: 0; + } + } + } + } + + .tabbed-contents { + @include span-columns(12); + border: $tabs-border-width solid $navbar-border; + padding: em(20); + } + + @for $i from 1 through $grid-columns { + ul.tabs-#{$i} { + li { + @include span-columns($i); + } + } + } +} diff --git a/app/assets/stylesheets/layout/_body.scss b/app/assets/stylesheets/layout/_body.scss index 39a496a..b6ad05b 100644 --- a/app/assets/stylesheets/layout/_body.scss +++ b/app/assets/stylesheets/layout/_body.scss @@ -49,3 +49,35 @@ body { @include span-columns(3); @include omega(); } + +/* + Heading styles +*/ + +h1, h2, h3, h4, h5, h6 { + + &.fancy { + text-align: center; + position: relative; + background-color: $light-blue; + + &:before { + content: ""; + display: block; + border-top: 2px solid $blue; + width: 100%; + height: 2px; + position: absolute; + top: 50%; + z-index: 1; + } + + span { + background: inherit; + padding: 0 .5em; + position: relative; + display: inline-block; + z-index: 1; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/layout/_header.scss b/app/assets/stylesheets/layout/_header.scss index 318efc3..90e557f 100644 --- a/app/assets/stylesheets/layout/_header.scss +++ b/app/assets/stylesheets/layout/_header.scss @@ -6,7 +6,7 @@ nav.top { background-color: $navigation-background; border-bottom: 1px solid $medium-gray; - font-family: $monserrat; + font-family: $montserrat; height: $navigation-height; width: 100%; z-index: 999; @@ -23,7 +23,7 @@ nav.top { cursor: pointer; display: block; float: right; - font-family: $monserrat; + font-family: $montserrat; font-weight: 700; line-height: $navigation-height; margin: 0; diff --git a/app/assets/stylesheets/layout/_navigation.scss b/app/assets/stylesheets/layout/_navigation.scss index 65f94da..fdb26d1 100644 --- a/app/assets/stylesheets/layout/_navigation.scss +++ b/app/assets/stylesheets/layout/_navigation.scss @@ -3,7 +3,7 @@ */ #menu { - font-family: "Montserrat", sans-serif; + font-family: $montserrat; background-color: $background-primary; height: em(60); max-height: em(60); diff --git a/app/assets/stylesheets/mixins/_buttons.scss b/app/assets/stylesheets/mixins/_buttons.scss index ccd74f4..a5e8908 100644 --- a/app/assets/stylesheets/mixins/_buttons.scss +++ b/app/assets/stylesheets/mixins/_buttons.scss @@ -3,7 +3,7 @@ */ @mixin button($background: $button-primary, $text: $button-text) { - font-family: $monserrat; + font-family: $montserrat; font-size: em(16); background-color: $background; color: $text; diff --git a/app/assets/stylesheets/pages/_forums.scss b/app/assets/stylesheets/pages/_forums.scss index 5c646ff..ebb9c3c 100644 --- a/app/assets/stylesheets/pages/_forums.scss +++ b/app/assets/stylesheets/pages/_forums.scss @@ -141,6 +141,7 @@ div#categories { .content { @include span-columns(9); @include omega; + background: image-url('images/layout/forum-bg-pattern.png') top left; .text, .signature { diff --git a/app/assets/stylesheets/pages/_matches.scss b/app/assets/stylesheets/pages/_matches.scss new file mode 100644 index 0000000..b999667 --- /dev/null +++ b/app/assets/stylesheets/pages/_matches.scss @@ -0,0 +1,22 @@ +/* + Matches Listing +*/ + +#matches { + table-layout: auto; + margin-bottom: em(20); + + .opponent { + width: 30%; + } + + .date, + .maps { + width: 20%; + } + + .score { + width: 10%; + text-align: right; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/pages/_teams.scss b/app/assets/stylesheets/pages/_teams.scss new file mode 100644 index 0000000..4b9c1bc --- /dev/null +++ b/app/assets/stylesheets/pages/_teams.scss @@ -0,0 +1,94 @@ +/* + Teams Listing +*/ + +#teams { + table { + table-layout: auto; + } + + .country { + width: 5%; + } + + .name { + width: 45%; + } + + .irc { + width: 20%; + } + + .members { + width: 10%; + } + + .actions { + width: 20%; + text-align: right; + } +} + +/* + Team Profiles +*/ + +#team-profile { + + .logo { + @include span-columns(12); + margin: em(20) 0; + text-align: center; + + img { + display: inline-block; + float: none; + width: auto; + } + } + + .controls { + @include span-columns(12); + margin: em(20) 0; + } +} + + +#members { + table-layout: auto; + + .country, + .age { + width: 5%; + } + + .member { + width: 20%; + } + + .steamid { + width: 15%; + } + + .rank { + width: 10%; + } + + .note { + width: 30%; + } + + .joined { + width: 10%; + } + + .joined { + text-align: right; + } + + &.short { + .rank { + width: 40%; + } + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/pages/_users.scss b/app/assets/stylesheets/pages/_users.scss new file mode 100644 index 0000000..557a12c --- /dev/null +++ b/app/assets/stylesheets/pages/_users.scss @@ -0,0 +1,21 @@ +#users { + table-layout: auto; + + .country, + .age { + width: 5%; + } + + .username, + .name { + width: 25%; + } + + .steamid { + width: 20%; + } + + .actions { + text-align: right; + } +} \ No newline at end of file diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index bb9d523..f066092 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -7,7 +7,7 @@ class CommentsController < ApplicationController end def show - @comments = Comment.recent5.all conditions: {commentable_id: params[:id2], commentable_type: params[:id]} + @comments = Comment.recent5.all conditions: { commentable_id: params[:id2], commentable_type: params[:id] } render partial: 'list', layout: false end diff --git a/app/controllers/forums_controller.rb b/app/controllers/forums_controller.rb index bf13ad8..09faf4f 100644 --- a/app/controllers/forums_controller.rb +++ b/app/controllers/forums_controller.rb @@ -8,7 +8,14 @@ class ForumsController < ApplicationController def show raise AccessError unless @forum.can_show? cuser - @topics = @forum.topics.all + + @topics = Topic.where(forum_id: @forum.id) + .joins(:posts, :user, :users_who_read) + .includes(:lock) + .group('topics.id') + .order('state DESC, posts.id DESC') + .paginate(page: params[:page], per_page: 30) + @forum.read_by! cuser if cuser @nobody = true end diff --git a/app/models/concerns/extra.rb b/app/models/concerns/extra.rb index 55093b9..be784b8 100644 --- a/app/models/concerns/extra.rb +++ b/app/models/concerns/extra.rb @@ -1,76 +1,76 @@ module Extra - extend ActiveSupport::Concern + extend ActiveSupport::Concern - CODING_HTML = 0 - CODING_BBCODE = 1 - CODING_MARKDOWN = 2 + 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 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 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 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 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_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 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_show? cuser + true + end - def can_create? cuser - true - end + def can_create? cuser + true + end - def can_update? cuser - true - end + def can_update? cuser + true + end - def can_destroy? cuser - true - end - end + def can_destroy? cuser + true + end + end end \ No newline at end of file diff --git a/app/models/topic.rb b/app/models/topic.rb index fc405ca..b13001f 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -57,7 +57,23 @@ class Topic < ActiveRecord::Base end def view_count - self.view_counts.length + view_counts.length + end + + def cache_key(key) + "/topics/#{id}/#{key}" + end + + def cached_view_count + Rails.cache.fetch(cache_key('view_count'), expires_in: 24.hours) do + view_count + end + end + + def cached_posts_count + Rails.cache.fetch(cache_key('posts'), expires_in: 12.hours) do + posts.count - 1 + end end def make_post diff --git a/app/models/user.rb b/app/models/user.rb index 7190a16..e54396b 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -163,7 +163,11 @@ class User < ActiveRecord::Base end def from - profile.town ? "#{profile.town}, #{country_s}" : "#{country_s}" + if profile.town.length > 0 + "#{profile.town}, #{country_s}" + else + "#{country_s}" + end end def age diff --git a/app/views/application/_header.html.erb b/app/views/application/_header.html.erb index 6a73a1c..9576d02 100644 --- a/app/views/application/_header.html.erb +++ b/app/views/application/_header.html.erb @@ -34,7 +34,7 @@