Author SHA1 Message Date
gurix ed461a7c3e some text adjustments 2017-04-18 16:35:49 +02:00
gurix 8cb8aea9ca Merge branch 'master' into features/publicity
# Conflicts:
#	.gitignore
2017-04-18 16:22:36 +02:00
gurix cb1bf34588 Remove mailchimp and add sendy 2017-04-18 14:41:35 +02:00
gurix 93dc7b0c50 fixed broken path 2017-04-18 07:18:33 +02:00
gurix 7a2187e839 fixed batch position 2017-04-17 10:26:01 +02:00
gurix 5579877589 Donation button and responsibility 2017-04-17 08:05:51 +02:00
gurix c65513fd0a change asset host 2017-04-15 21:29:20 +02:00
gurix 7bd771dbc7 Implemented list of statements 2017-04-14 12:46:03 +02:00
gurix 281caaf0fd Manage publicities 2017-04-14 11:34:01 +02:00
gurix dd5e22ea48 Ability to give a statement 2017-04-13 17:16:03 +02:00
gurix b30bd91f3d Makeup 2017-04-13 10:05:09 +02:00
91 changed files with 1131 additions and 203 deletions
+2 -1
View File
@@ -8,7 +8,8 @@
/.bundle /.bundle
/.rspec /.rspec
.ruby-version .ruby-version
.env
/avatars
# Ignore all logfiles and tempfiles. # Ignore all logfiles and tempfiles.
/log/* /log/*
!/log/.keep !/log/.keep
+12 -2
View File
@@ -11,6 +11,18 @@ gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes # See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby # gem 'therubyracer', platforms: :ruby
# Integrate Paperclip into Mongoid.
gem "mongoid-paperclip"
# To extend paperclip with locales
gem 'paperclip-i18n'
# Amazon's S3 file hosting service
gem 'aws-sdk'
# A fixtures replacement
gem 'factory_girl'
# Use jquery as the JavaScript library # Use jquery as the JavaScript library
gem 'jquery-rails' gem 'jquery-rails'
@@ -66,8 +78,6 @@ gem 'rails_admin'
gem 'mongoid_paranoia' gem 'mongoid_paranoia'
gem 'mailchimp-api', require: 'mailchimp'
group :development, :test do group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console # Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug' gem 'byebug'
+29 -5
View File
@@ -40,6 +40,14 @@ GEM
arel (6.0.4) arel (6.0.4)
autoprefixer-rails (6.7.7.1) autoprefixer-rails (6.7.7.1)
execjs execjs
aws-sdk (2.9.7)
aws-sdk-resources (= 2.9.7)
aws-sdk-core (2.9.7)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.9.7)
aws-sdk-core (= 2.9.7)
aws-sigv4 (1.0.0)
bcrypt (3.1.11) bcrypt (3.1.11)
benchmark-ips (2.7.2) benchmark-ips (2.7.2)
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
@@ -59,6 +67,9 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
rack-test (>= 0.5.4) rack-test (>= 0.5.4)
xpath (~> 2.0) xpath (~> 2.0)
climate_control (0.1.0)
cocaine (0.5.8)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.1) coderay (1.1.1)
coffee-rails (4.1.1) coffee-rails (4.1.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
@@ -92,8 +103,9 @@ GEM
dotenv (= 2.2.0) dotenv (= 2.2.0)
railties (>= 3.2, < 5.1) railties (>= 3.2, < 5.1)
erubis (2.7.0) erubis (2.7.0)
excon (0.55.0)
execjs (2.7.0) execjs (2.7.0)
factory_girl (4.8.0)
activesupport (>= 3.0.0)
faker (1.7.2) faker (1.7.2)
i18n (~> 0.5) i18n (~> 0.5)
font-awesome-rails (4.7.0.1) font-awesome-rails (4.7.0.1)
@@ -110,6 +122,7 @@ GEM
jbuilder (2.6.3) jbuilder (2.6.3)
activesupport (>= 3.0.0, < 5.2) activesupport (>= 3.0.0, < 5.2)
multi_json (~> 1.2) multi_json (~> 1.2)
jmespath (1.3.1)
jquery-rails (4.3.1) jquery-rails (4.3.1)
rails-dom-testing (>= 1, < 3) rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0) railties (>= 4.2.0)
@@ -131,14 +144,12 @@ GEM
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.4) mail (2.6.4)
mime-types (>= 1.16, < 4) mime-types (>= 1.16, < 4)
mailchimp-api (2.0.6)
excon (>= 0.16.0)
json (>= 1.7.7)
memory_profiler (0.9.8) memory_profiler (0.9.8)
method_source (0.8.2) method_source (0.8.2)
mime-types (3.1) mime-types (3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521) mime-types-data (3.2016.0521)
mimemagic (0.3.2)
mini_portile2 (2.1.0) mini_portile2 (2.1.0)
minitest (5.10.1) minitest (5.10.1)
mongo (2.4.1) mongo (2.4.1)
@@ -151,6 +162,9 @@ GEM
mongoid-compatibility (0.4.1) mongoid-compatibility (0.4.1)
activesupport activesupport
mongoid (>= 2.0) mongoid (>= 2.0)
mongoid-paperclip (0.0.11)
mongoid
paperclip (>= 2.3.6, != 4.3.0)
mongoid-rspec (3.0.0) mongoid-rspec (3.0.0)
mongoid (~> 5.0) mongoid (~> 5.0)
rake rake
@@ -164,6 +178,13 @@ GEM
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
origin (2.3.0) origin (2.3.0)
orm_adapter (0.5.0) orm_adapter (0.5.0)
paperclip (5.1.0)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
cocaine (~> 0.5.5)
mime-types
mimemagic (~> 0.3.0)
paperclip-i18n (4.3.0)
pry (0.10.4) pry (0.10.4)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
@@ -312,6 +333,7 @@ PLATFORMS
ruby ruby
DEPENDENCIES DEPENDENCIES
aws-sdk
bootstrap-sass (~> 3.3.5) bootstrap-sass (~> 3.3.5)
byebug byebug
capybara capybara
@@ -320,16 +342,18 @@ DEPENDENCIES
devise devise
devise-i18n devise-i18n
dotenv-rails dotenv-rails
factory_girl
faker faker
geocoder geocoder
jbuilder (~> 2.0) jbuilder (~> 2.0)
jquery-rails jquery-rails
kaminari-actionview kaminari-actionview
kaminari-mongoid kaminari-mongoid
mailchimp-api
mongoid (~> 5.0.0) mongoid (~> 5.0.0)
mongoid-paperclip
mongoid-rspec (= 3.0.0) mongoid-rspec (= 3.0.0)
mongoid_paranoia mongoid_paranoia
paperclip-i18n
pry-rails pry-rails
puma puma
rails (~> 4.2) rails (~> 4.2)
+33 -13
View File
@@ -13,35 +13,36 @@
*= require_tree . *= require_tree .
*= require_self *= require_self
*/ */
@import "variables"
$brand-success: #66903F
$navbar-default-bg: #FFF
$navbar-default-border: none
$font-size-base: 14px
$navbar-padding-horizontal: none
$navbar-default-link-color: #66903F
$navbar-default-link-active-bg: #FFF
$font-size-h1: floor($font-size-base * 1.8)
$font-size-h2: floor($font-size-base * 1.5)
$font-size-h3: floor($font-size-base * 1.2)
@import "bootstrap-sprockets" @import "bootstrap-sprockets"
@import "bootstrap" @import "bootstrap"
@import "typeaheadjs" @import "typeaheadjs"
@import "footnotes" @import "footnotes"
@import "statements"
.alert-alert .alert-alert
@extend .alert-danger @extend .alert-danger
.alert-notice .alert-notice
@extend .alert-info @extend .alert-info
body.admin
background: repeating-linear-gradient(45deg, yellow, yellow 50px, black 50px, black 100px)
body body
nav.languages
position: absolute
top: 12px
right: 12px
> .container > .container
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19) box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)
padding: 20px padding: 20px
margin-top: 10px margin-top: 10px
background: #FFF
header header
.pagelogo
max-height: 91px
h1 h1
font-size: 20px font-size: 20px
margin-top: 35px margin-top: 35px
@@ -109,3 +110,22 @@ body
ol ol
padding-left: 1em padding-left: 1em
.donation_button
height: 50px
background: $brand-success
width: 200px
text-align: center
font-size: 18px
line-height: 50px
font-family: sans-serif
color: #FFF
transform: rotate(-45deg)
position: relative
top: 26px
left: -47px
box-shadow: inset 0px 0px 0px 4px rgba(255, 255, 255, 0.34)
a
color: #FFF
+21
View File
@@ -0,0 +1,21 @@
@import "variables"
.statement
display: inline-table
width: 45%
margin: 5px
img
margin-right: 14px
float: left
h2
font-size: $font-size-base
margin: 0px
display: inline
@media (max-width: 800px)
.statement
display: block
width: 100%
margin: 5px
+10
View File
@@ -0,0 +1,10 @@
$brand-success: #66903F
$navbar-default-bg: #FFF
$navbar-default-border: none
$font-size-base: 14px
$navbar-padding-horizontal: none
$navbar-default-link-color: #66903F
$navbar-default-link-active-bg: #FFF
$font-size-h1: floor($font-size-base * 1.8)
$font-size-h2: floor($font-size-base * 1.5)
$font-size-h3: floor($font-size-base * 1.2)
@@ -1,5 +1,15 @@
module Admin module Admin
class ApplicationController < ::ApplicationController class ApplicationController < ::ApplicationController
http_basic_authenticate_with name: 'admin', password: ENV['ADMIN_PASSWORD'] unless Rails.env.development? before_action :authenticate_supporter!
before_action :authenticate_admin!
def authenticate_admin!
return true if current_supporter.admin?
head(:forbidden)
end
def admin_area
true
end
end end
end end
@@ -0,0 +1,29 @@
module Admin
class PublicitiesController < Admin::ApplicationController
def index
@pending = Supporter.where('publicity.state' => :pending).asc(:created_at)
@active = Supporter.where('publicity.state' => :approved).asc(:created_at)
end
def edit
@publicity = Supporter.find(params[:id]).publicity
end
def update
@publicity = Supporter.find(params[:id]).publicity
return redirect_to(admin_publicities_path) if @publicity.update_attributes(publicity_params)
render :edit
end
def destroy
current_supporter.publicity&.destroy
redirect_to(admin_publicities_path)
end
private
def publicity_params
params.require(:publicity).permit(:organisation, :statement, :avatar, :state)
end
end
end
+5 -1
View File
@@ -29,9 +29,13 @@ class ApplicationController < ActionController::Base
options.merge locale: I18n.locale options.merge locale: I18n.locale
end end
def admin_area
false
end
protected protected
def configure_permitted_parameters def configure_permitted_parameters
devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :street, :city, :zip, :support, :language, :age_category, :unsubscribed]) devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :street, :city, :zip, :support, :language, :age_category])
end end
end end
+29
View File
@@ -0,0 +1,29 @@
class PublicitiesController < ApplicationController
before_action :authenticate_supporter!
def new
@publicity = current_supporter.publicity || Publicity.new
end
def create
@publicity = Publicity.new(publicity_params.merge(supporter: current_supporter, state: :pending))
flash['success'] = t('.success') if @publicity.valid?
return redirect_to(root_path) if @publicity.save
render :new
end
def update
create
end
def destroy
current_supporter.publicity&.destroy
redirect_to(root_path)
end
private
def publicity_params
params.require(:publicity).permit(:organisation, :statement, :avatar)
end
end
+7 -16
View File
@@ -10,7 +10,7 @@ class SupportersController < ApplicationController
@supporter.password = random_password = SecureRandom.hex(5) @supporter.password = random_password = SecureRandom.hex(5)
if !input_to_fast? && @supporter.save if !input_to_fast? && @supporter.save
SupporterMailer.welcome_email(@supporter, random_password).deliver_now SupporterMailer.welcome_email(@supporter, random_password).deliver_now
mailchimp_registration sendy_registraion
redirect_to thanks_path redirect_to thanks_path
else else
flash.now[:danger] = input_to_fast? ? t('.timeout') : t('input_error') flash.now[:danger] = input_to_fast? ? t('.timeout') : t('input_error')
@@ -24,20 +24,11 @@ class SupportersController < ApplicationController
params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :li_membership, :age_category, :city, :comments) params.require(:supporter).permit(:first_name, :last_name, :street, :zip, :email, :support, :li_membership, :age_category, :city, :comments)
end end
def mailchimp_registration # We use sendy for newsletters atm
return unless Rails.env.production? def sendy_registraion
mailchimp = Mailchimp::API.new(ENV['MAILCHIMP_API']) uri = URI('http://newsletter.cannabis-initiative.ch/subscribe')
mailchimp.lists.subscribe(ENV['CH420_LIST_ID'], { 'email' => @supporter.email }, merge_vars, 'html', false) Net::HTTP.post_form(uri, list: ENV["SENDY_LIST_#{I18n.locale.upcase}"],
end email: @supporter.email,
name: "#{@supporter.first_name} #{@supporter.last_name}")
def merge_vars
{ 'EMAIL' => @supporter.email,
'FNAME' => @supporter.first_name,
'LNAME' => @supporter.last_name,
'SUPPORT' => @supporter.support,
'MEMBERSHIP' => @supporter.li_membership.to_s,
'AGE' => @supporter.age_category,
'LANG' => @supporter.language,
'ZIP' => @supporter.zip }
end end
end end
+26
View File
@@ -0,0 +1,26 @@
class Publicity
include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paperclip
has_mongoid_attached_file :avatar,
path: ':attachment/:id/:style.:extension',
styles: {
original: ['1920x1680>', :jpg],
small: ['100x100#', :jpg],
medium: ['250x250', :jpg],
large: ['500x500>', :jpg]
},
convert_options: { all: '-background white -flatten +matte' }
embedded_in :supporter
field :state, type: String, default: 'pending' # Possible states: pending, approved
field :organisation, type: String
field :statement, type: String
validates :state, presence: true
validates :avatar, presence: true
validates :statement, presence: true
validates_attachment_content_type :avatar, content_type: /\Aimage/
end
+9 -17
View File
@@ -1,5 +1,11 @@
class Supporter class Supporter
include Mongoid::Document include Mongoid::Document
include Mongoid::Timestamps
include Mongoid::Paranoia
include Geocoder::Model::Mongoid
COUNTER_START = 10_003
# Include default devise modules. Others available are: # Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable # :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable, devise :database_authenticatable, :registerable,
@@ -8,6 +14,7 @@ class Supporter
## Database authenticatable ## Database authenticatable
field :email, type: String, default: '' field :email, type: String, default: ''
field :encrypted_password, type: String, default: '' field :encrypted_password, type: String, default: ''
field :admin, type: Boolean, default: false
## Recoverable ## Recoverable
field :reset_password_token, type: String field :reset_password_token, type: String
@@ -23,22 +30,6 @@ class Supporter
field :current_sign_in_ip, type: String field :current_sign_in_ip, type: String
field :last_sign_in_ip, type: String field :last_sign_in_ip, type: String
## Confirmable
# field :confirmation_token, type: String
# field :confirmed_at, type: Time
# field :confirmation_sent_at, type: Time
# field :unconfirmed_email, type: String # Only if using reconfirmable
## Lockable
# field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
# field :unlock_token, type: String # Only if unlock strategy is :email or :both
# field :locked_at, type: Time
include Mongoid::Timestamps
include Mongoid::Paranoia
include Geocoder::Model::Mongoid
COUNTER_START = 10_003
geocoded_by :address geocoded_by :address
after_validation :geocode # auto-fetch coordinates after_validation :geocode # auto-fetch coordinates
@@ -53,7 +44,6 @@ class Supporter
field :coordinates, type: Array field :coordinates, type: Array
field :comments, type: String field :comments, type: String
field :language, type: String field :language, type: String
field :unsubscribed, type: Boolean, default: false
field :duplicate, type: Boolean, default: false field :duplicate, type: Boolean, default: false
validates :first_name, presence: true validates :first_name, presence: true
@@ -66,6 +56,8 @@ class Supporter
validates :age_category, presence: true validates :age_category, presence: true
validates :language, presence: true validates :language, presence: true
embeds_one :publicity
def self.counter def self.counter
actual = count.to_i actual = count.to_i
actual > COUNTER_START ? actual : COUNTER_START actual > COUNTER_START ? actual : COUNTER_START
+14
View File
@@ -0,0 +1,14 @@
h1= title "#{t('.title')} #{@publicity.supporter.first_name} #{@publicity.supporter.last_name}, #{@publicity.supporter.city}"
= simple_form_for(@publicity, url: admin_publicity_path(@publicity.supporter)) do |form|
.form-group
= "#{@publicity.supporter.first_name} #{@publicity.supporter.last_name}, #{@publicity.supporter.city}"
= form.input :organisation, required: false
= form.input :statement, as: :text, required: false
= form.input :avatar, as: :file, required: false
- if @publicity.avatar
.form-group
= image_tag(@publicity.avatar.url(:medium))
= form.input :state, as: :radio_buttons, collection: t('publicity_states').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first, required: false
= form.submit t('shared.save'), class: 'btn btn-primary'
+1
View File
@@ -0,0 +1 @@
= render 'form'
+19
View File
@@ -0,0 +1,19 @@
h1 = title t('.title')
table.table
tbody
- @pending.each do | supporter |
tr
td
= "#{supporter.first_name} #{supporter.last_name}"
br
= supporter.city
br
= mail_to supporter.email, supporter.email
br
= supporter.publicity.organisation
td width="50%" = supporter.publicity.statement
td = image_tag(supporter.publicity.avatar.url(:small))
td = link_to t('shared.edit'), edit_admin_publicity_path(supporter)
@@ -0,0 +1,2 @@
.donation_button
=link_to t('donation'), donation_path
+13 -2
View File
@@ -26,7 +26,8 @@ html lang="#{I18n.locale}"
meta content="/ms-icon-144x144.png" name="msapplication-TileImage" / meta content="/ms-icon-144x144.png" name="msapplication-TileImage" /
meta content="#ffffff" name="theme-color" / meta content="#ffffff" name="theme-color" /
body body class="#{'admin' if controller.admin_area}"
= render 'donation_button'
javascript: javascript:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
@@ -36,7 +37,17 @@ html lang="#{I18n.locale}"
ga('create', 'UA-79948850-1', 'auto'); ga('create', 'UA-79948850-1', 'auto');
ga('send', 'pageview'); ga('send', 'pageview');
/ = console if Rails.env.development? nav.languages
h2.sr-only =t('.lang')
a href='/' lang='de'
| Deutsch
| &nbsp; | &nbsp;
a href='/it' lang='it'
| Italiano
| &nbsp; | &nbsp;
a href='/fr' lang='fr'
| Français
br/
.container .container
= render 'shared/flashes' = render 'shared/flashes'
= render 'shared/header' = render 'shared/header'
+16 -44
View File
@@ -1,45 +1,17 @@
h1 = t("Unsere Sponsoren") h1 = t("Unsere Sponsoren")
.row .lead
.col-xs-12.col-sm-6.col-md-3 | Wir suchen tatkräftige Sponsoren, die uns bei der Sammlung der Unterschriften und im späteren Wahlkampf finanziell unterstützen. Im Gegenzug ermöglichen wir den Sponsoren, sich mit Logo, einem kleinen Text und Link zu präsentieren.
= image_tag 'dummy.png', alt: 'Platzhalter für Logo', class: 'img-responsive' h2 Beispiel...
.col-xs-12.col-sm-6.col-md-9 .well
h2 Ihr Firmenname .row
p Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. .col-xs-12.col-sm-6.col-md-3
.row = image_tag 'dummy.png', alt: 'Platzhalter für Logo', class: 'img-responsive'
.col-xs-12.col-sm-6.col-md-9 .col-xs-12.col-sm-6.col-md-9
h2 Ihr Firmenname h2 Ihr Firmenname
p Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. p Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
.col-xs-12.col-sm-6.col-md-3 .row
= image_tag 'dummy.png', alt: 'Platzhalter für Logo', class: 'img-responsive' .col-xs-12.col-sm-6.col-md-9
h2 Ihr Firmenname
.row p Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
.col-xs-12.col-sm-6.col-md-3 .col-xs-12.col-sm-6.col-md-3
= image_tag 'dummy.png', alt: 'Platzhalter für Logo', class: 'img-responsive' = image_tag 'dummy.png', alt: 'Platzhalter für Logo', class: 'img-responsive'
.col-xs-12.col-sm-6.col-md-9
h2 Ihr Firmenname
p Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
hr
.row
.col-xs-12.col-md-6
h1 = title 'Deine Spende zählt - Verein Legalize it!'
p
dl.dl-horizontal
dt Postkonto:
dd 87-091354-3, Verein Legalize it!, Postfach 2159, 8031 Zürich
dt IBAN:
dd CH02 0900 0000 8709 1354 3
dt Zahlungszweck:
dd Spende Initiative
h2 Warum kann ich nicht auch online oder per Kreditkarte spenden?
p Wir haben mehrere Versuche unternommen, dies mittels verschiedener (zahlbaren) Payment-Service-Providern zu ermöglichen, sind jedoch immer wieder gescheitert. Die Gründe dafür sind vielfältig: Zum einen bieten viele solche Dienstleister ihren Service gar nicht für Vereine an, zum anderen ist das Schweizer Vereinsrecht relativ liberal. Ein zentrales Register für Vereine wie in anderen Ländern üblich, gibt es nicht. Einzig ein Handelsregistereintrag könnte ein wenig Klarheit schaffen. Dies ist jedoch zu kostspielig und würde momentan zu viel Zeit in Anspruch nehmen. Selbst wenn wir einen solchen hätten, wäre es nicht sicher, dass Dienste wie beispielsweise PayPal uns akzeptieren würden.
p Eine andere schwierigere Hürde ist unser Umfeld. Wir haben, genau wie in Amerika, die Schwierigkeit, dass unser Themenbereich Cannabis ist. Da der Umgang mit Cannabis illegal ist, scheinen die Banken der Logik verfallen zu sein, dass alles was mit Cannabis zu tun hat, auch illegal sei, notabene auch das Ändern des illegalen Status. Viele Finanzdienstleister wie etwa Stripe.com lehnen daher jegliche Zusammenarbeit kategorisch ab.
p Somit bleibt nur zum guten alten Einzahlungsschein zu greifen beziehungsweise die richtigen Zahlenkombinationen beim E-Banking an den richtigen Stellen einzufügen.
p
b Wir würden uns freuen, wenn ihr das macht und uns finanziell unter die Arme greift.
p Danke, dein Verein Legalize it!
.col-xs-12.col-md-6
= link_to asset_path('Einzahlungsschein_Spende_Initiative.pdf') do
= image_tag('Einzahlungsschein_Spende_Initiative.jpg', class:'img-responsive pagelogo', alt: 'Einzahlungsschein Spende initiative')
+13
View File
@@ -0,0 +1,13 @@
- supporters = Supporter.where('publicity.state' => :approved).desc(:created_at)
h1 = title t('.title')
- supporters.each do |supporter|
.statement
= image_tag supporter.publicity.avatar.url(:small), alt: "#{supporter.first_name} #{supporter.last_name}"
h2= "#{supporter.first_name} #{supporter.last_name}, #{supporter.city}"
- unless supporter.publicity.organisation.blank?
em= ", #{supporter.publicity.organisation}"
br
= supporter.publicity.statement
hr.clearfix
+1 -1
View File
@@ -14,7 +14,7 @@ ul
li Teile unser Projekt in den sozialen Medien mit dem Hashtag #CH420 li Teile unser Projekt in den sozialen Medien mit dem Hashtag #CH420
li Erzähle allen von unserem Vorhaben und bitte Sie mitzumachen li Erzähle allen von unserem Vorhaben und bitte Sie mitzumachen
li Werde Mitglied beim <a href="https://www.hanflegal.ch">Verein Legalize it!</a> li Werde Mitglied beim <a href="https://www.hanflegal.ch">Verein Legalize it!</a>
li = link_to 'Spende für die Legalisierung', spenden_path li = link_to 'Spende für die Legalisierung', donation_path
li Besuche unser <a href="https://forum.hanflegal.ch">Forum</a>. Da findest du eine Jobbörse und spannende Projekte bei denen wir deine Hilfe brauchen können li Besuche unser <a href="https://forum.hanflegal.ch">Forum</a>. Da findest du eine Jobbörse und spannende Projekte bei denen wir deine Hilfe brauchen können
h2 Folge uns auf Facebook h2 Folge uns auf Facebook
+6
View File
@@ -0,0 +1,6 @@
h1= title t('.title')
= simple_form_for(@publicity, url: publicity_path) do |form|
= form.input :organisation, required: false, label: t('.organisation'), placeholder: t('.organisation_placeholder')
= form.input :statement, as: :text, required: false
= form.input :avatar, as: :file, label: t('.avatar'), required: false
= form.submit t('.save'), class: 'btn btn-primary'
+1
View File
@@ -0,0 +1 @@
= render 'form'
+2 -13
View File
@@ -2,19 +2,8 @@ header
.row .row
.col-md-1.col-xs-4 .col-md-1.col-xs-4
= image_tag('ch420_logo.png', class:'img-responsive pagelogo', alt: t('.logo')) = image_tag('ch420_logo.png', class:'img-responsive pagelogo', alt: t('.logo'))
.col-md-8.col-xs-8 .col-md-7.col-xs-8
h1 h1
= t('.title_html') = t('.title_html')
.col-xs-12.col-md-3 .col-xs-12.col-md-4.hidden-xs.hidden-sm
nav.pull-right
h2.sr-only =t('.lang')
a href='/' lang='de'
| Deutsch
| &nbsp; | &nbsp;
a href='/it' lang='it'
| Italiano
| &nbsp; | &nbsp;
a href='/fr' lang='fr'
| Français
br/
= render 'shared/counter' = render 'shared/counter'
+4
View File
@@ -8,6 +8,10 @@
= navbar_item t('.arguments'), arguments_path = navbar_item t('.arguments'), arguments_path
= navbar_item t('.faq'), faq_path = navbar_item t('.faq'), faq_path
= navbar_item t('.numbers'), numbers_path = navbar_item t('.numbers'), numbers_path
= navbar_item t('.statements'), statements_path
= navbar_item t('.sponsoring'), sponsoring_path = navbar_item t('.sponsoring'), sponsoring_path
= navbar_item t('.sign_in'), new_supporter_session_path unless supporter_signed_in? = navbar_item t('.sign_in'), new_supporter_session_path unless supporter_signed_in?
= navbar_item t('.sign_out'), destroy_supporter_session_path, nil, 'data-method' => :delete if supporter_signed_in? = navbar_item t('.sign_out'), destroy_supporter_session_path, nil, 'data-method' => :delete if supporter_signed_in?
- if supporter_signed_in? && current_supporter.admin?
= navbar_dropdown t('admin.title') do
= navbar_item t('admin.publicities.index.title'), admin_publicities_path
+25
View File
@@ -0,0 +1,25 @@
- if current_supporter.publicity
.panel.panel-default
.panel-heading
h2.panel-title
= t '.title'
.panel-body
dl.dl-horizontal
dt = Publicity.human_attribute_name(:status)
dd= t("publicity_states.#{current_supporter.publicity.state}")
- unless current_supporter.publicity.organisation.blank?
dt = Publicity.human_attribute_name(:organisation)
dd = current_supporter.publicity.organisation
dt = Publicity.human_attribute_name(:statement)
dd = current_supporter.publicity.statement
dt = Publicity.human_attribute_name(:avatar)
dd = image_tag current_supporter.publicity.avatar.url(:small), alt: ''
.pull-right
= link_to t(".renew"), new_publicity_path
br
= link_to t(".delete"), publicity_path, data: { confirm: t("shared.are_you_sure") }, method: :delete, class: 'text-danger'
- else
.alert.alert-notice
= link_to t('.create_publicity'), new_publicity_path
+1 -2
View File
@@ -23,12 +23,11 @@
dd == t("age_category.#{current_supporter.age_category}") dd == t("age_category.#{current_supporter.age_category}")
dt = Supporter.human_attribute_name(:language) dt = Supporter.human_attribute_name(:language)
dd = t("languages.#{current_supporter.language}") dd = t("languages.#{current_supporter.language}")
dt = Supporter.human_attribute_name(:unsubscribed)
dd = current_supporter.unsubscribed? ? t('shared.yes') : t('shared.no')
p p
= link_to t('.edit'), edit_supporter_registration_path(), class: 'pull-right' = link_to t('.edit'), edit_supporter_registration_path(), class: 'pull-right'
= render 'publicity'
aside.col-md-5.col-xs-12 aside.col-md-5.col-xs-12
= render 'right_side' = render 'right_side'
@@ -19,7 +19,6 @@
= f.input :support, as: :radio_buttons, collection: t('support_type').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first = f.input :support, as: :radio_buttons, collection: t('support_type').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first
= f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first = f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first
= f.input :language, as: :radio_buttons, collection: t('languages').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first = f.input :language, as: :radio_buttons, collection: t('languages').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first
= f.input :unsubscribed, as: :boolean
.form-actions .form-actions
= f.button :submit, t("devise.registrations.edit.update"), class: 'btn btn-primary' = f.button :submit, t("devise.registrations.edit.update"), class: 'btn btn-primary'
p = link_to t("devise.shared.links.back"), :back p = link_to t("devise.shared.links.back"), :back
Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

+1 -1
View File
@@ -31,7 +31,7 @@ module Ch420
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
config.i18n.default_locale = :de config.i18n.default_locale = :de
config.i18n.available_locales = [:de, :it, :fr] config.i18n.available_locales = [:de, :it, :fr, :en]
config.generators do |g| config.generators do |g|
g.orm :mongoid g.orm :mongoid
+12
View File
@@ -41,4 +41,16 @@ Rails.application.configure do
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 } config.action_mailer.smtp_settings = { address: 'localhost', port: 1025 }
config.paperclip_defaults = {
storage: :s3,
s3_protocol: :https,
s3_region: ENV["S3_REGION"],
s3_host_name: ENV["S3_HOST_NAME"],
s3_credentials: {
bucket: "cannabis-initiative-development",
access_key_id: ENV["S3_ACCESS_KEY"],
secret_access_key: ENV["S3_ACCESS_SECRET"]
}
}
end end
+14 -2
View File
@@ -74,8 +74,8 @@ Rails.application.configure do
# Use default logging formatter so that PID and timestamp are not suppressed. # Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new config.log_formatter = ::Logger::Formatter.new
config.action_mailer.default_url_options = { host: 'ch420.herokuapp.com' } config.action_mailer.default_url_options = { host: 'www.cannabis-initiative.ch' }
config.action_mailer.asset_host = 'https://ch420.herokuapp.com' config.action_mailer.asset_host = 'https://www.cannabis-initiative.ch'
config.action_mailer.delivery_method = :smtp config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
@@ -87,4 +87,16 @@ Rails.application.configure do
authentication: :plain, authentication: :plain,
enable_starttls_auto: true enable_starttls_auto: true
} }
config.paperclip_defaults = {
storage: :s3,
s3_protocol: :https,
s3_region: ENV["S3_REGION"],
s3_host_name: ENV["S3_HOST_NAME"],
s3_credentials: {
bucket: "cannabis-initiative-production",
access_key_id: ENV["S3_ACCESS_KEY"],
secret_access_key: ENV["S3_ACCESS_SECRET"]
}
}
end end
+1 -1
View File
@@ -1 +1 @@
Slim::Engine.set_default_options pretty: true Slim::Engine.set_options pretty: true
+8
View File
@@ -0,0 +1,8 @@
de:
admin:
title: Administration
publicities:
index:
title: Unveröffentlichte Statements
form:
title: Statement
+8
View File
@@ -0,0 +1,8 @@
fr:
admin:
title: Administration
publicities:
index:
title: Déclarations non publiées
form:
title: Déclaration
+8
View File
@@ -0,0 +1,8 @@
it:
admin:
title: Amministrazione
publicities:
index:
title: Dichiarazioni non pubblicati
form:
title: Dichiarazione
+42 -5
View File
@@ -6,22 +6,26 @@ de:
logo: Logo der Initiative logo: Logo der Initiative
title_html: Ja, ich will <strong class="text-success">Cannabis</strong> in der Schweiz <strong class="text-success">legalisieren</strong> title_html: Ja, ich will <strong class="text-success">Cannabis</strong> in der Schweiz <strong class="text-success">legalisieren</strong>
topnavigation: topnavigation:
donation: Spenden
sign_in: Anmelden sign_in: Anmelden
sign_out: Abmelden sign_out: Abmelden
initiative_text: Der Initiativtext im Wortlaut initiative_text: Der Initiativtext im Wortlaut
initiative: Die Initiative initiative: Die Initiative
arguments: Argumentarium arguments: Argumentarium
faq: Fragen und Antworten faq: Fragen und Antworten
sponsoring: Sponsoren & Spenden sponsoring: Sponsoren
numbers: Zahlen numbers: Zahlen
statementes: Statements
are_you_sure: Bist du sicher?
edit: Bearbeiten
save: Speichern
counter: counter:
supporters: "Unterstützer:" supporters: "Unterstützer:"
amount_of_supporters: Zurzeit haben wir %{amount} Unterstützer. amount_of_supporters: Zurzeit haben wir %{amount} Unterstützer.
input_error: Deine Eingaben konnte nicht gespeichert werden. Überprüfe deine Eingaben. input_error: Deine Eingaben konnte nicht gespeichert werden. Überprüfe deine Eingaben.
donation: Deine Spende
welcome_email: welcome_email:
subject: Besten Dank für deine Unterstützung! subject: Besten Dank für deine Unterstützung!
@@ -37,6 +41,11 @@ de:
middle: Ich bin 30 bis 64 Jahre alt middle: Ich bin 30 bis 64 Jahre alt
retired: Ich bin über 64 Jahre alt retired: Ich bin über 64 Jahre alt
publicity_states:
pending: Die Veröffentlichung wurde noch nicht genehmigt
approved: Das Statement wurde Veröffentlicht
declined: Das Statement wurde abgelehnt
languages: languages:
de: Deutsch de: Deutsch
fr: Français fr: Français
@@ -58,6 +67,12 @@ de:
zip: "4200" zip: "4200"
email: hans.muster@hanflegal.ch email: hans.muster@hanflegal.ch
publicity:
title: Mein Statement
renew: Statement neu einreichen
delete: Statement löschen
create_publicity: Deine Meinung zählt, darum bitten wir dir hier die Möglichkeit öffentlich deine Meinung zur Cannabis-Initiative kundzutun. Gib ein Starkes Statement ab und zeig dein Gesicht! Meine Unterstützung öffentlich kundtun ...
create: create:
timeout: Ihre Eingabe war zu schnell. timeout: Ihre Eingabe war zu schnell.
@@ -66,6 +81,19 @@ de:
edit: Meine Daten bearbeiten... edit: Meine Daten bearbeiten...
my_data: Meine Daten my_data: Meine Daten
publicities:
form:
title: Meine Meinung zur Cannabis-Initiative veröffentlichen
organisation: Organisation (Optional)
organisation_placeholder: Parteizugehörigkeit, Verband oder sonstige Organisationen
avatar: Lade ein Bild von dir Hoch
save: Zur Überprüfung einsenden
create:
success: Besten Dank die Daten werden überprüft.
update:
success: Besten Dank die Daten werden überprüft.
pages: pages:
show: show:
not_found: Die Seite konnte nicht gefunden werden. not_found: Die Seite konnte nicht gefunden werden.
@@ -73,12 +101,17 @@ de:
thanks: thanks:
title: Besten Dank für deine Unterstützung! title: Besten Dank für deine Unterstützung!
statements:
title: Statements von unseren Unterstützern
routes: routes:
initiative_text: initiativtext initiative_text: initiativtext
arguments: argumentarium arguments: argumentarium
faq: fragen_und_antworten faq: fragen_und_antworten
sponsoring: sponsoren_und_spenden sponsoring: sponsoren
donation: spenden
numbers: zahlen numbers: zahlen
statementes: statements
mongoid: mongoid:
models: models:
@@ -98,6 +131,10 @@ de:
remember_me: Angemeldet bleiben remember_me: Angemeldet bleiben
password: Passwort password: Passwort
language: Sprache language: Sprache
unsubscribed: Kein Newsletter
password_confirmation: Passwort bestätigen password_confirmation: Passwort bestätigen
current_password: Aktuelles Passwort current_password: Aktuelles Passwort
publicity:
state: Status
organisation: Organisation
statement: Statement
avatar: Bild
+45 -8
View File
@@ -5,30 +5,33 @@ fr:
"yes": Oui "yes": Oui
"no": Non "no": Non
counter: counter:
supporters: "Militant:" supporters: "Partisans:"
amount_of_supporters: Nous avons actuellement %{amount} supporters. amount_of_supporters: Nous avons actuellement %{amount} partisans.
header: header:
logo: Logo de l'initiative logo: Logo de l'initiative
title_html: Oui, je veux <strong class="text-success">légaliser le cannabis</strong> en Suisse. title_html: Oui, je veux <strong class="text-success">légaliser le cannabis</strong> en Suisse.
topnavigation: topnavigation:
donation: Donation
sign_out: déconnecter sign_out: déconnecter
sign_in: Connexion sign_in: Connexion
initiative: l' initiative initiative: l' initiative
initiative_text: L'initiative propose (en allemand) initiative_text: L'initiative propose (en allemand)
arguments: Arguments (en allemand) arguments: Arguments (en allemand)
faq: Questions et réponses (en allemand) faq: Questions et réponses (en allemand)
sponsoring: Donation et Sponsors (en allemand) sponsoring: Sponsors (en allemand)
numbers: Chiffres (en allemand) numbers: Chiffres (en allemand)
statements: Déclarations
are_you_sure: Tu es sûre?
edit: Éditer
save: Sauver
donation: Donation
welcome_email: welcome_email:
subject: Merci beaucoup pour ton soutien! subject: Merci beaucoup pour ton soutien!
support_type: support_type:
signer: Je signerais une initiative populaire pour la <span class="text-success">légalisation du cannabis</span>. signer: Je signerais une initiative populaire pour la <span class="text-success">légalisation du cannabis</span>.
supporter: Je signerais une initiative populaire pour la <span class="text-success">légalisation du cannabis</span> et aiderais activement à trouver des signatures dans ma région. supporter: Je signerais une initiative populaire pour la <span class="text-success">légalisation du cannabis</span> et aiderais activement à trouver des signatures dans ma région.
# activist: Ich unterschreibe eine Volksinitiative für die <span class="text-success">Legalisierung von Cannabis</span> und beteilige mich bei der Planung und Koordination einer Volksinitiative.
# nonvoting_supporter: Ich bin nicht stimmberechtigt, helfe aber aktiv Unterschriften in meiner Umgebung zu sammeln um <span class="text-success">Cannabis zu legalisierung</span>.
age_category: age_category:
underage: Jai moins de 18 ans underage: Jai moins de 18 ans
@@ -36,6 +39,11 @@ fr:
middle: Jai entre 30 et 64 ans middle: Jai entre 30 et 64 ans
retired: Jai plus que 64 ans retired: Jai plus que 64 ans
publicity_states:
pending: La publication n'a pas été approuvé
approved: La déclaration a été publiée
declined: La déclaration a été rejetée
languages: languages:
de: Deutsch de: Deutsch
fr: Français fr: Français
@@ -55,6 +63,12 @@ fr:
zip: "4200" zip: "4200"
email: hans.muster@hanflegal.ch email: hans.muster@hanflegal.ch
publicity:
title: Ma déclaration
renew: resoumettre déclaration
delete: supprimer déclaration
create_publicity: Votre opinion compte, nous vous demandons ici d'exprimer publiquement votre avis sur initiative de cannabis possible. Rendre public mon soutien ...
create: create:
timeout: Ihre Eingabe war zu schnell. timeout: Ihre Eingabe war zu schnell.
@@ -63,6 +77,19 @@ fr:
edit: Modifier mes données ... edit: Modifier mes données ...
my_data: Mes données my_data: Mes données
publicities:
form:
title: Donner mon avis sur l'initiative de cannabis
organisation: Organisation (Facultatif)
organisation_placeholder: Affiliation parti, une association ou d'autres organisations
avatar: Ajouter une photo
save: Envoyé pour examen
create:
success: Merci, les données sont vérifiées.
update:
success: Merci, les données sont vérifiées.
pages: pages:
show: show:
not_found: La page n'a pas été trouvé. not_found: La page n'a pas été trouvé.
@@ -70,12 +97,17 @@ fr:
thanks: thanks:
title: Merci beaucoup pour ton soutien! title: Merci beaucoup pour ton soutien!
statements:
title: Les déclarations de nos partisans
routes: routes:
initiative_text: l_initiative_propose initiative_text: l_initiative_propose
arguments: arguments arguments: arguments
faq: questions_et_reponses faq: questions_et_reponses
sponsoring: donation_et_sponsor sponsoring: sponsor
donation: donation
numbers: chiffres numbers: chiffres
statements: declarations
mongoid: mongoid:
models: models:
@@ -95,6 +127,11 @@ fr:
remember_me: Se souvenir de moi remember_me: Se souvenir de moi
password: mot de passe password: mot de passe
language: Langue language: Langue
unsubscribed: pas de newslettre
password_confirmation: confirmer le mot de passe password_confirmation: confirmer le mot de passe
current_password: Mot de passe actuel current_password: Mot de passe actuel
publicity:
status: Statu
organisation: Organisation
statement: Déclaration
avatar: Photo
+41 -5
View File
@@ -8,21 +8,24 @@ it:
logo: Logo dell'iniziativa logo: Logo dell'iniziativa
title_html: Si, voglio <strong class="text-success">legalizzare</strong> la <strong class="text-success">cannabis in Svizzera</strong> title_html: Si, voglio <strong class="text-success">legalizzare</strong> la <strong class="text-success">cannabis in Svizzera</strong>
topnavigation: topnavigation:
donation: Donazione
sign_out: Disconnettersi sign_out: Disconnettersi
sign_in: Registro sign_in: Registro
initiative_text: Il testo delliniziativa initiative_text: Il testo delliniziativa
initiative: l'iniziativa initiative: l'iniziativa
arguments: Argomentazioni arguments: Argomentazioni
faq: Domande e risposte (in tedesco) faq: Domande e risposte (in tedesco)
sponsoring: Donazione e Sponsor sponsoring: Sponsor
numbers: Numeri (in tedesco) numbers: Numeri (in tedesco)
statements: Dichiarazioni
counter: counter:
supporters: "Sostenitore:" supporters: "Sostenitore:"
amount_of_supporters: Al momento abbiamo %{amount} sostenitori. amount_of_supporters: Al momento abbiamo %{amount} sostenitori.
are_you_sure: Sei sicuro?
edit: Modifica
save: Salvare
donation: Donazione
welcome_email: welcome_email:
subject: Grazie mille per il tuo sostegno! subject: Grazie mille per il tuo sostegno!
@@ -38,6 +41,11 @@ it:
middle: Ho tra i 30 ed i 64 anni middle: Ho tra i 30 ed i 64 anni
retired: Ho più di 64 anni retired: Ho più di 64 anni
publicity_states:
pending: La pubblicazione non è stato approvato
approved: La dichiarazione è stata rilasciata
declined: La dichiarazione è stata respinta
languages: languages:
de: Deutsch de: Deutsch
fr: Français fr: Français
@@ -58,6 +66,12 @@ it:
zip: "4200" zip: "4200"
email: hans.muster@hanflegal.ch email: hans.muster@hanflegal.ch
publicity:
title: La mia dichiarazione
renew: Ripresentare Statement
delete: Eliminare la dichiarazione
create_publicity: La tua opinione conta, quindi vi chiediamo qui pubblicamente esprimere la tua opinione su iniziativa di cannabis possibile. Girare in una dichiarazione forte e mostrare il tuo volto! Il mio supporto rendere pubblico ...
create: create:
timeout: Ihre Eingabe war zu schnell. timeout: Ihre Eingabe war zu schnell.
@@ -66,6 +80,19 @@ it:
edit: Modifica i miei dati ... edit: Modifica i miei dati ...
my_data: Miei dati my_data: Miei dati
publicities:
form:
title: Lasciare un commento sull'iniziativa cannabis
organisation: Organizzazione (opzionale)
organisation_placeholder: Partito di appartenenza, di associazione o di altre organizzazioni
avatar: Carica una foto
save: Inviato per la revisione
create:
success: Grazie, i dati vengono controllati.
update:
success: Grazie, i dati vengono controllati.
pages: pages:
thanks: thanks:
title: Grazie mille per il tuo sostegno! title: Grazie mille per il tuo sostegno!
@@ -73,12 +100,17 @@ it:
show: show:
not_found: La pagina non è stata trovata. not_found: La pagina non è stata trovata.
statements:
title: Dichiarazioni di nostri sostenitori
routes: routes:
initiative_text: il_testo_dell_iniziativa initiative_text: il_testo_dell_iniziativa
arguments: argomentazioni arguments: argomentazioni
faq: domande_e_risposte faq: domande_e_risposte
sponsoring: donazione_e_sponsor sponsoring: sponsor
donation: donazione
numbers: numeri numbers: numeri
statements: dichiarazioni
mongoid: mongoid:
attributes: attributes:
@@ -96,6 +128,10 @@ it:
remember_me: Ricordati di mel remember_me: Ricordati di mel
password: Password password: Password
language: Lingua language: Lingua
unsubscribed: No Newsletter
password_confirmation: conferma password password_confirmation: conferma password
current_password: Password corrente current_password: Password corrente
publicity:
status: Statu
organisation: Organizzazione
statement: Dichiarazione
avatar: Foto
+472
View File
@@ -0,0 +1,472 @@
de:
mongoid:
errors:
messages:
blank_in_locale:
"can't be blank in %{location}"
message_title: "message"
summary_title: "summary"
resolution_title: "resolution"
ambiguous_relationship:
message: "Ambiguous relations %{candidates} defined on %{klass}."
summary:
"When Mongoid attempts to set an inverse document of a relation
in memory, it needs to know which relation it belongs to. When
setting %{name}, Mongoid looked on the class %{inverse}
for a matching relation, but multiples were found that could
potentially match: %{candidates}."
resolution: "On the %{name} relation on %{inverse} you must add an
:inverse_of option to specify the exact relationship on %{klass}
that is the opposite of %{name}."
callbacks:
message: "Calling %{method} on %{klass} resulted in a false return
from a callback."
summary: "If a before callback returns false when using Document.create!,
Document#save!, or Document#update_attributes! this error will get raised
since the document did not actually get saved."
resolution: "Double check all before callbacks to make sure they are
not unintentionally returning false."
calling_document_find_with_nil_is_invalid:
message: "Calling Document.find with nil is invalid."
summary: "Document.find expects the parameters to be 1 or more ids, and
will return a single document if 1 id is provided, otherwise an array
of documents if multiple ids are provided."
resolution: "Most likely this is caused by passing parameters directly
through to the find, and the parameter either is not present or the
key from which it is accessed is incorrect."
document_not_destroyed:
message: "%{klass} with id %{id} was not destroyed."
summary: "When calling %{klass}#destroy! and a callback halts the destroy
callback chain by returning a false value, the deletion will not
actually occur."
resolution: "Check the before/after destroy callbacks to ensure that the
return values are truthy for the chain to continue."
document_not_found:
message: "Document(s) not found for class %{klass} with id(s) %{missing}."
summary: "When calling %{klass}.find with an id or array of ids, each
parameter must match a document in the database or this error will be
raised. The search was for the id(s): %{searched} (%{total} total)
and the following ids were not found: %{missing}."
resolution: "Search for an id that is in the database or set
the Mongoid.raise_not_found_error configuration option to false,
which will cause a nil to be returned instead of raising this error when
searching for a single id, or only the matched documents when searching
for multiples."
document_with_attributes_not_found:
message: "Document not found for class %{klass} with attributes %{attributes}."
summary: "When calling %{klass}.find_by with a hash of attributes, all
attributes provided must match a document in the database or this error
will be raised."
resolution: "Search for attributes that are in the database or set
the Mongoid.raise_not_found_error configuration option to false,
which will cause a nil to be returned instead of raising this error."
eager_load:
message: "Eager loading :%{name} is not supported since it is a
polymorphic belongs_to relation."
summary: "Mongoid cannot currently determine the classes it needs to
eager load when the relation is polymorphic. The parents reside in
different collections so a simple id lookup is not sufficient enough."
resolution: "Don't attempt to perform this action and have patience,
maybe this will be supported in the future."
invalid_collection:
message: "Access to the collection for %{klass} is not allowed."
summary: "%{klass}.collection was called, and %{klass} is an embedded
document - it resides within the collection of the root document of
the hierarchy."
resolution: "For access to the collection that the embedded document is
in, use %{klass}#_root.collection, or do not attempt to persist an
embedded document without a parent set."
invalid_config_option:
message: "Invalid configuration option: %{name}."
summary: "A invalid configuration option was provided in your
mongoid.yml, or a typo is potentially present. The valid configuration
options are: %{options}."
resolution: "Remove the invalid option or fix the typo. If you were
expecting the option to be there, please consult the following page
with repect to Mongoid's configuration:\n\n
\_\_http://mongoid.org/en/mongoid/docs/installation.html"
invalid_field:
message: "Defining a field named '%{name}' is not allowed."
summary: "Defining this field would override the method '%{name}',
which would cause issues with expectations around the original
method and cause extremely hard to debug issues. The original
method was defined in:\n
\_\_Object: %{origin}\n
\_\_File: %{file}\n
\_\_Line: %{line}"
resolution: "Use Mongoid.destructive_fields to see what names are not
allowed, and don't use these names. These include names that also
conflict with core Ruby methods on Object, Module, Enumerable, or
included gems that inject methods into these or Mongoid internals."
invalid_field_option:
message: "Invalid option :%{option} provided for field :%{name}."
summary: "Mongoid requires that you only provide valid options on each
field definition in order to prevent unexpected behaviour later on."
resolution: "When defining the field :%{name} on '%{klass}', please provide
valid options for the field. These are currently: %{valid}. If you
meant to define a custom field option, please do so first like so:\n\n
\_\_Mongoid::Fields.option :%{option} do |model, field, value|\n
\_\_\_\_# Your logic here...\n
\_\_end\n
\_\_class %{klass}\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_field :%{name}, %{option}: true\n
\_\_end\n\n"
invalid_includes:
message: "Invalid includes directive: %{klass}.includes(%{args})"
summary: "Eager loading in Mongoid only supports providing arguments
to %{klass}.includes that are the names of relations on the %{klass}
model, and only supports one level of eager loading. (ie, eager loading
associations not on the %{klass} but one step away via another relation
is not allowed."
resolution: "Ensure that each parameter passed to %{klass}.includes is
a valid name of a relation on the %{klass} model. These are: %{relations}."
invalid_index:
message: "Invalid index specification on %{klass}: %{spec}, %{options}"
summary: "Indexes in Mongoid are defined as a hash of field name and
direction/2d pairs, with a hash for any additional options."
resolution: "Ensure that the index conforms to the correct syntax and
has the correct options.\n\n
Valid options are:\n
\_\_background: true|false\n
\_\_database: 'database_name'\n
\_\_drop_dups: true|false\n
\_\_name: 'index_name'\n
\_\_sparse: true|false\n
\_\_unique: true|false\n
\_\_min: 1\n
\_\_max: 1\n
\_\_bits: 26\n
\_\_bucket_size : 1\n
\_\_weights: { content: 1, title: 2 }\n
\_\_expire_after_seconds: number_of_seconds\n
Valid types are: 1, -1, '2d', '2dsphere', 'geoHaystack', 'text', 'hashed'\n\n
Example:\n
\_\_class Band\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_index({ name: 1, label: -1 }, { sparse: true })\n
\_\_\_\_index({ location: '2d' }, { background: true })\n
\_\_end\n\n"
invalid_options:
message: "Invalid option :%{invalid} provided to relation :%{name}."
summary: "Mongoid checks the options that are passed to the relation
macros to ensure that no ill side effects occur by letting something
slip by."
resolution: "Valid options are: %{valid}, make sure these are the ones
you are using."
invalid_path:
message: "Having a root path assigned for %{klass} is invalid."
summary: "Mongoid has two different path objects for determining
the location of a document in the database, Root and Embedded.
This error is raised when an embedded document somehow gets a
root path assigned."
resolution: "Most likely your embedded model, %{klass} is also
referenced via a has_many from a root document in another
collection. Double check the relation definitions and fix any
instances where embedded documents are improperly referenced
from other collections."
invalid_scope:
message: "Defining a scope of value %{value} on %{klass} is not
allowed."
summary: "Scopes in Mongoid must be procs that wrap criteria objects."
resolution: "Change the scope to be a proc wrapped critera.\n\n
Example:\n
\_\_class Band\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_scope :inactive, ->{ where(active: false) }\n
\_\_end\n\n"
invalid_storage_options:
message: "Invalid options passed to %{klass}.store_in: %{options}."
summary: "The :store_in macro takes only a hash of parameters with
the keys :database, :collection, or :session."
resolution: "Change the options passed to store_in to match the
documented API, and ensure all keys in the options hash are
symbols.\n\n
Example:\n
\_\_class Band\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_store_in collection: 'artists', database: 'secondary'\n
\_\_end\n\n"
invalid_storage_parent:
message: "Invalid store_in call on class %{klass}."
summary: "The :store_in macro can only be called on a base Mongoid Document"
resolution: "Remove the store_in call on class %{klass}, as it will use its
parent store configuration. Or remove the hierarchy extension for this
class."
invalid_time:
message: "'%{value}' is not a valid Time."
summary: "Mongoid tries to serialize the values for Date, DateTime, and
Time into proper UTC times to store in the database. The provided
value could not be parsed."
resolution: "Make sure to pass parsable values to the field setter
for Date, DateTime, and Time objects. When this is a String it needs
to be valid for Time.parse. Other objects must be valid to pass to
Time.local."
inverse_not_found:
message: "When adding a(n) %{klass} to %{base}#%{name}, Mongoid could
not determine the inverse foreign key to set. The attempted key was
'%{inverse}'."
summary: "When adding a document to a relation, Mongoid attempts
to link the newly added document to the base of the relation in
memory, as well as set the foreign key to link them on the
database side. In this case Mongoid could not determine what the
inverse foreign key was."
resolution: "If an inverse is not required, like a belongs_to or
has_and_belongs_to_many, ensure that :inverse_of => nil is set
on the relation. If the inverse is needed, most likely the
inverse cannot be figured out from the names of the relations and
you will need to explicitly tell Mongoid on the relation what
the inverse is.\n\n
Example:\n
\_\_class Lush\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_has_one :whiskey, class_name: \"Drink\", inverse_of: :alcoholic\n
\_\_end\n\n
\_\_class Drink\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_belongs_to :alcoholic, class_name: \"Lush\", inverse_of: :whiskey\n
\_\_end"
invalid_set_polymorphic_relation:
message: "The %{name} attribute can't be set to an instance of
%{other_klass} as %{other_klass} has multiple relations referencing
%{klass} as %{name}."
summary: "If the parent class of a polymorphic relation has multiple
definitions for the same relation, the values must be set from the
parent side and not the child side since Mongoid cannot determine
from the child side which relation to go in."
resolution: "Set the values from the parent, or redefine the relation
with only a single definition in the parent."
invalid_value:
message: "Value of type %{value_class} cannot be written to a field of type %{field_class}"
summary: "Tried to set a value of type %{value_class} to a field of type %{field_class}"
resolution: "Verify if the value to be set correspond to field definition"
mixed_relations:
message: "Referencing a(n) %{embedded} document from the %{root}
document via a relational association is not allowed since the
%{embedded} is embedded."
summary: "In order to properly access a(n) %{embedded} from %{root}
the reference would need to go through the root document of
%{embedded}. In a simple case this would require Mongoid to store
an extra foreign key for the root, in more complex cases where
%{embedded} is multiple levels deep a key would need to be stored
for each parent up the hierarchy."
resolution: "Consider not embedding %{embedded}, or do the key
storage and access in a custom manner in the application code."
mixed_session_configuration:
message: "Both uri and standard configuration options defined for
session: '%{name}'."
summary: "Instead of simply giving uri or standard options a
preference order, Mongoid assumes that you have made a mistake in
your configuration and requires that you provide one or the other,
but not both. The options that were provided were: %{config}."
resolution: "Provide either only a uri as configuration or only
standard options."
nested_attributes_metadata_not_found:
message: "Could not find metadata for relation '%{name}' on model:
%{klass}."
summary: "When defining nested attributes for a relation, Mongoid
needs to access the metadata for the relation '%{name}' in order
if add autosave functionality to it, if applicable. Either no
relation named '%{name}' could be found, or the relation had not
been defined yet."
resolution: "Make sure that there is a relation defined named
'%{name}' on %{klass} or that the relation definition comes before
the accepts_nested_attributes_for macro in the model - order
matters so that Mongoid has access to the metadata.\n\n
Example:\n
\_\_class Band\n
\_\_\_\_include Mongoid::Document\n
\_\_\_\_has_many :albums\n
\_\_\_\_accepts_nested_attributes_for :albums\n
\_\_end\n\n"
no_default_session:
message: "No default session configuration is defined."
summary: "The configuration provided settings for: %{keys}, but
Mongoid requires a :default to be defined at minimum."
resolution: "If configuring via a mongoid.yml, ensure that within
your :sessions section a :default session is defined.\n\n
Example:\n
\_\_development:\n
\_\_\_\_sessions:\n
\_\_\_\_\_\_default:\n
\_\_\_\_\_\_\_\_hosts:\n
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
no_environment:
message: "Could not load the configuration since no environment
was defined."
summary: "Mongoid attempted to find the appropriate environment
but no Rails.env, Sinatra::Base.environment, RACK_ENV, or
MONGOID_ENV could be found."
resolution: "Make sure some environment is set from the mentioned
options. Mongoid cannot load configuration from the yaml without
knowing which environment it is in, and we have considered
defaulting to development an undesireable side effect of this not
being defined."
no_map_reduce_output:
message: "No output location was specified for the map/reduce
operation."
summary: "When executing a map/reduce, you must provide the output
location of the results. The attempted command was: %{command}."
resolution: "Provide the location that the output of the operation
is to go by chaining an #out call to the map/reduce.\n\n
Example:\n
\_\_Band.map_reduce(map, reduce).out(inline: 1)\n\n
Valid options for the out function are:\n
\_\_inline: 1\n
\_\_merge: 'collection-name'\n
\_\_replace: 'collection-name'\n
\_\_reduce: 'collection-name'\n\n"
no_metadata:
message: "Metadata not found for document of type %{klass}."
summary: "Mongoid sets the metadata of a relation on the document
when it is either loaded from within the relation, or added to
one. The presence of the metadata is required in order to
provide various functionality around relations. Most likely you
are getting this error because the document is embedded and was
attempted to be persisted without being associated with a parent,
or the relation was not properly defined."
resolution: "Ensure that your relations on the %{klass} model
are all properly defined, and that the inverse relations
are also properly defined. Embedded relations must have both the
parent (embeds_one/embeds_many) and the inverse (embedded_in)
present in order to work properly."
no_parent:
message: "Cannot persist embedded document %{klass} without a
parent document."
summary: "If the document is embedded, in order to be persisted it
must always have a reference to its parent document. This is
most likely caused by either calling %{klass}.create or
%{klass}.create! without setting the parent document as an
attribute."
resolution: "Ensure that you've set the parent relation if
instantiating the embedded document directly, or always create new
embedded documents via the parent relation."
no_session_config:
message: "No configuration could be found for a session named
'%{name}'."
summary: "When attempting to create the new session, Mongoid could
not find a session configuration for the name: '%{name}'. This is
necessary in order to know the host, port, and options needed
to connect."
resolution: "Double check your mongoid.yml to make sure under the
sessions key that a configuration exists for '%{name}'. If you
have set the configuration programatically, ensure that '%{name}'
exists in the configuration hash."
no_sessions_config:
message: "No sessions configuration provided."
summary: "Mongoid's configuration requires that you provide details
about each session that can be connected to, and requires in
the sessions config at least 1 default session to exist."
resolution: "Double check your mongoid.yml to make sure that you
have a top-level sessions key with at least 1 default session
configuration for it. You can regenerate a new mongoid.yml for
assistance via `rails g mongoid:config`.\n\n
Example:\n
\_\_development:\n
\_\_\_\_sessions:\n
\_\_\_\_\_\_default:\n
\_\_\_\_\_\_\_\_database: mongoid_dev\n
\_\_\_\_\_\_\_\_hosts:\n
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
no_session_database:
message: "No database provided for session configuration: :%{name}."
summary: "Each session configuration must provide a database so Mongoid
knows where the default database to persist to. What was provided
was: %{config}."
resolution: "If configuring via a mongoid.yml, ensure that within
your :%{name} section a :database value for the session's default
database is defined.\n\n
Example:\n
\_\_development:\n
\_\_\_\_sessions:\n
\_\_\_\_\_\_%{name}:\n
\_\_\_\_\_\_\_\_database: my_app_db\n
\_\_\_\_\_\_\_\_hosts:\n
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
no_session_hosts:
message: "No hosts provided for session configuration: :%{name}."
summary: "Each session configuration must provide hosts so Mongoid
knows where the database server is located. What was provided
was: %{config}."
resolution: "If configuring via a mongoid.yml, ensure that within
your :%{name} section a :hosts value for the session hosts is
defined.\n\n
Example:\n
\_\_development:\n
\_\_\_\_sessions:\n
\_\_\_\_\_\_%{name}:\n
\_\_\_\_\_\_\_\_database: my_app_db\n
\_\_\_\_\_\_\_\_hosts:\n
\_\_\_\_\_\_\_\_\_\_- localhost:27017\n\n"
readonly_attribute:
message: "Attempted to set the readonly attribute '%{name}' with
the value: %{value}."
summary: "Attributes flagged as readonly via Model.attr_readonly
can only have values set when the document is a new record."
resolution: "Don't define '%{name}' as readonly, or do not attempt
to update its value after the document is persisted."
readonly_document:
message: "Attempted to persist the readonly document '%{klass}'."
summary: "Documents loaded from the database using #only
cannot be persisted."
resolution: "Don't attempt to persist documents that are flagged as
readonly."
scope_overwrite:
message: "Cannot create scope :%{scope_name}, because of existing
method %{model_name}.%{scope_name}."
summary: "When defining a scope that conflicts with a method that
already exists on the model, this error will get raised if
Mongoid.scope_overwrite_exception is set to true."
resolution: "Change the name of the scope so it does not conflict
with the already defined method %{model_name}, or set the
configuration option Mongoid.scope_overwrite_exception to false,
which is its default. In this case a warning will be logged."
taken:
"exisitert bereits"
too_many_nested_attribute_records:
message: "Accepting nested attributes for %{association} is limited
to %{limit} records."
summary: "More documents were sent to be processed than the allowed
limit."
resolution: "The limit is set as an option to the macro, for example:
accepts_nested_attributes_for :%{association}, limit: %{limit}.
Consider raising this limit or making sure no more are sent than
the set value."
unknown_attribute:
message: "Attempted to set a value for '%{name}' which is not
allowed on the model %{klass}."
summary: "Without including Mongoid::Attributes::Dynamic in your model
and the attribute does not already exist in the attributes hash,
attempting to call %{klass}#%{name}= for it is not allowed. This is
also triggered by passing the attribute to any method that accepts an
attributes hash, and is raised instead of getting a NoMethodError."
resolution: "You can include Mongoid::Attributes::Dynamic if you
expect to be writing values for undefined fields often."
unsaved_document:
message: "Attempted to save %{document} before the parent %{base}."
summary: "You cannot call create or create! through the
relation (%{document}) who's parent (%{base}) is
not already saved. This would case the database to be out of sync
since the child could potentially reference a nonexistant parent."
resolution: "Make sure to only use create or create! when the parent
document %{base} is persisted."
unsupported_javascript:
message: "Executing Javascript $where selector on an embedded criteria
is not supported."
summary: "Mongoid only supports providing a hash of arguments to
#where criterion on embedded documents. Since %{klass} is embedded,
the expression %{javascript} is not allowed."
resolution: "Please provide a standard hash to #where when the criteria
is for an embedded relation."
validations:
message: "Validation of %{document} failed."
summary: "The following errors were found: %{errors}"
resolution: "Try persisting the document with valid data or remove
the validations."
delete_restriction:
message: "Cannot delete %{document} because of dependent '%{relation}'."
summary: "When defining '%{relation}' with a :dependent => :restrict,
Mongoid will raise an error when attempting to delete the
%{document} when the child '%{relation}' still has documents in it."
resolution: "Don't attempt to delete the parent %{document} when
it has children, or change the dependent option on the relation."
+6 -3
View File
@@ -2,12 +2,11 @@ Rails.application.routes.draw do
devise_for :supporters devise_for :supporters
root to: 'supporters#new' root to: 'supporters#new'
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
get "/pages/:page" => "pages#show" get "/pages/:page" => "pages#show"
namespace :admin do namespace :admin do
get '/map', to: 'pages#map', as: :map get '/map', to: 'pages#map', as: :map
resources :publicities
# resources :supporters, only: :index # resources :supporters, only: :index
end end
@@ -17,14 +16,18 @@ Rails.application.routes.draw do
get '/faq', to: 'pages#show', as: :faq, page: 'faq' get '/faq', to: 'pages#show', as: :faq, page: 'faq'
get '/terms_and_conditions', to: 'pages#show', as: :terms_and_conditions, page: 'terms_and_conditions' get '/terms_and_conditions', to: 'pages#show', as: :terms_and_conditions, page: 'terms_and_conditions'
get '/sponsoring', to: 'pages#show', as: :sponsoring, page: 'sponsoring' get '/sponsoring', to: 'pages#show', as: :sponsoring, page: 'sponsoring'
get '/donation', to: 'pages#show', as: :donation, page: 'donation'
get '/numbers', to: 'pages#show', as: :numbers, page: 'numbers' get '/numbers', to: 'pages#show', as: :numbers, page: 'numbers'
get '/statements', to: 'pages#show', as: :statements, page: 'statements'
end end
get '/cities_autocomplete', to: 'cities_autocomplete#index', as: :cities_autocomplete get '/cities_autocomplete', to: 'cities_autocomplete#index', as: :cities_autocomplete
scope '/:locale' do scope '/:locale' do
get '/', to: 'supporters#new' get '/', to: 'supporters#new'
resources :supporters resources :supporters
resource :publicity
get '/thanks', to: 'pages#thanks', as: :thanks get '/thanks', to: 'pages#thanks', as: :thanks
get '/spenden', to: 'pages#spenden', as: :spenden
end end
mount RailsAdmin::Engine => '/admin', as: 'rails_admin'
end end
-47
View File
@@ -1,47 +0,0 @@
class MailChimpBatchUpdate
def initialize(api_key, list_id)
@mailchimp = Mailchimp::API.new(api_key)
@list_id = list_id
end
def update_all
subscribers = []
Supporter.each_with_index do |supporter, index|
subscribers.push(subscriber(supporter))
if index.modulo(20).zero?
batch_subscribe(subscribers)
subscribers = []
end
end
batch_subscribe(subscribers)
end
def batch_subscribe(subscribers)
@mailchimp.lists.batch_subscribe(@list_id, subscribers, false, true, false)
end
def subscriber(supporter)
{ 'EMAIL' => { 'email' => supporter.email }, 'language' => supporter.language, :EMAIL_TYPE => 'html',
:merge_vars => {
'EMAIL' => supporter.email,
'FNAME' => supporter.first_name,
'LNAME' => supporter.last_name,
'SUPPORT' => supporter.support,
'MEMBERSHIP' => supporter.li_membership.to_s,
'AGE' => supporter.age_category,
'LANG' => supporter.language,
'ZIP' => supporter.zip
} }
end
def update_unsubscibed
unsubscribed_members = @mailchimp.lists.members(@list_id, 'unsubscribed', limit: 100)
unsubscribed_members['data'].each do |member|
Supporter.where(email: member['email']).each do |supporter|
supporter.update_attributes unsubscribed: true
end
end
end
end
+4 -1
View File
@@ -1,4 +1,7 @@
helper = ApplicationController.helpers helper = ApplicationController.helpers
never_signed_in = Supporter.where(sign_in_count: nil) never_signed_in = Supporter.where(sign_in_count: nil)
never_signed_in.each_with_index { |u, i| puts "#{i} #{u.email}"; u.update_attributes password: "#{u.support}#{helper.number_with_delimiter(u.zip, delimiter: ',')}" } never_signed_in.each_with_index do |u, i|
puts "#{i} #{u.email}"
u.update_attributes password: "#{u.support}#{helper.number_with_delimiter(u.zip, delimiter: ',')}"
end
+7
View File
@@ -0,0 +1,7 @@
FactoryGirl.define do
factory :publicity do
organisation { Faker::Company.name }
statement { Faker::Lorem.paragraph }
avatar { File.new("#{Rails.root}/spec/support/fixtures/image.jpg") }
end
end
+14
View File
@@ -0,0 +1,14 @@
FactoryGirl.define do
factory :supporter do
email { Faker::Internet.email }
password { Faker::Lorem.words(8).join }
first_name { Faker::Name.first_name }
last_name { Faker::Name.last_name }
street { Faker::Address.street_name }
zip { Faker::Address.zip }
city { Faker::Address.city }
support { %w(signer supporter).sample }
age_category { %w(underage young middle retired).sample }
language { %w(de fr it).sample }
end
end
+75
View File
@@ -0,0 +1,75 @@
require 'rails_helper'
feature 'Publicity' do
let(:supporter) { create :supporter, first_name: 'Hans', last_name: 'Muster' }
let(:admin) { create :supporter, admin: true }
before { sign_in(supporter) }
scenario 'User makes his announcement public' do
visit root_path
click_link 'Meine Unterstützung öffentlich kundtun ...'
fill_in 'Organisation', with: 'Schweizer Volkspartei'
fill_in 'Statement', with: 'Wir wollen ja eigentlich nur das Volk verarschen ;)'
attach_file('publicity_avatar', "#{Rails.root}/spec/support/fixtures/image.jpg")
click_button 'Zur Überprüfung einsenden'
expect(page).to have_content 'Besten Dank die Daten werden überprüft.'
end
scenario 'User makes changes announcement' do
create :publicity, supporter: supporter
visit root_path
click_link 'Statement neu einreichen'
fill_in 'Organisation', with: 'Schweizer Volkspartei'
fill_in 'Statement', with: 'Wir wollen ja eigentlich nur das Volk verarschen ;)'
attach_file('publicity_avatar', "#{Rails.root}/spec/support/fixtures/image.jpg")
click_button 'Zur Überprüfung einsenden'
expect(page).to have_content 'Besten Dank die Daten werden überprüft.'
expect(page).to have_content 'Die Veröffentlichung wurde noch nicht genehmigt'
end
scenario 'non admin users cannot manage pending publicities' do
visit admin_publicities_path
expect(page.status_code).to eq 403
end
context 'management' do
before { sign_in(admin) }
scenario 'an administrator approves a pending announcement' do
create :publicity, state: :pending, supporter: supporter
# Already declined, so we don't list it'
create :publicity, state: :declined, supporter: create(:supporter, first_name: 'Donald', last_name: 'Trump')
visit admin_publicities_path
expect(page).to have_content 'Hans Muster'
expect(page).not_to have_content 'Donald Trump'
click_link 'Bearbeiten'
fill_in 'Organisation', with: 'Free Hemp Association'
fill_in 'Statement', with: 'Marihuana ist die Heilung der Nation, Alkohol die Zerstörung.'
attach_file('publicity_avatar', "#{Rails.root}/spec/support/fixtures/image.jpg")
choose 'Das Statement wurde Veröffentlicht'
click_button 'Speichern'
expect(page).not_to have_content 'Hans Muster'
end
end
end
+2 -2
View File
@@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
feature 'Support announcement' do feature 'Support' do
scenario 'User announces support' do scenario 'User announces support' do
visit root_path visit root_path
@@ -21,7 +21,7 @@ feature 'Support announcement' do
sleep 5 # Do a real sleep to have a real integration test sleep 5 # Do a real sleep to have a real integration test
expect(ActionMailer::Base.deliveries.count).to eq 0 expect(ActionMailer::Base.deliveries.count).to eq 0
expect_any_instance_of(SupportersController).to receive(:mailchimp_registration).and_return(true) expect_any_instance_of(SupportersController).to receive(:sendy_registraion).and_return(true)
expect { click_button 'Unterstützung zusichern' }.to change { Supporter.count }.by(1) expect { click_button 'Unterstützung zusichern' }.to change { Supporter.count }.by(1)
# expect(ActionMailer::Base.deliveries.count).to eq 1 # expect(ActionMailer::Base.deliveries.count).to eq 1
+9
View File
@@ -0,0 +1,9 @@
require 'rails_helper'
describe Publicity do
it { is_expected.to be_embedded_in(:supporter) }
it { is_expected.to validate_presence_of(:state) }
it { is_expected.to validate_presence_of(:statement) }
it { is_expected.to validate_presence_of(:avatar) }
end
+2
View File
@@ -12,6 +12,8 @@ describe Supporter do
it { is_expected.to validate_presence_of(:age_category) } it { is_expected.to validate_presence_of(:age_category) }
it { is_expected.to validate_presence_of(:language) } it { is_expected.to validate_presence_of(:language) }
it { is_expected.to embed_one(:publicity) }
describe '.counter' do describe '.counter' do
it 'counts only from a certain number on' do it 'counts only from a certain number on' do
allow(Supporter).to receive(:count) { 12 } allow(Supporter).to receive(:count) { 12 }
+10
View File
@@ -16,6 +16,16 @@ Bundler.require(*Rails.groups)
RSpec.configure do |config| RSpec.configure do |config|
config.include Mongoid::Matchers, type: :model config.include Mongoid::Matchers, type: :model
config.include FactoryGirl::Syntax::Methods
config.before(:suite) do
FactoryGirl.find_definitions
end
config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::Test::ControllerHelpers, type: :view
config.include Devise::Test::IntegrationHelpers, type: :feature
# rspec-expectations config goes here. You can use an alternate # rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest # assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer. # assertions if you prefer.
Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB