Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9bdf0fe27a | ||
|
|
229830b52b | ||
|
|
5f9ea11d77 | ||
|
|
de231092a2 | ||
|
|
e7035fc8c5 | ||
|
|
f0b34f96ff |
@@ -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'
|
||||
|
||||
@@ -107,6 +110,10 @@ group :development do
|
||||
# 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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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'
|
||||
@@ -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',
|
||||
}
|
||||
});
|
||||
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>';
|
||||
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);
|
||||
});
|
||||
|
||||
@@ -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'
|
||||
|
||||
+19
-1
@@ -19,10 +19,14 @@ 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.
|
||||
|
||||
@@ -109,7 +113,13 @@ de:
|
||||
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
|
||||
@@ -120,6 +130,8 @@ de:
|
||||
statementes: statements
|
||||
collection_concept: Sammelkonzept
|
||||
greendays: greensaturday
|
||||
network: netzwerk
|
||||
signature_collections: unterschriftensammlung
|
||||
|
||||
mongoid:
|
||||
models:
|
||||
@@ -147,3 +159,9 @@ de:
|
||||
organisation: Organisation
|
||||
statement: Statement
|
||||
avatar: Bild
|
||||
network/signature_collection:
|
||||
location_name: Ort
|
||||
location_zip: Postleitzahl
|
||||
location_address: Adresse
|
||||
event_date_start: Startzeit
|
||||
event_date_end: Endzeit
|
||||
|
||||
@@ -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?
|
||||
@@ -117,6 +119,8 @@ fr:
|
||||
statements: declarations
|
||||
collection_concept: plan_de_collecte
|
||||
greendays: greensaturday
|
||||
network: reseau
|
||||
signature_collections: collection_signature
|
||||
|
||||
mongoid:
|
||||
models:
|
||||
|
||||
@@ -21,6 +21,8 @@ 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:"
|
||||
@@ -121,6 +123,8 @@ it:
|
||||
statements: dichiarazioni
|
||||
collection_concept: sistema_di_raccolta
|
||||
greendays: greensaturday
|
||||
network: reticolato
|
||||
signature_collections: collezione_firme
|
||||
|
||||
mongoid:
|
||||
attributes:
|
||||
|
||||
@@ -62,16 +62,25 @@ SimpleNavigation::Configuration.run do |navigation|
|
||||
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|
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user