Skip to content

Commit

Permalink
Merge 37347f4 into 6706c61
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasduerschmid committed Feb 9, 2017
2 parents 6706c61 + 37347f4 commit 01caa71
Show file tree
Hide file tree
Showing 46 changed files with 684 additions and 354 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -122,6 +122,7 @@ group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails', '~> 3.2'
gem 'rspec-steps', '~> 2.1.1'
gem 'capybara', '~> 2.5'
gem 'poltergeist'
gem 'database_cleaner'
Expand Down
7 changes: 7 additions & 0 deletions Gemfile.lock
Expand Up @@ -235,6 +235,10 @@ GEM
ref (2.0.0)
responders (2.3.0)
railties (>= 4.2.0, < 5.1)
rspec (3.5.0)
rspec-core (~> 3.5.0)
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-core (3.5.4)
rspec-support (~> 3.5.0)
rspec-expectations (3.5.0)
Expand All @@ -251,6 +255,8 @@ GEM
rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.5.0)
rspec-support (~> 3.5.0)
rspec-steps (2.1.1)
rspec (>= 3.0, < 3.99)
rspec-support (3.5.0)
rubocop (0.29.1)
astrolabe (~> 1.3)
Expand Down Expand Up @@ -361,6 +367,7 @@ DEPENDENCIES
redcarpet
ref
rspec-rails (~> 3.2)
rspec-steps (~> 2.1.1)
rubocop (~> 0.29.1)
rubyzip
simplecov
Expand Down
Binary file added app/assets/images/banner.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions app/assets/javascripts/events.js
Expand Up @@ -77,3 +77,21 @@ function flipAllCheckboxes(rootCheckbox, className) {
});
}
}

function ajaxUpdateParticipantColor(form, errorMessage) {
if (!window.FormData)
return form.submit();

var xhr = new XMLHttpRequest();
xhr.open(form.method, form.action);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.onload = function() {
if (xhr.status < 200 || xhr.status >= 300)
return alert(errorMessage);
};
xhr.onerror = function() {
alert(errorMessage);
};

xhr.send(new FormData(form));
}
4 changes: 2 additions & 2 deletions app/assets/javascripts/requests.js
Expand Up @@ -4,8 +4,8 @@
function enableOwlCarousel() {
$(".owl-carousel").owlCarousel({
center: false,
item: 2,
autoplay: true,
items: 2,
autoplay: false,
loop: true,
dots: true,
margin: 30,
Expand Down
5 changes: 5 additions & 0 deletions app/assets/stylesheets/application.css
Expand Up @@ -29,6 +29,11 @@ body, footer, main, .front-section {
width: 100%;
}

.banner {
background-position: center;
background-size: cover;
}

.m-l-1 { margin-left: 15px; }
.m-r-1 { margin-right: 15px; }
.m-t-1 { margin-top: 15px; }
Expand Down
9 changes: 4 additions & 5 deletions app/assets/stylesheets/application_letters.css
Expand Up @@ -31,10 +31,9 @@ ul#eating-habit--list > li {
margin-left: 3px;
}

.application-details-table.table {
table-layout: fixed;
dl:not(.dl-horizontal) dd {
margin-bottom: 30px;
}
.application-details-table.table td, .application-details-table.table th {
border: none;
padding: 5px;
dl:not(.dl-horizontal) dt {
margin-bottom: 5px;
}
71 changes: 67 additions & 4 deletions app/assets/stylesheets/custom_bootstrap/custom_bootstrap.less
Expand Up @@ -74,7 +74,7 @@
@import "twitter/bootstrap/utilities.less";
@import "twitter/bootstrap/responsive-utilities.less";

body {
body:not(.wsp-home), .wsp-home .banner.front-section {
padding-top: 120px;
}

Expand Down Expand Up @@ -142,10 +142,12 @@ a:hover h1, a:hover h2, a:hover h3, a:hover h4 {
padding-bottom: 30px;
word-wrap: break-word;
}

@media (max-width: @screen-sm-max) {
h1 { font-size: 5rem; }
h2 { font-size: 4rem; }
}

@media (max-width: @screen-xs-max) {
h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; }
Expand All @@ -158,16 +160,34 @@ a:hover h1, a:hover h2, a:hover h3, a:hover h4 {
}


.spacer-20 {
.spacer-20 {
width: 100%;
height: 20px;
min-height: 20px;
}

.spacer-30 {
width: 100%;
height: 30px;
min-height: 30px;
}

.spacer-60 {
width: 100%;
height: 60px;
min-height: 60px;
}

// Fontpage

#wsp-welcome {

padding-top: 0px !important;

h1, h4, p {
color: #FFF;
}

ul {
list-style: none;
float: left;
Expand Down Expand Up @@ -238,8 +258,6 @@ strong, b {
font-weight: 700;
}



@import "multi-select.css";

.image-buttons .btn {
Expand All @@ -249,7 +267,52 @@ strong, b {
background-position: center;
border: 3px solid @body-bg;
}

.image-buttons .btn.active {
border: 3px solid @brand-primary;
}



#requestGallery {
.panel {
min-height: 500px;
}
}

.title, .page-title {
font-size: 64px;
line-height: 1;
}

.line-spacer {
border-bottom: 1px solid @gray-lighter;
margin-top: 0px;
margin-bottom: 30px;
width: 100%;
}

.events-facts {
ul {
padding-left: 25px;
}
}

.bottom-align-text {
position: absolute;
bottom: 15px;
right: 0;
}

.bottom-align-text {
position: absolute;
bottom: 15px;
right: 0;

}

.relative-box {
position: relative;

}

42 changes: 42 additions & 0 deletions app/assets/stylesheets/events.css
Expand Up @@ -54,12 +54,45 @@
transition: all 0.5s;
}

.event-preview a.btn-success{
color: #fff;
transition: all 0.5s;
}

.event-preview a.btn-danger{
color: #fff;
transition: all 0.5s;
}

.event-preview a.btn-default{
color: #000;
transition: all 0.5s;
}

.event-preview a:hover {
text-decoration: none;
color: #DE6207;
transition: all 0.5s;
}

.event-preview a.btn-success:hover {
text-decoration: none;
color: #fff;
transition: all 0.5s;
}

.event-preview a.btn-danger:hover {
text-decoration: none;
color: #fff;
transition: all 0.5s;
}

.event-preview a.btn-default:hover {
text-decoration: none;
color: #000;
transition: all 0.5s;
}

.front-section:nth-child(even) .event-preview {
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
Expand Down Expand Up @@ -118,3 +151,12 @@
height: 150px;
margin-bottom: 15px;
}

.text-success{
color: #009600;
}

#event-date-pickers a.close {
color: #000;
}

2 changes: 1 addition & 1 deletion app/controllers/agreement_letters_controller.rb
Expand Up @@ -18,7 +18,7 @@ def create
notice: t("agreement_letters.upload_success")
else
redirect_to check_application_letter_path(application_letter),
alert: @agreement_letter.errors.messages
alert: @agreement_letter.errors.full_messages
end
end
end
1 change: 1 addition & 0 deletions app/controllers/profiles_controller.rb
Expand Up @@ -36,6 +36,7 @@ def create
redirect_to edit_user_registration_path, notice: I18n.t('profiles.successful_creation')
end
else
flash.keep(:event_id)
render :new
end
end
Expand Down
12 changes: 8 additions & 4 deletions app/mailers/portal_mailer.rb
@@ -1,15 +1,19 @@
class PortalMailer < ApplicationMailer

include ApplicationHelper

# @param recipients [Array<String>] - email addresses of recipients - can be a string of comma separated email adresses too
# @param reply_to [Array<String>] - email addresses of recipient of the answer - can be a string of comma separated email adresses too
# @param subject [String] - subject of the mail
# @param content [String] - content of the mail
# @param some_attachments - array of hashes with name and content
# @return [ActionMailer::MessageDelivery] a mail object with the given parameters.
def generic_email(recipients, reply_to, subject, content, some_attachments = [])
some_attachments.each do |attachment|
def generic_email(recipients, reply_to, subject, content, attached_files = [])
attached_files.each do | attachment |
attachments[attachment[:name]] = attachment[:content]
end
mail(to: recipients, reply_to: reply_to, subject: subject, body: content)
mail(to: recipients, reply_to: reply_to, subject: subject) do | format |
format.html { markdown content }
format.text { content }
end
end
end
12 changes: 6 additions & 6 deletions app/models/agreement_letter.rb
Expand Up @@ -41,7 +41,7 @@ def save_file(file)
true
rescue IOError
self.destroy
errors.add(:file, I18n.t('agreement_letters.write_failed'))
errors.add(I18n.t('agreement_letters.file_error'), I18n.t('agreement_letters.write_failed'))
false
end
end
Expand All @@ -51,7 +51,7 @@ def save(*args)
if super
true
else
errors.add(:file, I18n.t('agreement_letters.upload_failed'))
errors.add(I18n.t('agreement_letters.file_error'), I18n.t('agreement_letters.upload_failed'))
false
end
end
Expand All @@ -67,16 +67,16 @@ def set_path
private
def valid_file?(file)
if !is_file?(file)
errors.add(:file, I18n.t("agreement_letters.not_a_file"))
errors.add(I18n.t('agreement_letters.file_error'), I18n.t("agreement_letters.not_a_file"))
false
elsif too_big?(file)
errors.add(:file, I18n.t("agreement_letters.file_too_big"))
errors.add(I18n.t('agreement_letters.file_error'), I18n.t("agreement_letters.file_too_big"))
false
elsif wrong_filetype?(file)
errors.add(:file, I18n.t("agreement_letters.wrong_filetype"))
errors.add(I18n.t('agreement_letters.file_error'), I18n.t("agreement_letters.wrong_filetype"))
false
elsif unable_to_open?(file)
errors.add(:file, I18n.t("agreement_letters.corrupt_document"))
errors.add(I18n.t('agreement_letters.file_error'), I18n.t("agreement_letters.corrupt_document"))
false
else
true
Expand Down
3 changes: 2 additions & 1 deletion app/views/application/index.html.erb
@@ -1,5 +1,6 @@
<section class="front-section">
<section class="front-section banner" style="background-image: url('<%= image_path('banner.jpg') %>')">
<div class="container" id="wsp-welcome">
<%= bootstrap_flash %>
<div class="row">
<div class="col-md-6">
<div class="row">
Expand Down
12 changes: 9 additions & 3 deletions app/views/application_letters/_upload_form.html.erb
@@ -1,13 +1,18 @@
<%= form_tag(event_agreement_letters_path(event_id), multipart: true) do %>
<div class="panel <%= agreement_letter.nil? ? 'panel-warning' : 'panel-success' %>">

<div class="panel-heading">
<% if agreement_letter.nil? %>
<% upload_message = t("agreement_letters.upload") %>
<%= t('agreement_letters.please_upload', event: @application_letter.event.name)%>
<% else %>
<% upload_message = t('.update', default: t("agreement_letters.update")) %>
<% already_uploaded_msg = t("agreement_letters.already_uploaded", timestamp: l(agreement_letter.updated_at)) %>
<%= glyph 'ok' %>
<%= t("agreement_letters.already_uploaded") %>
<% end %>
</div>

<span class="help-block bg-success"><%= already_uploaded_msg %></span>
<div class="panel-body">
<%= file_field_tag "letter_upload",
class: "btn btn-default btn-file",
style: 'display:inline',
Expand All @@ -16,5 +21,6 @@
<%= submit_tag upload_message,
class: 'btn btn-default',
id: "upload_btn_#{event_id}" %>
</div>
</div>
<% end %>

0 comments on commit 01caa71

Please sign in to comment.