the_role 2.3 → 2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 77b00593bcd32d2fee50327a0c3fab22fbadf482
4
- data.tar.gz: 269eb319746ed8f82864259c20ba46439ea59390
3
+ metadata.gz: 390002fab78f75cdae9b6aa2f354133640b21646
4
+ data.tar.gz: f7ef67983c17684310ec02f606454b58b921a58f
5
5
  SHA512:
6
- metadata.gz: 88afca09c44fe32449d4d8ca1d7bdfa60d9ad13f2d02fdf43c3fbb29931ec99377c9e6e4bf0c632c739f40f0858ec58d55eb59bffde8cbcb1e114cba33a6f518
7
- data.tar.gz: cf2b3f534ad0d7a949590a563d722e9048161a91560c3db73940b08cd5db4ba72691055fab7c86d1c596ed408fa99a22cf8a5c0389a53cb3a6905c0d796e2b0b
6
+ metadata.gz: e0512d3c687adf75d494cfee54b1fde431295bc0b59ccd677f3666b9949ea166f7b2a05c19f22192ff54f636de59835e58e3177db11403feee0f4a148339601c
7
+ data.tar.gz: 172dc91e2f26a1a1dd1f979302c59a7fe7186caff13c404472ed80ac387fa701160cd467a647133c2ba8474f37de8fdb01ab031a0f94935591bd5fc2d6cd1cd7
data/README.md CHANGED
@@ -13,12 +13,16 @@
13
13
  </tr>
14
14
  <tr>
15
15
  <td><img src="https://github.com/the-teacher/the_role/raw/master/Bye_bye_CanCan_I_got_the_Role.png" alt="Bye bye CanCan, I got The Role!"></td>
16
- <td>TheRole is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access. All permissions are defined in with 2-level-hash, and store in database with JSON.<br><br>TheRole - Semantic, lightweight role system with an administrative interface.<br><br>Role is a two-level hash, consisting of the <b>sections</b> and nested <b>rules</b>.<br><br><b>Section</b> may be associated with <b>controller</b> name.<br><br><b>Rule</b> may be associated with <b>action</b> name.<br><br>Section can have many rules.<br><br>Rule can have <b>true</b> or <b>false</b> value<br><br><b>Sections</b> and nested <b>Rules</b> provide <b>ACL</b> (<b>Access Control List</b>)<br><br>Role <b>stored in the database as JSON</b> string.<br><br>Using of hashes, makes role system extremely easy to configure and use.<br></td>
16
+ <td>TheRole is an authorization library for Ruby on Rails which restricts what resources a given user is allowed to access. All permissions are defined in with 2-level-hash, and stored in the database as a JSON string.<br><br>TheRole - Semantic, lightweight role system with an administrative interface.<br><br>Role is a two-level hash, consisting of the <b>sections</b> and nested <b>rules</b>.<br><br>A <b>Section</b> may be associated with a <b>controller</b> name.<br><br>A <b>Rule</b> may be associated with an <b>action</b> name.<br><br>A Section can have many rules.<br><br>A Rule can be <b>true</b> or <b>false</b>.<br><br><b>Sections</b> and nested <b>Rules</b> provide an <b>ACL</b> (<b>Access Control List</b>)<br><br><br>Using hashes, makes role system extremely easy to configure and use.<br></td>
17
17
  </tr>
18
18
  </table>
19
19
 
20
20
  ### GUI
21
21
 
22
+ :warn: UI moved in **the_role_bootstrap3_ui** gem
23
+
24
+ We are waiting for **foundation** version of UI
25
+
22
26
  <table>
23
27
  <tr>
24
28
  <td>TheRole management web interface => localhost:3000/admin/roles</td>
@@ -38,18 +42,21 @@ puts following yields into your layout:
38
42
  ### Rails 4 version
39
43
 
40
44
  ```
41
- gem 'the_role', '~> 2.0.0'
45
+ gem 'the_role', '~> 2.4'
46
+
47
+ gem 'the_role_bootstrap3_ui'
42
48
  ```
43
49
 
50
+ Please read *the_role_bootstrap3_ui* docs to know more about assets
51
+
44
52
  ## If you have any questions
45
53
 
46
- Please before ask anything try to launch and play with **[Dummy App](spec/dummy_app)** in spec folder. Maybe example of integration will be better than any documentation. Thank you!
54
+ Please, before asking anything try to launch and play with the **[Dummy App](spec/dummy_app)** in the spec folder. Maybe an example integration will be better than any documentation. Thank you!
47
55
 
48
56
  ### Instalation
49
57
 
50
58
  * [INSTALL](#install)
51
59
  * [INTEGRATION](#integration)
52
- * [Assets and Bootstrap](#assets-and-bootstrap)
53
60
  * [Configuration (optional)](#configuration)
54
61
 
55
62
  ### Understanding
@@ -88,7 +95,7 @@ bundle exec rails g the_role --help
88
95
 
89
96
  ### Change User migration
90
97
 
91
- Add **role_id:integer** field to your User Model
98
+ Add a **role_id:integer** field to your User Model
92
99
 
93
100
  ```ruby
94
101
  def self.up
@@ -142,7 +149,7 @@ install TheRole migrations
142
149
  rake the_role_engine:install:migrations
143
150
  ```
144
151
 
145
- Invoke migration
152
+ Invoke migrations
146
153
 
147
154
  ```ruby
148
155
  rake db:migrate
@@ -185,7 +192,7 @@ end
185
192
  create the_role config:
186
193
 
187
194
  ```
188
- bundle exec rails g the_role setup
195
+ bundle exec rails g the_role config
189
196
  ```
190
197
 
191
198
  **config/initializers/the_role.rb**
@@ -202,7 +209,7 @@ TheRole.configure do |config|
202
209
  end
203
210
  ```
204
211
 
205
- #### Using with any controller
212
+ #### Usage with any controller
206
213
 
207
214
  ```ruby
208
215
  class PagesController < ApplicationController
@@ -229,35 +236,26 @@ class PagesController < ApplicationController
229
236
  end
230
237
  ```
231
238
 
232
- ### Assets and Bootstrap
239
+ **integration with Inhirited Resource**
233
240
 
234
- **application.css**
235
-
236
- ```
237
- //= require bootstrap
238
- ```
239
-
240
- **application.js**
241
-
242
- ```
243
- //= require jquery
244
- //= require jquery_ujs
245
-
246
- //= require bootstrap
247
- //= require the_role_editinplace
241
+ ```ruby
242
+ def owner_required
243
+ @owner_check_object = resource
244
+ super
245
+ end
248
246
  ```
249
247
 
250
248
  ## Understanding
251
249
 
252
250
  #### TheRole instead of CanCan?
253
251
 
254
- TheRole in contrast to CanCan has simple and predefined way to find access state of current role. If you don't want to create your own role scheme with CanCan Abilities - TheRole can be a great solution for your.
252
+ TheRole, in contrast to CanCan, has a simple and predefined way to find the access state of the current role. If you don't want to create your own role scheme with CanCan Abilities - TheRole can be a great solution for you.
255
253
 
256
- You can manage roles with simple UI. TheRole's ACL structure is inspired by Rails controllers, that is why it's so great for Rails application.
254
+ You can manage roles with a simple UI. TheRole's ACL structure is inspired by Rails' controllers, that's why it's so great for Rails applications.
257
255
 
258
- #### What does it mean semantic?
256
+ #### What does semantic mean?
259
257
 
260
- Semantic - the science of meaning. Human should be able to understand fast what is happening in a role system.
258
+ Semantic - the science of meaning. Humans should be able to quickly understand what is happening in a role system.
261
259
 
262
260
  Look at the next Role hash. If you can understand access rules - this authorization system is semantic.
263
261
 
@@ -299,7 +297,7 @@ But, also, you can use virtual names of sections, and virtual names of section's
299
297
 
300
298
  And you can use them as well as other access rules.
301
299
 
302
- #### Using with Views
300
+ #### Usage within Views
303
301
 
304
302
  ```ruby
305
303
  <% if @user.has_role?(:twitter, :button) %>
@@ -311,11 +309,11 @@ And you can use them as well as other access rules.
311
309
 
312
310
  #### Who is Administrator?
313
311
 
314
- Administrator is the user who can access any section and the rules of your application.
312
+ Administrator is the user who can access any section and rules of your application.
315
313
 
316
314
  Administrator is the owner of any objects in your application.
317
315
 
318
- Administrator is the user, which has virtual section **system** and rule **administrator** in the role-hash.
316
+ Administrator is the user, who has a virtual section **system** and a rule **administrator** in the role-hash.
319
317
 
320
318
 
321
319
  ```ruby
@@ -328,13 +326,13 @@ admin_role_fragment = {
328
326
 
329
327
  #### Who is Moderator?
330
328
 
331
- Moderator is the user, which has access to any actions of some section(s).
329
+ Moderator is the user, who has access to any actions of some section(s).
332
330
 
333
331
  Moderator is the owner of any objects of some class.
334
332
 
335
- Moderator is the user, which has a virtual section **moderator**, with **section name** as rule name.
333
+ Moderator is the user, who has a virtual section **moderator**, with **section name** as rule name.
336
334
 
337
- There is Moderator of Pages (controller) and Twitter (virtual section)
335
+ An example of a Moderator of Pages (controller) and Twitter (virtual section)
338
336
 
339
337
  ```ruby
340
338
  moderator_role_fragment = {
@@ -352,7 +350,7 @@ Administrator is owner of any object in system.
352
350
 
353
351
  Moderator of pages is owner of any page.
354
352
 
355
- User is owner of object, when **Object#user_id == User#id**.
353
+ User is owner of objects, when **Object#user_id == User#id**.
356
354
 
357
355
 
358
356
  # API
@@ -364,13 +362,13 @@ User is owner of object, when **Object#user_id == User#id**.
364
362
  @user.role # => Role obj
365
363
  ```
366
364
 
367
- Is it Administrator?
365
+ Is a user Administrator?
368
366
 
369
367
  ```ruby
370
368
  @user.admin? => true | false
371
369
  ```
372
370
 
373
- Is it Moderator?
371
+ Is a user Moderator?
374
372
 
375
373
  ```ruby
376
374
  @user.moderator?(:pages) => true | false
@@ -378,7 +376,7 @@ Is it Moderator?
378
376
  @user.moderator?(:articles) => true | false
379
377
  ```
380
378
 
381
- Has user got an access to **rule** of **section** (action of controller)?
379
+ Has user got access to **rule** of **section** (action of controller)?
382
380
 
383
381
  ```ruby
384
382
  @user.has_role?(:pages, :show) => true | false
@@ -451,7 +449,7 @@ Is user **Owner** of object?
451
449
 
452
450
  ```ruby
453
451
  # Incoming hash is true-mask-hash
454
- # All the rules of the Role will be reseted to false
452
+ # All the rules of the Role will be reset to false
455
453
  # Only rules from true-mask-hash will be set true
456
454
  new_role_hash = {
457
455
  :pages => {
@@ -475,6 +473,7 @@ new_role_hash = {
475
473
 
476
474
  #### Changelog
477
475
 
476
+ * 2.3.0 - Refactoring
478
477
  * 2.1.0 - User#any_role? & Role#any?
479
478
  * 2.0.3 - create role fix, cleanup
480
479
  * 2.0.2 - code cleanup, readme
@@ -14,7 +14,8 @@ pl:
14
14
  section_not_deleted: Sekcja nie skasowana
15
15
  section_rule_deleted: "Reguła skasowana"
16
16
  section_rule_not_deleted: "Reguła nie skasowana"
17
-
17
+ access_denied: "Odmowa dostępu"
18
+
18
19
  admin:
19
20
  roles:
20
21
  new:
@@ -39,4 +40,4 @@ pl:
39
40
  sidebar:
40
41
  roles_list: Lista ról
41
42
  new_role: Utwórz nową rolę
42
- delete_role_confirm: 'Jesteś pewien? To może być niebezpieczne!'
43
+ delete_role_confirm: 'Czy jesteś pewien? To może być niebezpieczne!'
@@ -0,0 +1,43 @@
1
+ pt-BR:
2
+ the_role:
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: Sessão não foi criada
8
+ section_rule_created: "Regra de sessão criada"
9
+ section_rule_not_created: "Regra de sessão não foi criada"
10
+ section_rule_on: "Regra de sessão habilitada"
11
+ section_rule_off: "Regra de sessão desabilitada"
12
+ state_not_changed: "Regra de sessão não alterada"
13
+ section_deleted: Sessão excluída
14
+ section_not_deleted: Sessão não foi excluída
15
+ section_rule_deleted: "Regra de sessão excluída"
16
+ section_rule_not_deleted: "Regra de sessão não foi excluída"
17
+ access_denied: "Acesso negado"
18
+
19
+ admin:
20
+ roles:
21
+ new:
22
+ create: Criar novo Papel
23
+ name: "Nome do Papel (caracteres latinos, com underscore)"
24
+ title: Título do papel (texto)
25
+ description: Descrição do papel (texto)
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 sessã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 sessão
37
+ create_section: Criar nova sessã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 perigiso!'
@@ -13,7 +13,7 @@ class TheRoleGenerator < Rails::Generators::NamedBase
13
13
  elsif gen_name == 'admin'
14
14
  create_admin_role
15
15
  else
16
- puts 'TheComments Generator - wrong Name'
16
+ puts 'TheRole Generator - wrong Name'
17
17
  puts 'Try to use install'
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module TheRole
2
- VERSION = "2.3"
2
+ VERSION = "2.4"
3
3
  end
data/lib/the_role.rb CHANGED
@@ -1,5 +1,3 @@
1
- require 'haml'
2
-
3
1
  require 'the_role/hash'
4
2
  require 'the_role/config'
5
3
  require 'the_role/version'
@@ -1,11 +1,10 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rails', '~> 4.0.0'
4
- gem 'rake', '~> 10.0.4'
3
+ gem 'rails'
5
4
 
5
+ gem 'devise'
6
6
  gem 'sqlite3'
7
7
  gem 'state_machine', '~> 1.2.0'
8
- gem 'devise', git: 'https://github.com/plataformatec/devise.git'
9
8
 
10
9
  gem 'sprockets-rails', github: 'rails/sprockets-rails'
11
10
  gem 'coffee-rails', github: 'rails/coffee-rails'
@@ -19,8 +18,10 @@ gem 'uglifier'
19
18
  gem 'jquery-rails'
20
19
  gem 'jbuilder', '~> 1.0.1'
21
20
 
22
- gem 'the_role' , path: '../../'
23
- gem 'haml' , git: 'https://github.com/haml/haml.git', tag: '4.0.1'
21
+ gem 'the_role', path: '../../'
22
+ gem 'the_role_bootstrap3_ui',
23
+ github: 'the-teacher/the_role_bootstrap3_ui',
24
+ branch: 'master'
24
25
 
25
26
  group :test do
26
27
  gem 'factory_girl_rails', '~> 4.0'
@@ -7,7 +7,7 @@ App for development and testing TheRole gem
7
7
  ```
8
8
  git clone git@github.com:the-teacher/the_role.git
9
9
 
10
- cd the_role/spec/the_role_on_devise/
10
+ cd the_role/spec/dummy_app/
11
11
 
12
12
  bundle
13
13
  ```
@@ -15,7 +15,7 @@ bundle
15
15
  ### Start it!
16
16
 
17
17
  ```
18
- rake db:test_launch
18
+ rake db:bootstrap_and_seed
19
19
 
20
20
  rails s
21
21
  ```
@@ -36,4 +36,4 @@ rake assets:build RAILS_ENV=production
36
36
  rake db:test_launch RAILS_ENV=production
37
37
 
38
38
  rails s -e production
39
- ```
39
+ ```
data/the_role.gemspec CHANGED
@@ -19,5 +19,4 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_runtime_dependency 'rails', ['>= 3', '< 5']
22
- s.add_dependency 'haml'
23
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: the_role
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.3'
4
+ version: '2.4'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilya N. Zykin [the-teacher]
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-15 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,20 +30,6 @@ dependencies:
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5'
33
- - !ruby/object:Gem::Dependency
34
- name: haml
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - '>='
38
- - !ruby/object:Gem::Version
39
- version: '0'
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - '>='
45
- - !ruby/object:Gem::Version
46
- version: '0'
47
33
  description: Authorization for Rails 4 with Web Interface
48
34
  email:
49
35
  - zykin-ilya@ya.ru
@@ -60,8 +46,6 @@ files:
60
46
  - Gemfile
61
47
  - README.md
62
48
  - Rakefile
63
- - app/assets/javascripts/.keep
64
- - app/assets/javascripts/the_role_editinplace.js.coffee
65
49
  - app/controllers/admin/role_sections_controller.rb
66
50
  - app/controllers/admin/roles_controller.rb
67
51
  - app/controllers/concerns/controller.rb
@@ -69,14 +53,10 @@ files:
69
53
  - app/models/concerns/base.rb
70
54
  - app/models/concerns/role.rb
71
55
  - app/models/concerns/user.rb
72
- - app/views/admin/roles/_role.html.haml
73
- - app/views/admin/roles/_sidebar.html.haml
74
- - app/views/admin/roles/edit.html.haml
75
- - app/views/admin/roles/index.haml
76
- - app/views/admin/roles/new.html.haml
77
56
  - config/locales/en.yml
78
57
  - config/locales/es.yml
79
58
  - config/locales/pl.yml
59
+ - config/locales/pt_BR.yml
80
60
  - config/locales/ru.yml
81
61
  - config/locales/zh_CN.yml
82
62
  - config/routes.rb
File without changes
@@ -1,32 +0,0 @@
1
- showForm = (item) ->
2
- holder = item.parents('.holder')
3
- a_item = holder.children('span.a')
4
- b_item = holder.children('span.b')
5
-
6
- a_item.hide().off 'click'
7
- b_item.css('visibility', 'visible')
8
-
9
- holder.find('.btn-warning').click ->
10
- item = $ @
11
- hideForm item
12
- item.parents('form')[0].reset()
13
-
14
- holder.find('.btn-success').click ->
15
- $(@).parents('form')[0].submit()
16
-
17
- b_item.find('input').keypress (event) ->
18
- ENTER = 13
19
- form = $(event.target).parents('form')
20
- form.submit() if event.which is ENTER
21
-
22
- hideForm = (item) ->
23
- holder = item.parents('.holder')
24
- a_item = holder.children('span.a')
25
- b_item = holder.children('span.b')
26
-
27
- a_item.show()
28
- b_item.css('visibility', 'hidden')
29
- holder.find('.btn').off('click')
30
- a_item.click -> showForm item
31
-
32
- $ -> $('span.a', 'h3, h5').click -> showForm $(@)
@@ -1,97 +0,0 @@
1
- - content_for :role_update_btn_set do
2
- .btn-group
3
- %a.btn.btn-warning
4
- %i.icon-repeat.glyphicon.glyphicon-repeat
5
- %a.btn.btn-success
6
- %i.icon-ok.glyphicon.glyphicon-ok
7
-
8
- - content_for :role_main do
9
- - hidden = 'visibility:hidden'
10
- .panel.panel-primary
11
- .panel-heading Role Info (edit in place)
12
- .panel-body
13
- = form_for(role, url: change_admin_role_path(role), html: { class: "form-inline" } ) do |f|
14
- .row
15
- .col-md-12
16
- %h3.holder
17
- = t '.role_name'
18
- %span.a= role.name
19
- %span.b{ style: hidden }
20
- .form-group= f.text_field :name, class: "form-control"
21
- = yield(:role_update_btn_set)
22
-
23
- .row
24
- .col-md-12
25
- %h5.holder
26
- = t '.title'
27
- %span.a= role.title
28
- %span.b{ style: hidden }
29
- .form-group= f.text_field :title, class: "form-control"
30
- = yield(:role_update_btn_set)
31
-
32
- .row
33
- .col-md-12
34
- %h5.holder
35
- = t '.role_description'
36
- %span.a= role.description
37
- %span.b{ style: hidden }
38
- .form-group= f.text_field :description, class: "form-control"
39
- = yield(:role_update_btn_set)
40
-
41
- .panel.panel-primary
42
- .panel-heading Role rules
43
- .panel-body
44
- - role.to_hash.each_pair do |section, rules|
45
- .panel.panel-info
46
- .panel-heading
47
- .row
48
- .col-md-9
49
- %h5= section
50
- .col-md-3
51
- .delete
52
- .btn-group
53
- = button_to t('.delete_section'), admin_role_section_path(role, section), method: :delete, class: 'btn btn-danger', data: { confirm: t('.section_delete_confirm') }
54
-
55
- .panel-body
56
- .rules
57
- - rules.each_pair do |rule, value|
58
- .row
59
- .col-md-9
60
- %h4
61
- &rarr;
62
- = rule
63
- .col-md-3
64
- .controls
65
- .btn-group
66
- - klass = value ? :success : :info
67
- - state = value ? t('.enable') : t('.disable')
68
- %button{ class: "btn btn-#{klass}" }= state
69
- %button{ class: "btn btn-#{klass} dropdown-toggle", 'data-toggle' => :dropdown }
70
- %span.caret
71
- %ul.dropdown-menu
72
- %li.success= link_to t('.enable'), rule_on_admin_role_section_path(role, section, :name => rule), :method => :put
73
- %li.info= link_to t('.disable'), rule_off_admin_role_section_path(role, section, :name => rule), :method => :put
74
- %li.divider
75
- %li.error= link_to t('.delete_rule'), destroy_rule_admin_role_section_path(role, section, :name => rule), method: :delete, data: { confirm: t(".rule_delete_confirm") }
76
-
77
- .panel.panel-success
78
- .panel-heading
79
- = t '.create_section'
80
- .panel-body
81
- = form_tag admin_role_sections_path(role), class: "form-inline"do |f|
82
- .form-group
83
- = text_field_tag :section_name, '', class: "form-control", placeholder: t('.new_section_placeholder')
84
- = submit_tag t('.create_section'), class: "btn btn-success"
85
-
86
- .panel.panel-success
87
- .panel-heading
88
- = t '.create_rule'
89
- .panel-body
90
- = form_tag create_rule_admin_role_sections_path(role), role: :form, class: "form-inline" do |f|
91
- .form-group
92
- %select.form-control{ name: :section_name }
93
- - role.to_hash.each_pair do |section, rules|
94
- %option{ value: section }= section
95
- .form-group
96
- = text_field_tag :rule_name, '', class: "form-control", placeholder: t('.new_rule_placeholder')
97
- = submit_tag t('.create_rule'), class: "btn btn-success"
@@ -1,18 +0,0 @@
1
- - content_for :role_sidebar do
2
- .panel.panel-primary
3
- .panel-heading Role Nav
4
- .panel-body
5
- %h4= link_to raw('&larr; Home'), root_path
6
-
7
- .panel.panel-primary
8
- .panel-heading= t '.roles_list'
9
- .panel-body
10
-
11
- - (@roles || Role.all).each do |role|
12
- %p
13
- = link_to role.title, edit_admin_role_url(role)
14
- (#{role.users.count})
15
- = link_to admin_role_url(role), method: :delete, title: role.title, confirm: t('.delete_role_confirm'), class: :delete do
16
- %i.icon-remove.glyphicon.glyphicon-remove
17
-
18
- %p.new= link_to t('.new_role'), new_admin_role_path
@@ -1,2 +0,0 @@
1
- = render partial: 'sidebar'
2
- = render partial: 'role', locals: { role: @role }
@@ -1,2 +0,0 @@
1
- = render partial: 'sidebar'
2
- = render partial: 'role', locals: { role: @roles.first }
@@ -1,25 +0,0 @@
1
- = render partial: 'sidebar'
2
-
3
- - content_for :role_main do
4
- - unless @role.errors.blank?
5
- - @role.errors.each do |field, message|
6
- .alert.alert-danger
7
- %b= t(".#{field}")
8
- \:
9
- = message
10
-
11
- .panel.panel-success
12
- .panel-heading= raw t('.create')
13
-
14
- .panel-body
15
- = form_for(@role, url: admin_roles_path, role: :form) do |f|
16
- %label= t('.name')
17
- %p= f.text_field :name, class: "form-control"
18
-
19
- %label= t('.title')
20
- %p= f.text_field :title, class: "form-control"
21
-
22
- %label= t('.description')
23
- %p= f.text_field :description, class: "form-control"
24
-
25
- = f.submit t('.create'), class: "btn btn-success"