finish foodcoop i18n + controller + model
This commit is contained in:
parent
c69a559dc4
commit
8043fd2164
11 changed files with 76 additions and 42 deletions
|
@ -14,7 +14,8 @@ class Workgroup < Group
|
|||
before_destroy :check_last_admin_group
|
||||
|
||||
def self.weekdays
|
||||
[["Montag", "1"], ["Dienstag", "2"], ["Mittwoch","3"],["Donnerstag","4"],["Freitag","5"],["Samstag","6"],["Sonntag","0"]]
|
||||
days = I18n.t('date.day_names')
|
||||
(0..days.length-1).map {|i| [days[i], i.to_s]}
|
||||
end
|
||||
|
||||
# Returns an Array with date-objects to represent the next weekly-tasks
|
||||
|
@ -54,7 +55,7 @@ class Workgroup < Group
|
|||
# Check before destroy a group, if this is the last group with admin role
|
||||
def check_last_admin_group
|
||||
if role_admin && Workgroup.where(:role_admin => true).size == 1
|
||||
raise "Die letzte Gruppe mit Admin-Rechten darf nicht gelöscht werden"
|
||||
raise I18n.t('workgroups.error_last_admin_group')
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -62,7 +63,7 @@ class Workgroup < Group
|
|||
# Return an error if this is the last group with admin role and role_admin should set to false
|
||||
def last_admin_on_earth
|
||||
if !role_admin && Workgroup.where(:role_admin => true, :id.ne => id).empty?
|
||||
errors.add(:role_admin, "Der letzten Gruppe mit Admin-Rechten darf die Admin-Rolle nicht entzogen werden")
|
||||
errors.add(:role_admin, I18n.t('workgroups.error_last_admin_role'))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th Name
|
||||
%th Mitglieder
|
||||
%th zuletzt bestellt
|
||||
%th= t '.name'
|
||||
%th= t '.user'
|
||||
%th= t '.last_ordered'
|
||||
|
||||
%tbody
|
||||
- for ordergroup in @ordergroups
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
- title "Bestellgruppen"
|
||||
- title t('.title')
|
||||
|
||||
.well
|
||||
= form_tag foodcoop_ordergroups_path, :method => :get, :remote => true, 'data-submit-onchange' => true,
|
||||
class: 'form-search' do
|
||||
= text_field_tag :name, params[:name], class: 'input-medium search-query', placeholder: 'Name ...'
|
||||
= text_field_tag :name, params[:name], class: 'input-medium search-query', placeholder: t('.name')
|
||||
%label{:for => 'only_active'}
|
||||
= check_box_tag 'only_active', 1, params[:only_active]
|
||||
Nur aktive
|
||||
%small (mindestens einmal in den letzten 3 Monaten bestellt)
|
||||
= t '.only_active'
|
||||
%small= t '.only_active_desc'
|
||||
|
||||
#ordergroups
|
||||
= render :partial => "ordergroups"
|
||||
= render :partial => "ordergroups"
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
%table.table.table-striped
|
||||
%thead
|
||||
%tr
|
||||
%th Benutzername
|
||||
%th Name
|
||||
%th Email
|
||||
%th Telefon
|
||||
%th Bestellgruppe
|
||||
%th Arbeitsgruppe(n)
|
||||
%th= t 'simple_form.labels.user.nick'
|
||||
%th= t 'simple_form.labels.user.name'
|
||||
%th= t 'simple_form.labels.user.email'
|
||||
%th= t 'simple_form.labels.user.phone'
|
||||
%th= t 'simple_form.labels.user.ordergroup'
|
||||
%th= t 'simple_form.labels.user.workgroup', count: 3
|
||||
%tbody
|
||||
- for user in @users
|
||||
%tr
|
||||
|
|
|
@ -1,23 +1,18 @@
|
|||
- title "Mitglieder"
|
||||
- title t('.title')
|
||||
|
||||
%section
|
||||
%p
|
||||
Hier kannst Du den Mitgliedern Deiner Foodcoop eine Nachricht schreiben.
|
||||
%br/
|
||||
Damit Deine Kontaktdaten einzusehen sind, musst Du sie unter
|
||||
= link_to "Einstellungen", my_profile_path
|
||||
freigeben.
|
||||
= t('.body', profile_link: link_to(t('.profile_link'), my_profile_path)).html_safe
|
||||
|
||||
.well
|
||||
= form_tag foodcoop_users_path, :method => :get, :remote => true,
|
||||
'data-submit-onchange' => true, class: 'form-search' do
|
||||
|
||||
= text_field_tag :user_name, params[:user_name], class: 'input-medium search-query',
|
||||
placeholder: 'Name ...'
|
||||
placeholder: t('.ph_name')
|
||||
= text_field_tag :ordergroup_name, params[:ordergroup_name], class: 'input-medium search-query',
|
||||
placeholder: 'Bestelllgruppe ...'
|
||||
placeholder: t('.ph_ordergroup')
|
||||
%button.btn
|
||||
%i.icon-search
|
||||
|
||||
#users
|
||||
= render :partial => "users"
|
||||
= render :partial => "users"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
%section.well
|
||||
%h3= workgroup.name
|
||||
= render :partial => 'shared/group', :locals => { :group => workgroup }
|
||||
= link_to "Alle Aufgaben zeigen", workgroup_tasks_path(workgroup_id: workgroup), class: 'btn'
|
||||
= link_to t('.show_tasks'), workgroup_tasks_path(workgroup_id: workgroup), class: 'btn'
|
||||
= link_to_new_message message_params: {group_id: workgroup.id}
|
||||
- if workgroup.member?(current_user)
|
||||
= link_to "Gruppe bearbeiten", edit_foodcoop_workgroup_path(workgroup), class: 'btn'
|
||||
= link_to t('.edit'), edit_foodcoop_workgroup_path(workgroup), class: 'btn'
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
- title "Gruppe bearbeiten"
|
||||
- title t('.title')
|
||||
|
||||
%p
|
||||
Neue Mitglieder kannst du
|
||||
= link_to "hier", new_invite_path(id: @workgroup.id)
|
||||
einladen.
|
||||
%p= t('.invite_new', invite_link: link_to(t('.invite_link'), new_invite_path(id: @workgroup.id))).html_safe
|
||||
= simple_form_for [:foodcoop, @workgroup] do |f|
|
||||
= render :partial => 'shared/group_form_fields', :locals => {:f => f}
|
||||
.form-actions
|
||||
= f.submit
|
||||
= link_to "oder abbrechen", foodcoop_workgroups_path
|
||||
= link_to t('.or_cancel'), foodcoop_workgroups_path
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
- title "Arbeitsgruppen"
|
||||
- title t('.title')
|
||||
|
||||
= t('.body').html_safe
|
||||
|
||||
%p
|
||||
Das bearbeiten von Gruppen ist nur für Mitglieder der Gruppe möglich.
|
||||
%br/
|
||||
Wenn du einer Gruppe beitreten willst, dann schreib doch den Mitgliedern eine Nachricht.
|
||||
|
||||
= render :partial => "workgroup", :collection => @workgroups
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
35
config/locales/de/de.foodcoop.yml
Normal file
35
config/locales/de/de.foodcoop.yml
Normal file
|
@ -0,0 +1,35 @@
|
|||
de:
|
||||
foodcoop:
|
||||
ordergroups:
|
||||
index:
|
||||
title: 'Bestellgruppen'
|
||||
name: Name ...
|
||||
only_active: 'Nur aktive'
|
||||
only_active_desc: '(mindestens einmal in den letzten 3 Monaten bestellt)'
|
||||
ordergroups:
|
||||
name: 'Name'
|
||||
user: 'Mitglieder'
|
||||
last_ordered: 'zuletzt bestellt'
|
||||
users:
|
||||
index:
|
||||
title: 'Mitglieder'
|
||||
body:
|
||||
<p>Hier kannst Du den Mitgliedern Deiner Foodcoop eine Nachricht schreiben.</p>
|
||||
<p>Damit Deine Kontaktdaten einzusehen sind, musst Du sie unter %{profile_link} freigeben.</p>
|
||||
profile_link: 'Einstellungen'
|
||||
ph_name: Name ...
|
||||
ph_ordergroup: Bestellgruppe ...
|
||||
workgroups:
|
||||
index:
|
||||
title: 'Arbeitsgruppen'
|
||||
body:
|
||||
<p>Das bearbeiten von Gruppen ist nur für Mitglieder der Gruppe möglich.<br/>
|
||||
Wenn du einer Gruppe beitreten willst, dann schreib doch den Mitgliedern eine Nachricht.</p>
|
||||
edit:
|
||||
title: 'Gruppe bearbeiten'
|
||||
invite_new: 'Neue Mitglieder kannst du %{invite_link} einladen.'
|
||||
invite_link: 'hier'
|
||||
or_cancel: 'oder abbrechen'
|
||||
workgroup:
|
||||
show_tasks: 'Alle Aufgaben zeigen'
|
||||
edit: 'Gruppe bearbeiten'
|
|
@ -93,7 +93,14 @@ de:
|
|||
delivered_on: 'Lieferdatum'
|
||||
user:
|
||||
nick: "Benutzername"
|
||||
name: "Name"
|
||||
last_name: "Nachname"
|
||||
email: 'Email'
|
||||
phone: "Telefon"
|
||||
ordergroup: 'Bestellgruppe'
|
||||
workgroup:
|
||||
one: 'Arbeitsgruppe'
|
||||
other: 'Arbeitsgruppen'
|
||||
order_comment:
|
||||
text: Kommentiere diese Bestellung ...
|
||||
order:
|
||||
|
|
|
@ -8,3 +8,5 @@ de:
|
|||
# used by controller
|
||||
update:
|
||||
notice: 'Arbeitsgruppe wurde aktualisiert'
|
||||
error_last_admin_group: 'Die letzte Gruppe mit Admin-Rechten darf nicht gelöscht werden'
|
||||
error_last_admin_role: 'Der letzten Gruppe mit Admin-Rechten darf die Admin-Rolle nicht entzogen werden'
|
||||
|
|
Loading…
Reference in a new issue