Skip to content

Commit

Permalink
Ajustes na criação de logs e no registro de novos usuários
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloisr committed Nov 7, 2012
1 parent b82046b commit 8be7a7b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/controllers/admin/ips_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def create
redirect_if_cannot 'create', 'ips'
@ip = Ip.new(params[:ip])
if @ip.save
log current_user, "Criou o IP : #{@ip.to_json}"
log current_user, "Criou o IP : #{@ip.ip}/#{@ip.cidr}"
redirect_to admin_ips_url, :notice => t('application.obj_successfully_created', :obj => 'Ip')
else
render :action => "new"
Expand All @@ -32,7 +32,7 @@ def update
redirect_if_cannot 'update', 'ips'
@ip = Ip.find(params[:id])
if @ip.update_attributes(params[:ip])
log current_user, "Atualizou o IP : #{@ip.to_json}"
log current_user, "Atualizou o IP : #{@ip.ip}/#{@ip.cidr}"
redirect_to admin_ips_url, notice: t('application.obj_successfully_updated', :obj => 'Ip')
else
render action: "edit"
Expand All @@ -44,7 +44,7 @@ def destroy
@ip = Ip.find(params[:id])
@ip.destroy

log current_user, "Removeu o IP : #{@ip.to_json}"
log current_user, "Removeu o IP : #{@ip.ip}/#{@ip.cidr}"

redirect_to admin_ips_path, :notice => t('application.obj_successfully_destroyed', :obj => 'Ip')
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module ApplicationHelper
def admin_menu(label, link, icon = '')
raw content_tag(:li, link_to(icon + t(".#{label}"), link)) if can?('view', 'admin')
raw content_tag(:li, link_to(icon + t(".#{label}"), link), class: current_page?(link) ? 'active' : '') if can?('view', 'admin')
end

def icon(name, color = '')
Expand Down
14 changes: 8 additions & 6 deletions app/views/layouts/_menu.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@
logout_path,
:method => :delete) %>
<%= content_tag :li,
link_to(icon('edit') + t('.editaccount'),
editaccount_path) %>
link_to(icon('edit') + t('.editaccount'), editaccount_path),
class: current_page?(new_user_path) ? 'active' : '' %>
<% else %>
<%= content_tag :li,
link_to(icon('pencil') + t('.register'),
new_user_path) if setting(:allow_register) == 'true' %>
new_user_path),
class: current_page?(new_user_path) ? 'active' : '' if Setting.find_or_default('allow_register').value == 'true' %>
<%= content_tag :li,
link_to(icon('refresh') + t('.login'), login_path) %>
link_to(icon('refresh') + t('.login'), login_path),
class: current_page?(login_path) ? 'active' : '' %>
<% end %>

<%= content_tag :li,
link_to(icon('folder-close') + t('.projects'),
projects_path) if can?('index', 'projects') %>
link_to(icon('folder-close') + t('.projects'), projects_path),
class: current_page?(projects_path) ? 'active' : '' if can?('index', 'projects') %>

<%= content_tag :li, t('.admin'), :class => 'nav-header' if can?('view', 'admin') %>
<%= admin_menu('projects', admin_projects_path, icon('folder-close')) %>
Expand Down
2 changes: 2 additions & 0 deletions lib/cranelift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
require 'cranelift/scm'
require 'cranelift/auth'

ApplicationController.send(:include, Cranelift::Auth)

module Cranelift
end
2 changes: 0 additions & 2 deletions lib/cranelift/auth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,3 @@ def redirect_if_cannot(action, controller)
redirect_to root_url, :alert => t('application.unauthorized_access') unless can?(action, controller)
end
end

ApplicationController.send(:include, Cranelift::Auth)

0 comments on commit 8be7a7b

Please sign in to comment.