Network and first signature collection prototyping

This commit is contained in:
2017-12-17 11:21:09 +01:00
parent 58a576e011
commit f0b34f96ff
35 changed files with 2400 additions and 92 deletions
+12 -5
View File
@@ -14,6 +14,9 @@ gem 'coffee-rails', '~> 4.1.0'
# Integrate Paperclip into Mongoid. # Integrate Paperclip into Mongoid.
gem 'mongoid-paperclip' gem 'mongoid-paperclip'
# Adds support for multiparameter fields to mongoid 4.x series.
gem 'mongoid-sadstory'
# Markdown rendering # Markdown rendering
gem 'redcarpet' gem 'redcarpet'
@@ -29,7 +32,7 @@ gem 'paperclip-i18n'
# Amazon's S3 file hosting service # Amazon's S3 file hosting service
gem 'aws-sdk', '< 3.0' # see https://github.com/thoughtbot/paperclip/issues/2484 gem 'aws-sdk', '< 3.0' # see https://github.com/thoughtbot/paperclip/issues/2484
# A fixtures replacement # A fixtures replacement
gem 'factory_girl' gem 'factory_girl'
# It's a small library to provide the Rails I18n translations on the JavaScript. # 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' gem 'roadie-rails', '~> 1.0'
# Devise is a flexible authentication solution for Rails based on Warden. # Devise is a flexible authentication solution for Rails based on Warden.
gem 'devise' gem 'devise'
# Translations for devise # Translations for devise
gem 'devise-i18n' gem 'devise-i18n'
@@ -92,7 +95,7 @@ group :development, :test do
gem 'byebug' gem 'byebug'
gem 'mongoid-rspec', '3.0.0' gem 'mongoid-rspec', '3.0.0'
gem 'rspec-rails', '~> 3.0' gem 'rspec-rails', '~> 3.0'
gem 'pry-rails' gem 'pry-rails'
gem 'dotenv-rails' gem 'dotenv-rails'
end end
@@ -100,13 +103,17 @@ end
group :development do group :development do
# A series of things you can use to benchmark a Rails or Ruby app. # A series of things you can use to benchmark a Rails or Ruby app.
gem 'derailed_benchmarks' gem 'derailed_benchmarks'
# To use all profiling methods available # To use all profiling methods available
gem 'stackprof' gem 'stackprof'
# Access an IRB console on exception pages or by using <%= console %> in views # Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0' 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 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
# gem 'spring' # gem 'spring'
end end
+10
View File
@@ -50,6 +50,10 @@ GEM
aws-sigv4 (1.0.2) aws-sigv4 (1.0.2)
bcrypt (3.1.11) bcrypt (3.1.11)
benchmark-ips (2.7.2) 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) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.7) bootstrap-sass (3.3.7)
@@ -101,6 +105,7 @@ GEM
dotenv-rails (2.2.1) dotenv-rails (2.2.1)
dotenv (= 2.2.1) dotenv (= 2.2.1)
railties (>= 3.2, < 5.2) railties (>= 3.2, < 5.2)
erubi (1.7.0)
erubis (2.7.0) erubis (2.7.0)
execjs (2.7.0) execjs (2.7.0)
factory_girl (4.8.1) factory_girl (4.8.1)
@@ -180,6 +185,8 @@ GEM
mongoid (~> 5.0) mongoid (~> 5.0)
rake rake
rspec (~> 3.3) rspec (~> 3.3)
mongoid-sadstory (0.0.2)
mongoid
mongoid_paranoia (0.2.1) mongoid_paranoia (0.2.1)
mongoid (>= 4) mongoid (>= 4)
mongoid-compatibility mongoid-compatibility
@@ -354,6 +361,8 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
aws-sdk (< 3.0) aws-sdk (< 3.0)
better_errors
binding_of_caller
bootstrap-sass (~> 3.3.5) bootstrap-sass (~> 3.3.5)
byebug byebug
capybara capybara
@@ -373,6 +382,7 @@ DEPENDENCIES
mongoid (~> 5.0.0) mongoid (~> 5.0.0)
mongoid-paperclip mongoid-paperclip
mongoid-rspec (= 3.0.0) mongoid-rspec (= 3.0.0)
mongoid-sadstory
mongoid_paranoia mongoid_paranoia
paperclip-i18n paperclip-i18n
pry-rails pry-rails
+1
View File
@@ -16,4 +16,5 @@
//= require typeahead.bundle //= require typeahead.bundle
//= require markerclusterer_compiled //= require markerclusterer_compiled
//= require i18n/translations //= require i18n/translations
//= require list
//= require_tree . //= require_tree .
@@ -33,6 +33,11 @@ class ApplicationController < ActionController::Base
false false
end end
def only_admin
return true if current_supporter && current_supporter.admin?
raise ActionController::RoutingError, 'Not Found'
end
protected protected
def configure_permitted_parameters def configure_permitted_parameters
-5
View File
@@ -57,9 +57,4 @@ class GreendaysController < ApplicationController
def greenday_params def greenday_params
params.require(:greenday).permit(:title, :address, :homepage, :description, :logo, :delete_logo) params.require(:greenday).permit(:title, :address, :homepage, :description, :logo, :delete_logo)
end end
def only_admin
return true if current_supporter && current_supporter.admin?
raise ActionController::RoutingError, 'Not Found'
end
end end
@@ -0,0 +1,75 @@
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
@network_signature_collections = Network::SignatureCollection.all
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,8 @@
class Network::SignatureCollection
include Mongoid::Document
field :location_name, type: String
field :location_zip, type: Integer
field :location_address, type: String
field :event_date_start, type: Time
field :event_date_end, type: Time
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,39 @@
h1 = title t('.title')
#signature_collections_table
input.search.form-control.string placeholder="#{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
javascript:
var options = {
valueNames: [ 'location_name', 'location_zip', 'location_address', 'event_date_start', 'event_date_end' ]
};
var signature_collections = new List('signature_collections_table', options);
@@ -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
+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'
+58 -64
View File
@@ -1,67 +1,61 @@
- title(t('shared.header.title_html')) = simple_form_for @supporter do |f|
.row = f.input :first_name, placeholder: t('.placeholders.first_name')
.col-xs-12.col-md-7 = f.input :last_name, placeholder: t('.placeholders.last_name')
h2.sr-only = t('.form') = f.input :street, placeholder: t('.placeholders.street')
= simple_form_for @supporter do |f| = f.input :city, placeholder: t('.placeholders.city')
= f.input :first_name, placeholder: t('.placeholders.first_name') = f.input :zip, placeholder: t('.placeholders.zip')
= f.input :last_name, placeholder: t('.placeholders.last_name') = f.input :email, placeholder: t('.placeholders.email')
= f.input :street, placeholder: t('.placeholders.street') = f.input :tel, placeholder: '+41 (0) xxxx'
= f.input :city, placeholder: t('.placeholders.city') = 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 :zip, placeholder: t('.placeholders.zip') = f.input :li_membership, as: :boolean
= f.input :email, placeholder: t('.placeholders.email') = f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first
= f.input :tel, placeholder: '+41 (0) xxxx' = f.input :comments, as: :text
= f.input :support, as: :radio_buttons, collection: t('support_type').map{ |x| [x.first, raw(x.last)]}, label_method: :last, value_method: :first .form-group
= f.input :li_membership, as: :boolean = f.submit value: t('.submit'), class: 'btn btn-success'
= f.input :age_category, as: :radio_buttons, collection: t('age_category'), label_method: :last, value_method: :first .form-group
= f.input :comments, as: :text = link_to t('.terms_and_conditions'), terms_and_conditions_path, class: 'small'
.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: javascript:
var cities = new Bloodhound({ var cities = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace, datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace, queryTokenizer: Bloodhound.tokenizers.whitespace,
remote: { remote: {
url: '/cities_autocomplete.json?query=%QUERY', url: '/cities_autocomplete.json?query=%QUERY',
wildcard: '%QUERY', wildcard: '%QUERY',
} }
}); });
var suggestion_template = function (data) { var suggestion_template = function (data) {
return '<p>' + data.plz + ' - ' + data.city + '</p>'; 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({ source: cities
minLength: 2, }).on('typeahead:selected', function(event, datum) {
},{ $("#supporter_city").val(datum.city);
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'
+7 -2
View File
@@ -35,5 +35,10 @@
= render 'right_side' = render 'right_side'
- else - 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"], access_key_id: ENV["S3_ACCESS_KEY"],
secret_access_key: ENV["S3_ACCESS_SECRET"] secret_access_key: ENV["S3_ACCESS_SECRET"]
} }
} }
end end
+31 -14
View File
@@ -19,34 +19,38 @@ de:
numbers: Zahlen numbers: Zahlen
statements: Statements statements: Statements
collection_concept: Wie macht man eine Volksinitiative? collection_concept: Wie macht man eine Volksinitiative?
network: Netzwerk
signature_collections: Unterschriftensammlung
lang: Sprache lang: Sprache
are_you_sure: Bist du sicher? are_you_sure: Bist du sicher?
edit: Bearbeiten edit: Bearbeiten
show: Anzeigen
destroy: Löschen
save: Speichern save: Speichern
description: Volksinitiative zur Legalisierung von Cannabis in der Schweiz. description: Volksinitiative zur Legalisierung von Cannabis in der Schweiz.
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 donation: Deine Spende
welcome_email: welcome_email:
subject: Besten Dank für deine Unterstützung! subject: Besten Dank für deine Unterstützung!
support_type: support_type:
signer: Ich würde eine Volksinitiative für die <span class="text-success">Legalisierung von Cannabis</span> unterschreiben. 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. 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. # 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>. # 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: Ich bin jünger als 18 Jahre alt underage: Ich bin jünger als 18 Jahre alt
young: Ich bin 18 bis 30 Jahre alt young: Ich bin 18 bis 30 Jahre alt
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: publicity_states:
pending: Die Veröffentlichung wurde noch nicht genehmigt pending: Die Veröffentlichung wurde noch nicht genehmigt
approved: Das Statement wurde Veröffentlicht approved: Das Statement wurde Veröffentlicht
@@ -56,7 +60,7 @@ de:
de: Deutsch de: Deutsch
fr: Français fr: Français
it: Italiano it: Italiano
supporters: supporters:
form: form:
form: Formular form: Formular
@@ -76,15 +80,15 @@ de:
renew: Statement neu einreichen renew: Statement neu einreichen
delete: Statement löschen 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_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.
new: new:
title: Hallo %{name} title: Hallo %{name}
edit: Meine Daten bearbeiten edit: Meine Daten bearbeiten
my_data: Meine Daten my_data: Meine Daten
publicities: publicities:
form: form:
title: Meine Meinung zur Cannabis-Initiative veröffentlichen title: Meine Meinung zur Cannabis-Initiative veröffentlichen
@@ -92,7 +96,7 @@ de:
organisation_placeholder: Parteizugehörigkeit, Verband oder sonstige Organisationen organisation_placeholder: Parteizugehörigkeit, Verband oder sonstige Organisationen
avatar: Lade ein Bild von dir Hoch avatar: Lade ein Bild von dir Hoch
save: Zur Überprüfung einsenden save: Zur Überprüfung einsenden
create: create:
success: Besten Dank die Daten werden überprüft. success: Besten Dank die Daten werden überprüft.
update: update:
@@ -100,16 +104,21 @@ de:
pages: pages:
show: show:
not_found: Die Seite konnte nicht gefunden werden. not_found: Die Seite konnte nicht gefunden werden.
thanks: thanks:
title: Besten Dank für deine Unterstützung! title: Besten Dank für deine Unterstützung!
statements: statements:
title: Statements von unseren Unterstützern title: Statements von unseren Unterstützern
submit_your_own_statement: Veröffentliche dein eigenes Statement... submit_your_own_statement: Veröffentliche dein eigenes Statement...
read_more: das ganze Statement lesen. read_more: das ganze Statement lesen.
network:
signature_collections:
index:
new: Neue Sammlung erfasssen
title: Unterschriftensammlungen
search: Suche
routes: routes:
initiative_text: initiativtext initiative_text: initiativtext
arguments: argumentarium arguments: argumentarium
@@ -120,6 +129,8 @@ de:
statementes: statements statementes: statements
collection_concept: Sammelkonzept collection_concept: Sammelkonzept
greendays: greensaturday greendays: greensaturday
network: netzwerk
signature_collections: unterschriftensammlung
mongoid: mongoid:
models: models:
@@ -146,4 +157,10 @@ de:
state: Status state: Status
organisation: Organisation organisation: Organisation
statement: Statement 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
+4
View File
@@ -24,6 +24,8 @@ fr:
statements: Déclarations statements: Déclarations
collection_concept: Comment faire une initiative populaire? (en allemand) collection_concept: Comment faire une initiative populaire? (en allemand)
my_account: Mon compte my_account: Mon compte
network: Réseau
signature_collections: Collection des signatures
lang: Langue lang: Langue
are_you_sure: Tu es sûre? are_you_sure: Tu es sûre?
@@ -117,6 +119,8 @@ fr:
statements: declarations statements: declarations
collection_concept: plan_de_collecte collection_concept: plan_de_collecte
greendays: greensaturday greendays: greensaturday
network: reseau
signature_collections: collection_signature
mongoid: mongoid:
models: models:
+5 -1
View File
@@ -21,7 +21,9 @@ it:
statements: Dichiarazioni statements: Dichiarazioni
collection_concept: Come fare un iniziativa popolare? (in tedesco) collection_concept: Come fare un iniziativa popolare? (in tedesco)
my_account: Il mio account my_account: Il mio account
network: Reticolato
signature_collections: collezione di firme
counter: counter:
supporters: "Sostenitore:" supporters: "Sostenitore:"
amount_of_supporters: Al momento abbiamo %{amount} sostenitori. amount_of_supporters: Al momento abbiamo %{amount} sostenitori.
@@ -121,6 +123,8 @@ it:
statements: dichiarazioni statements: dichiarazioni
collection_concept: sistema_di_raccolta collection_concept: sistema_di_raccolta
greendays: greensaturday greendays: greensaturday
network: reticolato
signature_collections: collezione_firme
mongoid: mongoid:
attributes: attributes:
+9
View File
@@ -62,16 +62,25 @@ SimpleNavigation::Configuration.run do |navigation|
unless supporter_signed_in? unless supporter_signed_in?
primary.item :home, I18n.t('.shared.topnavigation.support'), "/#{I18n.locale}" primary.item :home, I18n.t('.shared.topnavigation.support'), "/#{I18n.locale}"
end end
primary.item :initiative, I18n.t('.shared.topnavigation.initiative'), initiative_text_path do | initiative | 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 :arguments, I18n.t('.shared.topnavigation.arguments'), arguments_path
initiative.item :faq, I18n.t('.shared.topnavigation.faq'), faq_path initiative.item :faq, I18n.t('.shared.topnavigation.faq'), faq_path
initiative.item :numbers, I18n.t('.shared.topnavigation.numbers'), numbers_path initiative.item :numbers, I18n.t('.shared.topnavigation.numbers'), numbers_path
initiative.item :collection_concept, I18n.t('.shared.topnavigation.collection_concept'), collection_concept_path initiative.item :collection_concept, I18n.t('.shared.topnavigation.collection_concept'), collection_concept_path
end end
primary.item :statements, I18n.t('.shared.topnavigation.statements'), statements_path do |statements| primary.item :statements, I18n.t('.shared.topnavigation.statements'), statements_path do |statements|
statements.item :new_statement, I18n.t('.supporters.publicity.renew'), new_publicity_path statements.item :new_statement, I18n.t('.supporters.publicity.renew'), new_publicity_path
end end
primary.item :donation, I18n.t('donation'), donation_path 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'} primary.item :blog, 'Blog', 'http://blog.cannabis-initiative.ch/', link_html: { target: '_blank'}
if supporter_signed_in? if supporter_signed_in?
primary.item :home, I18n.t('.shared.topnavigation.my_account'), "/#{I18n.locale}" do |my_account| 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 Rails.application.routes.draw do
devise_for :supporters devise_for :supporters
root to: 'supporters#new' root to: 'supporters#new'
@@ -11,6 +12,11 @@ Rails.application.routes.draw do
end end
localized do localized do
get 'network', to: 'pages#show', as: :network, page: 'network'
namespace :network do
resources :signature_collections
end
resources :greendays resources :greendays
get '/initiative_text', to: 'pages#show', as: :initiative_text, page: 'initiative_text' get '/initiative_text', to: 'pages#show', as: :initiative_text, page: 'initiative_text'
get '/arguments', to: 'pages#show', as: :arguments, page: 'arguments' get '/arguments', to: 'pages#show', as: :arguments, page: 'arguments'
@@ -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,15 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Network::SignatureCollectionsHelper. For example:
#
# describe Network::SignatureCollectionsHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe Network::SignatureCollectionsHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
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,39 @@
require "rails_helper"
RSpec.describe Network::SignatureCollectionsController, type: :routing do
describe "routing" do
it "routes to #index" do
expect(:get => "/network/signature_collections").to route_to("network/signature_collections#index")
end
it "routes to #new" do
expect(:get => "/network/signature_collections/new").to route_to("network/signature_collections#new")
end
it "routes to #show" do
expect(:get => "/network/signature_collections/1").to route_to("network/signature_collections#show", :id => "1")
end
it "routes to #edit" do
expect(:get => "/network/signature_collections/1/edit").to route_to("network/signature_collections#edit", :id => "1")
end
it "routes to #create" do
expect(:post => "/network/signature_collections").to route_to("network/signature_collections#create")
end
it "routes to #update via PUT" do
expect(:put => "/network/signature_collections/1").to route_to("network/signature_collections#update", :id => "1")
end
it "routes to #update via PATCH" do
expect(:patch => "/network/signature_collections/1").to route_to("network/signature_collections#update", :id => "1")
end
it "routes to #destroy" do
expect(:delete => "/network/signature_collections/1").to route_to("network/signature_collections#destroy", :id => "1")
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
+1758
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long