finish foodcoop i18n + controller + model

This commit is contained in:
wvengen 2013-02-22 00:19:22 +01:00
parent c69a559dc4
commit 8043fd2164
11 changed files with 76 additions and 42 deletions

View file

@ -14,7 +14,8 @@ class Workgroup < Group
before_destroy :check_last_admin_group before_destroy :check_last_admin_group
def self.weekdays 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 end
# Returns an Array with date-objects to represent the next weekly-tasks # 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 # Check before destroy a group, if this is the last group with admin role
def check_last_admin_group def check_last_admin_group
if role_admin && Workgroup.where(:role_admin => true).size == 1 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
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 # Return an error if this is the last group with admin role and role_admin should set to false
def last_admin_on_earth def last_admin_on_earth
if !role_admin && Workgroup.where(:role_admin => true, :id.ne => id).empty? 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
end end

View file

@ -5,9 +5,9 @@
%table.table.table-striped %table.table.table-striped
%thead %thead
%tr %tr
%th Name %th= t '.name'
%th Mitglieder %th= t '.user'
%th zuletzt bestellt %th= t '.last_ordered'
%tbody %tbody
- for ordergroup in @ordergroups - for ordergroup in @ordergroups

View file

@ -1,13 +1,13 @@
- title "Bestellgruppen" - title t('.title')
.well .well
= form_tag foodcoop_ordergroups_path, :method => :get, :remote => true, 'data-submit-onchange' => true, = form_tag foodcoop_ordergroups_path, :method => :get, :remote => true, 'data-submit-onchange' => true,
class: 'form-search' do 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'} %label{:for => 'only_active'}
= check_box_tag 'only_active', 1, params[:only_active] = check_box_tag 'only_active', 1, params[:only_active]
Nur aktive = t '.only_active'
%small (mindestens einmal in den letzten 3 Monaten bestellt) %small= t '.only_active_desc'
#ordergroups #ordergroups
= render :partial => "ordergroups" = render :partial => "ordergroups"

View file

@ -4,12 +4,12 @@
%table.table.table-striped %table.table.table-striped
%thead %thead
%tr %tr
%th Benutzername %th= t 'simple_form.labels.user.nick'
%th Name %th= t 'simple_form.labels.user.name'
%th Email %th= t 'simple_form.labels.user.email'
%th Telefon %th= t 'simple_form.labels.user.phone'
%th Bestellgruppe %th= t 'simple_form.labels.user.ordergroup'
%th Arbeitsgruppe(n) %th= t 'simple_form.labels.user.workgroup', count: 3
%tbody %tbody
- for user in @users - for user in @users
%tr %tr

View file

@ -1,23 +1,18 @@
- title "Mitglieder" - title t('.title')
%section %section
%p = t('.body', profile_link: link_to(t('.profile_link'), my_profile_path)).html_safe
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.
.well .well
= form_tag foodcoop_users_path, :method => :get, :remote => true, = form_tag foodcoop_users_path, :method => :get, :remote => true,
'data-submit-onchange' => true, class: 'form-search' do 'data-submit-onchange' => true, class: 'form-search' do
= text_field_tag :user_name, params[:user_name], class: 'input-medium search-query', = 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', = text_field_tag :ordergroup_name, params[:ordergroup_name], class: 'input-medium search-query',
placeholder: 'Bestelllgruppe ...' placeholder: t('.ph_ordergroup')
%button.btn %button.btn
%i.icon-search %i.icon-search
#users #users
= render :partial => "users" = render :partial => "users"

View file

@ -1,7 +1,7 @@
%section.well %section.well
%h3= workgroup.name %h3= workgroup.name
= render :partial => 'shared/group', :locals => { :group => workgroup } = 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} = link_to_new_message message_params: {group_id: workgroup.id}
- if workgroup.member?(current_user) - 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'

View file

@ -1,11 +1,8 @@
- title "Gruppe bearbeiten" - title t('.title')
%p %p= t('.invite_new', invite_link: link_to(t('.invite_link'), new_invite_path(id: @workgroup.id))).html_safe
Neue Mitglieder kannst du
= link_to "hier", new_invite_path(id: @workgroup.id)
einladen.
= simple_form_for [:foodcoop, @workgroup] do |f| = simple_form_for [:foodcoop, @workgroup] do |f|
= render :partial => 'shared/group_form_fields', :locals => {:f => f} = render :partial => 'shared/group_form_fields', :locals => {:f => f}
.form-actions .form-actions
= f.submit = f.submit
= link_to "oder abbrechen", foodcoop_workgroups_path = link_to t('.or_cancel'), foodcoop_workgroups_path

View file

@ -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 = render :partial => "workgroup", :collection => @workgroups

View 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'

View file

@ -93,7 +93,14 @@ de:
delivered_on: 'Lieferdatum' delivered_on: 'Lieferdatum'
user: user:
nick: "Benutzername" nick: "Benutzername"
name: "Name"
last_name: "Nachname" last_name: "Nachname"
email: 'Email'
phone: "Telefon"
ordergroup: 'Bestellgruppe'
workgroup:
one: 'Arbeitsgruppe'
other: 'Arbeitsgruppen'
order_comment: order_comment:
text: Kommentiere diese Bestellung ... text: Kommentiere diese Bestellung ...
order: order:

View file

@ -8,3 +8,5 @@ de:
# used by controller # used by controller
update: update:
notice: 'Arbeitsgruppe wurde aktualisiert' 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'