mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Adding and removing people
This commit is contained in:
parent
d95d8f234b
commit
3a2bf49f97
6 changed files with 64 additions and 28 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
class Admin::PeopleController < ApplicationController
|
class Admin::PeopleController < ApplicationController
|
||||||
before_filter :verify_organizer
|
before_filter :verify_organizer
|
||||||
|
respond_to :html
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@people = Person.all
|
@people = Person.all
|
||||||
|
|
@ -15,16 +16,28 @@ class Admin::PeopleController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def new
|
||||||
|
@person = Person.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@person = Person.new(params[:person])
|
||||||
|
flash[:notice] = 'Person was successfully created.' if @person.save
|
||||||
|
respond_with @person, :location => admin_people_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@person = Person.find(params[:id])
|
@person = Person.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def edit
|
||||||
|
@person = Person.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@person = Person.find(params[:id])
|
||||||
|
flash[:notice] = 'Person was successfully updated' if @person.update_attributes(params[:person])
|
||||||
|
respond_with @person, :location => admin_people_path
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete
|
def delete
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class Person < ActiveRecord::Base
|
||||||
|
|
||||||
validates :first_name, :presence => true
|
validates :first_name, :presence => true
|
||||||
validates :last_name, :presence => true
|
validates :last_name, :presence => true
|
||||||
|
validates :email, :presence => true
|
||||||
validate :biography_limit
|
validate :biography_limit
|
||||||
|
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
|
|
|
||||||
10
app/views/admin/people/_form.html.haml
Normal file
10
app/views/admin/people/_form.html.haml
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
= semantic_form_for [:admin, @person] do |f|
|
||||||
|
= f.inputs "Basic Information" do
|
||||||
|
= f.input :first_name, :as => :string
|
||||||
|
= f.input :last_name, :as => :string
|
||||||
|
= f.input :public_name, :as => :string
|
||||||
|
= f.input :email
|
||||||
|
= f.input :company, :as => :string
|
||||||
|
= f.input :biography, :input_html => {:rows => 10}
|
||||||
|
= f.actions do
|
||||||
|
= f.action :submit, :button_html => {:class => "btn primary"}
|
||||||
|
|
@ -1,29 +1,39 @@
|
||||||
%h2
|
.row-fluid
|
||||||
People
|
.span6
|
||||||
- if @people
|
%h2
|
||||||
= "(#{@people.length})"
|
People
|
||||||
.well
|
- if @people
|
||||||
%table.table.table-striped.table-bordered.table-hover#people
|
= "(#{@people.length})"
|
||||||
%thead
|
.span6
|
||||||
%th
|
.pull-right{:style=>"margin-top:20px; margin-bottom:20px;"}
|
||||||
%b Email
|
= link_to "New person", new_admin_person_path, :class => "btn btn-success"
|
||||||
%th
|
|
||||||
%b Last Name
|
.row-fluid
|
||||||
%th
|
.span12
|
||||||
%b First Name
|
.well
|
||||||
%th
|
%table.table.table-striped.table-bordered.table-hover#people
|
||||||
%b Public Name
|
%thead
|
||||||
%th
|
%th
|
||||||
%b # of Conference Registrations
|
%b Email
|
||||||
%th
|
%th
|
||||||
- @people.each do |person|
|
%b Last Name
|
||||||
%tr
|
%th
|
||||||
%td= person.email
|
%b First Name
|
||||||
%td= person.last_name
|
%th
|
||||||
%td= person.first_name
|
%b Public Name
|
||||||
%td= person.public_name
|
%th
|
||||||
%td= person.registrations.count
|
%b # of Conference Registrations
|
||||||
%td= link_to "View", admin_person_path(person)
|
%th
|
||||||
|
%th
|
||||||
|
- @people.each do |person|
|
||||||
|
%tr
|
||||||
|
%td= person.email
|
||||||
|
%td= person.last_name
|
||||||
|
%td= person.first_name
|
||||||
|
%td= person.public_name
|
||||||
|
%td= person.registrations.count
|
||||||
|
%td= link_to "Edit", edit_admin_person_path(person)
|
||||||
|
%td= link_to "View", admin_person_path(person)
|
||||||
|
|
||||||
:javascript
|
:javascript
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
|
|
|
||||||
1
app/views/application/edit.html.haml
Normal file
1
app/views/application/edit.html.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render :partial => "form"
|
||||||
1
app/views/application/new.html.haml
Normal file
1
app/views/application/new.html.haml
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
= render :partial => "form"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue