diff --git a/app/controllers/contacts_controller.rb b/app/controllers/contacts_controller.rb
new file mode 100644
index 0000000..45bf21d
--- /dev/null
+++ b/app/controllers/contacts_controller.rb
@@ -0,0 +1,31 @@
+class ContactUs::ContactsController < ApplicationController
+
+ def create
+ @contact = ContactUs::Contact.new(params[:contact_us_contact])
+
+ if verify_recaptcha(model: @contact) && @contact.save
+ redirect_to(ContactUs.success_redirect || '/', :notice => _('Contact email was successfully sent.'))
+ else
+ flash[:alert] = _('Captcha verification failed, please retry.')
+ redirect_to request.referrer
+ #render_new_page
+ end
+ end
+
+ def new
+ @contact = ContactUs::Contact.new
+ render_new_page
+ end
+
+ protected
+
+ def render_new_page
+ case ContactUs.form_gem
+ when 'formtastic' then render 'new_formtastic'
+ when 'simple_form' then render 'new_simple_form'
+ else
+ render 'new'
+ end
+ end
+
+end
diff --git a/app/controllers/org_admin/templates_controller.rb b/app/controllers/org_admin/templates_controller.rb
index 7440e04..0da5044 100644
--- a/app/controllers/org_admin/templates_controller.rb
+++ b/app/controllers/org_admin/templates_controller.rb
@@ -375,15 +375,18 @@
if org_id.present? || funder_id.present?
unless funder_id.blank?
# Load the funder's template(s)
- templates = Template.valid.publicly_visible.where(published: true, org_id: funder_id).to_a
+ funder_templates = Template.valid.publicly_visible.where(published: true, org_id: funder_id)
- unless org_id.blank?
+ if org_id.blank?
+ templates = funder_templates.to_a
+ else
# Swap out any organisational cusotmizations of a funder template
- templates.each do |tmplt|
+ funder_templates.each do |tmplt|
customization = Template.valid.find_by(published: true, org_id: org_id, customization_of: tmplt.dmptemplate_id)
if customization.present? && tmplt.created_at < customization.created_at
- templates.delete(tmplt)
templates << customization
+ else
+ templates << tmplt
end
end
end
diff --git a/app/models/org.rb b/app/models/org.rb
index dee239c..303cc0d 100644
--- a/app/models/org.rb
+++ b/app/models/org.rb
@@ -160,8 +160,8 @@
#
def resize_image
unless logo.nil?
- if logo.height != 75
- self.logo = logo.thumb('x75') # resize height and maintain aspect ratio
+ if logo.height != 100
+ self.logo = logo.thumb('x100') # resize height and maintain aspect ratio
end
end
end
diff --git a/app/views/shared/export/_plan_txt.erb b/app/views/shared/export/_plan_txt.erb
index 45cd172..6b06132 100644
--- a/app/views/shared/export/_plan_txt.erb
+++ b/app/views/shared/export/_plan_txt.erb
@@ -30,7 +30,7 @@
<% section[:questions].each do |question| %>
<% if @show_sections_questions %>
<%# text in this case is an array to accomodate for option_based %>
- <% if question[:text].length > 1 %>
+ <% if question[:text].respond_to?(:each) %>
<% question[:text].each do |txt| %>
<%= "#{strip_tags(txt.gsub(/
/, '\n'))}\n" %>
<% end %>
@@ -47,9 +47,8 @@
<% answer.question_options.each do |opt| %>
<%= " #{opt.text}\n" %>
<% end %>
- <% else %>
-<%= " #{strip_tags(answer.text.gsub(/<\/?p>/, '').gsub(/
/, '\n').chomp)}\n\n" if answer.text.present? %>
<% end %>
+<%= " #{strip_tags(answer.text.gsub(/<\/?p>/, '').gsub(/
/, '\n').chomp)}\n\n" if answer.text.present? %>
<% end %>
<% end %>
<% end %>
diff --git a/test/unit/org_test.rb b/test/unit/org_test.rb
index 40720a3..0d5e284 100644
--- a/test/unit/org_test.rb
+++ b/test/unit/org_test.rb
@@ -66,7 +66,7 @@
end
# ---------------------------------------------------
- test "should resize logo to a height of 75" do
+ test "should resize logo to a height of 100" do
['logo.jpg', # this one is at 160x160
'logo_300x300.jpg',
'logo_100x100.jpg'].each do |file|
@@ -75,7 +75,7 @@
@org.logo = Dragonfly.app.fetch_file("#{path}")
assert @org.valid?, "expected the logo to have been attached to the org"
- assert_equal 75, @org.logo.height, "expected the logo to have been resized properly"
+ assert_equal 100, @org.logo.height, "expected the logo to have been resized properly"
end
end