many things, comments working.

This commit is contained in:
jomo
2013-06-24 13:29:39 +02:00
parent 7a894f4f6a
commit fb52e8bed2
44 changed files with 490 additions and 223 deletions

View File

@@ -1,39 +0,0 @@
module Tools
def Tools.avatar_url(user_id, size)
u = User.find_by_id(user_id)
u.nil? ? ign = :char : ign = u.ign
return "https://minotar.net/avatar/#{ign}/#{size}"
end
def Tools.mc_running?
host = "play.redstoner.com"
port = 25565
wait = 300/1000.0 #milliseconds, the .0 is required!!
require 'timeout'
require 'socket'
r = false
begin
Timeout::timeout(wait) {
TCPSocket.new host, port
r = true
}
rescue Exception
# could not connect to the server
end
return r
end
def Tools.rank_to_int(rank)
r = Tools.ranks[rank]
end
def Tools.int_to_rank(int)
r = Tools.ranks.rassoc(int)
r.nil? ? "unknown" : r[0].to_s
end
def Tools.ranks
# Lower case !!!
{:visitor => 10, :member => 20, "member+" => 25, :builder => 30, :donor => 40, "donor+" => 45, :mod => 100, :admin => 200, :superadmin => 500}
end
end

View File

@@ -0,0 +1,13 @@
<%%= simple_form_for(@<%= singular_table_name %>) do |f| %>
<%%= f.error_notification %>
<div class="form-inputs">
<%- attributes.each do |attribute| -%>
<%%= f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> %>
<%- end -%>
</div>
<div class="form-actions">
<%%= f.button :submit %>
</div>
<%% end %>