Commit 1f8f8df3 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Ales Rosina
Browse files

setup journal model

parent 4d2177e3
......@@ -21,6 +21,9 @@ class Client < ApplicationRecord
has_many :relatives, as: :relativeable, dependent: :destroy
accepts_nested_attributes_for :relatives, allow_destroy: true
has_many :journal, as: :journalable
accepts_nested_attributes_for :journal
validates :state, inclusion: { in: STATES }
def self.gender_request_collection
......
class Journal < ApplicationRecord
belongs_to :user
end
......@@ -8,6 +8,9 @@ class Volunteer < ApplicationRecord
has_one :contact, as: :contactable
accepts_nested_attributes_for :contact
has_many :journal, as: :journalable
accepts_nested_attributes_for :journal
belongs_to :user, optional: true
belongs_to :registrar, optional: true,
......
......@@ -2,71 +2,72 @@
.col-xs-12
h1= @volunteer.contact.full_name
.row
.col-xs-12
.table-responsive
table.table.table-no-border-top
tbody
= render 'contacts/show', contact: @volunteer.contact
tr
td= t_attr(:date_of_birth)
td= l(@volunteer.date_of_birth) if @volunteer.date_of_birth
tr
td= t_attr(:gender)
td= t("gender.#{@volunteer.gender}") if @volunteer.gender.present?
tr
td= t_attr(:avatar)
td= image_tag @volunteer.avatar.url(:thumb) if @volunteer.avatar.present?
tr
td= t_attr(:nationality)
td= country(@volunteer.nationality)
tr
td= t_attr(:additional_nationality)
td= country(@volunteer.additional_nationality)
- if policy(Volunteer).supervisor_privileges?
= render 'journals/list_block', journal_records: @volunteer.journal
= render 'language_skills/show', speaker: @volunteer
.table-responsive
table.table.table-no-border-top
tbody
= render 'contacts/show', contact: @volunteer.contact
tr
td= t_attr(:date_of_birth)
td= l(@volunteer.date_of_birth) if @volunteer.date_of_birth
tr
td= t_attr(:gender)
td= t("gender.#{@volunteer.gender}") if @volunteer.gender.present?
tr
td= t_attr(:avatar)
td= image_tag @volunteer.avatar.url(:thumb) if @volunteer.avatar.present?
tr
td= t_attr(:nationality)
td= country(@volunteer.nationality)
tr
td= t_attr(:additional_nationality)
td= country(@volunteer.additional_nationality)
= render 'language_skills/show', speaker: @volunteer
tr
td= t_attr(:profession)
td= @volunteer.profession
tr
td= t_attr(:education)
td= @volunteer.education
tr
td= t_attr(:motivation)
td= @volunteer.motivation
tr
td= t_attr(:experience)
td= Volunteer.human_boolean(@volunteer.experience)
tr
td= t_attr(:expectations)
td= @volunteer.expectations
tr
td= t_attr(:strengths)
td= @volunteer.strengths
tr
td= t_attr(:interests)
td= @volunteer.interests
- if policy(Volunteer).destroy?
tr
td= t_attr(:state)
td= t("state.#{@volunteer.state}")
- if @volunteer.rejected?
tr
td= t_attr(:profession)
td= @volunteer.profession
tr
td= t_attr(:education)
td= @volunteer.education
tr
td= t_attr(:motivation)
td= @volunteer.motivation
tr
td= t_attr(:experience)
td= Volunteer.human_boolean(@volunteer.experience)
tr
td= t_attr(:expectations)
td= @volunteer.expectations
tr
td= t_attr(:strengths)
td= @volunteer.strengths
tr
td= t_attr(:interests)
td= @volunteer.interests
- if policy(Volunteer).destroy?
tr
td= t_attr(:state)
td= t("state.#{@volunteer.state}")
- if @volunteer.rejected?
tr
td= t_attr(:rejection_type)
td= t("rejection_type.#{@volunteer.rejection_type}") if @volunteer.rejection_type.present?
tr
td= t_attr(:rejection_text)
td= @volunteer.rejection_text
tr
td= t_attr(:duration)
td= t("duration.#{@volunteer.duration}") if @volunteer.duration.present?
tr
td= t_attr(:region)
td= t("region.#{@volunteer.region}") if @volunteer.region.present?
td= t_attr(:rejection_type)
td= t("rejection_type.#{@volunteer.rejection_type}") if @volunteer.rejection_type.present?
tr
td= t_attr(:region_specific)
td= @volunteer.region_specific
td= t_attr(:rejection_text)
td= @volunteer.rejection_text
tr
td= t_attr(:duration)
td= t("duration.#{@volunteer.duration}") if @volunteer.duration.present?
tr
td= t_attr(:region)
td= t("region.#{@volunteer.region}") if @volunteer.region.present?
tr
td= t_attr(:region_specific)
td= @volunteer.region_specific
h3= t_attr(:single_accompaniment)
.table-responsive
......
......@@ -90,10 +90,10 @@ de:
profile: Profil
role: Rolle
volunteer: &id-volunteer_attributes
address: Adresse
additional_email_addresses: Zusätzliche Mailadressen
additional_phone_numbers: Zusätzliche Telefonnummern
additional_nationality: Zusätzliche Nationalität
additional_phone_numbers: Zusätzliche Telefonnummern
address: Adresse
adults: Erwachsene
avatar: Bild
birth_year: Jahrgang
......@@ -144,10 +144,10 @@ de:
volunteer_email:
active: Aktiv
body: Textkörper
registrar: Registrator/in
subject: Betreff
title: Überschrift
user: Ersteller
registrar: Registrator/in
errors:
models:
profile:
......@@ -194,6 +194,7 @@ de:
volunteer: Freiwillige/n
volunteer_application: Freiwilligen Bewerbung
volunteer_email: Bestätigungsmail
add_entry: Eintrag Hinzufügen
add_language: Sprache hinzufügen
add_relative: Verwandte hinzufügen
age_request: &id-age_requests
......@@ -215,7 +216,6 @@ de:
client_destroyed: Klient/in wurde erfolgreich gelöscht.
client_updated: Klient/in wurde erfolgreich aktualisiert.
clients: Klienten/innen
profile_updated: Der Login wurde erfolgreich geändert.
contact_info: Kontakt Informationen
contacts:
fields:
......@@ -227,8 +227,8 @@ de:
crud:
c_action:
create: '%{model} wurde erfolgreich erstellt.'
update: '%{model} wurde erfolgreich geändert.'
destroy: '%{model} wurde erfolgreich gelöscht.'
update: '%{model} wurde erfolgreich geändert.'
title:
add: '%{model} hinzufügen'
updated: '%{model} wurde erfolgreich geändert.'
......@@ -369,6 +369,7 @@ de:
other_request: Sonstige Anforderungen an den/die Freiwillige/n
password_reset_instructions: Ich möchte mein Passwort zurücksetzen
personal_background: Persönlicher Hintergrund
profile_updated: Der Login wurde erfolgreich geändert.
region: &id-regions
canton: Kanton
city: Stadt
......@@ -498,20 +499,20 @@ de:
user_destroyed: 'Benutzer %{email} wurde erfolgreich gelöscht.'
users: Benutzer/in
voluntary_platform: Freiwilligen Plattform
volunteer_application: Freiwilligen Bewerbung
volunteer_availability: Wann sind Sie für einen Freiwilligeneinsatz verfügbar?
volunteer_created: Freiwillige/r wurde erfolgreich erstellt.
volunteer_destroyed: Freiwillige/r wurde erfolgreich gelöscht.
volunteer_emails: Bestätigungs-Mails
volunteer_engagement_type_will: Welche Art von Einsatz können Sie sich vorstellen?
volunteer_mailer:
welcome_email:
<<: *id-volunteer_attributes
submitted: Die Angaben der Anmeldung
lead: Dies ist die Bestätigung für das Freiwilligen Email
subject: Bestätigung der Anmeldung als Freiwillger bei der AOZ
volunteer_self_applicant: Selbstanmelder
volunteer_application: Freiwilligen Bewerbung
volunteer_created: Freiwillige/r wurde erfolgreich erstellt.
volunteer_destroyed: Freiwillige/r wurde erfolgreich gelöscht.
submitted: Die Angaben der Anmeldung
volunteer_request: Anforderungen an die/den Freiwillige/n
volunteer_self_applicant: Selbstanmelder
volunteer_updated: Freiwillige/r wurde erfolgreich aktualisiert.
volunteers: Freiwillige
wanna_apply: Möchten Sie sich als Freiwillige/r bewerben?
......
......@@ -23,11 +23,11 @@ en:
department: Department
email: Email
volunteer: &id-volunteer_attributes
address: Address
additional_email_addresses: Additional email addresses
additional_phone_numbers: Additional phone numbers
creative: Creative
culture: Culture
address: Address
duration: Duration of the accompaniment
family: Family
full_name: Name
......@@ -63,13 +63,13 @@ en:
volunteer_experience_desc: Description of voluntary experience
add_language: Add language
add_relative: Add family member
age_request: "Volunteer's age"
age_requests: &id-age_requests
age_middle: 36 - 50
age_no_matter: "doesn't matter"
age_old: older than 51
age_young: 20 - 35
all: All
age_request: "Volunteer's age"
application_submitted: Your application has been successfully sent.
are_you_sure: Are you sure?
are_you_sure_delete_user: 'Are you sure you want to delete %{email}?'
......@@ -91,8 +91,8 @@ en:
crud:
c_action:
create: '%{model} was successfully created.'
update: '%{model} was successfully updated.'
destroy: '%{model} was successfully deleted.'
update: '%{model} was successfully updated.'
title:
add: 'Add %{model}'
updated: '%{model} successfully updated.'
......@@ -186,8 +186,8 @@ en:
short: Short term
edit_login: Edit login
edit_profile: Edit profile
entry_year: Entry year
engagement_type_will: Welche Art von Einsatz können Sie sich vorstellen?
entry_year: Entry year
errors:
messages:
already_confirmed: was already confirmed, please try signing in
......@@ -205,10 +205,10 @@ en:
gender: &id-genders
female: female
male: male
gender_request: Volunteer's gender
gender_requests: &id-gender_requests
no_matter: gender doesn't matter
same: gender same
gender_request: Volunteer's gender
get_back: We will soon get back to you.
group_accompaniment: Group accompaniment
helpers:
......@@ -349,7 +349,6 @@ en:
users: Users
voluntary_platform: Voluntaries Platform
volunteer_application: Volunteer Application
volunteer_request: Request for volunteers
volunteer_availability: What times are you available for voluntary engagement?
volunteer_created: Volunteer was successfully created.
volunteer_destroyed: Volunteer was successfully deleted.
......@@ -358,8 +357,9 @@ en:
volunteer_mailer:
welcome_email:
<<: *id-volunteer_attributes
submitted: Data submitted with the application
subject: Volunteer application confirmation
submitted: Data submitted with the application
volunteer_request: Request for volunteers
volunteer_self_applicant: Self-applicant
volunteer_updated: Volunteer was successfully updated.
volunteers: Volunteers
......
class CreateJournals < ActiveRecord::Migration[5.1]
def change
create_table :journals do |t|
t.string :subject
t.references :user, index: true, foreign_key: true
t.text :body
t.references :journalable, polymorphic: true, index: true
t.datetime :deleted_at, index: true
t.timestamps
end
end
end
......@@ -75,8 +75,6 @@ ActiveRecord::Schema.define(version: 20170710142357) do
t.string "first_name"
t.string "last_name"
t.string "title"
t.string "primary_email"
t.string "primary_phone"
t.index ["contactable_type", "contactable_id"], name: "index_contacts_on_contactable_type_and_contactable_id"
t.index ["deleted_at"], name: "index_contacts_on_deleted_at"
end
......@@ -94,6 +92,20 @@ ActiveRecord::Schema.define(version: 20170710142357) do
t.index ["department_id", "user_id"], name: "index_departments_users_on_department_id_and_user_id"
end
create_table "journals", force: :cascade do |t|
t.string "subject"
t.bigint "user_id"
t.text "body"
t.string "journalable_type"
t.bigint "journalable_id"
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["deleted_at"], name: "index_journals_on_deleted_at"
t.index ["journalable_type", "journalable_id"], name: "index_journals_on_journalable_type_and_journalable_id"
t.index ["user_id"], name: "index_journals_on_user_id"
end
create_table "language_skills", force: :cascade do |t|
t.bigint "languageable_id"
t.string "language"
......@@ -179,19 +191,6 @@ ActiveRecord::Schema.define(version: 20170710142357) do
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
create_table "volunteer_emails", force: :cascade do |t|
t.string "subject"
t.string "title"
t.text "body"
t.bigint "user_id"
t.boolean "active"
t.datetime "deleted_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["deleted_at"], name: "index_volunteer_emails_on_deleted_at"
t.index ["user_id"], name: "index_volunteer_emails_on_user_id"
end
create_table "volunteers", force: :cascade do |t|
t.date "date_of_birth"
t.string "gender"
......@@ -242,7 +241,7 @@ ActiveRecord::Schema.define(version: 20170710142357) do
add_foreign_key "assignments", "volunteers"
add_foreign_key "clients", "users"
add_foreign_key "contact_points", "contacts"
add_foreign_key "journals", "users"
add_foreign_key "profiles", "users"
add_foreign_key "volunteer_emails", "users"
add_foreign_key "volunteers", "users"
end
FactoryGirl.define do
factory :journal do
subject 'MyString'
user nil
body 'MyText'
end
end
require 'application_system_test_case'
class JournalsTest < ApplicationSystemTestCase
# test "visiting the index" do
# visit journals_url
#
# assert_selector "h1", text: "Journal"
# end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment