mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 21:31:28 +00:00
Fix a few pages in views
This commit is contained in:
parent
ce5dfcfa6a
commit
b0c9697109
6 changed files with 27 additions and 17 deletions
|
@ -90,7 +90,10 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Print the attributes from the list
|
||||||
def cascade model, list
|
def cascade model, list
|
||||||
|
return "" if model.nil?
|
||||||
|
|
||||||
out = list.map do |element|
|
out = list.map do |element|
|
||||||
name = key = element
|
name = key = element
|
||||||
item = ""
|
item = ""
|
||||||
|
@ -104,10 +107,15 @@ module ApplicationHelper
|
||||||
if m = key.to_s.match(/^(.*)_b$/)
|
if m = key.to_s.match(/^(.*)_b$/)
|
||||||
name = m[1]
|
name = m[1]
|
||||||
key = m[1]
|
key = m[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
str = eval("model.#{key}")
|
||||||
|
rescue
|
||||||
|
next
|
||||||
end
|
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)
|
if model[key].instance_of?(Time) or model[key].instance_of?(ActiveSupport::TimeWithZone)
|
||||||
# result << shorttime(str)
|
# result << shorttime(str)
|
||||||
|
|
|
@ -89,11 +89,11 @@ class Article < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def previous_article
|
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
|
end
|
||||||
|
|
||||||
def next_article
|
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
|
end
|
||||||
|
|
||||||
def statuses
|
def statuses
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Directory < ActiveRecord::Base
|
||||||
validates_with PathValidator
|
validates_with PathValidator
|
||||||
# TODO: add validation for path
|
# TODO: add validation for path
|
||||||
|
|
||||||
before_validation :init_variables, on: :create
|
before_validation :init_variables
|
||||||
after_create :make_path
|
after_create :make_path
|
||||||
after_save :update_timestamp
|
after_save :update_timestamp
|
||||||
before_destroy :remove_files, unless: Proc.new { preserve_files }
|
before_destroy :remove_files, unless: Proc.new { preserve_files }
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<h1>General Information</h1>
|
<h1>General Information</h1>
|
||||||
<p>
|
<p>
|
||||||
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.
|
We now primarily focus on its successor, Natural Selection 2.
|
||||||
</p>
|
</p>
|
||||||
<p>To contact us:</p>
|
<p>To contact us:</p>
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
<ol>
|
<ol>
|
||||||
<li>Use the <%= link_to 'contact', new_issue_path %> form</li>
|
<li>Use the <%= link_to 'contact', new_issue_path %> form</li>
|
||||||
<li>Join our official <%= link_to 'discord', 'https://discord.gg/Bvs3KjX' %></li>
|
<li>Join our official <%= link_to 'discord', 'https://discord.gg/Bvs3KjX' %></li>
|
||||||
<li>Send email to the head admin as per the list below (mind that some email adresses are not shown due to privacy settings)</li>
|
<li>Send email to the head admin from list below (some email adresses are not shown due to privacy settings)</li>
|
||||||
<li>Contact other staff members directly, check below and click profile for contact details</li>
|
<li>Contact other staff members directly, check below and click profile for contact details</li>
|
||||||
</ol>
|
</ol>
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
<% if cuser and cuser.admin? %>
|
<% if cuser and cuser.admin? %>
|
||||||
<div class="controls">
|
<div class="controls">
|
||||||
<%= link_to "Edit Directory", edit_directory_path(dir), class: 'button' %>
|
<%= 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 Directory", { controller: "directories", action: "new", id: dir }, { class: 'button' } %>
|
||||||
<%= link_to "New File", { controller: "data_files", action: "new", id: dir }, { class: 'button' } %>
|
<%= link_to "New File", { controller: "data_files", action: "new", id: dir }, { class: 'button' } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -11,15 +11,17 @@
|
||||||
<%= cascade movie, ["content", "format", ["Author", :user], "length_s", ["Views", "view_count"], ["Date", "file.created_at"]] %>
|
<%= 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| %>
|
<% (params[:action] == "show" ? movie.all_files : [movie.file]).each do |file| %>
|
||||||
<b>File: </b> <%= link_to File.basename(file.name.to_s), file.url %>
|
<% unless file.nil? %>
|
||||||
<ul>
|
<b>File: </b> <%= link_to File.basename(file.name.to_s), file.url %>
|
||||||
<li>
|
<ul>
|
||||||
<strong>MD5:</strong> <%= file.md5_s %>
|
<li>
|
||||||
</li>
|
<strong>MD5:</strong> <%= file.md5_s %>
|
||||||
<li>
|
</li>
|
||||||
<strong>Size:</strong> <%= file.size_s %> MB
|
<li>
|
||||||
</li>
|
<strong>Size:</strong> <%= file.size_s %> MB
|
||||||
</ul>
|
</li>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if cuser and movie.can_update? cuser %>
|
<% if cuser and movie.can_update? cuser %>
|
||||||
|
|
Loading…
Reference in a new issue