Author SHA1 Message Date
gurix 9bdf0fe27a Ignore case for search 2017-12-18 20:12:32 +01:00
gurix 229830b52b Remove unnecessary library 2017-12-18 20:12:07 +01:00
gurix 5f9ea11d77 geospatial searching 2017-12-17 22:26:09 +01:00
gurix de231092a2 Sample data for signatures 2017-12-17 12:27:10 +01:00
gurix e7035fc8c5 removed unnecessary specs 2017-12-17 12:26:55 +01:00
gurix f0b34f96ff Network and first signature collection prototyping 2017-12-17 11:21:09 +01:00
gurix 58a576e011 added Geocoding key 2017-11-20 14:57:12 +01:00
gurix 4c8f3b8643 fixed broken design 2017-11-20 09:22:04 +01:00
gurix b753511096 website instead of url 2017-11-18 19:48:23 +01:00
gurix 2fb44885ce responsibility 2017-11-18 19:20:11 +01:00
gurix 4e45e94f4b changed content 2017-11-16 17:38:48 +01:00
gurix d8106e7b08 Merge branch 'staging' 2017-11-16 14:52:16 +01:00
Markus GrafandGitHub 018ddce8cf Update donation.de.slim 2017-11-14 21:28:57 +01:00
Markus GrafandGitHub bd95513f59 Update numbers.de.slim 2017-11-10 15:37:10 +01:00
Markus GrafandGitHub 06922e9316 Update thanks.de.slim 2017-11-10 10:12:01 +01:00
40 changed files with 692 additions and 136 deletions
+12 -5
View File
@@ -14,6 +14,9 @@ gem 'coffee-rails', '~> 4.1.0'
# Integrate Paperclip into Mongoid.
gem 'mongoid-paperclip'
# Adds support for multiparameter fields to mongoid 4.x series.
gem 'mongoid-sadstory'
# Markdown rendering
gem 'redcarpet'
@@ -29,7 +32,7 @@ gem 'paperclip-i18n'
# Amazon's S3 file hosting service
gem 'aws-sdk', '< 3.0' # see https://github.com/thoughtbot/paperclip/issues/2484
# A fixtures replacement
# A fixtures replacement
gem 'factory_girl'
# It's a small library to provide the Rails I18n translations on the JavaScript.
@@ -54,7 +57,7 @@ gem 'route_translator'
gem 'roadie-rails', '~> 1.0'
# Devise is a flexible authentication solution for Rails based on Warden.
gem 'devise'
gem 'devise'
# Translations for devise
gem 'devise-i18n'
@@ -92,7 +95,7 @@ group :development, :test do
gem 'byebug'
gem 'mongoid-rspec', '3.0.0'
gem 'rspec-rails', '~> 3.0'
gem 'pry-rails'
gem 'dotenv-rails'
end
@@ -100,13 +103,17 @@ end
group :development do
# A series of things you can use to benchmark a Rails or Ruby app.
gem 'derailed_benchmarks'
# To use all profiling methods available
gem 'stackprof'
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Better Errors replaces the standard Rails error page with a much better and more useful error page.
gem "better_errors"
gem "binding_of_caller"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
# gem 'spring'
end
+10
View File
@@ -50,6 +50,10 @@ GEM
aws-sigv4 (1.0.2)
bcrypt (3.1.11)
benchmark-ips (2.7.2)
better_errors (2.4.0)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.7)
@@ -101,6 +105,7 @@ GEM
dotenv-rails (2.2.1)
dotenv (= 2.2.1)
railties (>= 3.2, < 5.2)
erubi (1.7.0)
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.8.1)
@@ -180,6 +185,8 @@ GEM
mongoid (~> 5.0)
rake
rspec (~> 3.3)
mongoid-sadstory (0.0.2)
mongoid
mongoid_paranoia (0.2.1)
mongoid (>= 4)
mongoid-compatibility
@@ -354,6 +361,8 @@ PLATFORMS
DEPENDENCIES
aws-sdk (< 3.0)
better_errors
binding_of_caller
bootstrap-sass (~> 3.3.5)
byebug
capybara
@@ -373,6 +382,7 @@ DEPENDENCIES
mongoid (~> 5.0.0)
mongoid-paperclip
mongoid-rspec (= 3.0.0)
mongoid-sadstory
mongoid_paranoia
paperclip-i18n
pry-rails
+25 -21
View File
@@ -22,7 +22,7 @@
@import "donations"
@import "nav"
*:focus
*:focus
outline: 0
-webkit-box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.075), 0 0 8px red
box-shadow: inset 0 2px 2px rgba(0, 0, 0, 0.075), 0 0 8px red
@@ -38,6 +38,10 @@
.alert-notice
@extend .alert-info
.form-inline > *
margin: 5px
body.admin
background: repeating-linear-gradient(45deg, yellow, yellow 50px, black 50px, black 100px)
@@ -51,7 +55,7 @@ body
padding: 20px
margin-top: 10px
background: #FFF
.anouncement
margin-top: 10px
@@ -64,38 +68,38 @@ body
h1
font-size: 20px
margin-top: 35px
.navbar
.container
padding-left: 0px
header > .row
margin-bottom: 12px
main > h1
margin-top: 0px
ul#topnav
font-size: 1.2em
li
text-transform: uppercase
ul
li
li
text-transform: none
li.active
border-bottom: 1px solid #66903F
.lead
font-weight: normal
#new_supporter
label.required
abbr
display: none
#counter
background-color: $brand-success
margin-top: 24px
@@ -103,7 +107,7 @@ body
border: 1px solid $brand-success
border-radius: 5px
color: white
.counter_char
background-color: white
width: 20px
@@ -114,7 +118,7 @@ body
display: inline-block
text-align: center
color: $brand-success
.text-success
color: $brand-success
@@ -122,18 +126,18 @@ body
display: block
float: left
margin: 12px
.table-inherit
width: inherit
footer
footer
h2
margin: 0px
font-size: $font-size-base
ol
ol
padding-left: 1em
.donation_button
height: 50px
background: $brand-success
@@ -149,10 +153,10 @@ body
left: -47px
box-shadow: inset 0px 0px 0px 4px rgba(255, 255, 255, 0.34)
a
a
color: #FFF
.row.fix
.row.fix
display: flex
flex-wrap: wrap
width: 100%
+1 -4
View File
@@ -8,7 +8,4 @@
#map
width: 100%
height: 300px
margin-bottom: 12px
.col-lg-4
width: 32% !important
margin-bottom: 12px
@@ -33,6 +33,11 @@ class ApplicationController < ActionController::Base
false
end
def only_admin
return true if current_supporter && current_supporter.admin?
raise ActionController::RoutingError, 'Not Found'
end
protected
def configure_permitted_parameters
-5
View File
@@ -57,9 +57,4 @@ class GreendaysController < ApplicationController
def greenday_params
params.require(:greenday).permit(:title, :address, :homepage, :description, :logo, :delete_logo)
end
def only_admin
return true if current_supporter && current_supporter.admin?
raise ActionController::RoutingError, 'Not Found'
end
end
@@ -0,0 +1,90 @@
class Network::SignatureCollectionsController < ApplicationController
before_action :only_admin, except: [:index, :show]
before_action :set_network_signature_collection, only: [:show, :edit, :update, :destroy]
# GET /network/signature_collections
# GET /network/signature_collections.json
def index
@query, @location, @distance = params[:query], params[:location], params[:distance]
@network_signature_collections = Network::SignatureCollection.where(:event_date_start.gte => DateTime.now)
@network_signature_collections = @network_signature_collections.or(location_zip_s: /#{@query}/i) if @query
@network_signature_collections = @network_signature_collections.or(location_name: /#{@query}/i) if @query
@network_signature_collections = @network_signature_collections.or(location_address: /#{@query}/i) if @query
distance_from_location
end
def distance_from_location
return unless @location && @distance
location_coordinates = Geocoder.coordinates(@location)
return unless location_coordinates # only filter when coordinates found
@network_signature_collections = @network_signature_collections.geo_near(location_coordinates.reverse).max_distance(@distance.to_f/111)
end
# GET /network/signature_collections/1
# GET /network/signature_collections/1.json
def show
end
# GET /network/signature_collections/new
def new
@network_signature_collection = Network::SignatureCollection.new
end
# GET /network/signature_collections/1/edit
def edit
end
# POST /network/signature_collections
# POST /network/signature_collections.json
def create
@network_signature_collection = Network::SignatureCollection.new(network_signature_collection_params)
respond_to do |format|
if @network_signature_collection.save
format.html { redirect_to @network_signature_collection, notice: 'Signature collection was successfully created.' }
format.json { render :show, status: :created, location: @network_signature_collection }
else
format.html { render :new }
format.json { render json: @network_signature_collection.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /network/signature_collections/1
# PATCH/PUT /network/signature_collections/1.json
def update
respond_to do |format|
if @network_signature_collection.update(network_signature_collection_params)
format.html { redirect_to @network_signature_collection, notice: 'Signature collection was successfully updated.' }
format.json { render :show, status: :ok, location: @network_signature_collection }
else
format.html { render :edit }
format.json { render json: @network_signature_collection.errors, status: :unprocessable_entity }
end
end
end
# DELETE /network/signature_collections/1
# DELETE /network/signature_collections/1.json
def destroy
@network_signature_collection.destroy
respond_to do |format|
format.html { redirect_to network_signature_collections_url, notice: 'Signature collection was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_network_signature_collection
@network_signature_collection = Network::SignatureCollection.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def network_signature_collection_params
params.require(:network_signature_collection).permit(:location_name, :location_zip, :location_address, :event_date_start, :event_date_end)
end
end
@@ -0,0 +1,30 @@
class Network::SignatureCollection
include Mongoid::Document
include Geocoder::Model::Mongoid
field :location_name, type: String
field :location_zip, type: Integer
field :location_zip_s, type: String
field :location_address, type: String
field :event_date_start, type: Time
field :event_date_end, type: Time
field :coordinates, type: Array
geocoded_by :address
before_save :update_location # auto-fetch coordinates
before_save :stringify_zip # auto-fetch coordinates
def address
"#{location_zip} #{location_name}, Switzerland"
end
def update_location
geocode
end
def stringify_zip
self.location_zip_s = self.location_zip.to_s
end
index({coordinates: "2d"})
end
+3 -3
View File
@@ -1,4 +1,4 @@
b Am 23. November ist Nationaler CBD-Tag!
p Um die #{link_to 'Finanzierung der Sammlung und Beglaubigung', donation_path} der eidgenössischen #{link_to 'Volksinitiative zur Cannabislegalisierung', initiative_text_path} in der Schweiz voranzutreiben, lanciert der Verein Legalize it! in Zusammenarbeit mit dem #{link_to 'Branchenverband IG Hanf', 'https://www.ighanf.ch/D_about.html', target: '_blank'} am 23. November 2017 den ersten nationalen CBD-Tag.
p An diesem Tag gibt es in zahlreichen CBD-Läden 10 Prozent Rabatt auf ausgewählte CBD-Produkte. In jedem Laden steht eine Spendenbox, welche für Spenden für die Initiative benutzt werden kann und die dem Verein Legalize it! zugute kommt.
b Am Samstag 25. November ist Nationaler CBD-Tag!
p Um die #{link_to 'Finanzierung der Sammlung und Beglaubigung', donation_path} der eidgenössischen #{link_to 'Volksinitiative zur Cannabislegalisierung', initiative_text_path} in der Schweiz voranzutreiben, lanciert der Verein Legalize it! in Zusammenarbeit mit dem #{link_to 'Branchenverband IG Hanf', 'https://www.ighanf.ch/D_about.html', target: '_blank'} am Samstag 25. November 2017 den ersten nationalen CBD-Tag.
p In jedem Laden steht eine Spendenbox, welche für Spenden für die Initiative benutzt werden kann und die dem Verein Legalize it! zugute kommt.
p Welche Läden mitmachen, seht ihr auf der Karte:
+3 -3
View File
@@ -1,5 +1,5 @@
h1.sr-only = title 'Gründonnerstag'
h1.sr-only = title '#Greensaturday'
= render 'description'
#map
= link_to 'Neuen Shop erfassen', new_greenday_path if admin?
@@ -13,7 +13,7 @@ h1.sr-only = title 'Gründonnerstag'
= image_tag greenday.logo.url(:original), alt: '', class: 'img-responsive'
address = simple_format(greenday.address)
- if greenday.homepage
= link_to(greenday.homepage, greenday.homepage, target: "_blank")
= link_to("Website", greenday.homepage, target: "_blank")
p = markdown(greenday.description).html_safe
- if admin?
@@ -53,7 +53,7 @@ javascript:
}
content += '<address>' + data.address.replace(/\n/g,"<br>")
if(data.homepage) {
content += '<br/><a href="' + data.homepage + '" target="_blank">' +data.homepage + '</a>'
content += '<br/><a href="' + data.homepage + '" target="_blank">Website</a>'
}
content += '</address>'
+4
View File
@@ -22,6 +22,10 @@ html lang="#{I18n.locale}"
link href="/favicon-96x96.png" rel="icon" sizes="96x96" type="image/png" /
link href="/favicon-16x16.png" rel="icon" sizes="16x16" type="image/png" /
link href="/manifest.json" rel="manifest" /
meta name="viewport" content="width=device-width, initial-scale=1.0"
meta content="#ffffff" name="msapplication-TileColor" /
meta content="/ms-icon-144x144.png" name="msapplication-TileImage" /
meta content="#ffffff" name="theme-color" /
@@ -0,0 +1,12 @@
= simple_form_for(@network_signature_collection) do |f|
= f.error_notification
.form-inputs
= f.input :location_name
= f.input :location_zip, as: :numeric
= f.input :location_address
= f.input :event_date_start, as: :datetime
= f.input :event_date_end, as: :datetime
.form-actions
= f.button :submit, value: t('shared.save')
@@ -0,0 +1,2 @@
json.extract! network_signature_collection, :id, :location_name, :location_zip, :location_address, :event_date_start, :event_date_end, :created_at, :updated_at
json.url network_signature_collection_url(network_signature_collection, format: :json)
@@ -0,0 +1,8 @@
h1 Editing network_signature_collection
== render 'form'
= link_to 'Show', @network_signature_collection
' |
= link_to 'Back', network_signature_collections_path
@@ -0,0 +1,47 @@
h1 = title t('.title')
css:
.form-inline > * {
margin: 5px;
}
form
.form-inline
input.form-control placeholder="#{t('.search')}" name="query" value="#{@query}"
input.form-control placeholder="#{t('.location')}" name="location" value="#{@location}"
select.form-control name="distance"
- [5, 10, 20, 50, 100, 150, 200].each do | d |
- if d == @distance.to_i
option value="#{d}" selected="selected" #{d} Km
- else
option value="#{d}" #{d} Km
input.btn.btn-primary type="submit" value="#{t('.search')}"
table.table
thead
tr
th = Network::SignatureCollection.human_attribute_name :location_name
th = Network::SignatureCollection.human_attribute_name :location_zip
th = Network::SignatureCollection.human_attribute_name :location_address
th = Network::SignatureCollection.human_attribute_name :event_date_start
th = Network::SignatureCollection.human_attribute_name :event_date_end
- if admin?
th
th
th
tbody.list
- @network_signature_collections.each do |network_signature_collection|
tr
td.location_name = network_signature_collection.location_name
td.location_zip = network_signature_collection.location_zip
td.location_address = network_signature_collection.location_address
td.event_date_start = l network_signature_collection.event_date_start, format: :short
td.event_date_end = l network_signature_collection.event_date_end, format: :short
- if admin?
td = link_to t('shared.show'), network_signature_collection
td = link_to t('shared.edit'), edit_network_signature_collection_path(network_signature_collection)
td = link_to t('shared.destroy'), network_signature_collection, data: { confirm: 'Are you sure?' }, method: :delete
br
= link_to t('.new'), new_network_signature_collection_path
@@ -0,0 +1 @@
json.array! @network_signature_collections, partial: 'network_signature_collections/network_signature_collection', as: :network_signature_collection
@@ -0,0 +1,5 @@
h1 New network_signature_collection
== render 'form'
= link_to 'Back', network_signature_collections_path
@@ -0,0 +1,21 @@
p#notice = notice
p
strong = Network::SignatureCollection.human_attribute_name :location_name
= @network_signature_collection.location_name
p
strong = Network::SignatureCollection.human_attribute_name :location_zip
= @network_signature_collection.location_zip
p
strong = Network::SignatureCollection.human_attribute_name :location_address
= @network_signature_collection.location_address
p
strong = Network::SignatureCollection.human_attribute_name :event_date_start
= @network_signature_collection.event_date_start
p
strong = Network::SignatureCollection.human_attribute_name :event_date_end
= @network_signature_collection.event_date_end
= link_to 'Edit', edit_network_signature_collection_path(@network_signature_collection)
' |
= link_to 'Back', network_signature_collections_path
@@ -0,0 +1 @@
json.partial! "network_signature_collections/network_signature_collection", network_signature_collection: @network_signature_collection
+5 -4
View File
@@ -16,7 +16,7 @@ javascript:
});
h2 Spendenbarometer
b Aktueller Stand: 68'000 CHF
b Aktueller Stand: 73'000 CHF
.row
.col-xs-12
.progress-target style="width: 20%"
@@ -35,15 +35,16 @@ b Aktueller Stand: 68'000 CHF
| 500'000 CHF
.progress
.progress-bar.progress-bar-success role="progressbar" aria-valuenow="68000" aria-valuemin="0" aria-valuemax="500000" style="width: 13.6%"
.progress-bar.progress-bar-success role="progressbar" aria-valuenow="73000" aria-valuemin="0" aria-valuemax="500000" style="width: 14.6%"
p Detailliertere Informationen, wie dieses Geld eingesetzt wird, findest du unter <a href="#{collection_concept_path}">«Wie macht man eine Volksinitiative?»</a>
h2 Via Kreditkarte online spenden
= form_tag charges_path do
= hidden_field_tag(:stripeToken)
#error_explanation.text-danger
= flash[:error] if flash[:error].present?
- if flash[:error].present?
#error_explanation.text-danger
= flash[:error]
.row
.col-xs12.col-md-5
button.donatebox.btn.btn-success onclick="donate(20)" 20 .-
+18
View File
@@ -0,0 +1,18 @@
h1 = title 'Netzwerk Legalisierung'
p Liebe Legalisierende
p Du bist auf der offiziellen Webseite für die Volksinitiative zur Legalisierung von Cannabis in der Schweiz.
p Das Netzwerk Legalisierung ist ein Versuch, eine Kampagne völlig neu zu organisieren. Konkret ermöglicht dir das Netzwerk, die Kampagne für die Legalisierung selbst zu gestalten und die Legalisierung dann auch mit den anderen im Netzwerk voranzutreiben. Das Netzwerk Legalisierung ist also ein grosses Werkzeug, aufgebaut aus vielen kleinen Werkzeugen.
p Entstanden ist die Idee, weil der Verein Legalize it!, der die Initiative lanciert hat, kaum Ressourcen zur Verfügung stehen. Im Gegensatz zu Parteien und grossen Organisationen ist Legalize it! kein durchorganisierter politischer Verein mit tausenden Mitgliedern und einem immer-vollen Konto. Der Verein Legalize it! kann also die Initiative nicht alleine meistern.
p Letztendlich bedeutet dies: Ob die Legalisierung durchkommt, hängt entscheidend von dir und allen anderen Mitwirkenden im Netzwerk ab. Legalisierung passiert nicht, sondern muss gemacht werden.
p Wenig überraschend werden wir beim Verein dafür immer wieder gefragt, wie man sich für die Legalisierung konkret einsetzen kann. Denn Hunderttausende sind von der heutigen Bevormundungspolitik als Konsumierende direkt betroffen. Und sie alle wissen, dass sie direkt betroffen sind.
p Um die Legalisierung voranzubringen, bracht es verschieden Vorgehensweisen. Darum sammeln wir all eure Aktionen auf dieser Plattform. Das Netzwerk Legalisierung ist daher so aufgebaut, dass alle Möglichkeiten, sich für die Legalisierung von Cannabis einzusetzen, auf einer Plattform gesammelt werden.
p Ohne einen stramm-durchorganisierten Verein im Eiltempo hochzuziehen, wollen wir so als schlank-organisiertes und smart organisiertes Netzwerk gemeinsam die Legalisierung erreichen.
h2 So funktioniert es
p Das Netzwerk ist in drei Hauptkategorien und sieben Unterkategorien aufgeteilt. Schau dir die Seiten am besten von links nach rechts mal an, damit du einen Überblick bekommst.
p Die erste Hauptkategorie beschäftigt sich mit dem, was nötig ist, damit die Initiative überhaupt zu Stande kommt. Es geht also um die Unterschriftensammlung und Finanzierung. Erreichen wir die Ziele in der ersten Kategorie nicht, ist es nicht möglich, diese Initiative durchzuführen.
p In der zweiten Hauptkategorie in der Mitte werden die Grundlagen der Überzeugungs- und Kampagnenarbeit thematisiert. Das ist zum einen die Selbstbildung, zum anderen der Aufbau von Netzwerk-Cliquen.
p In der dritten Hauptkategorie rechts geht es um die eigentliche Überzeugungs- und Kampagnenarbeit. Es geht um die Überzeugungsarbeit in deinem eignen Umfeld, halb-öffentliche und öffentliche Überzeugungsarbeit mittels Social Media und politischer Aktionen, sowie die Möglichkeiten das Netzwerk intern zu stärken. In der dritten Hauptkategorie geht es also um deine konkreten Möglichkeiten, die Kampagne selbst zu gestalten und zu organisieren, um die Leute gezielt zu überzeugen. Du findest in der dritten Hauptkategorie dazu einen einführenden Text, das Aktionen- und Veranstaltungstool, sowie Möglichkeiten zum Ideen-Austausch.
p Damit du das Netzwerk nutzen kannst musst du dich lediglich hier registrieren:
- @supporter = Supporter.new
= render 'supporters/form'
+3 -3
View File
@@ -5,11 +5,11 @@ article
caption Cannabis-Konsum im Jahr 2014 gemäss <a href="http://www.suchtmonitoring.ch/de/4/1-2.html?cannabis-pravalenz-gebrauch-in-der-gesamtbevolkerung" target="_blank">Suchtmonitoring</a>
tbody
tr
td Gelegenheitskonsumenten (Konsum innerhalb von 12 Monaten)
td Mindestens einmaliger Konsum innerhalb der letzten 12 Monaten
td ca. 536000
td 6.7%
tr
td Regelmässige Konsumenten (Konsum innerhalb von 30 Tagen)
td Mindestens einmaliger Konsum innerhalb der letzten 30 Tage
td ca. 240000
td 3%
tr
@@ -71,4 +71,4 @@ article
a href="#prevalenz-ref" aria-label="Zurück zum Inhalt"↵
li#preis
| Der Verkaufspreis auf dem Schwarzmarkt liegt derzeit bei ca. 10 - 15 Fr. pro Gramm. Um den Schwarzmarkt wirksam zu bekämpfen, darf der Verkaufspreis inklusive Steuern nicht höher ausfallen, als der Preis auf dem Schwarzmarkt. Reine Produktionskosten liegen bei ca. 0.8 Fr. pro Gramm.
a href="#preis-ref" aria-label="Zurück zum Inhalt"↵
a href="#preis-ref" aria-label="Zurück zum Inhalt"↵
+2 -2
View File
@@ -9,13 +9,13 @@ p
h2 Was kannst du machen?
ul
li = link_to 'Spende für die Legalisierung', donation_path
li Versende den <a href="mailto:?subject=Es wird Zeit, Cannabis in der Schweiz legalisieren&body=Ich hab meine Unterstützung zugesichert unter https://ch420.herokuapp.com. Unterstütze uns auch du.">Link zum Online-Formular</a> an all deine Freunde und Bekannte
li Folge uns auf <a href="https://www.facebook.com/vereinlegalizeit">Facebook</a> und <a href="https://twitter.com/VereinLegalize">Twitter</a>
li Teile unser Projekt in den sozialen Medien mit dem Hashtag #CH420
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 = 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
h2 Folge uns auf Facebook
#fb-root
+58 -64
View File
@@ -1,67 +1,61 @@
- title(t('shared.header.title_html'))
.row
.col-xs-12.col-md-7
h2.sr-only = t('.form')
= simple_form_for @supporter do |f|
= f.input :first_name, placeholder: t('.placeholders.first_name')
= f.input :last_name, placeholder: t('.placeholders.last_name')
= f.input :street, placeholder: t('.placeholders.street')
= f.input :city, placeholder: t('.placeholders.city')
= f.input :zip, placeholder: t('.placeholders.zip')
= f.input :email, placeholder: t('.placeholders.email')
= f.input :tel, placeholder: '+41 (0) xxxx'
= 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 :li_membership, as: :boolean
= f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first
= f.input :comments, as: :text
.form-group
= f.submit value: t('.submit'), class: 'btn btn-success'
.form-group
= link_to t('.terms_and_conditions'), terms_and_conditions_path, class: 'small'
= simple_form_for @supporter do |f|
= f.input :first_name, placeholder: t('.placeholders.first_name')
= f.input :last_name, placeholder: t('.placeholders.last_name')
= f.input :street, placeholder: t('.placeholders.street')
= f.input :city, placeholder: t('.placeholders.city')
= f.input :zip, placeholder: t('.placeholders.zip')
= f.input :email, placeholder: t('.placeholders.email')
= f.input :tel, placeholder: '+41 (0) xxxx'
= 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 :li_membership, as: :boolean
= f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first
= f.input :comments, as: :text
.form-group
= f.submit value: t('.submit'), class: 'btn btn-success'
.form-group
= link_to t('.terms_and_conditions'), terms_and_conditions_path, class: 'small'
javascript:
var cities = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/cities_autocomplete.json?query=%QUERY',
wildcard: '%QUERY',
}
});
var suggestion_template = function (data) {
return '<p>' + data.plz + ' - ' + data.city + '</p>';
javascript:
var cities = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: {
url: '/cities_autocomplete.json?query=%QUERY',
wildcard: '%QUERY',
}
});
var suggestion_template = function (data) {
return '<p>' + data.plz + ' - ' + data.city + '</p>';
}
$('#supporter_city').typeahead({
minLength: 2,
},{
limit: 20,
display: 'city',
templates: {
suggestion: function (data) {
return suggestion_template(data);
}
},
source: cities
}).on('typeahead:selected', function(event, datum) {
$("#supporter_zip").val(datum.plz);
});
$('#supporter_zip').typeahead({
minLength: 2,
},{
limit: 20,
display: 'plz',
templates: {
suggestion: function (data) {
return suggestion_template(data);
}
$('#supporter_city').typeahead({
minLength: 2,
},{
limit: 20,
display: 'city',
templates: {
suggestion: function (data) {
return suggestion_template(data);
}
},
source: cities
}).on('typeahead:selected', function(event, datum) {
$("#supporter_zip").val(datum.plz);
});
$('#supporter_zip').typeahead({
minLength: 2,
},{
limit: 20,
display: 'plz',
templates: {
suggestion: function (data) {
return suggestion_template(data);
}
},
source: cities
}).on('typeahead:selected', function(event, datum) {
$("#supporter_city").val(datum.city);
});
aside.col-md-5.col-xs-12
= render 'right_side'
},
source: cities
}).on('typeahead:selected', function(event, datum) {
$("#supporter_city").val(datum.city);
});
+7 -2
View File
@@ -35,5 +35,10 @@
= render 'right_side'
- else
= render 'form'
- title(t('shared.header.title_html'))
.row
.col-xs-12.col-md-7
h2.sr-only = t('.form')
= render 'form'
aside.col-md-5.col-xs-12
= render 'right_side'
+1 -1
View File
@@ -52,5 +52,5 @@ Rails.application.configure do
access_key_id: ENV["S3_ACCESS_KEY"],
secret_access_key: ENV["S3_ACCESS_SECRET"]
}
}
}
end
+3
View File
@@ -0,0 +1,3 @@
Geocoder.configure(
lookup: :google,
api_key: ENV['GEOCODING_API'])
+33 -15
View File
@@ -19,34 +19,38 @@ de:
numbers: Zahlen
statements: Statements
collection_concept: Wie macht man eine Volksinitiative?
network: Netzwerk
signature_collections: Unterschriftensammlung
lang: Sprache
are_you_sure: Bist du sicher?
edit: Bearbeiten
show: Anzeigen
destroy: Löschen
save: Speichern
description: Volksinitiative zur Legalisierung von Cannabis in der Schweiz.
counter:
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.
donation: Deine Spende
welcome_email:
subject: Besten Dank für deine Unterstützung!
support_type:
signer: Ich würde eine Volksinitiative für die <span class="text-success">Legalisierung von Cannabis</span> unterschreiben.
supporter: Ich würde eine Volksinitiative für die <span class="text-success">Legalisierung von Cannabis</span> unterschreiben und helfe aktiv Unterschriften in meiner Umgebung zu sammeln.
# 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:
underage: Ich bin jünger als 18 Jahre alt
young: Ich bin 18 bis 30 Jahre alt
middle: Ich bin 30 bis 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
@@ -56,7 +60,7 @@ de:
de: Deutsch
fr: Français
it: Italiano
supporters:
form:
form: Formular
@@ -76,15 +80,15 @@ de:
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:
timeout: Ihre Eingabe war zu schnell.
new:
title: Hallo %{name}
edit: Meine Daten bearbeiten
my_data: Meine Daten
publicities:
form:
title: Meine Meinung zur Cannabis-Initiative veröffentlichen
@@ -92,7 +96,7 @@ de:
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:
@@ -100,16 +104,22 @@ de:
pages:
show:
not_found: Die Seite konnte nicht gefunden werden.
not_found: Die Seite konnte nicht gefunden werden.
thanks:
title: Besten Dank für deine Unterstützung!
statements:
title: Statements von unseren Unterstützern
submit_your_own_statement: Veröffentliche dein eigenes Statement...
read_more: das ganze Statement lesen.
network:
signature_collections:
index:
new: Neue Sammlung erfasssen
title: Unterschriftensammlungen
search: Suche
location: Ort
routes:
initiative_text: initiativtext
arguments: argumentarium
@@ -119,7 +129,9 @@ de:
numbers: zahlen
statementes: statements
collection_concept: Sammelkonzept
greendays: gründonnerstag
greendays: greensaturday
network: netzwerk
signature_collections: unterschriftensammlung
mongoid:
models:
@@ -146,4 +158,10 @@ de:
state: Status
organisation: Organisation
statement: Statement
avatar: Bild
avatar: Bild
network/signature_collection:
location_name: Ort
location_zip: Postleitzahl
location_address: Adresse
event_date_start: Startzeit
event_date_end: Endzeit
+5 -1
View File
@@ -24,6 +24,8 @@ fr:
statements: Déclarations
collection_concept: Comment faire une initiative populaire? (en allemand)
my_account: Mon compte
network: Réseau
signature_collections: Collection des signatures
lang: Langue
are_you_sure: Tu es sûre?
@@ -116,7 +118,9 @@ fr:
numbers: chiffres
statements: declarations
collection_concept: plan_de_collecte
greendays: jeudi_vert
greendays: greensaturday
network: reseau
signature_collections: collection_signature
mongoid:
models:
+6 -2
View File
@@ -21,7 +21,9 @@ it:
statements: Dichiarazioni
collection_concept: Come fare un iniziativa popolare? (in tedesco)
my_account: Il mio account
network: Reticolato
signature_collections: collezione di firme
counter:
supporters: "Sostenitore:"
amount_of_supporters: Al momento abbiamo %{amount} sostenitori.
@@ -120,7 +122,9 @@ it:
numbers: numeri
statements: dichiarazioni
collection_concept: sistema_di_raccolta
greendays: giovedi_verdi
greendays: greensaturday
network: reticolato
signature_collections: collezione_firme
mongoid:
attributes:
+10 -1
View File
@@ -57,21 +57,30 @@ SimpleNavigation::Configuration.run do |navigation|
# against the current URI. You may also use a proc, or the symbol <tt>:subpath</tt>.
#
primary.item :greendays, 'Gründonnerstag', greendays_path
primary.item :greendays, '#Greensaturday', greendays_path
unless supporter_signed_in?
primary.item :home, I18n.t('.shared.topnavigation.support'), "/#{I18n.locale}"
end
primary.item :initiative, I18n.t('.shared.topnavigation.initiative'), initiative_text_path do | initiative |
initiative.item :arguments, I18n.t('.shared.topnavigation.arguments'), arguments_path
initiative.item :faq, I18n.t('.shared.topnavigation.faq'), faq_path
initiative.item :numbers, I18n.t('.shared.topnavigation.numbers'), numbers_path
initiative.item :collection_concept, I18n.t('.shared.topnavigation.collection_concept'), collection_concept_path
end
primary.item :statements, I18n.t('.shared.topnavigation.statements'), statements_path do |statements|
statements.item :new_statement, I18n.t('.supporters.publicity.renew'), new_publicity_path
end
primary.item :donation, I18n.t('donation'), donation_path
primary.item :network, I18n.t('.shared.topnavigation.network'), network_path do | network |
network.item :signature_collections, I18n.t('.shared.topnavigation.signature_collections'), network_signature_collections_path
end
primary.item :blog, 'Blog', 'http://blog.cannabis-initiative.ch/', link_html: { target: '_blank'}
if supporter_signed_in?
primary.item :home, I18n.t('.shared.topnavigation.my_account'), "/#{I18n.locale}" do |my_account|
+6
View File
@@ -1,4 +1,5 @@
Rails.application.routes.draw do
devise_for :supporters
root to: 'supporters#new'
@@ -11,6 +12,11 @@ Rails.application.routes.draw do
end
localized do
get 'network', to: 'pages#show', as: :network, page: 'network'
namespace :network do
resources :signature_collections
end
resources :greendays
get '/initiative_text', to: 'pages#show', as: :initiative_text, page: 'initiative_text'
get '/arguments', to: 'pages#show', as: :arguments, page: 'arguments'
+8
View File
@@ -5,3 +5,11 @@
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
@cities = CSV.read Rails.root.join('db', 'plz_ch.csv')
@cities.sample(122).each do |city|
tmp_date = DateTime.now + rand(50)
Network::SignatureCollection.create(location_zip: city.first, location_name: city.last, location_address: Faker::Address.street_address, event_date_start: tmp_date, event_date_end: tmp_date+rand(10).to_f/10)
end
# Network::SignatureCollection.where(location: {"$near" => x.location, '$maxDistance' => 1.fdiv(111.12)}).map &:location_name
@@ -0,0 +1,141 @@
require 'rails_helper'
# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator. If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails. There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec. Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.
#
# Also compared to earlier versions of this generator, there are no longer any
# expectations of assigns and templates rendered. These features have been
# removed from Rails core in Rails 5, but can be added back in via the
# `rails-controller-testing` gem.
RSpec.describe Network::SignatureCollectionsController, type: :controller do
# This should return the minimal set of attributes required to create a valid
# Network::SignatureCollection. As you add validations to Network::SignatureCollection, be sure to
# adjust the attributes here as well.
let(:valid_attributes) {
skip("Add a hash of attributes valid for your model")
}
let(:invalid_attributes) {
skip("Add a hash of attributes invalid for your model")
}
# This should return the minimal set of values that should be in the session
# in order to pass any filters (e.g. authentication) defined in
# Network::SignatureCollectionsController. Be sure to keep this updated too.
let(:valid_session) { {} }
describe "GET #index" do
it "returns a success response" do
signature_collection = Network::SignatureCollection.create! valid_attributes
get :index, {}, valid_session
expect(response).to be_success
end
end
describe "GET #show" do
it "returns a success response" do
signature_collection = Network::SignatureCollection.create! valid_attributes
get :show, {:id => signature_collection.to_param}, valid_session
expect(response).to be_success
end
end
describe "GET #new" do
it "returns a success response" do
get :new, {}, valid_session
expect(response).to be_success
end
end
describe "GET #edit" do
it "returns a success response" do
signature_collection = Network::SignatureCollection.create! valid_attributes
get :edit, {:id => signature_collection.to_param}, valid_session
expect(response).to be_success
end
end
describe "POST #create" do
context "with valid params" do
it "creates a new Network::SignatureCollection" do
expect {
post :create, {:network_signature_collection => valid_attributes}, valid_session
}.to change(Network::SignatureCollection, :count).by(1)
end
it "redirects to the created network_signature_collection" do
post :create, {:network_signature_collection => valid_attributes}, valid_session
expect(response).to redirect_to(Network::SignatureCollection.last)
end
end
context "with invalid params" do
it "returns a success response (i.e. to display the 'new' template)" do
post :create, {:network_signature_collection => invalid_attributes}, valid_session
expect(response).to be_success
end
end
end
describe "PUT #update" do
context "with valid params" do
let(:new_attributes) {
skip("Add a hash of attributes valid for your model")
}
it "updates the requested network_signature_collection" do
signature_collection = Network::SignatureCollection.create! valid_attributes
put :update, {:id => signature_collection.to_param, :network_signature_collection => new_attributes}, valid_session
signature_collection.reload
skip("Add assertions for updated state")
end
it "redirects to the network_signature_collection" do
signature_collection = Network::SignatureCollection.create! valid_attributes
put :update, {:id => signature_collection.to_param, :network_signature_collection => valid_attributes}, valid_session
expect(response).to redirect_to(signature_collection)
end
end
context "with invalid params" do
it "returns a success response (i.e. to display the 'edit' template)" do
signature_collection = Network::SignatureCollection.create! valid_attributes
put :update, {:id => signature_collection.to_param, :network_signature_collection => invalid_attributes}, valid_session
expect(response).to be_success
end
end
end
describe "DELETE #destroy" do
it "destroys the requested network_signature_collection" do
signature_collection = Network::SignatureCollection.create! valid_attributes
expect {
delete :destroy, {:id => signature_collection.to_param}, valid_session
}.to change(Network::SignatureCollection, :count).by(-1)
end
it "redirects to the network_signature_collections list" do
signature_collection = Network::SignatureCollection.create! valid_attributes
delete :destroy, {:id => signature_collection.to_param}, valid_session
expect(response).to redirect_to(network_signature_collections_url)
end
end
end
@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Network::SignatureCollection, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end
@@ -0,0 +1,10 @@
require 'rails_helper'
RSpec.describe "Network::SignatureCollections", type: :request do
describe "GET /network_signature_collections" do
it "works! (now write some real specs)" do
get network_signature_collections_path
expect(response).to have_http_status(200)
end
end
end
@@ -0,0 +1,24 @@
require 'rails_helper'
RSpec.describe "network/signature_collections/edit", type: :view do
before(:each) do
@network_signature_collection = assign(:network_signature_collection, Network::SignatureCollection.create!(
:location_name => "MyString",
:location_zip => 1,
:location_address => "MyString"
))
end
it "renders the edit network_signature_collection form" do
render
assert_select "form[action=?][method=?]", network_signature_collection_path(@network_signature_collection), "post" do
assert_select "input#network_signature_collection_location_name[name=?]", "network_signature_collection[location_name]"
assert_select "input#network_signature_collection_location_zip[name=?]", "network_signature_collection[location_zip]"
assert_select "input#network_signature_collection_location_address[name=?]", "network_signature_collection[location_address]"
end
end
end
@@ -0,0 +1,25 @@
require 'rails_helper'
RSpec.describe "network/signature_collections/index", type: :view do
before(:each) do
assign(:network_signature_collections, [
Network::SignatureCollection.create!(
:location_name => "Location Name",
:location_zip => 2,
:location_address => "Location Address"
),
Network::SignatureCollection.create!(
:location_name => "Location Name",
:location_zip => 2,
:location_address => "Location Address"
)
])
end
it "renders a list of network/signature_collections" do
render
assert_select "tr>td", :text => "Location Name".to_s, :count => 2
assert_select "tr>td", :text => 2.to_s, :count => 2
assert_select "tr>td", :text => "Location Address".to_s, :count => 2
end
end
@@ -0,0 +1,24 @@
require 'rails_helper'
RSpec.describe "network/signature_collections/new", type: :view do
before(:each) do
assign(:network_signature_collection, Network::SignatureCollection.new(
:location_name => "MyString",
:location_zip => 1,
:location_address => "MyString"
))
end
it "renders new network_signature_collection form" do
render
assert_select "form[action=?][method=?]", network_signature_collections_path, "post" do
assert_select "input#network_signature_collection_location_name[name=?]", "network_signature_collection[location_name]"
assert_select "input#network_signature_collection_location_zip[name=?]", "network_signature_collection[location_zip]"
assert_select "input#network_signature_collection_location_address[name=?]", "network_signature_collection[location_address]"
end
end
end
@@ -0,0 +1,18 @@
require 'rails_helper'
RSpec.describe "network/signature_collections/show", type: :view do
before(:each) do
@network_signature_collection = assign(:network_signature_collection, Network::SignatureCollection.create!(
:location_name => "Location Name",
:location_zip => 2,
:location_address => "Location Address"
))
end
it "renders attributes in <p>" do
render
expect(rendered).to match(/Location Name/)
expect(rendered).to match(/2/)
expect(rendered).to match(/Location Address/)
end
end