diff --git a/models/site.rb b/models/site.rb index 6974d6db..18deefda 100644 --- a/models/site.rb +++ b/models/site.rb @@ -128,6 +128,8 @@ class Site < Sequel::Model BLOCK_JERK_THRESHOLD = 3 + MAXIMUM_TAGS = 5 + def self.newsletter_sites Site.select(:email). exclude(email: 'nil').exclude(is_banned: true). @@ -962,8 +964,8 @@ class Site < Sequel::Model end end - if ((new? ? 0 : tags_dataset.count) + new_tags.length > 5) - errors.add :new_tags_string, 'Cannot have more than 5 tags for your site.' + if ((new? ? 0 : tags_dataset.count) + new_tags.length > MAXIMUM_TAGS) + errors.add :new_tags_string, "Cannot have more than #{MAXIMUM_TAGS} tags for your site." end new_tags.each do |tag| diff --git a/views/_tags.erb b/views/_tags.erb index e786ad97..5e42a56c 100644 --- a/views/_tags.erb +++ b/views/_tags.erb @@ -9,13 +9,15 @@ <% if is_current_site %>
- Add + <% if is_current_site && current_site.tags_dataset.count < Site::MAXIMUM_TAGS %> + Add + <% end %>     Remove
<% end %> <% end %> -<% end %> +<% end %> - \ No newline at end of file +