From 306b36c045cd62638db179115ed002c6ab7c5cd8 Mon Sep 17 00:00:00 2001 From: luca-marie Date: Thu, 22 Sep 2016 14:36:10 +0200 Subject: included Theas work on error-handling \o/; changed link to twitter-account in header; fixed erb escaping characters problem without letting evil code pass; setting customized image file 'Avatar_Pic.png' in config/custo../assets to get loaded instead of default twitter-logo --- config/initializers/assets.rb | 1 + config/initializers/customization.rb | 3 ++- config/initializers/twitter.rb | 37 ++++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/twitter.rb (limited to 'config/initializers') diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 0000000..ccb32b6 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1 @@ +Rails.application.config.assets.precompile += %w( Avatar_Pic.png ) diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb index 9f537e9..9b3a2b9 100644 --- a/config/initializers/customization.rb +++ b/config/initializers/customization.rb @@ -21,7 +21,8 @@ customization_directory = APP_CONFIG["customization_directory"] # * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise # this initializer will never get called in production mode when the assets are precompiled. # -Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" +# Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" +Rails.application.config.assets.paths.unshift "#{customization_directory}/assets" # # Copy files to public diff --git a/config/initializers/twitter.rb b/config/initializers/twitter.rb new file mode 100644 index 0000000..9f537e9 --- /dev/null +++ b/config/initializers/twitter.rb @@ -0,0 +1,37 @@ +# +# When deploying, common customizations can be dropped in config/customizations. This initializer makes this work. +# +APP_CONFIG["customization_directory"] ||= "#{Rails.root}/config/customization" +customization_directory = APP_CONFIG["customization_directory"] + +# +# Set customization views as the first view path +# +# Rails.application.config.paths['app/views'].unshift "config/customization/views" +# (For some reason, this does not work here. See application.rb for where this is actually called.) + +# +# Set customization stylesheets as the first asset path +# +# Some notes: +# +# * This cannot go in application.rb, as far as I can tell. In application.rb, the default paths +# haven't been loaded yet, so the path we add will always end up at the end unless we add it here. +# +# * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise +# this initializer will never get called in production mode when the assets are precompiled. +# +Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" + +# +# Copy files to public +# +if !defined?(RAKE) && Dir.exist?("#{customization_directory}/public") + require 'fileutils' + FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public", :preserve => true) +end + +# +# Add I18n path +# +Rails.application.config.i18n.load_path += Dir["#{customization_directory}/locales/*.{rb,yml,yaml}"] -- cgit v1.2.3 From 6f9c4fdab2caef90e49ca965617e767b50bcbbb2 Mon Sep 17 00:00:00 2001 From: luca-marie Date: Thu, 22 Sep 2016 15:31:52 +0200 Subject: initializer/twitter.rb file unnecessary; added change in main view only if twitter feature is set enabled == true --- config/initializers/twitter.rb | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 config/initializers/twitter.rb (limited to 'config/initializers') diff --git a/config/initializers/twitter.rb b/config/initializers/twitter.rb deleted file mode 100644 index 9f537e9..0000000 --- a/config/initializers/twitter.rb +++ /dev/null @@ -1,37 +0,0 @@ -# -# When deploying, common customizations can be dropped in config/customizations. This initializer makes this work. -# -APP_CONFIG["customization_directory"] ||= "#{Rails.root}/config/customization" -customization_directory = APP_CONFIG["customization_directory"] - -# -# Set customization views as the first view path -# -# Rails.application.config.paths['app/views'].unshift "config/customization/views" -# (For some reason, this does not work here. See application.rb for where this is actually called.) - -# -# Set customization stylesheets as the first asset path -# -# Some notes: -# -# * This cannot go in application.rb, as far as I can tell. In application.rb, the default paths -# haven't been loaded yet, so the path we add will always end up at the end unless we add it here. -# -# * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise -# this initializer will never get called in production mode when the assets are precompiled. -# -Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" - -# -# Copy files to public -# -if !defined?(RAKE) && Dir.exist?("#{customization_directory}/public") - require 'fileutils' - FileUtils.cp_r("#{customization_directory}/public/.", "#{Rails.root}/public", :preserve => true) -end - -# -# Add I18n path -# -Rails.application.config.i18n.load_path += Dir["#{customization_directory}/locales/*.{rb,yml,yaml}"] -- cgit v1.2.3 From 7c9aba4a6192617cd29765450711a65affccecef Mon Sep 17 00:00:00 2001 From: luca-marie Date: Thu, 22 Sep 2016 16:13:42 +0200 Subject: clean up --- config/initializers/customization.rb | 3 --- 1 file changed, 3 deletions(-) (limited to 'config/initializers') diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb index 9b3a2b9..a96564c 100644 --- a/config/initializers/customization.rb +++ b/config/initializers/customization.rb @@ -1,10 +1,8 @@ -# # When deploying, common customizations can be dropped in config/customizations. This initializer makes this work. # APP_CONFIG["customization_directory"] ||= "#{Rails.root}/config/customization" customization_directory = APP_CONFIG["customization_directory"] -# # Set customization views as the first view path # # Rails.application.config.paths['app/views'].unshift "config/customization/views" @@ -21,7 +19,6 @@ customization_directory = APP_CONFIG["customization_directory"] # * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise # this initializer will never get called in production mode when the assets are precompiled. # -# Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" Rails.application.config.assets.paths.unshift "#{customization_directory}/assets" # -- cgit v1.2.3 From 4ffa776d2c760618b17bd76a9a023f7fe762babd Mon Sep 17 00:00:00 2001 From: luca-marie Date: Fri, 23 Sep 2016 11:52:46 +0200 Subject: Doc updated on how to customize avatar picture in twitter feature; update error response messages; added 'config/customization/images' + link in 'config/initializer/customization.rb' --- config/initializers/customization.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'config/initializers') diff --git a/config/initializers/customization.rb b/config/initializers/customization.rb index a96564c..6d9c741 100644 --- a/config/initializers/customization.rb +++ b/config/initializers/customization.rb @@ -19,8 +19,8 @@ customization_directory = APP_CONFIG["customization_directory"] # * For this to work, config.assets.initialize_on_precompile MUST be set to true, otherwise # this initializer will never get called in production mode when the assets are precompiled. # -Rails.application.config.assets.paths.unshift "#{customization_directory}/assets" - +Rails.application.config.assets.paths.unshift "#{customization_directory}/images" +Rails.application.config.assets.paths.unshift "#{customization_directory}/stylesheets" # # Copy files to public # -- cgit v1.2.3