[refs #818] small ui changes

This commit is contained in:
Alexander Machehin 2012-12-29 18:38:14 +06:00
parent 1e878f0775
commit 70903249ce
8 changed files with 21 additions and 8 deletions

View File

@ -23,7 +23,7 @@ class Admin::UsersController < Admin::BaseController
@user.confirmed_at = Time.now.utc
if (@user.save rescue false)
flash[:notice] = t('flash.user.saved')
flash[:warning] = "Token=#{@user.reload.authentication_token}"
flash[:warning] = @user.authentication_token
redirect_to(@user.system? ? system_admin_users_path : admin_users_path)
else
flash[:error] = t('flash.user.save_error')
@ -53,7 +53,7 @@ class Admin::UsersController < Admin::BaseController
def destroy
@user.destroy
flash[:notice] = t("flash.user.destroyed")
redirect_to admin_users_path
redirect_to(@user.system? ? system_admin_users_path : admin_users_path)
end
def list
@ -93,7 +93,8 @@ class Admin::UsersController < Admin::BaseController
def reset_auth_token
@user.reset_authentication_token!
flash[:notice] = t("flash.user.reset_auth_token")
redirect_to 'system_index'
flash[:warning] = @user.authentication_token
redirect_to system_admin_users_path
end
protected

View File

@ -1,12 +1,13 @@
# -*- encoding : utf-8 -*-
class Api::V1::UsersController < Api::V1::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:show] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :user, :only => :show
before_filter :set_current_user, :except => :show
def show
@user = User.opened.find! params[:id] # dont show system users
end
def show_current_user
@ -45,4 +46,4 @@ class Api::V1::UsersController < Api::V1::BaseController
@user = current_user
end
end
end

View File

@ -14,3 +14,6 @@
%td.width18=radio_button_tag :myradio, 'system', true, {:id => 'users_filter', :class => 'niceRadio', :name => 'filter'}
%td.width135=t("layout.users.system")
.both
-if params[:action] != 'system'
.bordered
= link_to t("layout.users.system"), system_admin_users_path, :class => 'button'

View File

@ -1,6 +1,6 @@
users = @users.map do |user|
link_block = [
(link_to t('layout.reset_auth_token'), reset_auth_token_admin_user_path(user) if can? :edit, user),
(link_to t('layout.users.reset_token'), reset_auth_token_admin_user_path(user), :method => :put, :confirm => t('layout.users.confirm_reset_token') if can? :edit, user),
(link_to t('layout.delete'), admin_user_path(user), :method => :delete, :confirm => t('layout.users.confirm_delete') if can? :destroy, user)
].compact.join('&nbsp;|&nbsp;').html_safe

View File

@ -1,4 +1,4 @@
%h3.fix= title t("layout.users.system_header")
%h3.fix= title t("layout.users.system")
- columns = [{:type => 'html'}, {:type => nil, :sortable => false, :searchable => false, :class => 'buttons'}]
= raw datatable(columns, {:sort_by => "[0, 'asc']", :processing => t("layout.processing"), :search_label => t("layout.search.header"),

View File

@ -11,15 +11,19 @@ en:
show: User
back_to_the_list: ⇐ List of users
confirm_delete: Are you sure you want to remove this user?
confirm_reset_token: Are you sure you want to reset token for this user?
own_projects: My projects
part_projects: Projects participation
filter_header: Filter
system: System accounts
reset_token: Reset token
flash:
user:
saved: User saved successtully
save_error: Unable to save user data
destroyed: User account deleted
reset_auth_token: User token reseted successfully
activerecord:
models:

View File

@ -11,15 +11,19 @@ ru:
show: Пользователь
back_to_the_list: К списку пользователей
confirm_delete: Вы уверены, что хотите удалить этого пользователя?
confirm_reset_token: Вы уверены, что хотите сбросить токен этого пользователя?
own_projects: Мои проекты
part_projects: Участвую в проектах
filter_header: Фильтр
system: Служебные учетки
reset_token: Сбросить токен
flash:
user:
saved: Пользователь успешно сохранен
save_error: Не удалось сохранить данные о пользователе
destroyed: Учетная запись успешно удалена
reset_auth_token: Для учетной записи изменен токен
activerecord:
models:

View File

@ -100,7 +100,7 @@ Rosa::Application.routes.draw do
get :system
get :system_list
end
get :reset_auth_token, :on => :member
put :reset_auth_token, :on => :member
end
resources :register_requests, :only => [:index] do
put :update, :on => :collection