Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

haml glory!

  • Loading branch information...
commit d97ef84ef78ede140494309b53bdcbbbbb920e7a 1 parent cc6a221
@nofxx authored
View
4 app/controllers/home_controller.rb
@@ -1,6 +1,8 @@
class HomeController < ApplicationController
def index
- @mensagem = "Bem-vindo"
+ @mensagem = "Bem-vindo"
+ @aps = current_user.aps.count
+ @clients = current_user.clients.count
end
end
View
2  app/helpers/application_helper.rb
@@ -72,7 +72,7 @@ def flexigrid_button_click(class_name, redirect_to_url, options = {})
output << " if (confirm('#{options[:confirm]}'))" if options[:confirm]
output << " window.location = '" << url_for(redirect_to_url) << "/'+$('td', '.trSelected', '.flexigrid')[0].textContent;"
output << " } else { "
- output << " alert('You dont selected a item.'); } "
+ output << " alert('Select one item.'); } "
else
output << "window.location = '" << url_for(redirect_to_url) << "'"
end
View
40 app/views/aps/_ap.html.haml
@@ -0,0 +1,40 @@
+- form_for(@ap) do |f|
+= f.error_messages
+%p
+ = f.label :essid
+ = f.text_field :essid
+%p
+ = f.label :mac
+ = f.text_field :mac
+%p
+ = f.label :enc
+ = f.text_field :enc
+%p
+ = f.label :key
+ = f.text_field :key
+%p
+ = f.label :ip
+ = f.text_field :ip
+%p
+ = f.label :mask
+ = f.text_field :mask
+%p
+ = f.label :dhcp
+ = f.check_box :dhcp
+%p
+ = f.label :canal
+ = f.text_field :channel
+%p
+ = f.label :Pais
+ = f.text_field :country
+%p
+ = f.label :Cidade
+ = f.text_field :city
+%p
+ = f.label :Estado
+ = f.text_field :region
+
+%p= f.submit(metodo == "post" ? "Gravar" : "Atualizar")
+- end
+
+
View
56 app/views/aps/edit.html.erb
@@ -1,56 +0,0 @@
-<h1>Editando <%= @ap.essid %></h1>
-
-<% form_for(@ap) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :essid %><br />
- <%= f.text_field :essid %>
- </p>
- <p>
- <%= f.label :mac %><br />
- <%= f.text_field :mac %>
- </p>
- <p>
- <%= f.label :enc %><br />
- <%= f.text_field :enc %>
- </p>
- <p>
- <%= f.label :key %><br />
- <%= f.text_field :key %>
- </p>
- <p>
- <%= f.label :ip %><br />
- <%= f.text_field :ip %>
- </p>
- <p>
- <%= f.label :mask %><br />
- <%= f.text_field :mask %>
- </p>
- <p>
- <%= f.label :dhcp %><br />
- <%= f.check_box :dhcp %>
- </p>
- <p>
- <%= f.label :canal %><br />
- <%= f.text_field :channel %>
- </p>
- <p>
- <%= f.label :Pais %><br />
- <%= f.text_field :country %>
- </p>
- <p>
- <%= f.label :Cidade %><br />
- <%= f.text_field :city %>
- </p>
- <p>
- <%= f.label :Estado %><br />
- <%= f.text_field :region %>
- </p>
- <p>
- <%= f.submit "Atualizar" %>
- </p>
-<% end %>
-
-<%= link_to 'Ver', @ap %> |
-<%= link_to 'Voltar', aps_path %>
View
7 app/views/aps/edit.html.haml
@@ -0,0 +1,7 @@
+%h1= "Editando #{@ap.essid}"
+
+= partial 'aps/ap', :metodo => "put"
+
+= link_to 'Ver', @ap
+|
+= link_to 'Voltar', aps_path
View
2  app/views/aps/index.html.erb
@@ -1,2 +0,0 @@
-<h1>Listando Pontos de acesso</h1>
-<%= content_tag('div', '', :id => 'flexigrid') %>
View
3  app/views/aps/index.html.haml
@@ -0,0 +1,3 @@
+%h1 Listando Pontos de acesso
+
+= content_tag('div', '', :id => 'flexigrid')
View
5 app/views/aps/index.js.erb
@@ -12,6 +12,8 @@ $(document).ready(function(){
s << {:display => 'Mac', :name => 'mac'}
s << {:display => 'IP', :name => 'ip'}
+ b << {:name => 'Ver', :bclass => 'show'}
+ b << {:separator => true}
b << {:name => 'Adicionar', :bclass => 'add'}
b << {:separator => true}
b << {:name => 'Editar', :bclass => 'edit'}
@@ -20,7 +22,8 @@ $(document).ready(function(){
end
%>
-
+
+ <%= flexigrid_button_click '.show', '/aps/show', :include_id => true %>
<%= flexigrid_button_click '.add', new_ap_path %>
<%= flexigrid_button_click '.edit', '/aps/edit', :include_id => true %>
<%= flexigrid_button_click '.destroy', '/aps/destroy', :include_id => true, :confirm => 'Tem certeza?' %>
View
55 app/views/aps/new.html.erb
@@ -1,55 +0,0 @@
-<h1>Novo Ponto de acesso</h1>
-
-<% form_for(@ap) do |f| %>
- <%= f.error_messages %>
-
- <p>
- <%= f.label :essid %><br />
- <%= f.text_field :essid %>
- </p>
- <p>
- <%= f.label :mac %><br />
- <%= f.text_field :mac %>
- </p>
- <p>
- <%= f.label :enc %><br />
- <%= f.text_field :enc %>
- </p>
- <p>
- <%= f.label :key %><br />
- <%= f.text_field :key %>
- </p>
- <p>
- <%= f.label :ip %><br />
- <%= f.text_field :ip %>
- </p>
- <p>
- <%= f.label :mask %><br />
- <%= f.text_field :mask %>
- </p>
- <p>
- <%= f.label :dhcp %><br />
- <%= f.check_box :dhcp %>
- </p>
- <p>
- <%= f.label :channel %><br />
- <%= f.text_field :channel %>
- </p>
- <p>
- <%= f.label :pais %><br />
- <%= f.text_field :country %>
- </p>
- <p>
- <%= f.label :cidade %><br />
- <%= f.text_field :city %>
- </p>
- <p>
- <%= f.label :estado %><br />
- <%= f.text_field :region %>
- </p>
- <p>
- <%= f.submit "Criar" %>
- </p>
-<% end %>
-
-<%= link_to 'Voltar', aps_path %>
View
5 app/views/aps/new.html.haml
@@ -0,0 +1,5 @@
+%h1 Novo Ponto de acesso
+
+= partial 'aps/ap', :metodo => "post"
+
+= link_to 'Voltar', aps_path
View
63 app/views/aps/show.html.erb
@@ -1,63 +0,0 @@
-<h1><%= @ap.essid %></h1>
-<p>
- <b>Essid:</b>
- <%=h @ap.essid %>
-</p>
-
-<p>
- <b>Mac:</b>
- <%=h @ap.mac %>
-</p>
-
-<p>
- <b>Enc:</b>
- <%=h @ap.enc %>
-</p>
-
-<p>
- <b>Key:</b>
- <%=h @ap.key %>
-</p>
-
-<p>
- <b>Ip:</b>
- <%=h @ap.ip %>
-</p>
-
-<p>
- <b>Mask:</b>
- <%=h @ap.mask %>
-</p>
-
-<p>
- <b>Dhcp:</b>
- <%=h @ap.dhcp %>
-</p>
-
-<p>
- <b>Canal:</b>
- <%=h @ap.channel %>
-</p>
-
-<p>
- <b>Pais:</b>
- <%=h @ap.country %>
-</p>
-
-<p>
- <b>Cidade:</b>
- <%=h @ap.city %>
-</p>
-
-<p>
- <b>Estado:</b>
- <%=h @ap.region %>
-</p>
-<p>Clientes:
-<% for client in @ap.clients %>
- <p><%= link_to client.mac, client %></p>
-<% end %>
-</p>
-<br>
-<%= link_to 'Editar', edit_ap_path(@ap) %> |
-<%= link_to 'Voltar', aps_path %>
View
44 app/views/aps/show.html.haml
@@ -0,0 +1,44 @@
+%h1= @ap.essid
+%p
+ %b Essid:
+ =h @ap.essid
+%p
+ %b Mac:
+ =h @ap.mac
+%p
+ %b Enc:
+ =h @ap.enc
+%p
+ %b Key:
+ =h @ap.key
+%p
+ %b Ip:
+ =h @ap.ip
+%p
+ %b Mask:
+ =h @ap.mask
+%p
+ %b DHCP:
+ =h @ap.dhcp
+%p
+ %b Canal:
+ =h @ap.channel
+%p
+ %b Pais:
+ =h @ap.country
+%p
+ %b Cidade:
+ =h @ap.city
+%p
+ %b Estado:
+ =h @ap.region
+%p
+ %b Clientes:
+ - for client in @ap.clients
+ %p
+ = link_to client.mac, client
+ - end
+%br/
+= link_to 'Editar', edit_ap_path(@ap)
+|
+= link_to 'Voltar', aps_path
View
3  app/views/home/index.html.erb
@@ -1,3 +0,0 @@
-<p><%= @mensagem %></p>
-
-
View
18 app/views/home/index.html.haml
@@ -0,0 +1,18 @@
+%h1= @mensagem
+
+%p
+ You may want to start up
+ = link_to "uploading a logfile?", new_logfile_path
+
+
+%h2 News on your area
+
+
+
+%h2= current_user.login.upcase
+%p
+ You have
+ = link_to "#{@aps} Access Points", aps_path
+ and
+ = link_to "#{@clients} Clients.", clients_path
+
View
8 app/views/layouts/header.html.erb
@@ -1,3 +1,5 @@
-<div id="header">
- <div id="logo"></div>
-</div>
+<a href='/'>
+ <div id="header">
+ <div id="logo"></div>
+ </div>
+</a>
View
149 config/environment.rb
@@ -1,74 +1,75 @@
-# Be sure to restart your server when you modify this file
-
-# Uncomment below to force Rails into production mode when
-# you don't control web/app server and can't set it the proper way
-# ENV['RAILS_ENV'] ||= 'production'
-
-# Specifies gem version of Rails to use when vendor/rails is not present
-RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
-
-# Bootstrap the Rails environment, frameworks, and default configuration
-require File.join(File.dirname(__FILE__), 'boot')
-
-Rails::Initializer.run do |config|
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
- # See Rails::Configuration for more options.
-
- # Skip frameworks you're not going to use. To use Rails without a database
- # you must remove the Active Record framework.
- # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
-
- # Specify gems that this application depends on.
- # They can then be installed with "rake gems:install" on new installations.
- # config.gem "bj"
- # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
- # config.gem "aws-s3", :lib => "aws/s3"
-
- # Only load the plugins named here, in the order given. By default, all plugins
- # in vendor/plugins are loaded in alphabetical order.
- # :all can be used as a placeholder for all plugins not explicitly named
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
-
- # Add additional load paths for your own custom dirs
- # config.load_paths += %W( #{RAILS_ROOT}/extras )
-
- # Force all environments to use the same logger level
- # (by default production uses :info, the others :debug)
- # config.log_level = :debug
-
- # Make Time.zone default to the specified zone, and make Active Record store time values
- # in the database in UTC, and return them converted to the specified local zone.
- # Run "rake -D time" for a list of tasks for finding time zone names. Uncomment to use default local time.
- config.time_zone = 'UTC'
-
- # Your secret key for verifying cookie session data integrity.
- # If you change this key, all old sessions will become invalid!
- # Make sure the secret is at least 30 characters and all random,
- # no regular words or you'll be exposed to dictionary attacks.
- config.action_controller.session = {
- :session_key => '_rufi_session',
- :secret => '7879ed2d552bd6e691461f2c663dc3477ccb785a75ebc988659566529a4994bde8b143f67d46b69cbd5f9680b3991259a057b370a49e90f97928db626d61ddf3'
- }
-
- # Use the database for sessions instead of the cookie-based default,
- # which shouldn't be used to store highly confidential information
- # (create the session table with "rake db:sessions:create")
- # config.action_controller.session_store = :active_record_store
-
- # Use SQL instead of Active Record's schema dumper when creating the test database.
- # This is necessary if your schema can't be completely dumped by the schema dumper,
- # like if you have constraints or database-specific column types
- # config.active_record.schema_format = :sql
-
- # Activate observers that should always be running
- # config.active_record.observers = :cacher, :garbage_collector
- config.active_record.observers = :user_observer
-
- # #
- # GEMS
- #
- config.gem 'hpricot'
-
-end
+# Be sure to restart your server when you modify this file
+
+# Uncomment below to force Rails into production mode when
+# you don't control web/app server and can't set it the proper way
+# ENV['RAILS_ENV'] ||= 'production'
+
+# Specifies gem version of Rails to use when vendor/rails is not present
+RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION
+
+# Bootstrap the Rails environment, frameworks, and default configuration
+require File.join(File.dirname(__FILE__), 'boot')
+
+Rails::Initializer.run do |config|
+ # Settings in config/environments/* take precedence over those specified here.
+ # Application configuration should go into files in config/initializers
+ # -- all .rb files in that directory are automatically loaded.
+ # See Rails::Configuration for more options.
+
+ # Skip frameworks you're not going to use. To use Rails without a database
+ # you must remove the Active Record framework.
+ # config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
+
+ # Specify gems that this application depends on.
+ # They can then be installed with "rake gems:install" on new installations.
+ # config.gem "bj"
+ # config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net"
+ # config.gem "aws-s3", :lib => "aws/s3"
+
+ # Only load the plugins named here, in the order given. By default, all plugins
+ # in vendor/plugins are loaded in alphabetical order.
+ # :all can be used as a placeholder for all plugins not explicitly named
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
+
+ # Add additional load paths for your own custom dirs
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
+
+ # Force all environments to use the same logger level
+ # (by default production uses :info, the others :debug)
+ # config.log_level = :debug
+
+ # Make Time.zone default to the specified zone, and make Active Record store time values
+ # in the database in UTC, and return them converted to the specified local zone.
+ # Run "rake -D time" for a list of tasks for finding time zone names. Uncomment to use default local time.
+ config.time_zone = 'UTC'
+
+ # Your secret key for verifying cookie session data integrity.
+ # If you change this key, all old sessions will become invalid!
+ # Make sure the secret is at least 30 characters and all random,
+ # no regular words or you'll be exposed to dictionary attacks.
+ config.action_controller.session = {
+ :session_key => '_rufi_session',
+ :secret => '7879ed2d552bd6e691461f2c663dc3477ccb785a75ebc988659566529a4994bde8b143f67d46b69cbd5f9680b3991259a057b370a49e90f97928db626d61ddf3'
+ }
+
+ # Use the database for sessions instead of the cookie-based default,
+ # which shouldn't be used to store highly confidential information
+ # (create the session table with "rake db:sessions:create")
+ # config.action_controller.session_store = :active_record_store
+
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
+ # like if you have constraints or database-specific column types
+ # config.active_record.schema_format = :sql
+
+ # Activate observers that should always be running
+ # config.active_record.observers = :cacher, :garbage_collector
+ config.active_record.observers = :user_observer
+
+ # #
+ # GEMS
+ #
+ config.gem 'hpricot'
+ config.gem 'haml'
+
+end
View
2  spec/controllers/home_controller_spec.rb
@@ -37,7 +37,7 @@ def do_get
it "should have tag bem vindo" do
do_get
- response.should have_tag('p', /vindo/)
+ response.should have_tag('h1', /vindo/)
end
it "should hava @mensagem with value Bem-vindo" do
View
1  vendor/plugins/haml/init.rb
@@ -1,4 +1,3 @@
-require 'rubygems'
begin
require File.join(File.dirname(__FILE__), 'lib', 'haml') # From here
rescue LoadError
Please sign in to comment.
Something went wrong with that request. Please try again.