Unable to replace spree default logo in spree 2.1.3 - ruby-on-rails-4

Used firebug and inspected Spree default logo is coming from
/assets/store/logo.png
Checked in spree 2.1.3 Version Source code and found default logo is coming from /logo section.
path :
core/app/models/spree/app_configuration.rb
preference :logo, :string, default: 'logo/spree_50.png'
Trying to Override, the default logo using Spree:Config option.
Spree::Config.set(logo: "store/logo.png")
But it's still redirecting to the old image(spree_50.png) and I am unable to replace the default logo.

In application.rb:
Spree.config do |config|
# Example:
# Uncomment to override the default site name.
# config.site_name = "Spree Demo Site"
config.logo = "logo.png"
end
Then add your logo to public/images/ and the logo will show up.

You can place your image at this path.
Inside: app/assets/images/logo/"Your Image"
for eg. app/assets/images/logo/hi5_logo.png**
Inside: config/initializers/spree.rb
Spree.config do |config|
config.logo = "logo/hi5_logo.png" #for default store logo
config.admin_interface_logo = "logo/hi5_logo.png" #for admin logo
end

Related

How to get site settings in a django project converted to wagtail

I have a django site onto which I have added wagtail following these instructions.
I have set up Social Media setting using these instructions
I have sucessfully added details on the admin page ad I can return and edit these details
However I cannot access them in a template
If I display
{{settings.site_settings.SiteSettings.facebook}}
I get '' (tested using {% if settings.site_settings.SiteSettings.facebook == '' ...)
However
{{settings.site_settings.SiteSettings}}
returns None
and
{{settings.site_settings}}
returns SettingsModuleProxy(site_settings)
What am I doing wrong?
The problem was simply that I had misspelt the SiteSettings class name in models.py (very red-face)

pdfkit not rendering images from cdn + rails 4.2 + pdfkit

I am trying to convert a html page that displays images from facebook cdn to pdf using pdfkit. I am using rails 4.2, pdfkit 0.6.2 and wkhtmltopdf-binary 0.9.9.3.
# Gemfile
gem 'pdfkit'
gem 'wkhtmltopdf-binary'
# controller
def generate_pdf
#booklet = Booklet.find params[:id]
#cover = Image.last
#images = #booklet.images.sort_by(&:uploaded_at)
respond_to do |format|
format.html
format.pdf do
html = render_to_string(layout: true , action: "generate_pdf.html.haml")
kit = PDFKit.new(html, page_size: 'A4', print_media_type: true)
kit.stylesheets << "#{Rails.root}/app/assets/stylesheets/application.scss"
pdf = kit.to_pdf
send_data pdf, filename: 'booklet.pdf', type: 'application/pdf', disposition: 'inline'
end
end
end
# application.scss
#import 'bootstrap';
#import 'custom';
#import 'jquery.booklet';
#import 'bootstrap-datepicker3';
# haml
= link_to 'Download Booklet', generate_pdf_booklet_path(#booklet, format: 'pdf'), class: 'btn btn-primary'
# config/application.rb
require 'pdfkit'
config.middleware.use PDFKit::Middleware
# config/initializers/mime_types.rb
Mime::Type.register "application/pdf", :pdf unless Mime::Type.lookup_by_extension(:pdf)
example facebook cdn image urls are
https://scontent.xx.fbcdn.net/hphotos-prn2/v/t1.0-9/s720x720/560041_10200752471482799_613254552_n.jpg?oh=900fe52ecc9b93e044cae4917f538626&oe=559F41E9 and https://fbcdn-sphotos-g-a.akamaihd.net/hphotos-ak-xap1/t31.0-8/s720x720/906468_10201023370815113_668460846_o.jpg
When i send a pdf request, I get following output on the server log
Rendered booklets/generate_pdf.html.haml within layouts/application (671.3ms)
QSslSocket: cannot resolve SSLv2_client_method
QSslSocket: cannot resolve SSLv2_server_method
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "fbcdn-sphotos-e-a.akamaihd.net"
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "fbcdn-sphotos-e-a.akamaihd.net"
QSslSocket::connectToHostEncrypted() called when already connecting/connected
QSslSocket::connectToHostEncrypted() called when already connecting/connected
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "fbcdn-sphotos-b-a.akamaihd.net"
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "fbcdn-sphotos-b-a.akamaihd.net"
QSslSocket::connectToHostEncrypted() called when already connecting/connected
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "fbcdn-sphotos-f-a.akamaihd.net"
QAbstractSocket::connectToHost() called when already looking up or connecting/connected to "fbcdn-sphotos-c-a.akamaihd.net"
Rendered text template (0.0ms)
Sent data booklet.pdf (1.4ms)
The pdf is getting generated but the local images(app/assets/images) and the cdn images arent rendered in the pdf. Also, the stylesheet isnt applied in the pdf. What am I missing?
Have created a sample repository for the above problem. Here: https://github.com/prasadsurase/topdf
I finally managed to fix the images issue. I removed the wkhtmltopdf-binary gem from the Gemfile and installed the wkhtmltopdf library(version 0.9.6) on the box as
sudo apt-get install wkhtmltopdf
Unfortunately, I am not able to install the same version on the server. A better approach would be to download the binary and keep it in your application in the bin folder and specify the binary's relative location in the pdfkit initializer. This would remove the version issues. FYI, the stylesheet issue still persists( PDFkit *.css stylesheets not being applied)
This issue usually caused by the SSL library of QT. If updating wkthmltopdf doesn't help, finding a suitable libssl-dev version may help to solve the issue.

Add clickable links to dashboard of rails_admin gem

Using rails_admin gem, I want to create a clickable link to rails_admin dashboard's left hand side bar.
Path of that link should be according to the rails path. I don't want to add any model for the same.
Please help me in adding the link.
You can add in your rails admin initializer:
config.navigation_static_links = {
'Dashboard' => '/admin' #or whatever you used to mount RailsAdmin in your routes file
}

JoomGallery with Avatar Slide Galleria Unlimited

I am using
Joomla 2.5
JoomGallery 2.xx
I have downloaded and installed Avatar Slide Galleria Unlimited
I am trying to use Avatar Slide Galleria Unlimited on top of JoomGallery.
In JoomGallery when i am setting up:
Detail view --> General Settings --> Open Original Image in
I see many installed plugins except of avatar.
Any suggestion how can i make "JoomGallery" to work with "Avatar Slide Galleria"
any help would be much appropriated.
With the Unlimited Edition, Avatar Slide Galleria is module extensions for Joomla to slide images in from JoomGallery. It's not JoomGallery plugin.
Galleria will only be called by Joomla site but not the JoomGallery.
You cuold add the module into your site and set it to show JoomGallery Images.
SETUP MODULE
Login to Joomla Control Panel page as Administrator
Choice Extension>Module Manager.
Click New.
Choice Avatar Slide Galleria.
Set the parameter for your Module silde image from Joomgallery
Avatar slide galleria can slide JoomGallery images by categories and sub categories.
You can chosse categories or sub categories for Galleria to slide them.
Thanks

Django Tiny_MCE and FileBrowser leading ../../../

Hi Im using Filebrowser for Django and also TinyMCE. I include TinyMCE in my admin text area editor by adding a admin template to folder media in my templates with filename base_site.html
Now when I add a image with filebrowser, tiny_mce adds a leading ../../../../ before /media/uploads/etc/image.jpg
Any ideas why? I guess its some URL thats not set correct. But im not sure if its tiny_mce or filebrowser.
TinyMCE has an option to avoid converting urls to what seems to be relative urls. You need to put the following on your configuration:
remove_script_host : false,
convert_urls : false,
Check out this thread: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=642