From b6956c89c08a0082bc874593837145d8a6351ea0 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sat, 5 Apr 2014 01:37:52 +0100 Subject: [PATCH] Fixes repeated shout box submissions. Added delay of 2s between shouts Fixes admin links Fixes issue solution formatting --- app/assets/javascripts/local.js | 10 ++++++---- app/models/issue.rb | 4 ++++ app/views/about/adminpanel.html.erb | 28 +++++++++++++++------------- app/views/issues/show.html.erb | 2 +- 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/app/assets/javascripts/local.js b/app/assets/javascripts/local.js index f862df9..a0c08bc 100644 --- a/app/assets/javascripts/local.js +++ b/app/assets/javascripts/local.js @@ -220,12 +220,14 @@ $( function() { $('input[type=submit]', this).attr('disabled', 'disabled'); }); - $('form.new_shoutmsg').submit(function(){ - $('input[type=submit]', this).attr('disabled', 'disabled'); - }); + $('form.new_shoutmsg').on("ajax:complete", function(event, xhr, status){ + var self = this; - $('form.new_shoutmsg').live("ajax:complete", function(event,xhr,status){ $(this)[0].reset(); + + setTimeout(function() { + $('input[type=submit]', self).removeAttr('disabled'); + }, 2000); }); // User page diff --git a/app/models/issue.rb b/app/models/issue.rb index 4fd6c07..f31f870 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -85,6 +85,10 @@ class Issue < ActiveRecord::Base end end + def solution_formatted + bbcode_to_html(solution) + end + def remove_readings if status_changed? and status == STATUS_SOLVED Reading.delete_all ["readable_type = 'Issue' AND readable_id = ?", self.id] diff --git a/app/views/about/adminpanel.html.erb b/app/views/about/adminpanel.html.erb index dd03ec6..c52f363 100644 --- a/app/views/about/adminpanel.html.erb +++ b/app/views/about/adminpanel.html.erb @@ -4,17 +4,19 @@ +
  • <%= link_to "Article Admin", controller: "articles", action: "admin" %>
  • +
  • <%= link_to "Files Admin", controller: "directories", action: "show", id: Directory.first %>
  • +
  • + <%= link_to issues_path do %> + Issues (<%= Issue.with_status(0).count %>) + <% end %> +
  • +
  • <%= link_to "Bans", bans_path %>
  • +
  • <%= link_to "Groups", groups_path %>
  • +
  • <%= link_to "Categories", categories_path %>
  • +
  • <%= link_to "Polls", polls_path %>
  • +
  • <%= link_to "Contests", contests_path %>
  • +
  • <%= link_to "Challenges", challenges_path %>
  • +
  • <%= link_to "Maps", maps_path %>
  • + diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index cf20311..bde2c26 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -23,7 +23,7 @@

    Solution:

    - <%= raw RbbCode::Parser.new.parse(@issue.solution) %> + <%= raw @issue.solution_formatted %> <% end %>