fixed bug with number only tags breaking js

This commit is contained in:
albert
2011-10-26 18:39:18 -04:00
parent 5a52ccbbc9
commit 9f21630c33
8 changed files with 13 additions and 9 deletions

View File

@@ -78,12 +78,12 @@
}
Danbooru.Blacklist.posts = function() {
return $("article.post-preview");
return $(".post-preview");
}
Danbooru.Blacklist.post_match = function(post, blacklist) {
var $post = $(post);
var tags = $post.data("tags").match(/\S+/g) || [];
var tags = String($post.data("tags")).match(/\S+/g) || [];
tags.push("rating:" + $post.data("rating"));
tags.push("uploader:" + $post.data("uploader"));

View File

@@ -48,7 +48,7 @@
var old_tags = $post.data("tags");
$.each(commands, function(i, x) {
var array = $post.data("tags").match(/\S+/g);
var array = String($post.data("tags")).match(/\S+/g);
$post.data("tags", Danbooru.TagScript.process(array, x).join(" "));
});

View File

@@ -31,8 +31,10 @@ module ApplicationHelper
end
def compact_time(time)
if time > Time.now.beginning_of_day
time_tag(time.strftime("%H:%M"), time)
if time > Time.now.end_of_day
time_tag(time.strftime("%b %e, %Y"), time)
elsif time > Time.now.beginning_of_day
time_tag(time.strftime("%l:%M %P"), time)
elsif time > Time.now.beginning_of_year
time_tag(time.strftime("%b %e"), time)
else

View File

@@ -2,8 +2,9 @@ class Ban < ActiveRecord::Base
after_create :update_feedback
belongs_to :user
belongs_to :banner, :class_name => "User"
attr_accessible :reason, :duration, :user_id
attr_accessible :reason, :duration, :user_id, :user_name
validate :user_is_inferior
validates_presence_of :user_id, :reason, :duration
def self.is_banned?(user)
exists?(["user_id = ? AND expires_at > ?", user.id, Time.now])

View File

@@ -2,7 +2,7 @@
<div class="index">
<h1>Bans</h1>
<table class="striped">
<table class="striped" width="100%">
<thead>
<tr>
<th>User</th>

View File

@@ -3,7 +3,7 @@
<h1>Show Ban</h1>
<ul>
<li><strong>User</strong>: <%= @ban.user.name %></li>
<li><strong>Expires</strong>: <%= @ban.expires_at %></li>
<li><strong>Expires</strong>: <%= compact_time @ban.expires_at %></li>
<li><strong>Reason</strong>: <%= @ban.reason %></li>
</ul>
</div>

View File

@@ -9,5 +9,5 @@
<%= nav_link_to("Notes", notes_path(:group_by => "post")) %>
<%= nav_link_to("Wiki", wiki_pages_path(:title => "help:home")) %>
<%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %>
<%= nav_link_to("&raquo;".html_safe, site_map_path, :id => "site-map-link") %>
<%= nav_link_to("More &raquo;".html_safe, site_map_path, :id => "site-map-link") %>
</menu>

View File

@@ -10,5 +10,6 @@
<% if CurrentUser.is_janitor? %>
<%= nav_link_to("Dashboard", moderator_dashboard_path) %>
<% end %>
<%= nav_link_to("More &raquo;".html_safe, site_map_path) %>
</ul>
</div>