From f156ed306085c1b342da420b4f916e7259c32867 Mon Sep 17 00:00:00 2001 From: Ari Timonen Date: Fri, 7 Jun 2019 11:04:16 -0400 Subject: [PATCH] More progress on upgrade --- Gemfile.lock | 2 +- app/assets/javascripts/local.js | 6 ++++++ app/controllers/teamers_controller.rb | 3 +++ app/helpers/application_helper.rb | 1 - app/models/forum.rb | 2 +- app/models/post.rb | 2 +- app/models/user.rb | 2 +- app/views/comments/_comment.html.erb | 2 +- app/views/posts/_post.html.erb | 3 ++- app/views/topics/show.html.erb | 2 +- 10 files changed, 17 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index c4d78bd..87e7aea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -270,7 +270,7 @@ GEM websocket-driver (0.5.4) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.2) - will_paginate (3.0.5) + will_paginate (3.0.12) xpath (2.0.0) nokogiri (~> 1.3) diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js index d21797c..6fbf463 100644 --- a/app/assets/javascripts/local.js +++ b/app/assets/javascripts/local.js @@ -32,6 +32,12 @@ $(function() { $(this).scrollTop(scrollTop-Math.round(delta)); }); + + // Forums fast reply + $("a#fastReply").live('click', function() { + $('#reply').fadeIn('slow') + }); + // Gather stuff $("a#gather-info-hide").live('click', function() { diff --git a/app/controllers/teamers_controller.rb b/app/controllers/teamers_controller.rb index 28302fe..e4477e6 100644 --- a/app/controllers/teamers_controller.rb +++ b/app/controllers/teamers_controller.rb @@ -1,4 +1,7 @@ class TeamersController < ApplicationController + def index + end + def create @teamer = Teamer.new params[:teamer] raise AccessError unless @teamer.can_create? cuser, params[:teamer] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9b9d542..b62a0e1 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -171,7 +171,6 @@ module ApplicationHelper end end - def upcoming_matches GoogleCalendar.new(ENV['GOOGLE_CALENDAR_ID'], timezone_offset). upcoming.sort_by do |event| diff --git a/app/models/forum.rb b/app/models/forum.rb index dff7494..785dec8 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -75,7 +75,7 @@ class Forum < ActiveRecord::Base is_admin = Grouper.where(user_id: cuser, group_id: Group::ADMINS) Forum.where("EXISTS (#{is_admin.to_sql}) OR id IN (SELECT q.id from (#{user_has_access.to_sql}) q ) OR - id IN (SELECT q.id from (#{Forum.public.to_sql}) q )") + id IN (SELECT q.id from (#{Forum.public_forums.to_sql}) q )") end end diff --git a/app/models/post.rb b/app/models/post.rb index c8c9d22..c526131 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -16,7 +16,7 @@ class Post < ActiveRecord::Base attr_protected :id, :updated_at, :created_at, :votes, :user_id - scope :basic, :include => [{:user => [:team, :profile]}, :topic] + scope :basic, -> {includes([{:user => [:team, :profile]}, :topic])} validates_presence_of :topic, :user validates_length_of :text, :in => 1..10000 diff --git a/app/models/user.rb b/app/models/user.rb index fc2622f..04a5e84 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -183,7 +183,7 @@ class User < ActiveRecord::Base end def banned? type = Ban::TYPE_SITE - Ban.first :conditions => ["expiry > UTC_TIMESTAMP() AND user_id = ? AND ban_type = ?", self.id, type] + Ban.where("expiry > UTC_TIMESTAMP() AND user_id = ? AND ban_type = ?", self.id, type).exists? end def admin? diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb index ca08506..0643014 100644 --- a/app/views/comments/_comment.html.erb +++ b/app/views/comments/_comment.html.erb @@ -10,7 +10,7 @@
<% if cuser %> - <%= link_to_function icon('comment'), "QuoteText(#{comment.id}, 'comments')" %> + <%= link_to '#', data:{on: :click, call: 'QuoteText',args: "#{comment.id}, 'comments'"} > <% if comment.can_update? cuser %> <%= link_to icon('pencil'), edit_comment_path(comment) %> <% end %> diff --git a/app/views/posts/_post.html.erb b/app/views/posts/_post.html.erb index a256089..c4e46b7 100644 --- a/app/views/posts/_post.html.erb +++ b/app/views/posts/_post.html.erb @@ -69,7 +69,8 @@
<% if post.topic.posts.build.can_create? cuser %> - <%= link_to_function 'Quote Reply', "QuoteText(#{post.id}); $('#reply').fadeIn('slow')", class: 'button tiny' %> + <%= # link_to_function 'Quote Reply', "QuoteText(#{post.id}); $('#reply').fadeIn('slow') ", class: 'button tiny' %> + <%= link_to '#', data:{on: :click, call: 'QuoteText', args: "#{post.id}"}, class: 'button tiny' %> <% end %> <% if post.can_update? cuser %> <%= link_to 'Edit', edit_post_path(post), class: 'button tiny' %> diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 458a9aa..4b3da2b 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -54,7 +54,7 @@
<% if @newpost.can_create? cuser %> - <%= link_to_function 'Fast Reply', "$('#reply').fadeIn('slow')", class: 'button' %> + <%= link_to 'Fast Reply', "#", class: 'button fastReply' %> <%= link_to 'Reply', new_post_path(@newpost, id: @topic), class: 'button' %> <% end %> <% if @topic.can_update? cuser %>