the_role_management_panel 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +21 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +71 -0
  6. data/Rakefile +1 -0
  7. data/app/assets/javascripts/the_role_editinplace.js.coffee +38 -0
  8. data/app/assets/javascripts/the_role_management_panel.js +10 -0
  9. data/app/assets/javascripts/the_role_management_panel_initializer.js.coffee +4 -0
  10. data/app/assets/stylesheets/the_role_management_panel.css.scss +4 -0
  11. data/app/controllers/admin/role_sections_controller.rb +95 -0
  12. data/app/controllers/admin/roles_controller.rb +139 -0
  13. data/app/views/admin/roles/_role.html.haml +97 -0
  14. data/app/views/admin/roles/_sidebar.html.haml +41 -0
  15. data/app/views/admin/roles/edit.html.haml +2 -0
  16. data/app/views/admin/roles/index.haml +2 -0
  17. data/app/views/admin/roles/new.html.haml +28 -0
  18. data/app/views/layouts/the_role_management_panel.html.haml +47 -0
  19. data/config/locales/en.the_role.gui.yml +49 -0
  20. data/config/locales/es.the_role.gui.yml +46 -0
  21. data/config/locales/nl.the_role.gui.yml +47 -0
  22. data/config/locales/pl.the_role.gui.yml +46 -0
  23. data/config/locales/pt_BR.the_role.gui.yml +47 -0
  24. data/config/locales/ru.the_role.gui.yml +49 -0
  25. data/config/locales/zh_CN.the_role.gui.yml +46 -0
  26. data/config/routes.rb +52 -0
  27. data/gem_version.rb +3 -0
  28. data/lib/generators/the_role_management_panel/USAGE +32 -0
  29. data/lib/generators/the_role_management_panel/the_role_management_panel_generator.rb +56 -0
  30. data/lib/the_role_management_panel/version.rb +1 -0
  31. data/lib/the_role_management_panel.rb +12 -0
  32. data/the_role_management_panel.gemspec +31 -0
  33. metadata +199 -0
@@ -0,0 +1,49 @@
1
+ en:
2
+ the_role_gui:
3
+ role_created: Role created
4
+ role_updated: Role updated
5
+ role_deleted: Role deleted
6
+ section_created: Section created
7
+ section_not_created: Section not created
8
+ section_rule_created: "Section rule created"
9
+ section_rule_not_created: "Section rule not created"
10
+ section_rule_on: "Section rule is enable"
11
+ section_rule_off: "Section rule is disable"
12
+ state_not_changed: "Section rule not changed"
13
+ section_deleted: Section deleted
14
+ section_not_deleted: Section not deleted
15
+ section_rule_deleted: "Section rule deleted"
16
+ section_rule_not_deleted: "Section rule not deleted"
17
+ imported_roles: "Imported roles: %{roles_list}"
18
+
19
+ roles:
20
+ new:
21
+ create: Create new Role
22
+ name: Name of role (underscored latin string)
23
+ title: Title of role (text)
24
+ description: Description of role (text)
25
+ based_on_role: "New role will be based on:"
26
+ role:
27
+ role_name: Role name
28
+ title: Title
29
+ role_description: Description of role
30
+ delete_section: Delete section
31
+ section_delete_confirm: 'Do you want to delete section?'
32
+ rule_delete_confirm: 'Do you want to delete rule?'
33
+ enable: Enable
34
+ disable: Disable
35
+ delete_rule: Delete rule
36
+ new_section_placeholder: New section name
37
+ create_section: Create new section
38
+ new_rule_placeholder: New rule name
39
+ create_rule: Create new rule
40
+ role_export: "Export role"
41
+ sidebar:
42
+ roles_list: Roles list
43
+ new_role: Create new role
44
+ delete_role_confirm: 'Are you sure? It can be dangerous!'
45
+
46
+ roles_export: "Roles Export"
47
+ roles_import: "Roles Import"
48
+ roles_import_confirm: 'It can change role policy of your system. Are you sure?'
49
+
@@ -0,0 +1,46 @@
1
+ es:
2
+ the_role_gui:
3
+ role_created: Rol creado
4
+ role_updated: Rol actualizado
5
+ role_deleted: Rol eliminado
6
+ section_created: Sección creada
7
+ section_not_created: Sección no creada
8
+ section_rule_created: Regla de sección creada
9
+ section_rule_not_created: Regla de sección no creada
10
+ section_rule_on: Regla de sección activada
11
+ section_rule_off: Regla de sección desactivada
12
+ state_not_changed: Regla de sección no modificada
13
+ section_deleted: Sección eliminada
14
+ section_not_deleted: Sección no eliminada
15
+ section_rule_deleted: Regla de sección eliminada
16
+ section_rule_not_deleted: Regla de sección no eliminada
17
+ imported_roles: "Imported roles: %{roles_list}"
18
+
19
+ roles:
20
+ new:
21
+ create: Crear nuevo rol
22
+ name: Nombre del rol (cadena de caracteres simples + guión bajo)
23
+ title: Título del rol
24
+ description: Descripción del rol
25
+ role:
26
+ role_name: Nombre del rol
27
+ title: Título
28
+ role_description: Descripción del rol
29
+ delete_section: Eliminar sección
30
+ section_delete_confirm: "¿Quieres borrar la sección?"
31
+ rule_delete_confirm: "¿Quieres eliminar la regla?"
32
+ enable: Activar
33
+ disable: Desactivar
34
+ delete_rule: Eliminar regla
35
+ new_section_placeholder: Nombre de la nueva sección
36
+ create_section: Crear nueva sección
37
+ new_rule_placeholder: Nombre de la nueva regla
38
+ create_rule: Crear nueva regla
39
+ sidebar:
40
+ roles_list: Lista de roles
41
+ new_role: Crear nuevo rol
42
+ delete_role_confirm: "¿Estás seguro? ¡Puede ser peligroso!"
43
+
44
+ roles_export: "Roles Export"
45
+ roles_import: "Roles Import"
46
+ roles_import_confirm: 'It can change role policy of your system. Are you sure?'
@@ -0,0 +1,47 @@
1
+ nl:
2
+ the_role_gui:
3
+ role_created: Toegangsprofiel aangemaakt
4
+ role_updated: Toegangsprofiel bijgewerkt
5
+ role_deleted: Toegangsprofiel verwijderd
6
+ section_created: Sectie aangemaakt
7
+ section_not_created: Sectie niet aangemaakt
8
+ section_rule_created: "Sectieprofiel aangemaakt"
9
+ section_rule_not_created: "Sectieprofiel niet aangemaakt"
10
+ section_rule_on: "Sectieprofiel is geactiveerd"
11
+ section_rule_off: "Sectieprofiel is gedeactiveerd"
12
+ state_not_changed: "Sectieprofiel niet aangepast"
13
+ section_deleted: Sectie verwijderd
14
+ section_not_deleted: Sectie niet verwijderd
15
+ section_rule_deleted: "Sectieprofiel verwijderd"
16
+ section_rule_not_deleted: "Sectieprofiel niet verwijderd"
17
+ imported_roles: "Imported roles: %{roles_list}"
18
+
19
+ roles:
20
+ new:
21
+ create: Maak nieuwe toegangsprofiel aan
22
+ name: Naam van toegangsprofiel (underscored latin string)
23
+ title: Titel van toegangsprofiel (text)
24
+ description: Beschrijving van toegangsprofiel (text)
25
+ based_on_role: "Nieuwe toegansprofiel wordt gebaseerd op:"
26
+ role:
27
+ role_name: Toegangsprofiel naam
28
+ title: Titel
29
+ role_description: Omschrijving van het toegangsprofiel
30
+ delete_section: Verwijder sectie
31
+ section_delete_confirm: 'Wil je de sectie verwijderen?'
32
+ rule_delete_confirm: 'Wil je het toegangsprofiel verwijderen?'
33
+ enable: Activeren
34
+ disable: Deactiveren
35
+ delete_rule: Verwijder toegangsprofiel
36
+ new_section_placeholder: Naam nieuwe sectie
37
+ create_section: Maak nieuwe sectie aan
38
+ new_rule_placeholder: Naam nieuw toegansprofiel
39
+ create_rule: Maak nieuw toegansprofiel
40
+ sidebar:
41
+ roles_list: Lijst toegangsprofielen
42
+ new_role: Maak nieuw toegansprofiel
43
+ delete_role_confirm: 'Weet je het zeker? Dit kan gevaarlijk zijn!'
44
+
45
+ roles_export: "Roles Export"
46
+ roles_import: "Roles Import"
47
+ roles_import_confirm: 'It can change role policy of your system. Are you sure?'
@@ -0,0 +1,46 @@
1
+ pl:
2
+ the_role_gui:
3
+ role_created: Rola dodana
4
+ role_updated: Rola zaktualizowana
5
+ role_deleted: Role skasowana
6
+ section_created: Sekcja utworzona
7
+ section_not_created: Sekcja nie utworzona
8
+ section_rule_created: "Reguła utworzona"
9
+ section_rule_not_created: "Reguła nie utworzona"
10
+ section_rule_on: "Reguła uruchomiona"
11
+ section_rule_off: "Reguła wyłączona"
12
+ state_not_changed: "Reguła nie zmieniona"
13
+ section_deleted: Sekcja skasowana
14
+ section_not_deleted: Sekcja nie skasowana
15
+ section_rule_deleted: "Reguła skasowana"
16
+ section_rule_not_deleted: "Reguła nie skasowana"
17
+ imported_roles: "Imported roles: %{roles_list}"
18
+
19
+ roles:
20
+ new:
21
+ create: Utwórz nową rolę
22
+ name: Nazwa roli
23
+ title: Tytuł roli (text)
24
+ description: Opis roli (text)
25
+ role:
26
+ role_name: Nazwa roli
27
+ title: Tytuł
28
+ role_description: Opis roli
29
+ delete_section: Skasuj sekcje
30
+ section_delete_confirm: 'Czy aby napewno chcesz skasować sekcję?'
31
+ rule_delete_confirm: 'Czy aby na pewno chcesz usunąć rolę?'
32
+ enable: Włącz
33
+ disable: Wyłącz
34
+ delete_rule: Skasuj regułę
35
+ new_section_placeholder: Nazwa nowej sekcji
36
+ create_section: Utwórz nową sekcję
37
+ new_rule_placeholder: Nazwa nowej reguły
38
+ create_rule: Utwórz nową regułę
39
+ sidebar:
40
+ roles_list: Lista ról
41
+ new_role: Utwórz nową rolę
42
+ delete_role_confirm: 'Czy jesteś pewien? To może być niebezpieczne!'
43
+
44
+ roles_export: "Roles Export"
45
+ roles_import: "Roles Import"
46
+ roles_import_confirm: 'It can change role policy of your system. Are you sure?'
@@ -0,0 +1,47 @@
1
+ pt-BR:
2
+ the_role_gui:
3
+ role_created: Papel criado
4
+ role_updated: Papel atualizado
5
+ role_deleted: Papel excluído
6
+ section_created: Seção criada
7
+ section_not_created: Seção não foi criada
8
+ section_rule_created: "Regra de seção criada"
9
+ section_rule_not_created: "Regra de seção não foi criada"
10
+ section_rule_on: "Regra de seção habilitada"
11
+ section_rule_off: "Regra de seção desabilitada"
12
+ state_not_changed: "Regra de seção não alterada"
13
+ section_deleted: Seção excluída
14
+ section_not_deleted: Seção não foi excluída
15
+ section_rule_deleted: "Regra de seção excluída"
16
+ section_rule_not_deleted: "Regra de seção não foi excluída"
17
+ imported_roles: "Imported roles: %{roles_list}"
18
+
19
+ roles:
20
+ new:
21
+ create: Criar novo Papel
22
+ name: "Nome do Papel (caracteres latinos, com underscore)"
23
+ title: Título do papel (texto)
24
+ description: Descrição do papel (texto)
25
+ based_on_role: "Novo papel baseado em:"
26
+ role:
27
+ role_name: Nome do papel
28
+ title: Título
29
+ role_description: Descrição do papel
30
+ delete_section: Excluir sessão
31
+ section_delete_confirm: 'Deseja excluir a seção?'
32
+ rule_delete_confirm: 'Deseja excluir a regra?'
33
+ enable: Habilitar
34
+ disable: Desabilitar
35
+ delete_rule: Excluir regra
36
+ new_section_placeholder: Nome da nova seção
37
+ create_section: Criar nova seção
38
+ new_rule_placeholder: Nome da nova regra
39
+ create_rule: Criar nova regra
40
+ sidebar:
41
+ roles_list: Lista de Papéis
42
+ new_role: Criar novo papel
43
+ delete_role_confirm: 'Tem certeza? Isto pode ser perigoso!'
44
+
45
+ roles_export: "Roles Export"
46
+ roles_import: "Roles Import"
47
+ roles_import_confirm: 'It can change role policy of your system. Are you sure?'
@@ -0,0 +1,49 @@
1
+ ru:
2
+ the_role_gui:
3
+ role_created: Роль создана
4
+ role_updated: Роль обновлена
5
+ role_deleted: Роль удалена
6
+ section_created: Раздел создан
7
+ section_not_created: Раздел не создан
8
+ section_rule_created: Правило создано
9
+ section_rule_not_created: Правило не создано
10
+ section_rule_on: Правило доступа включено
11
+ section_rule_off: Правило доступа отключено
12
+ state_not_changed: Состояние правила не изменилось
13
+ section_deleted: Раздел удален
14
+ section_not_deleted: Раздел не удален
15
+ section_rule_deleted: Правило удалено
16
+ section_rule_not_deleted: Правило не удалено
17
+ cant_be_imported: Импорт ролей не удался
18
+ imported_roles: "Были импортированы роли: %{roles_list}"
19
+
20
+ roles:
21
+ new:
22
+ create: Создать новую роль
23
+ name: Имя роли (строка из латинских символов + нижнее подчеркивание)
24
+ title: Заголовок роли
25
+ description: Описание роли
26
+ based_on_role: "Новая роль будет основана на:"
27
+ role:
28
+ role_name: Имя роли
29
+ title: Заголовок
30
+ role_description: Описание
31
+ delete_section: Удалить раздел
32
+ section_delete_confirm: 'Вы хотите удалить раздел?'
33
+ rule_delete_confirm: 'Вы хотите удалить правило?'
34
+ enable: Включено
35
+ disable: Отключено
36
+ delete_rule: Удалить правило
37
+ new_section_placeholder: Имя нового раздела
38
+ create_section: Создать раздел
39
+ new_rule_placeholder: Имя нового правила
40
+ create_rule: Создать правило
41
+ role_export: Выгрузить роль
42
+ sidebar:
43
+ roles_list: Список ролей
44
+ new_role: Создать новую Роль
45
+ delete_role_confirm: 'Удалить роль? Это может быть опасно! Уверены?'
46
+
47
+ roles_export: Выгрузить роли
48
+ roles_import: Загрузить роли
49
+ roles_import_confirm: 'Загрузка внешних ролей может существенно изменить настройки доступа. Вы уверены?'
@@ -0,0 +1,46 @@
1
+ zh_CN:
2
+ the_role_gui:
3
+ role_created: 角色已创建
4
+ role_updated: 角色已更新
5
+ role_deleted: 角色已删除
6
+ section_created: 章节已创建
7
+ section_not_created: 章节没有被创建
8
+ section_rule_created: "章节的规则已创建"
9
+ section_rule_not_created: "章节的规则没有被创建"
10
+ section_rule_on: "章节的规则可有"
11
+ section_rule_off: "章节的规则不可有"
12
+ state_not_changed: "章节的规则没有改变"
13
+ section_deleted: 章节已删除
14
+ section_not_deleted: 章节没有被删除
15
+ section_rule_deleted: "章节的规则已被删除"
16
+ section_rule_not_deleted: "章节的规则没有被删除"
17
+ imported_roles: "Imported roles: %{roles_list}"
18
+
19
+ roles:
20
+ new:
21
+ create: 创建新角色
22
+ name: 角色名称 (字符串)
23
+ title: 角色标题 (文本)
24
+ description: 角色描述 (文本)
25
+ role:
26
+ role_name: 角色名称
27
+ title: 角色标题
28
+ role_description: 角色描述
29
+ delete_section: 删除章节
30
+ section_delete_confirm: '你想要删除章节?'
31
+ rule_delete_confirm: '你想删除规则?'
32
+ enable: 可用
33
+ disable: 不可用
34
+ delete_rule: 删除规则
35
+ new_section_placeholder: 新章节名称
36
+ create_section: 创建新章节
37
+ new_rule_placeholder: 新规则名称
38
+ create_rule: 创建新规则
39
+ sidebar:
40
+ roles_list: 角色列表
41
+ new_role: 创建新角色
42
+ delete_role_confirm: '你确定? 可能存在风险!'
43
+
44
+ roles_export: "Roles Export"
45
+ roles_import: "Roles Import"
46
+ roles_import_confirm: 'It can change role policy of your system. Are you sure?'
data/config/routes.rb ADDED
@@ -0,0 +1,52 @@
1
+ module TheRoleManagementPanel
2
+ # TheRoleManagementPanel::Routes.mixin(self)
3
+ class Routes
4
+ def self.mixin mapper
5
+ mapper.resources :roles, except: :show do
6
+ mapper.resources :sections, controller: :role_sections, only: :none do
7
+ mapper.collection do
8
+ mapper.post :create
9
+ mapper.post :create_rule
10
+ end
11
+
12
+ mapper.member do
13
+ mapper.put :rule_on
14
+ mapper.put :rule_off
15
+
16
+ mapper.delete :destroy
17
+ mapper.delete :destroy_rule
18
+ end
19
+ end
20
+ end
21
+
22
+ mapper.namespace :admin do
23
+ mapper.resources :roles, except: :show do
24
+ mapper.collection do
25
+ mapper.get :export
26
+ mapper.put :import
27
+ end
28
+
29
+ mapper.member do
30
+ mapper.get :role_export
31
+ mapper.put :change
32
+ end
33
+
34
+ mapper.resources :sections, controller: :role_sections, only: :none do
35
+ mapper.collection do
36
+ mapper.post :create
37
+ mapper.post :create_rule
38
+ end
39
+
40
+ mapper.member do
41
+ mapper.put :rule_on
42
+ mapper.put :rule_off
43
+
44
+ mapper.delete :destroy
45
+ mapper.delete :destroy_rule
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
data/gem_version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module TheRoleManagementPanel
2
+ VERSION = "3.0.1"
3
+ end
@@ -0,0 +1,32 @@
1
+ ---------------------------------------
2
+ TheRole Management Panel
3
+ ---------------------------------------
4
+
5
+ !!! Description:
6
+
7
+ This generators helps to install files from TheRole Management Panel gem into your Application
8
+
9
+ !!! This text:
10
+
11
+ > bundle exec rails g the_role_management_panel help
12
+
13
+ !!! Generators:
14
+
15
+ > bundle exec rails g the_role_management_panel install
16
+ - Install views, controllers, assets
17
+
18
+ > bundle exec rails g the_role_management_panel assets
19
+ - Install assets
20
+
21
+ > bundle exec rails g the_role_management_panel controllers
22
+ - Install controllers
23
+
24
+ > bundle exec rails g the_role_management_panel views
25
+ - Install views
26
+
27
+ > bundle exec rails g the_role_management_panel locales
28
+ - Install locales
29
+
30
+ ---------------------------------------
31
+ ~ TheRole Management Panel
32
+ ---------------------------------------
@@ -0,0 +1,56 @@
1
+ class TheRoleManagementPanelGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../../../../', __FILE__)
3
+ # argument :xname, type: :string, default: :xname
4
+
5
+ # bundle exec rails g the_role_management_panel NAME
6
+ def generate_controllers
7
+ if gen_name == 'install'
8
+ cp_views
9
+ cp_assets
10
+ cp_controllers
11
+ elsif gen_name == 'assets'
12
+ cp_assets
13
+ elsif gen_name == 'controllers'
14
+ cp_controllers
15
+ elsif gen_name == 'views'
16
+ cp_views
17
+ elsif gen_name == 'locales'
18
+ cp_locales
19
+ elsif gen_name == 'help'
20
+ cp_help
21
+ else
22
+ puts 'TheRole ManagementPanel Generator - wrong Name'
23
+ puts 'Try to use install'
24
+ end
25
+ end
26
+
27
+ private
28
+
29
+ def gen_name
30
+ name.to_s.downcase
31
+ end
32
+
33
+ def cp_assets
34
+ directory 'app/assets',
35
+ 'app/assets'
36
+ end
37
+
38
+ def cp_controllers
39
+ directory 'app/controllers',
40
+ 'app/controllers'
41
+ end
42
+
43
+ def cp_views
44
+ directory 'app/views',
45
+ 'app/views'
46
+ end
47
+
48
+ def cp_locales
49
+ directory 'config/locales',
50
+ 'config/locales'
51
+ end
52
+
53
+ def cp_help
54
+ puts File.read "#{ TheRoleManagementPanelGenerator.source_root }/lib/generators/the_role_management_panel/USAGE"
55
+ end
56
+ end
@@ -0,0 +1 @@
1
+ require_relative "../../gem_version"
@@ -0,0 +1,12 @@
1
+ require_relative "the_role_management_panel/version"
2
+
3
+ require 'the_notification'
4
+ require 'bootstrap-sass'
5
+ require 'sass-rails'
6
+ require 'haml'
7
+
8
+ module TheRoleManagementPanel
9
+ class Engine < Rails::Engine; end
10
+ end
11
+
12
+ require_relative "../config/routes.rb"
@@ -0,0 +1,31 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'the_role_management_panel/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "the_role_management_panel"
8
+ spec.version = TheRoleManagementPanel::VERSION
9
+ spec.authors = ["Ilya N. Zykin"]
10
+ spec.email = ["zykin-ilya@ya.ru"]
11
+ spec.summary = %q{ TheRole Management panel }
12
+ spec.description = %q{ Management panel for TheRole on Bootstrap3 }
13
+ spec.homepage = "https://github.com/TheRole/the_role_management_panel"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency 'haml'
25
+ spec.add_dependency 'the_notification', '~> 0.5'
26
+
27
+ spec.add_dependency 'rails', ['>= 3', '< 5']
28
+ spec.add_dependency 'bootstrap-sass', '~> 3.3', '>= 3.3.1'
29
+ spec.add_dependency 'sass-rails'
30
+ spec.add_dependency 'coffee-rails'
31
+ end