[Git][noosfero/noosfero][master] 2 commits: Fix the load picture on new template
Rodrigo Souto
gitlab at mg.gitlab.com
Thu Jul 6 16:49:24 BRT 2017
Rodrigo Souto pushed to branch master at Noosfero / noosfero
Commits:
bcc7b033 by antoniocoj at 2017-07-06T19:48:54+00:00
Fix the load picture on new template
- - - - -
1c535a1d by Rodrigo Souto at 2017-07-06T19:48:55+00:00
Merge branch 'template_picture' into 'master'
Fix the load picture on new template
See merge request !1266
- - - - -
2 changed files:
- app/models/profile.rb
- test/unit/profile_test.rb
Changes:
=====================================
app/models/profile.rb
=====================================
--- a/app/models/profile.rb
+++ b/app/models/profile.rb
@@ -570,7 +570,7 @@ class Profile < ApplicationRecord
self.custom_footer = template[:custom_footer]
self.custom_header = template[:custom_header]
self.public_profile = template.public_profile
-
+ self.image = template.image
# flush
self.save(:validate => false)
end
@@ -1096,7 +1096,6 @@ private :generate_url, :url_options
image.public_filename(:icon) if image.present?
end
- #FIXME make this test
def profile_custom_image(size = :icon)
image_path = profile_custom_icon if size == :icon
image_path ||= image.public_filename(size) if image.present?
=====================================
test/unit/profile_test.rb
=====================================
--- a/test/unit/profile_test.rb
+++ b/test/unit/profile_test.rb
@@ -1039,6 +1039,18 @@ class ProfileTest < ActiveSupport::TestCase
assert_equal 'leftbar', p.layout_template
end
+ should 'copy picture template when applying template' do
+ template = fast_create(Profile, :is_template => true)
+ template.image = Image.new
+ template.save!
+
+ p = create(Profile)
+
+ p.apply_template(template)
+
+ assert_equal template.image, p.image
+ end
+
should 'copy blocks when applying template' do
template = fast_create(Profile, :is_template => true)
template.boxes.destroy_all
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/61047aa18f349135b3eb91c9bffaeac46a9ca58a...1c535a1d60577495bffc4f3bd8e7a61d3335f25b
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/compare/61047aa18f349135b3eb91c9bffaeac46a9ca58a...1c535a1d60577495bffc4f3bd8e7a61d3335f25b
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20170706/50574b47/attachment-0001.html>
More information about the Noosfero-dev
mailing list