Revert "new ui member settings account data"

This reverts commit e1f4ee464b.
This commit is contained in:
saurabhbhatia 2013-10-18 19:51:02 +08:00
parent e1f4ee464b
commit 3e491380cd
11 changed files with 5 additions and 383 deletions

View File

@ -4,7 +4,6 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
helper OrbitBackendHelper helper OrbitBackendHelper
before_filter :set_attribute,:except => [:index,:show] before_filter :set_attribute,:except => [:index,:show]
open_for_user :only => [:setting_account, :edit_user_data, :update]
open_for_visitor :only => [:index, :show] open_for_visitor :only => [:index, :show]
def index def index
@ -184,36 +183,6 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
@user = User.find(params[:users_new_interface_id]) @user = User.find(params[:users_new_interface_id])
end end
def edit_user_data
if params[:users_new_interface_id].blank?
redirect_to :action => :index
else
@user = User.find(params[:users_new_interface_id])
if current_user.id != @user.id
redirect_to :action => :index
end
@form_index = 0
get_info_and_roles
end
end
def setting_account
if params[:users_new_interface_id].blank?
redirect_to :action => :index
else
@user = User.find(params[:users_new_interface_id])
if current_user.id != @user.id
redirect_to :action => :index
end
end
end
def update def update
@user = User.find(params[:id]) @user = User.find(params[:id])
@ -234,37 +203,6 @@ class Admin::UsersNewInterfaceController < OrbitMemberController
render :action => :edit_passwd, :notice => flash.now[:error] render :action => :edit_passwd, :notice => flash.now[:error]
end end
elsif params[:edit_type] == 'edit_user_data'
if current_user.id != @user.id
redirect_to :action => :index
end
@user.update_attributes(params[:user])
attribute_values_key = params[:user].has_key?('new_attribute_values') ? 'new_attribute_values' : 'attribute_values'
attribute_values = params[:user].delete(attribute_values_key)
@user.save
redirect_to :action => :show
elsif params[:edit_type] == 'setting_account'
if current_user.id != @user.id
redirect_to :action => :index
end
if !@user.valid_password?(params[:old_password])
flash.now[:error] = t("users.valid_old_password")
end
if !flash.now[:error] && @user.update_attributes(params[:user])
redirect_to :action => :show
else
render :action => :setting_account, :notice => flash.now[:error]
end
else else
@user.update_attributes(params[:user]) @user.update_attributes(params[:user])

View File

@ -1,81 +0,0 @@
<%= render :partial=>"infos"%>
<div id="roles-area" class="input-area">
<%=render :partial=>"user_role_data",:collection=>Role.all.asc("_id")%>
</div>
<% content_for :page_specific_javascript do -%>
<% ( params[:users_new_interface_id].blank? ? @fname = 'new_attribute_values' : @fname = 'attribute_values' ) %>
<!-- Text -->
<script id="template-text" type="text/x-tmpl">
<div class="input-append">
<input type="text" id="${roleType+'_text_'+appendIndex}" name="${'user[<%= @fname %>]['+nameNumber+'][value][]'}" class="input-medium" placeholder="">
<a href="#" class="btn remove-input">
<i class="icon-trash"></i>
</a>
</div>
</script>
<!-- Text Language -->
<script id="template-text-language" type="text/x-tmpl">
<div class="input-append">
<div class="tab-content">
<% VALID_LOCALES.collect do |locale| %>
<% active = (locale == @site_valid_locales.first ? "active" : "") %>
<div class="tab-pane fade <%= active %> in" id="${roleType+'_text_language_<%= locale %>_'+appendIndex}">
<input type="text" name="${'user[<%= @fname %>]['+nameNumber+'][value][][<%= locale %>]'}" placeholder="<%= I18nVariable.from_locale(locale) %>" value="">
</div>
<% end %>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<% VALID_LOCALES.collect do |locale| %>
<% active = (locale == @site_valid_locales.first ? "active" : "") %>
<a class="btn <%= active %>" href="${'#'+roleType+'_text_language_<%= locale %>_'+appendIndex}" data-toggle="tab"><%= I18nVariable.from_locale(locale) %></a>
<% end %>
<a href="#" class="btn remove-input"><i class="icon-trash"></i></a>
</div>
</div>
</script>
<!-- Address -->
<script id="template-address" type="text/x-tmpl">
<div class="input-append">
<div class="tab-content">
<div class="tab-pane fade active in" id="${roleType+'_address_en_'+appendIndex}">
<input type="text" name="${'user[new_attribute_values]['+nameNumber+'][value][en]'}" placeholder="Address" value="">
<input type="hidden" id="${roleType+'_street_address_en_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][en][street_address]'}" value="">
<input type="hidden" id="${roleType+'_cityarea_en_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][en][county]'}" value="">
<input type="hidden" id="${roleType+'_city_en_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][en][city]'}" value="">
<input type="hidden" id="${roleType+'_zip_en_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][en][zip]'}" value="">
<input type="hidden" id="${roleType+'_county_en_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][en][country]'}" value="">
<input type="hidden" id="${roleType+'_indicator_en_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][en][indicator]'}" value="">
</div>
<div class="tab-pane fade" id="${roleType+'_address_zh_tw_'+appendIndex}">
<input type="text" name="${'user[new_attribute_values]['+nameNumber+'][value][zh_tw]'}" placeholder="地址" value="">
<input type="hidden" id="${roleType+'_street_address_zh_tw_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][zh_tw][street_address]'}" value="">
<input type="hidden" id="${roleType+'_cityarea_zh_tw_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][zh_tw][county]'}" value="">
<input type="hidden" id="${roleType+'_city_zh_tw_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][zh_tw][city]'}" value="">
<input type="hidden" id="${roleType+'_zip_zh_tw_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][zh_tw][zip]'}" value="">
<input type="hidden" id="${roleType+'_county_zh_tw_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][zh_tw][country]'}" value="">
<input type="hidden" id="${roleType+'_indicator_zh_tw_'+appendIndex}" name="${'user[new_attribute_values]['+nameNumber+'][address_ext][zh_tw][indicator]'}" value="">
</div>
</div>
<div class="btn-group" data-toggle="buttons-radio">
<a class="btn active" href="${'#'+roleType+'_address_en_'+appendIndex}" data-toggle="tab">English</a>
<a class="btn" href="${'#'+roleType+'_address_zh_tw_'+appendIndex}" data-toggle="tab">Chinese</a>
<a class="btn" href="#address-field" role="button" data-toggle="modal"><i class="icon-edit"></i></a>
<a href="#" class="btn remove-input"><i class="icon-trash"></i></a>
</div>
</div>
</script>
<% end -%>

View File

@ -1,91 +0,0 @@
<% role_disable = @user.roles.include?(user_role_data) ? false : true %>
<div class="attributes <%= role_disable ? 'disabled hide' : '' %>">
<div class="attributes-header clearfix">
<%= hidden_field_tag("user[disable_role][id][#{user_role_data.id}]",role_disable,:for=>@form_index,:value=>role_disable)%>
<h4><%= user_role_data.title %><%= t(:role_info)%></h4>
</div>
<div class="attributes-body">
<% @form_index = @form_index +1 %>
<div class="control-group">
<%= label_tag t(:status), nil, {:func=>"field_label", :for=>"1", :class=>"control-label muted"} %>
<div class="controls">
<% user_role_data.role_statuses.where(:disable => false).each_with_index do |rrs, i|%>
<%= hidden_field_tag("user[role_status][id][#{rrs.id}]", false,:for=>"#{@form_index}")%>
<%= label_tag(i,check_box_tag( "user[role_status][id][#{rrs.id}]", true, @user.role_statuses.include?(rrs))+rrs.title,:class=>"checkbox inline") %>
<% end %>
</div>
</div>
<% @form_index = @form_index +1 %>
<div class="control-group">
<%= label_tag t(:category), nil, {:func=>"field_label", :for=>"1", :class=>"control-label muted"} %>
<div class="controls">
<% user_role_data.role_categorys.where(:disable => false).each_with_index do |rrcg, i|%>
<%= hidden_field_tag("user[role_category][id][#{rrcg.id}]", false,:for=>"#{@form_index}")%>
<%= label_tag(i,check_box_tag( "user[role_category][id][#{rrcg.id}]", true, @user.role_categorys.include?(rrcg))+rrcg.title,:class=>"checkbox inline") %>
<% end %>
</div>
</div>
<% user_role_data.attribute_fields.asc(:_id).each do |rf|%>
<%= rf.block_helper(@user,@form_index)%>
<% @form_index = @form_index +1 %>
<% end %>
<% @form_index = @form_index +1 %>
<div class="input-area sub-role">
<% user_role_data.sub_roles.where(:disabled=>false).asc("_id").each do |sub_role| %>
<% sub_role_disable = @user.sub_roles.include?(sub_role) ? false : true %>
<div class="attributes <%= sub_role_disable ? 'disabled hide' : '' %>">
<div class="attributes-header clearfix">
<%= hidden_field_tag("user[disable_sub_role][id][#{sub_role.id}]",sub_role_disable,:for=>@form_index,:value=>sub_role_disable)%>
<h4><%= sub_role.title %><%= t(:role_info)%></h4>
</div>
<div class="attributes-body">
<% sub_role.attribute_fields.asc(:_id).each do |af|%>
<%= af.block_helper(@user,@form_index)%>
<% @form_index = @form_index +1 %>
<% end %>
</div>
</div>
<% end %>
</div>
</div>
</div>

View File

@ -1,53 +0,0 @@
<%#= devise_error_messages! %>
<%= flash_messages %>
<div class="attributes">
<div class="attributes-header clearfix">
<h4><%=t("users.user_basic_id_form")%></h4>
</div>
<div class="attributes-body">
<!-- Account -->
<div class="control-group">
<label class="control-label muted" for="account">
<%= f.label t("users.user_id"),:class=>"control-label" %>
</label>
<div class="controls add-input">
<span><%= @user.user_id %></span>
</div>
</div>
<!-- Old Password -->
<div class="control-group">
<label class="control-label muted" for="password">
<%= f.label t("password_current"),:class=>"control-label" %>
</label>
<div class="controls add-input">
<%= password_field_tag "old_password",nil, :class=>"input-medium", :id=>"password" %>
</div>
</div>
<!-- Password -->
<div class="control-group">
<label class="control-label muted" for="password">
<%= f.label t("users.new_password"),:class=>"control-label" %>
</label>
<div class="controls add-input">
<%= f.password_field :password, :class=>"input-medium", :id=>"password" %>
<span class="help-block"><%= t("users.new_password_note")%></span>
</div>
</div>
<!-- Confirm Password -->
<div class="control-group">
<label class="control-label muted" for="confirm_password">
<%= f.label t("users.new_password_confirmation"),:class=>"control-label" %>
</label>
<div class="controls add-input">
<%= f.password_field :password_confirmation, :class=>"input-medium", :id=>"confirm_password" %>
</div>
</div>
</div>
</div>

View File

@ -1,43 +0,0 @@
<% content_for :side_bar do %>
<%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %>
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %>
<%= stylesheet_link_tag "lib/main-forms.css" %>
<%= stylesheet_link_tag "lib/fileupload.css" %>
<%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%>
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery-ui-1.10.3.custom.min.js" %>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "lib/bootstrap-fileupload.js" %>
<%= javascript_include_tag "lib/bootstrap-datetimepicker.js" %>
<%= javascript_include_tag "lib/datetimepicker/date.time.picker.js" %>
<%= javascript_include_tag "lib/member/textarea-lang-btn.js" %>
<%= javascript_include_tag "lib/member/role-forms.js" %>
<% end -%>
<%= form_for @user, :url => admin_users_new_interface_path(@user), :html => { :multipart => true , :class=>"form-horizontal main-forms", :id=>"user-forms"} do |f| %>
<fieldset>
<div id="basic-area" class="input-area">
<%= f.error_messages %>
<%= render :partial => 'user_basic', :locals => {:f => f}%>
<%= render :partial => 'form_user_data', :locals => { :f => f } %>
</div>
<div class="form-actions">
<%= hidden_field_tag 'edit_type', 'edit_user_data' %>
<%= link_to t(:update_), "#", :class=>"btn btn-primary returnDecide", :onclick=>"$('#user-forms').submit()" %>
<%= link_back('btn') %>
</div>
</fieldset>
<% end -%>

View File

@ -1,39 +0,0 @@
<% content_for :side_bar do %>
<%= render :partial => 'admin/users_new_interface/side_bar' %>
<% end %>
<% content_for :page_specific_css do -%>
<%= stylesheet_link_tag "lib/wrap-nav.css" %>
<%= stylesheet_link_tag "lib/pageslide.css" %>
<%= stylesheet_link_tag "lib/main-forms.css" %>
<%= stylesheet_link_tag "lib/fileupload.css" %>
<%= stylesheet_link_tag "lib/togglebox.css" %>
<% end -%>
<% content_for :page_specific_javascript do -%>
<%= javascript_include_tag "lib/jquery.tmpl.min.js" %>
<%= javascript_include_tag "lib/bootstrap-fileupload.js" %>
<%= javascript_include_tag "lib/member/role-forms.js" %>
<%= javascript_include_tag "lib/member/textarea-lang-btn.js" %>
<% end -%>
<%= form_for @user, :url => admin_users_new_interface_path(@user), :html => { :multipart => true , :class=>"form-horizontal main-forms"} do |f| %>
<fieldset>
<div id="basic-area" class="input-area">
<%= f.error_messages %>
<%= render :partial => 'user_setting_account', :locals => {:f => f}%>
</div>
<div class="form-actions">
<%= link_back('btn') %>
<%= hidden_field_tag 'edit_type', 'setting_account' %>
<%= link_to t(:update_), "#", :class=>"btn btn-primary returnDecide", :onclick=>"$('#edit_user_#{@user.id}').submit()" %>
</div>
</fieldset>
<% end -%>

View File

@ -20,7 +20,7 @@
<small class="muted"><%= @user.email %></small> <small class="muted"><%= @user.email %></small>
<div class="btn-group"> <div class="btn-group">
<%= link_to("<i class='icon-edit'></i> #{t(:edit)}".html_safe,edit_admin_users_new_interface_path(@user),:class=>"btn btn-mini" ) if is_admin?%> <%= link_to("<i class='icon-edit'></i> #{t(:edit)}".html_safe,edit_admin_users_new_interface_path(@user),:class=>"btn btn-mini" ) if is_admin?%>
<%= link_to("<i class='icons-cycle'></i> #{t("users.change_passwd")}".html_safe,admin_users_new_interface_edit_passwd_path(@user),:class=>"btn btn-mini" ) if is_admin? and current_user.id != @user.id %> <%= link_to("<i class='icons-cycle'></i> #{t("users.change_passwd")}".html_safe,admin_users_new_interface_edit_passwd_path(@user),:class=>"btn btn-mini" ) if is_admin?%>
</div> </div>
</div> </div>

View File

@ -31,11 +31,8 @@
<span><%= current_user.name %></span> <span><%= current_user.name %></span>
</a> </a>
<ul class="dropdown-menu" role="menu" aria-labelledby="orbit-user"> <ul class="dropdown-menu" role="menu" aria-labelledby="orbit-user">
<li><%= link_to content_tag(:i, nil, class: 'icons-tools') + ' ' + t("users.change_passwd"), admin_users_new_interface_setting_account_path(current_user), tabindex: '-1' %></li> <li><%= link_to content_tag(:i, nil, class: 'icons-tools') + ' ' + t(:account_settings), desktop_path + "#settings-account", tabindex: '-1' %></li>
<li><%= link_to content_tag(:i, nil, class: 'icons-vcard') + ' ' + t("users.user_basic_data"), admin_users_new_interface_edit_user_data_path(current_user), tabindex: '-1' %></li>
<% if @site.desktop_closed.blank? %>
<li><%= link_to content_tag(:i, nil, class: 'icons-screen') + ' ' + t(:desktop), desktop_path, tabindex: '-1' %></li> <li><%= link_to content_tag(:i, nil, class: 'icons-screen') + ' ' + t(:desktop), desktop_path, tabindex: '-1' %></li>
<% end %>
<li><%= link_to content_tag(:i, nil, class: 'icons-logout') + ' ' + t(:logout), destroy_user_session_path, tabindex: '-1' %></li> <li><%= link_to content_tag(:i, nil, class: 'icons-logout') + ' ' + t(:logout), destroy_user_session_path, tabindex: '-1' %></li>
<li class="divider"></li> <li class="divider"></li>
<li><a tabindex="-1" href="#"><i class="icons-lifebuoy"></i> <%= t(:help) %></a></li> <li><a tabindex="-1" href="#"><i class="icons-lifebuoy"></i> <%= t(:help) %></a></li>

View File

@ -11,6 +11,7 @@ en:
not_sub_manager: Access Denied for you are not SubManager for this app not_sub_manager: Access Denied for you are not SubManager for this app
not_admin: Access Denied for you are not Admin not_admin: Access Denied for you are not Admin
object: Access Denied for you don't have permission for this object object: Access Denied for you don't have permission for this object
account_settings: Account settings
academic_info: Academic Info. academic_info: Academic Info.
action: Action action: Action
ad: ad:
@ -486,13 +487,12 @@ en:
users: users:
admin_change_password: You cannot change your own password here! admin_change_password: You cannot change your own password here!
avatar: Profile Picture avatar: Profile Picture
change_passwd: Change Password change_passwd: Change password
email: Email email: Email
first_name: First Name first_name: First Name
last_name: Last Name last_name: Last Name
male: Male male: Male
name: Name name: Name
valid_old_password: Current password doesn't match confirmation
new_password: New password new_password: New password
new_password_note: At least 6 characters new_password_note: At least 6 characters
new_password_confirmation: Confirm new password new_password_confirmation: Confirm new password
@ -508,8 +508,6 @@ en:
user_id_not_null: User account cannot be null user_id_not_null: User account cannot be null
user_id_length: User account should be more than 3 characters user_id_length: User account should be more than 3 characters
user_id_error: Someone already use that user account user_id_error: Someone already use that user account
user_basic_id_form: Account Info.
user_basic_data: Personal Profile
version: Version version: Version
vertical: Vertical vertical: Vertical
view: View view: View

View File

@ -11,6 +11,7 @@ zh_tw:
not_sub_manager: 拒絕存取,因你不是此應用程式次管理員 not_sub_manager: 拒絕存取,因你不是此應用程式次管理員
not_admin: 拒絕存取,因你不是系統管理者 not_admin: 拒絕存取,因你不是系統管理者
object: 拒絕存取,因你沒有權限 object: 拒絕存取,因你沒有權限
account_settings: 帳號設定
academic_info: 學術資訊 academic_info: 學術資訊
action: 操作 action: 操作
ad: ad:
@ -492,7 +493,6 @@ zh_tw:
first_name: 名字 first_name: 名字
male: 男性 male: 男性
name: 姓名 name: 姓名
valid_old_password: 目前的密碼不符合確認值
new_password: 新密碼 new_password: 新密碼
new_password_note: 至少6個字元 new_password_note: 至少6個字元
new_password_confirmation: 確認新密碼 new_password_confirmation: 確認新密碼
@ -509,8 +509,6 @@ zh_tw:
user_id_not_null: 使用者帳號不能是空值 user_id_not_null: 使用者帳號不能是空值
user_id_length: 使用者帳號至少需要3個字元 user_id_length: 使用者帳號至少需要3個字元
user_id_error: 該使用者帳號已被使用 user_id_error: 該使用者帳號已被使用
user_basic_id_form: 帳號資料
user_basic_data: 個人資料
version: 版本 version: 版本
vertical: 垂直的 vertical: 垂直的
view: 檢視 view: 檢視

View File

@ -221,8 +221,6 @@ Orbit::Application.routes.draw do
post 'update_order_list' post 'update_order_list'
end end
match "edit_passwd" => "users_new_interface#edit_passwd" ,:as => :edit_passwd match "edit_passwd" => "users_new_interface#edit_passwd" ,:as => :edit_passwd
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
end end
resources :member_selects do resources :member_selects do