Permalink
Browse files

Merge branch 'master' of github.com:huerlisi/learnyt

  • Loading branch information...
2 parents f6ef1f0 + 93ae50e commit f0b6628a35dd4f842da8e0fba696e94b2d5c2c3a @huerlisi committed Dec 18, 2010
View
@@ -13,6 +13,10 @@ class Person < ActiveRecord::Base
validates_date :date_of_birth, :date_of_death, :allow_nil => true, :allow_blank => true
validates_presence_of :vcard
+ def self.gender
+ [[I18n.t('activerecord.values.person.male'), MALE], [I18n.t('activerecord.values.person.female'), FEMALE]]
+ end
+
# Constructor
def initialize(attributes = nil)
super
@@ -26,6 +30,10 @@ def to_s
"%s (%s)" % [vcard.try(:full_name), vcard.try(:locality)]
end
+ def sex_to_s
+ sex.eql?MALE ? I18n.t('activerecord.values.person.male') : I18n.t('activerecord.values.person.female')
+ end
+
# Tags
acts_as_taggable
@@ -11,6 +11,7 @@
@import 'partials/content/quiz_assignments'
@import 'partials/content/ui_multiselect'
@import 'partials/content/e_mails'
+@import 'partials/content/ui_tabbs'
@import 'partials/content/application'
@@ -0,0 +1,9 @@
+#tabs
+ form.formtastic
+ border: none
+
+#tab-form_address
+ form.formtastic .date label
+ display: block
+ form.formtastic li fieldset .label
+ margin-top: 20px
@@ -0,0 +1,7 @@
+%div[resource]
+ = ui_tabs [ |
+ {:name => 'form_address', :partial => 'people/tab_form_address' }, |
+ {:name => 'form_remarks', :partial => 'people/tab_form_remarks' }, |
+ {:name => 'form_user', :partial => 'people/tab_form_user', :if => lambda { resource.user } }, |
+ {:name => 'create_user', :partial => 'people/tab_create_user', :unless => lambda { resource.user } } |
+ ] |
@@ -0,0 +1,2 @@
+page['#content .parent'].html(render('edit'))
+page.call('addTabsBehaviour')
@@ -0,0 +1,7 @@
+%div[resource]
+ = ui_tabs [ |
+ {:name => 'form_address' }, |
+ {:name => 'form_remarks' }, |
+ {:name => 'form_user', :if => lambda { resource.user } }, |
+ {:name => 'create_user', :unless => lambda { resource.user } } |
+ ] |
@@ -1,5 +1,8 @@
= semantic_form_for resource do |f|
= f.semantic_errors
+ = f.input :date_of_birth
+ = f.input :date_of_death
+ = f.input :sex, :as => :select, :collection => Person.gender
= f.inputs t('form.person.address') do
= render 'vcards/form', :f => f
@@ -1,5 +1,19 @@
= render 'people/tab_header'
+- [:date_of_birth, :date_of_death].each do |attr|
+ - if resource.send(attr)
+ %h2
+ = t("activerecord.attributes.person.#{attr}")
+ %p
+ = resource.send(attr)
+ %br
+- if resource.sex
+ %h2
+ = t("activerecord.attributes.person.sex")
+ %p
+ = resource.sex_to_s
+ %br
+
%h2
= t('learnyt.address')
= full_address(resource.vcard)
@@ -1,4 +1,5 @@
-= render 'people/tab_header'
+%h1
+ = resource
%h2
= t_title(:new, User)
@@ -0,0 +1,3 @@
+= render 'people/tab_header'
+
+= render 'people/form'
@@ -0,0 +1,10 @@
+= render 'people/tab_header'
+
+= semantic_form_for resource do |f|
+ = f.semantic_errors
+ = f.inputs do
+ = f.input :remarks, :input_html => {"class" => 'autogrow signable', :rows => 1}
+ = button_to_function t('learnyt.add_signature'), "$('.signable').insertAtCaret('\\n#{t('learnyt.signature', :name => current_user.person.vcard.full_name, :date_time => DateTime.now)}')"
+
+ = f.buttons do
+ = f.commit_button
@@ -0,0 +1,3 @@
+= render 'people/tab_header'
+- @user = resource.user
+= render 'users/form'
@@ -1,6 +1 @@
-= contextual_links
-
-%h1= t_title
-
-%div[resource]
- = render 'form'
+= render 'edit'
@@ -0,0 +1,2 @@
+page['#content .person'].html(render('edit'))
+page.call('addTabsBehaviour')
@@ -0,0 +1,7 @@
+%div[resource]
+ = ui_tabs [ |
+ {:name => 'form_address', :partial => 'people/tab_form_address' }, |
+ {:name => 'form_remarks', :partial => 'people/tab_form_remarks' }, |
+ {:name => 'form_user', :partial => 'people/tab_form_user', :if => lambda { resource.user } }, |
+ {:name => 'create_user', :partial => 'people/tab_create_user', :unless => lambda { resource.user } } |
+ ] |
@@ -0,0 +1,2 @@
+page['#content .student'].html(render('edit'))
+page.call('addTabsBehaviour')
@@ -0,0 +1,7 @@
+%div[resource]
+ = ui_tabs [ |
+ {:name => 'form_address', :partial => 'people/tab_form_address' }, |
+ {:name => 'form_remarks', :partial => 'people/tab_form_remarks' }, |
+ {:name => 'form_user', :partial => 'people/tab_form_user', :if => lambda { resource.user } }, |
+ {:name => 'create_user', :partial => 'people/tab_create_user', :unless => lambda { resource.user } } |
+ ] |
@@ -0,0 +1,2 @@
+page['#content .teacher'].html(render('edit'))
+page.call('addTabsBehaviour')
@@ -126,6 +126,11 @@ de:
body: Inhalt
send_at: Versandzeit
+ values:
+ person:
+ male: Mann
+ female: Frau
+
learnyt:
all: Alle
edit: Editieren
@@ -153,10 +158,13 @@ de:
all: Alle Aufgaben
tabs:
- address: Personalien
- remarks: Bemerkungen
- user: Login
- create_user: Benutzer anlegen
+ address: Personalien
+ remarks: Bemerkungen
+ user: Login
+ create_user: Benutzer anlegen
+ form_address: Personalien
+ form_remarks: Bemerkungen
+ form_user: Login
formtastic:
hints:

0 comments on commit f0b6628

Please sign in to comment.