many things, comments working.
This commit is contained in:
39
lib/Tools.rb
39
lib/Tools.rb
@@ -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
|
||||
13
lib/templates/erb/scaffold/_form.html.erb
Normal file
13
lib/templates/erb/scaffold/_form.html.erb
Normal 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 %>
|
||||
Reference in New Issue
Block a user