diff --git a/.gitignore b/.gitignore index 023345b6..82809a67 100644 --- a/.gitignore +++ b/.gitignore @@ -23,3 +23,4 @@ uploads/**/* *.supported mongoid.yml *. +sftp-config.json diff --git a/app/assets/images/availability-check-loader.gif b/app/assets/images/availability-check-loader.gif new file mode 100644 index 00000000..49b6d853 Binary files /dev/null and b/app/assets/images/availability-check-loader.gif differ diff --git a/app/assets/stylesheets/sign_up.css b/app/assets/stylesheets/sign_up.css index e681da25..d51deb25 100644 --- a/app/assets/stylesheets/sign_up.css +++ b/app/assets/stylesheets/sign_up.css @@ -1,10 +1,12 @@ .sign-up{ margin: 150px auto 0; position: relative; - text-align: center; - width: 500px; + /*text-align: center;*/ + width: 600px; +} +.sign-up.facebook-form{ + text-align: center; } - .sign-up .form{ background-color: #FFFFFF; box-shadow: 0 10px 20px #CBCBCB; @@ -52,10 +54,36 @@ margin-right: 10px; } +.sign-up .notify{ + font-size: 15px; +} + +.notify.alert{ + padding: 5px 10px 5px 3px; +} + +.notify .icon-ok{ + color: green; + margin-right: 3px; + margin-left: 3px; +} + +.notify .icon-remove{ + color: red; + margin-right: 3px; + margin-left: 3px; +} + .sign-up input[type=checkbox]{ margin-top: 0; } +.sign-up .error{ + border-color: #E9322D; + box-shadow: 0 0 6px #F8B987; + color: #B94A48; +} + .line{ border-bottom: 1px solid #EDEDED; } @@ -64,3 +92,9 @@ text-align: left; } +.loader{ + width:100px; + margin-left: 3px; +} + + diff --git a/app/controllers/admin/users_new_interface_controller.rb b/app/controllers/admin/users_new_interface_controller.rb index 77045ed3..c492083f 100644 --- a/app/controllers/admin/users_new_interface_controller.rb +++ b/app/controllers/admin/users_new_interface_controller.rb @@ -7,6 +7,18 @@ class Admin::UsersNewInterfaceController < OrbitMemberController open_for_user :only => [:setting_account, :edit_user_data, :update] open_for_visitor :only => [:index, :show] + def registration_approval + page_num = params[:page] || 1 + @users = User.approval_pending.page(page_num).per(12).desc("_id") + end + + def approve_registration + user = User.find(params[:users_new_interface_id]) + user.approved = true + user.save + redirect_to admin_users_new_interface_registration_approval_path + end + def index get_tags get_sub_roles @@ -385,6 +397,8 @@ class Admin::UsersNewInterfaceController < OrbitMemberController end @users = User.not_guest_user end + + protected def get_tags diff --git a/app/controllers/basic_infos_controller.rb b/app/controllers/basic_infos_controller.rb index 8386e13d..bda825e9 100644 --- a/app/controllers/basic_infos_controller.rb +++ b/app/controllers/basic_infos_controller.rb @@ -35,4 +35,20 @@ class BasicInfosController < ApplicationController end end + def check_availability + response = {} + case params[:type] + when "user_id" + response["success"] = User.where(:user_id => params[:value]).count > 0 ? false : true + when "user_email" + response["success"] = User.where(:email => params[:value]).count > 0? false : true + end + render :json => response.to_json + end + + + + + + end \ No newline at end of file diff --git a/app/controllers/facebook_controller.rb b/app/controllers/facebook_controller.rb index c2cc4d03..4662301c 100644 --- a/app/controllers/facebook_controller.rb +++ b/app/controllers/facebook_controller.rb @@ -69,14 +69,12 @@ class FacebookController< ApplicationController u.first_name_translations = firstname u.last_name_translations = lastname u.office_tel = user["phone"] - u.email = user["email"] - # u.email = "xyz@zyx.com" u.sex = user["gender"] || "unknown" u.remote_avatar_url = user["picture"] if user["picture"] if u.save render :json=>{"success"=>true,"user"=>user}.to_json else - render :json=>{"success"=>false,"message"=>"Email already occupied."}.to_json + render :json=>{"success"=>false,"message"=>"There was an error imporing data."}.to_json end else diff --git a/app/models/user/user.rb b/app/models/user/user.rb index 815ff355..ee5b08db 100644 --- a/app/models/user/user.rb +++ b/app/models/user/user.rb @@ -17,6 +17,7 @@ class User field :last_name, localize: true field :email field :sex, :default => 'unknown' + field :approved, type: Boolean, :default => false field :office_tel field :cache_dept,type: Hash field :status_record,type: Hash @@ -56,7 +57,8 @@ class User before_save :assign_default_position, :if => :assign_default_position? before_save :rebuild_status_record scope :remote_account, where(:nccu_id.ne => nil) - scope :not_guest_user, all_of(:name.ne => "guest") + scope :not_guest_user, all_of(:name.ne => "guest").and(:approved => true) + scope :approval_pending, where(:approved => false) validates :user_id, :presence => { :message => I18n.t("users.user_id_not_null") } , diff --git a/app/views/admin/users_new_interface/_not_approved_listing.html.erb b/app/views/admin/users_new_interface/_not_approved_listing.html.erb new file mode 100644 index 00000000..2a53aceb --- /dev/null +++ b/app/views/admin/users_new_interface/_not_approved_listing.html.erb @@ -0,0 +1,29 @@ + <% + if not_approved_listing.sex == 'male' + @user_sex = 'gender-man' + elsif not_approved_listing.sex == 'female' + @user_sex = 'gender-woman' + else + @user_sex = 'gender-none' + end + %> + + + + <% not_approved_listing.roles.each do |rf| %> + <% @roledata = Role.find(rf.id) %> + <%= @roledata.title %> + <% end %> + + + <%= link_to (not_approved_listing.name && not_approved_listing.name != not_approved_listing.email ? not_approved_listing.name : not_approved_listing.user_id),admin_users_new_interface_path(not_approved_listing) %> +
+ +
+ + <%= not_approved_listing.email %> + \ No newline at end of file diff --git a/app/views/admin/users_new_interface/_side_bar.html.erb b/app/views/admin/users_new_interface/_side_bar.html.erb index fbeedd3c..115d064b 100644 --- a/app/views/admin/users_new_interface/_side_bar.html.erb +++ b/app/views/admin/users_new_interface/_side_bar.html.erb @@ -29,7 +29,7 @@ <%= content_tag :li, link_to((content_tag(:span, t(:all_member))), admin_users_new_interface_index_path), :class => active_for_action('users_new_interface', 'index') %> <%= content_tag :li, link_to((content_tag(:span, t(:add_member))), new_admin_users_new_interface_path), :class => active_for_action('users_new_interface', 'new') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:member_authorization))), '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> - <%= content_tag :li, link_to((content_tag(:span, t(:member_registration))), '#'), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) %> + <%= content_tag :li, link_to((content_tag(:span, t(:member_registration))), admin_users_new_interface_registration_approval_path), :class => active_for_action('users_new_interface', 'registration_approval') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:member_role))),admin_roles_path ), :class => active_for_action('roles', 'index') if (is_admin? rescue nil) %> <%= content_tag :li, link_to((content_tag(:span, t(:member_info))), edit_admin_info_path(Info.first.id.to_s)), :class => active_for_action('users_new_interfacexx', 'index') if (is_admin? rescue nil) and Info.first %> <% end -%> diff --git a/app/views/admin/users_new_interface/registration_approval.html.erb b/app/views/admin/users_new_interface/registration_approval.html.erb new file mode 100644 index 00000000..f7d087b6 --- /dev/null +++ b/app/views/admin/users_new_interface/registration_approval.html.erb @@ -0,0 +1,31 @@ +<% content_for :side_bar do %> + <%= render :partial => 'admin/users_new_interface/side_bar' %> +<% end %> + +<%= render :partial => "js_and_css"%> + +
+ + + + + + + + + + + <% if !@users.blank? %> + <%= render :partial => "not_approved_listing",:collection=> @users %> + <% else %> + + <% end %> + +
RolesNameEmail
Hooray! No pending registration approvals left.
+
+
+ +
+ diff --git a/app/views/basic_infos/index.html.erb b/app/views/basic_infos/index.html.erb index 30af97a5..698fd41f 100644 --- a/app/views/basic_infos/index.html.erb +++ b/app/views/basic_infos/index.html.erb @@ -1,6 +1,6 @@ <%= stylesheet_link_tag "sign_up" %>
-
+
\ No newline at end of file + + + + + diff --git a/config/routes.rb b/config/routes.rb index 0c7e99d3..05aabae7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -20,6 +20,7 @@ Orbit::Application.routes.draw do get 'basic_infos' => "basic_infos#index" get 'basic_infos/form' => "basic_infos#form_page" get 'basic_infos/role_page' => "basic_infos#role_page" + get 'basic_infos/check_availability' => "basic_infos#check_availability" post 'basic_infos/role_update' => "basic_infos#role_update" match 'basic_infos/basic_info_update' => "basic_infos#basic_info_update" # routes for admin @@ -220,6 +221,8 @@ Orbit::Application.routes.draw do end resources :users + match "users_new_interface/registration_approval" => "users_new_interface#registration_approval" + resources :users_new_interface do member do get 'temp_edit' @@ -234,6 +237,8 @@ Orbit::Application.routes.draw do match "edit_user_data" => "users_new_interface#edit_user_data" ,:as => :edit_user_data match "setting_account" => "users_new_interface#setting_account" ,:as => :setting_account match "edit_privilege" => "users_new_interface#edit_privilege" ,:as => :edit_privilege + match "approve_registration" => "users_new_interface#approve_registration", :as => :approve_registration + end resources :member_selects do