Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added administration part of users

  • Loading branch information...
commit 17346f168e82d98f2df6d45e7496fa8d739079f1 1 parent ec137d3
@ZuevEvgenii authored
View
15 app/admin/users.rb
@@ -0,0 +1,15 @@
+ActiveAdmin.register User do
+ index do
+ column :email
+ column :activated
+ column :created_at
+ default_actions
+ end
+
+ show do
+ render "show"
+ end
+
+ form :partial => "form"
+end
+
View
3  app/controllers/pacients_controller.rb
@@ -4,10 +4,9 @@ def register
@user.email = params[:user][:email]
@user.password = params[:user][:password]
@user.password_confirmation = params[:user][:password_confirmation]
- @user.marker = Marker.new(:address => params[:user][:location], :group => Group.find_by_title("Patients"), :name => params[:user][:name])
+ @user.marker = Marker.new(:address => params[:user][:location], :group => Group.find_by_title("Patients"), :name => params[:user][:name], :published => params[:user][:publish_me])
@user.activated = false
-
if @user.save
UserMailer.welcome_email(@user).deliver
UserMailer.nearest_email(@user).deliver
View
2  app/models/user.rb
@@ -5,7 +5,7 @@ class User < ActiveRecord::Base
:recoverable, :rememberable, :trackable, :validatable, :confirmable
# Setup accessible (or protected) attributes for your model
- attr_accessible :email, :password, :password_confirmation, :remember_me
+ attr_accessible :email, :password, :password_confirmation, :remember_me, :activated
has_one :marker, :dependent => :destroy
end
View
9 app/views/admin/users/_form.html.erb
@@ -0,0 +1,9 @@
+<p>Email: <%= @user.email %> </p>
+<p>Marker name: <%= @user.marker.name %> </p>
+<p>Marker address: <%= @user.marker.address %> </p>
+<%= semantic_form_for [:admin, @user] do |f| %>
+ <%= f.label :activated %>
+ <%= f.check_box :activated %>
+ <%= f.buttons %>
+<% end %>
+
View
6 app/views/admin/users/_show.html.erb
@@ -0,0 +1,6 @@
+<h3> <%= user.email %> </h3>
+<p> <b> Activated: <%= user.activated %> </b> </p>
+<p> Marker name: <%= user.marker.name %> </p>
+<p> Address: <%= user.marker.address %> </p>
+Published: <%= user.marker.published %>
+
Please sign in to comment.
Something went wrong with that request. Please try again.