Merge branch 'master' of github.com:bterkuile/cmtool

This commit is contained in:
2015-03-06 09:59:51 +01:00
7 changed files with 22 additions and 13 deletions
+3 -3
View File
@@ -94,7 +94,7 @@ GEM
xpath (~> 2.0)
climate_control (0.0.3)
activesupport (>= 3.0)
cocaine (0.5.5)
cocaine (0.5.7)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
coffee-script (2.3.0)
@@ -144,7 +144,7 @@ GEM
mime-types (1.25.1)
mini_portile (0.6.2)
minitest (5.5.1)
multi_json (1.10.1)
multi_json (1.11.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
paperclip (4.2.1)
@@ -212,7 +212,7 @@ GEM
rspec-mocks (~> 3.2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
sass (3.4.12)
sass (3.4.13)
sass-rails (5.0.1)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
@@ -1,6 +1,6 @@
module Cmtool
class ApplicationController < ::ApplicationController
before_filter :authenticate_user!, :authorize_user, :check_environment, :set_locale
before_filter :authorize_user, :check_environment, :set_locale
layout 'cmtool/application'
private
@@ -21,6 +21,11 @@ module Cmtool
end
end
def cmtool_user
defined?(super) ? super : current_user
end
helper_method :cmtool_user
def check_environment
@cmtool_warnings ||= []
@cmtool_warnings << 'no_host_specified' unless ( Rails.application.config.action_mailer.default_url_options[:host] rescue false) ||
@@ -35,10 +35,6 @@ module Cmtool
end
@user = ::User.find(params[:id])
if @user.update_attributes(user)
if user['password']
# Sign in after changing current logged in password
sign_in(@user, :bypass => true) if @user == current_user
end
redirect_to cmtool.users_path, :notice => I18n.t('cmtool.action.update.successful', :model => ::User.model_name.human)
else
render :action => 'edit'
+4
View File
@@ -113,6 +113,10 @@ module Cmtool
format("%.2f",n) + %w(B KB MB GB TB)[count]
end
def cmtool_user
controller.send :cmtool_user
end
def edit_td(obj)
content_tag(
:td,
+3 -3
View File
@@ -7,13 +7,13 @@
li.toggle-topbar.menu-icon
a href="#"
span Menu
- if user_signed_in?
- if cmtool_user.present?
section.top-bar-section
ul.right
li.has-dropdown
a href="#" = current_user.email
a href="#" = cmtool_user.email
ul.dropdown
li.log-out= link_to t('helpers.links.logout'), main_app.destroy_user_session_path, method: :delete
li.log-out= link_to t('helpers.links.logout'), main_app.root_path
ul.left
- Cmtool::Menu.items.each do |menu_item|
- if menu_item.group?
@@ -1,5 +1,5 @@
#user-info
#user-info-email= link_to current_user.email, cmtool.user_path(current_user)
#user-info-email= link_to cmtool_user.email, cmtool.user_path(current_user)
#user-info-sign-in-out class: user_signed_in? ? 'signed-in' : 'signed-out'
- if user_signed_in?
= link_to t('devise.sessions.sign_out'), cmtool.destroy_user_session_path
@@ -4,6 +4,10 @@ class ApplicationController < ActionController::Base
private
def authorize_cmtool
redirect_to new_user_session_path unless current_user.present?
redirect_to main_app.new_user_session_path unless current_user.present?
end
def cmtool_user
current_user
end
end