diff options
author | jomo <github@jomo.tv> | 2013-06-24 13:29:39 +0200 |
---|---|---|
committer | jomo <github@jomo.tv> | 2013-06-24 13:29:39 +0200 |
commit | fb52e8bed20142d0d08b2f0568a14172ab62844c (patch) | |
tree | a4e50ca07194906652abf1b71cea6ca0e3e0dbf9 /lib | |
parent | 7a894f4f6aecf3d6dcf103cf8cd51c52ab6f2655 (diff) |
many things, comments working.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Tools.rb | 39 | ||||
-rw-r--r-- | lib/templates/erb/scaffold/_form.html.erb | 13 |
2 files changed, 13 insertions, 39 deletions
diff --git a/lib/Tools.rb b/lib/Tools.rb deleted file mode 100644 index 6271f11..0000000 --- a/lib/Tools.rb +++ /dev/null @@ -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
\ No newline at end of file diff --git a/lib/templates/erb/scaffold/_form.html.erb b/lib/templates/erb/scaffold/_form.html.erb new file mode 100644 index 0000000..201a069 --- /dev/null +++ b/lib/templates/erb/scaffold/_form.html.erb @@ -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 %> |