Skip to content

Commit

Permalink
Merge branch 'develop' into feature-test-suite
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasknoepfle committed Feb 11, 2015
2 parents 2d82a3a + 27a4173 commit 5dbeec9
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 52 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions app/assets/stylesheets/billboards/_billboard-subscriptions.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Subscriptions billboard
*/


// General stuff
#billboard-subscriptions > article > h2,
#billboard-subscriptions > article > a {
text-indent: -1000em;
}

#billboard-subscriptions > article > a {
top: 0;
left: 0;
width: 100%;
height: 100%
}



// Responsive code: small version
@include till-breakpoint($bp-tablet) {
#billboard-subscriptions {
background-image: image-url('welcome/billboard_subscriptions_small.jpg');
}
}


// Responsive code: medium version
@include between-breakpoints($bp-tablet, $bp-tablet-horizontal) {
#billboard-subscriptions {
background-image: image-url('welcome/billboard_subscriptions_medium.jpg');
}
}


// Responsive code: big version
@include at-breakpoint($bp-tablet-horizontal) {
#billboard-subscriptions {
background-image: image-url('welcome/billboard_subscriptions_big.jpg');
}
}
11 changes: 6 additions & 5 deletions app/assets/stylesheets/controller/welcome.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@import "mixins/all";
@import "billboards/billboard-subscriptions";
@import "billboards/billboard-valentines";
@import "billboards/billboard-ecobookstore";
@import "billboards/billboard-toys";
@import "billboards/billboard-gifts";
@import "billboards/billboard-gourmet";
//@import "billboards/billboard-ecobookstore";
//@import "billboards/billboard-toys";
//@import "billboards/billboard-gifts";
//@import "billboards/billboard-gourmet";
@import "billboards/billboard-books";
@import "billboards/billboard-bybike";
//@import "billboards/billboard-bybike";


/*
Expand Down
11 changes: 7 additions & 4 deletions app/controllers/toolbox_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ def reindex
def contact
session[:seller_message] = {} unless session[:seller_message]
session[:seller_message][params[:contact][:article_id]] = params[:contact][:text] # store text
return redirect_to :back, flash: { error: I18n.t('article.show.contact.acceptance_error') } unless params[:contact][:email_transfer_accepted] == "1" # manual validation: transfer of email was accepted
return redirect_to :back, flash: { error: I18n.t('article.show.contact.empty_error') } unless params[:contact][:text].length > 0 # manual validation: message is present
return redirect_to :back, flash: { error: I18n.t('article.show.contact.long_error') } unless params[:contact][:text].length < 2000 # manual validation: message is shorter than 2000 characters

if params && params[:contact][:article_id]
article = Article.find params[:contact][:article_id]
return redirect_to :back, flash: { error: I18n.t('article.show.contact.acceptance_error') } unless params[:contact][:email_transfer_accepted] == "1" # manual validation: transfer of email was accepted
return redirect_to :back, flash: { error: I18n.t('article.show.contact.empty_error') } unless params[:contact][:text].length > 0 # manual validation: message is present
return redirect_to :back, flash: { error: I18n.t('article.show.contact.long_error') } unless params[:contact][:text].length < 2000 # manual validation: message is shorter than 2000 characters
ArticleMailer.delay.contact(current_user,
article,
params[:contact][:text])
Expand All @@ -54,9 +54,12 @@ def contact

elsif params && params[:contact][:user_id]
user = User.find params[:contact][:user_id]
return redirect_to user, flash: { error: I18n.t('users.profile.contact.acceptance_error') } unless params[:contact][:email_transfer_accepted] == "1" # manual validation: transfer of email was accepted
return redirect_to user, flash: { error: I18n.t('users.profile.contact.empty_error') } unless params[:contact][:text].length > 0 # manual validation: message is present
return redirect_to user, flash: { error: I18n.t('users.profile.contact.long_error') } unless params[:contact][:text].length < 2000 # manual validation: message is shorter than 2000 characters
UserMailer.delay.contact(sender: current_user, receiver: user, text: params[:contact][:text])
session[:seller_message][params[:contact][:user_id]] = nil # delete from session
redirect_to user, notice: I18n.t('article.show.contact.success_notice')
redirect_to user, notice: I18n.t('users.profile.contact.success_notice')
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/articles/show/_commendation_label.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

- case label
- when :bike_courier
=<> link_to fa_icon('bicycle'), link, class: "#{commendation_label_classes} accordion-anchor ungrouped_colorbox"
=<> link_to fa_icon('bicycle'), link, class: "#{commendation_label_classes} ungrouped_colorbox"
-else
- if local_assigns.has_key?(:link) && link
=<> link_to t("article.commendations.#{label.to_s}"), link,
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/email/_help.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
h4
| Probleme mit der Bestellung?
| Lies unsere
= link_to 'FAQ.', 'https://www.fairmondo.de/faq'
=< link_to 'FAQ.', 'https://www.fairmondo.de/faq'
br
br
= mail_to $email_addresses['default'], 'Kontaktiere unseren Kundenservice.'
64 changes: 36 additions & 28 deletions app/views/welcome/index.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@
span.slides-arrow.slides-arrow--right
i.fa.fa-chevron-right

/ Runde Sache subscriptions
.billboard#billboard-subscriptions
article
h2 Schöne und faire Dinge per Fahrrad zu Dir nach Hause
= link_to 'Jetzt die ersten Runde Sache Abos sichern',
'https://www.startnext.com/rundesache',
target: '_blank'

/ Valentines
.billboard#billboard-valentines
article
Expand Down Expand Up @@ -108,36 +116,36 @@
/ '/libraries/8216', id: 'billboard-ecobookstore-link2'
/ Produkte unter 15 EUR
.billboard#billboard-gifts
article
h2
| Tolle <span id="billboard-gifts-gifts">Produkte</span> unter
<span id="billboard-gifts-price">15&thinsp;&euro;</span>
ul
li#billboard-gifts-link1
= link_to '/libraries/8052?pk_campaign=bb6&pk_kwd=geschenke' do
div
p Alle ansehen
/ .billboard#billboard-gifts
/ article
/ h2
/ | Tolle <span id="billboard-gifts-gifts">Produkte</span> unter
/ <span id="billboard-gifts-price">15&thinsp;&euro;</span>
/ ul
/ li#billboard-gifts-link1
/ = link_to '/libraries/8052?pk_campaign=bb6&pk_kwd=geschenke' do
/ div
/ p Alle ansehen
/ Edle Tropfen
.billboard#billboard-gourmet
article
h2 Edle<br>Tropfen
= link_to '/users/mexican-tears?pk_campaign=bb5&pk_kwd=mexicantears' do
| Klick mich,<br>ich bin <br>scharf<br>und<br>beliebt
ul
li#billboard-gourmet-link1
= link_to '/libraries/7318?pk_campaign=bb5&pk_kwd=essigoel' do
div
p Essige und Öle
li#billboard-gourmet-link2
= link_to '/libraries/7317?pk_campaign=bb5&pk_kwd=sauce' do
div
p Gourmetsaucen
li#billboard-gourmet-link3
= link_to '/libraries/7320?pk_campaign=bb5&pk_kwd=weine' do
div
p Weine
/ .billboard#billboard-gourmet
/ article
/ h2 Edle<br>Tropfen
/ = link_to '/users/mexican-tears?pk_campaign=bb5&pk_kwd=mexicantears' do
/ | Klick mich,<br>ich bin <br>scharf<br>und<br>beliebt
/ ul
/ li#billboard-gourmet-link1
/ = link_to '/libraries/7318?pk_campaign=bb5&pk_kwd=essigoel' do
/ div
/ p Essige und Öle
/ li#billboard-gourmet-link2
/ = link_to '/libraries/7317?pk_campaign=bb5&pk_kwd=sauce' do
/ div
/ p Gourmetsaucen
/ li#billboard-gourmet-link3
/ = link_to '/libraries/7320?pk_campaign=bb5&pk_kwd=weine' do
/ div
/ p Weine
/ Startnext widget
Expand Down
38 changes: 25 additions & 13 deletions test/features/user_profile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,33 +62,45 @@
sender = FactoryGirl.create :user
login_as sender
visit profile_user_path receiver
click_link I18n.t 'users.profile.contact.heading'

within('.user-menu') do
click_link I18n.t 'users.profile.contact.heading'
end
end

scenario "user contacts seller" do
fill_in 'contact[text]', with: 'foobar'
click_button I18n.t('users.profile.contact.action')
within('.contact_seller') do
fill_in 'contact[text]', with: 'foobar'
click_button I18n.t('users.profile.contact.action')
end
page.must_have_content I18n.t 'users.profile.contact.success_notice'
end

scenario "user contacts seller but unchecks email transfer acceptance" do
fill_in 'contact[text]', with: 'foobar'
uncheck 'contact[email_transfer_accepted]'
click_button I18n.t('users.profile.contact.action')
page.must_have_content I18n.t 'users.profile.contact.acceptance_error'
within('.contact_seller') do
fill_in 'contact[text]', with: 'foobar'
uncheck 'contact[email_transfer_accepted]'
click_button I18n.t('users.profile.contact.action')
end
page.must_have_content I18n.t('users.profile.contact.acceptance_error')
end

scenario "user contacts seller with blank message" do
fill_in 'contact[text]', with: ''
click_button I18n.t('users.profile.contact.action')
page.must_have_content I18n.t 'users.profile.contact.empty_error'
within('.contact_seller') do
fill_in 'contact[text]', with: ''
click_button I18n.t('users.profile.contact.action')
end
page.must_have_content I18n.t('users.profile.contact.empty_error')
end

scenario "user contacts seller with message that exceeds 2000 character limit" do
text = ''
2001.times { text += 'a' }
fill_in 'contact[text]', with: text
click_button I18n.t('users.profile.contact.action')
page.must_have_content I18n.t 'users.profile.contact.long_error'

within('.contact_seller') do
fill_in 'contact[text]', with: text
click_button I18n.t('users.profile.contact.action')
end
page.must_have_content I18n.t('users.profile.contact.long_error')
end
end

0 comments on commit 5dbeec9

Please sign in to comment.