From 7c68b2a1673db455b519db97829944a290cf845f Mon Sep 17 00:00:00 2001 From: Yuki Date: Wed, 26 Aug 2015 00:45:08 +0530 Subject: [PATCH] PRODUCTION V DEVELOPMENT, ROUND 3 FIGHT --- app/controllers/user_controller.rb | 4 ++-- app/views/layouts/application.html.haml | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index d2cfe93c..e7550cf9 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -138,12 +138,12 @@ class UserController < ApplicationController if current_user.theme.save flash[:success] = 'Theme saved.' else - flash[:error] = 'Theme saving failed.' + flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.values.flatten.join ' ' end elsif current_user.theme.update_attributes(update_attributes) flash[:success] = 'Theme saved.' else - flash[:error] = 'Theme saving failed.' + flash[:error] = 'Theme saving failed. ' + current_user.theme.errors.messages.values.flatten.join ' ' end redirect_to edit_user_theme_path end diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index fdcb44db..b117453c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -12,11 +12,10 @@ %title= yield(:title) = javascript_include_tag 'i18n', 'data-turbolinks-track' => true = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true - - if @user.present? and @user.theme.present? and (if user_signed_in? then current_user.show_foreign_themes? else true end) - %link{rel: 'stylesheet', href: @user.theme.css.url, media: :all, 'data-turbolinks-track' => true} - - elsif user_signed_in? and current_user.theme.present? + - if user_signed_in? and not current_user.theme.nil? %link{rel: 'stylesheet', href: current_user.theme.css.url, media: :all, 'data-turbolinks-track' => true} - - else + - if (not @user.nil?) and (not @user.theme.nil?) and (if user_signed_in? then current_user.show_foreign_themes? else true end) + %link{rel: 'stylesheet', href: @user.theme.css.url, media: :all, 'data-turbolinks-track' => true} = javascript_include_tag 'application', 'data-turbolinks-track' => true - if user_signed_in? - if current_user.mod?