diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 797c494..63efec8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -90,7 +90,10 @@ module ApplicationHelper end end + # Print the attributes from the list def cascade model, list + return "" if model.nil? + out = list.map do |element| name = key = element item = "" @@ -104,10 +107,15 @@ module ApplicationHelper if m = key.to_s.match(/^(.*)_b$/) name = m[1] key = m[1] + end + + begin + str = eval("model.#{key}") + rescue + next end - str = eval("model.#{key}") - next if str == "" or str.nil? + next if str == "" or str.nil? if model[key].instance_of?(Time) or model[key].instance_of?(ActiveSupport::TimeWithZone) # result << shorttime(str) diff --git a/app/models/article.rb b/app/models/article.rb index 86acef0..0eadf49 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -89,11 +89,11 @@ class Article < ActiveRecord::Base end def previous_article - category.articles.nodrafts.first&.(where("id < ?", self.id).order("id DESC")) + category.articles.nodrafts.where("id < ?", self.id).order("id DESC").first end def next_article - category.articles.nodrafts.first&.(where("id > ?", self.id).order("id ASC")) + category.articles.nodrafts.where("id > ?", self.id).order("id ASC").first end def statuses diff --git a/app/models/directory.rb b/app/models/directory.rb index a4b351a..3219a6a 100644 --- a/app/models/directory.rb +++ b/app/models/directory.rb @@ -58,7 +58,7 @@ class Directory < ActiveRecord::Base validates_with PathValidator # TODO: add validation for path - before_validation :init_variables, on: :create + before_validation :init_variables after_create :make_path after_save :update_timestamp before_destroy :remove_files, unless: Proc.new { preserve_files } diff --git a/app/views/about/staff.html.erb b/app/views/about/staff.html.erb index fae68f3..683de57 100644 --- a/app/views/about/staff.html.erb +++ b/app/views/about/staff.html.erb @@ -1,6 +1,6 @@

General Information

- We are a free-working organization founded in 2005 which has organized various competitions for the Half-Life mod Natural Selection. + We are a non-profit organization founded in 2005 which has organized various competitions for the Half-Life mod Natural Selection. We now primarily focus on its successor, Natural Selection 2.

To contact us:

@@ -8,7 +8,7 @@
  1. Use the <%= link_to 'contact', new_issue_path %> form
  2. Join our official <%= link_to 'discord', 'https://discord.gg/Bvs3KjX' %>
  3. -
  4. Send email to the head admin as per the list below (mind that some email adresses are not shown due to privacy settings)
  5. +
  6. Send email to the head admin from list below (some email adresses are not shown due to privacy settings)
  7. Contact other staff members directly, check below and click profile for contact details

diff --git a/app/views/directories/show.html.erb b/app/views/directories/show.html.erb index 7882312..b7fca0a 100644 --- a/app/views/directories/show.html.erb +++ b/app/views/directories/show.html.erb @@ -83,7 +83,7 @@ <% if cuser and cuser.admin? %>
<%= link_to "Edit Directory", edit_directory_path(dir), class: 'button' %> - <%= link_to "Delete Directory", dir, data: { confirm: "Are you sure?" }, class: 'button' %> + <%= link_to "Delete Directory", dir, data: { confirm: "Are you sure?" }, method: 'delete', class: 'button' %> <%= link_to "New Directory", { controller: "directories", action: "new", id: dir }, { class: 'button' } %> <%= link_to "New File", { controller: "data_files", action: "new", id: dir }, { class: 'button' } %>
diff --git a/app/views/movies/_movie.html.erb b/app/views/movies/_movie.html.erb index 9972900..4768e4a 100644 --- a/app/views/movies/_movie.html.erb +++ b/app/views/movies/_movie.html.erb @@ -11,15 +11,17 @@ <%= cascade movie, ["content", "format", ["Author", :user], "length_s", ["Views", "view_count"], ["Date", "file.created_at"]] %> <% (params[:action] == "show" ? movie.all_files : [movie.file]).each do |file| %> - File: <%= link_to File.basename(file.name.to_s), file.url %> - + <% unless file.nil? %> + File: <%= link_to File.basename(file.name.to_s), file.url %> + + <% end %> <% end %> <% if cuser and movie.can_update? cuser %>