the_role 0.9.92 → 0.9.93
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/app/controllers/admin/roles_controller.rb +2 -2
- data/app/views/admin/roles/{_form.slim → _form.haml} +5 -6
- data/app/views/admin/roles/{edit.slim → edit.html.haml} +11 -11
- data/app/views/admin/roles/{index.slim → index.haml} +5 -5
- data/app/views/admin/roles/new.html.haml +13 -0
- data/app/views/layouts/the_role.html.haml +15 -0
- data/config/locales/en.yml +42 -0
- data/config/locales/ru.yml +33 -33
- data/lib/the_role/version.rb +1 -1
- data/the_role.gemspec +1 -1
- metadata +11 -10
- data/app/views/admin/roles/new.slim +0 -12
- data/app/views/layouts/the_role.slim +0 -15
data/Gemfile
CHANGED
@@ -29,8 +29,8 @@ class Admin::RolesController < ApplicationController
|
|
29
29
|
|
30
30
|
def update
|
31
31
|
role = TheRole.get(@role.the_role).the_reset!
|
32
|
-
role
|
33
|
-
|
32
|
+
new_role = params[:role] ? params[:role][:the_role] : Hash.new
|
33
|
+
role.the_merge!(new_role)
|
34
34
|
if @role.update_attribute(:the_role, role.to_yaml)
|
35
35
|
flash[:notice] = t('the_role.role_updated')
|
36
36
|
redirect_to edit_admin_role_path(@role)
|
@@ -1,19 +1,18 @@
|
|
1
1
|
- role = TheRole.get(@role.the_role)
|
2
2
|
|
3
3
|
- if role.blank?
|
4
|
-
h3
|
5
|
-
= t('.empty')
|
4
|
+
%h3= t('.empty')
|
6
5
|
- else
|
7
6
|
-role.each do |name, set|
|
8
|
-
h4
|
7
|
+
%h4
|
9
8
|
= name
|
10
|
-
span.controls
|
9
|
+
%span.controls
|
11
10
|
= link_to(t('.delete'), admin_role_section_url(@role, name), :method => :delete, :confirm => t('.destroy_section_confirm'))
|
12
11
|
|
13
12
|
- if set.is_a?(Hash)
|
14
|
-
ul.rights
|
13
|
+
%ul.rights
|
15
14
|
- set.each do |n, v|
|
16
|
-
li
|
15
|
+
%li
|
17
16
|
= check_box_tag "role[the_role][#{name}][#{n}]", true, v
|
18
17
|
= n
|
19
18
|
.controls
|
@@ -1,37 +1,37 @@
|
|
1
1
|
- content_for :title do
|
2
2
|
= t('.title')
|
3
3
|
|
4
|
-
p= flash[:notice]
|
4
|
+
%p= flash[:notice]
|
5
5
|
|
6
|
-
h1= t('.title')
|
6
|
+
%h1= t('.title')
|
7
7
|
|
8
|
-
p= link_to raw(t('.back')), admin_roles_path
|
8
|
+
%p= link_to raw(t('.back')), admin_roles_path
|
9
9
|
|
10
|
-
h2
|
11
|
-
|
10
|
+
%h2
|
11
|
+
= t('.name')
|
12
12
|
= @role.title
|
13
13
|
|
14
14
|
= form_for :role, :url => {:action=> :update }, :html => {:method => :put, :class => :form } do |f|
|
15
15
|
= render :partial => 'form', :locals => {:f => f, :button => t('.update')}
|
16
16
|
|
17
|
-
h4= t('.create_section')
|
17
|
+
%h4= t('.create_section')
|
18
18
|
- role = TheRole.get(@role.the_role)
|
19
19
|
|
20
20
|
= form_tag(new_role_section_admin_role_path, :method => :post, :class => :new_action) do
|
21
21
|
= text_field_tag :section_name
|
22
22
|
= submit_tag t('.create_section')
|
23
23
|
|
24
|
-
h4= t('.create_access_policy')
|
24
|
+
%h4= t('.create_access_policy')
|
25
25
|
|
26
26
|
- unless role.empty?
|
27
27
|
= form_tag(new_role_policy_admin_role_path(@role), :method => :post, :class => :new_action) do
|
28
28
|
= text_field_tag :section_policy
|
29
29
|
|
30
|
-
select name
|
30
|
+
%select{ :name => :section_name }
|
31
31
|
-role.each do |name, set|
|
32
|
-
option value
|
32
|
+
%option{ :value => name }
|
33
33
|
= name
|
34
34
|
|
35
|
-
input type
|
35
|
+
%input{ :type => :submit, :value => t('.create_policy') }
|
36
36
|
- else
|
37
|
-
p= t('.section_needs')
|
37
|
+
%p= t('.section_needs')
|
@@ -1,9 +1,9 @@
|
|
1
|
-
h3= t('.list')
|
2
|
-
ul.index
|
1
|
+
%h3= t('.list')
|
2
|
+
%ul.index
|
3
3
|
- @roles.each do |role|
|
4
|
-
li
|
5
|
-
p
|
4
|
+
%li
|
5
|
+
%p
|
6
6
|
= link_to role.title, edit_admin_role_url(role)
|
7
7
|
= link_to t('.delete') + role.title , admin_role_url(role), :method => :delete, :class => :delete
|
8
8
|
|
9
|
-
p= link_to t('.new'), new_admin_role_path
|
9
|
+
%p= link_to t('.new'), new_admin_role_path
|
@@ -0,0 +1,13 @@
|
|
1
|
+
%p= link_to raw(t('.back')), admin_roles_path
|
2
|
+
|
3
|
+
- @role.errors.each do |f, m|
|
4
|
+
%p= m
|
5
|
+
|
6
|
+
.form
|
7
|
+
%h5= t('.create')
|
8
|
+
= form_for(@role, :url => admin_roles_path) do |f|
|
9
|
+
%label= t('.name')
|
10
|
+
%p= f.text_field :name
|
11
|
+
%label= t('.title')
|
12
|
+
%p= f.text_field :title
|
13
|
+
= f.submit t('.new')
|
@@ -0,0 +1,15 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%title= yield(:title)
|
5
|
+
= stylesheet_link_tag 'the_role/reset'
|
6
|
+
= stylesheet_link_tag 'the_role/style'
|
7
|
+
= stylesheet_link_tag 'the_role/headers'
|
8
|
+
= stylesheet_link_tag 'the_role/form'
|
9
|
+
|
10
|
+
= javascript_include_tag :jquery
|
11
|
+
= javascript_include_tag :jquery_ujs
|
12
|
+
= csrf_meta_tags
|
13
|
+
|
14
|
+
%body
|
15
|
+
.body= yield
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Sample localization file for English. Add more files in this directory for other locales.
|
2
|
+
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
+
ru:
|
4
|
+
the_role:
|
5
|
+
name_presence: Установите имя роли
|
6
|
+
title_presence: Установите название роли
|
7
|
+
section_created: Правовая группа успешно создана
|
8
|
+
section_policy_created: В заданной группе успешно создана политика доступа
|
9
|
+
section_deleted: Политика доступа удалена
|
10
|
+
section_policy_deleted: Политика доступа удалена
|
11
|
+
section_name_is_wrong: Ошибочное название правовой группы
|
12
|
+
section_policy_wrong_name: Ошибочное название правовой политики
|
13
|
+
section_name_is_blank: Имя правовой группы оказалось пустым
|
14
|
+
section_exists: Правовая группа уже существует
|
15
|
+
role_created: Роль успешно создана
|
16
|
+
role_updated: Роль успешно обновлена
|
17
|
+
admin:
|
18
|
+
roles:
|
19
|
+
index:
|
20
|
+
list: Список ролей
|
21
|
+
delete: 'Удалить роль '
|
22
|
+
new: Создать новую роль
|
23
|
+
edit:
|
24
|
+
title: Редактирование роли
|
25
|
+
back: '← К списку ролей'
|
26
|
+
name: 'Название роли — '
|
27
|
+
create_section: Создать правовую группу
|
28
|
+
create_access_policy: Создать политику доступа
|
29
|
+
create_policy: Создать политику
|
30
|
+
section_needs: Создайте хотя бы одну правовую группу
|
31
|
+
update: Обновить
|
32
|
+
form:
|
33
|
+
destroy_section_confirm: Удалить правовую группу?
|
34
|
+
empty: Нет ни одной правовой группы
|
35
|
+
delete_policy_confirm: Удалить политику доступа?
|
36
|
+
delete: Удалить
|
37
|
+
new:
|
38
|
+
back: '← К списку ролей'
|
39
|
+
create: Создать новую роль
|
40
|
+
name: Имя роли (латиницей)
|
41
|
+
title: Название роли
|
42
|
+
new: Создать
|
data/config/locales/ru.yml
CHANGED
@@ -1,42 +1,42 @@
|
|
1
1
|
# Sample localization file for English. Add more files in this directory for other locales.
|
2
2
|
# See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
|
3
|
-
|
3
|
+
en:
|
4
4
|
the_role:
|
5
|
-
name_presence:
|
6
|
-
title_presence:
|
7
|
-
section_created:
|
8
|
-
section_policy_created:
|
9
|
-
section_deleted:
|
10
|
-
section_policy_deleted:
|
11
|
-
section_name_is_wrong:
|
12
|
-
section_policy_wrong_name:
|
13
|
-
section_name_is_blank:
|
14
|
-
section_exists:
|
15
|
-
role_created:
|
16
|
-
role_updated:
|
5
|
+
name_presence: Set the role name
|
6
|
+
title_presence: Set title of role
|
7
|
+
section_created: Role group is successfully created
|
8
|
+
section_policy_created: In a given group is successfully created an access policy
|
9
|
+
section_deleted: access policy is removed
|
10
|
+
section_policy_deleted: access policy is removed
|
11
|
+
section_name_is_wrong: Wrong name of Role
|
12
|
+
section_policy_wrong_name: Wrong name of Role Policy
|
13
|
+
section_name_is_blank: The name of the Role team was empty
|
14
|
+
section_exists: Role group already exists
|
15
|
+
role_created: The Role of successfully established
|
16
|
+
role_updated: Role updated successfully
|
17
17
|
admin:
|
18
18
|
roles:
|
19
19
|
index:
|
20
|
-
list:
|
21
|
-
delete: '
|
22
|
-
new:
|
20
|
+
list: list of roles
|
21
|
+
delete: 'Delete role: '
|
22
|
+
new: Create a new role
|
23
23
|
edit:
|
24
|
-
title:
|
25
|
-
back: '
|
26
|
-
name: '
|
27
|
-
create_section:
|
28
|
-
create_access_policy:
|
29
|
-
create_policy:
|
30
|
-
section_needs:
|
31
|
-
update:
|
24
|
+
title: Editing role
|
25
|
+
back: '← To the list of roles'
|
26
|
+
name: 'Name of role -'
|
27
|
+
create_section: Create a Role group
|
28
|
+
create_access_policy: Create an access policy
|
29
|
+
create_policy: New Policy
|
30
|
+
section_needs: Create at least one Role group
|
31
|
+
update: Update
|
32
32
|
form:
|
33
|
-
destroy_section_confirm:
|
34
|
-
empty:
|
35
|
-
delete_policy_confirm:
|
36
|
-
delete:
|
33
|
+
destroy_section_confirm: Remove a role section?
|
34
|
+
empty: There is no role section
|
35
|
+
delete_policy_confirm: Remove the access policy?
|
36
|
+
delete: Delete
|
37
37
|
new:
|
38
|
-
back: '
|
39
|
-
create:
|
40
|
-
name:
|
41
|
-
title:
|
42
|
-
new:
|
38
|
+
back: '← To the list of roles'
|
39
|
+
create: Create a new role
|
40
|
+
name: Name of the role (Latin)
|
41
|
+
title: Title of role
|
42
|
+
new: Create
|
data/lib/the_role/version.rb
CHANGED
data/the_role.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the_role
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.93
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,15 +13,15 @@ date: 2011-10-29 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: haml
|
16
|
-
requirement: &
|
16
|
+
requirement: &78949540 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
21
|
+
version: '3.0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *78949540
|
25
25
|
description: TheRole - simple, but powerful role system for ROR applications
|
26
26
|
email:
|
27
27
|
- zykin-ilya@ya.ru
|
@@ -40,11 +40,12 @@ files:
|
|
40
40
|
- app/assets/stylesheets/the_role/style.css.scss
|
41
41
|
- app/controllers/admin/role_section_controller.rb
|
42
42
|
- app/controllers/admin/roles_controller.rb
|
43
|
-
- app/views/admin/roles/_form.
|
44
|
-
- app/views/admin/roles/edit.
|
45
|
-
- app/views/admin/roles/index.
|
46
|
-
- app/views/admin/roles/new.
|
47
|
-
- app/views/layouts/the_role.
|
43
|
+
- app/views/admin/roles/_form.haml
|
44
|
+
- app/views/admin/roles/edit.html.haml
|
45
|
+
- app/views/admin/roles/index.haml
|
46
|
+
- app/views/admin/roles/new.html.haml
|
47
|
+
- app/views/layouts/the_role.html.haml
|
48
|
+
- config/locales/en.yml
|
48
49
|
- config/locales/ru.yml
|
49
50
|
- config/routes.rb
|
50
51
|
- db/migrate/20111025025129_create_roles.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
p= link_to raw(t('.back')), admin_roles_path
|
2
|
-
- @role.errors.each do |f, m|
|
3
|
-
p= m
|
4
|
-
|
5
|
-
.form
|
6
|
-
h5= t('.create')
|
7
|
-
= form_for(@role, :url => admin_roles_path) do |f|
|
8
|
-
label= t('.name')
|
9
|
-
p= f.text_field :name
|
10
|
-
label= t('.title')
|
11
|
-
p= f.text_field :title
|
12
|
-
= f.submit t('.new')
|
@@ -1,15 +0,0 @@
|
|
1
|
-
doctype html
|
2
|
-
html
|
3
|
-
head
|
4
|
-
title= yield(:title)
|
5
|
-
= stylesheet_link_tag 'the_role/reset'
|
6
|
-
= stylesheet_link_tag 'the_role/style'
|
7
|
-
= stylesheet_link_tag 'the_role/headers'
|
8
|
-
= stylesheet_link_tag 'the_role/form'
|
9
|
-
|
10
|
-
= javascript_include_tag :jquery
|
11
|
-
= javascript_include_tag :jquery_ujs
|
12
|
-
= csrf_meta_tags
|
13
|
-
|
14
|
-
body
|
15
|
-
.body= yield
|