Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Unfinished people administration commited for starting pair programming.

  • Loading branch information...
commit 735a2e147a04674ff6d98ee53ddca65d79e9ce42 1 parent 9ea37d1
@raskhadafi raskhadafi authored
View
8 app/helpers/application_helper.rb
@@ -1,8 +1,7 @@
module ApplicationHelper
# Tabs
def ui_tab_link(name, options = {})
- only = options.delete(:only)
- return if only and !only.call
+ return if options[:if] and not options[:if].call
content_tag 'li' do
link_to t(name, :scope => 'tabs'), "#tab-#{name}"
@@ -10,9 +9,8 @@ def ui_tab_link(name, options = {})
end
def ui_tab_content(name, options = {})
- only = options.delete(:only)
- return if only and !only.call
-
+ return if options[:if] and !options[:if].call
+
partial = options.delete(:partial)
partial ||= "tab_#{name}"
View
7 app/views/parents/_show.html.haml
@@ -1,7 +0,0 @@
-%h2= t('learnyt.address')
-
-= full_address(resource.vcard)
-
-%h2= t_attr(:remarks, Person)
-
-%p.remarks<= resource.remarks
View
7 app/views/people/_show.html.haml
@@ -1,7 +0,0 @@
-#tabs.ui-tabs
- %ul
- = ui_tab_link 'address'
- = ui_tab_link 'user', :only => lambda { resource.user }
-
- = ui_tab_content 'address'
- = ui_tab_content 'user', :only => lambda { resource.user }
View
22 app/views/people/_tab_create_user.html.haml
@@ -0,0 +1,22 @@
+%h1
+ Create user
+- @user = resource.user
+= semantic_form_for @user do |f|
+ = f.semantic_errors
+ = f.inputs do
+ = f.input :email
+ = f.input :password, :hint => !f.object.new_record?, :input_html => {:autocomplete => "off"}
+ = f.input :password_confirmation
+ -# f.input :current_password, :required => true unless can?(:manage, User)
+ = f.input :role_texts, :as => :select, :collection => Ability.roles_for_collection, :include_blank => false, :input_html => {:multiple => 'multiple'}, :required => true if can?(:manage, Role)
+
+ - f.object.build_person unless f.object.person
+ = f.semantic_fields_for :person do |p|
+ = p.inputs t_attr(:address, Person) do
+ = render 'vcards/form', :f => p
+
+ = f.inputs t('learnyt.tags') do
+ = f.input :tag_list
+
+ = f.buttons do
+ = f.commit_button
View
0  app/views/students/_remarks_tab.html.haml → app/views/people/_tab_remarks.html.haml
File renamed without changes
View
8 app/views/people/show.html.haml
@@ -3,4 +3,10 @@
%h1= resource
%div[resource]
- = render 'show'
+ = ui_tabs [ |
+ {:name => 'address', :partial => 'people/tab_address' }, |
+ {:name => 'remarks', :partial => 'people/tab_remarks' }, |
+ {:name => 'user', :partial => 'people/tab_user', :if => lambda { resource.user } }, |
+ {:name => 'create_user', :partial => 'people/tab_create_user', :unless => lambda { resource.user } } |
+ ] |
+
View
5 app/views/students/_show.html.haml
@@ -1,5 +0,0 @@
-= ui_tabs [ |
- {:name => "address", :partial => 'people/address_tab' }, |
- {:name => "remarks"}, |
- {:name => "user", :partial => 'people/user_tab', :only => lambda { resource.user} } |
- ] |
Please sign in to comment.
Something went wrong with that request. Please try again.