biovision-regions 0.1.180316 → 0.2.180419

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
  SHA256:
3
- metadata.gz: 2fb6438d3fe3a89b3c390f468b6418aa7f2afd8085a81097d3d113799421d7e6
4
- data.tar.gz: 9d6fe63322491f8c3b2e32f63291468d1a3600bb3cab18cf8977c1a0c641f0b6
3
+ metadata.gz: ef8d872c992f6cbe52c52491f72b11dc2c8b22383fd4ab25fd1c3139825b1e84
4
+ data.tar.gz: 799d93c776c2e189cfd31d6e788125faa327c64e8f8b906e8f468eaaf4b00321
5
5
  SHA512:
6
- metadata.gz: 638a7c6aff83aa3f85f4150013208c586fe03f1e51c3cee699f7041e5157759b7d0464ccaed7e3ef8ab69499b2f9d6662a446399a56fce602d04bc706a91b275
7
- data.tar.gz: 77bc866cacac56908b051e42bd6d8d168a88b5acc32b1e2bd266099bef741b99717617c9e07b2086867efa031db03f590e7b3ff6c49737705a87928ee79aff9f
6
+ metadata.gz: bb8316732d0777858197867b8e649beae50324fa95f9dad839383f6be2400a816cc289ad8a60cab488670af6917be1df69586b7cb9dd910a7025ac6ffa238d27
7
+ data.tar.gz: 48546040871b82df582ad4b9aad6fb4716b487d5e5aa5d39a6f56ad38df9b2256f46b9e70d6be64442b62ee487a324575bd32c8f07853ac7167ba36ef339fcab
@@ -14,7 +14,7 @@ class RegionsController < ApplicationController
14
14
  def create
15
15
  @entity = Region.new(creation_parameters)
16
16
  if @entity.save
17
- form_processed_ok(admin_region_path(@entity.id))
17
+ form_processed_ok(admin_region_path(id: @entity.id))
18
18
  else
19
19
  form_processed_with_error(:new)
20
20
  end
@@ -34,7 +34,7 @@ class RegionsController < ApplicationController
34
34
  # patch /regions/:id
35
35
  def update
36
36
  if @entity.update(entity_parameters)
37
- form_processed_ok(admin_region_path(@entity.id))
37
+ form_processed_ok(admin_region_path(id: @entity.id))
38
38
  else
39
39
  form_processed_with_error(:edit)
40
40
  end
@@ -70,7 +70,7 @@ class RegionsController < ApplicationController
70
70
 
71
71
  def restrict_editing
72
72
  if @entity.locked? || !@entity.editable_by?(current_user)
73
- redirect_to admin_region_path(@entity.id), alert: t('regions.edit.forbidden')
73
+ redirect_to admin_region_path(id: @entity.id), alert: t('regions.edit.forbidden')
74
74
  end
75
75
  end
76
76
 
@@ -1,7 +1,7 @@
1
1
  module BiovisionRegionsHelper
2
2
  # @param [Region] entity
3
3
  def admin_region_link(entity)
4
- link_to(entity.name, admin_region_path(entity.id))
4
+ link_to(entity.name, admin_region_path(id: entity.id))
5
5
  end
6
6
 
7
7
  # @param [Region] entity
@@ -4,7 +4,7 @@
4
4
  <%= label_tag element_id, region.name %>
5
5
  </div>
6
6
  <% if region.children_cache.any? %>
7
- <ul class="regions" data-url="<%= regions_admin_privilege_path(privilege.id, parent_id: region.id, user_id: user.id) %>">
7
+ <ul class="regions" data-url="<%= regions_admin_privilege_path(id: privilege.id, parent_id: region.id, user_id: user.id) %>">
8
8
  <li>
9
9
  <button class="add_regions" type="button"><%= t('.deeper_level') %></button>
10
10
  </li>
@@ -9,12 +9,12 @@
9
9
  <div class="secondary info">
10
10
  <%= t(:user_count, count: entity.users_count) %>
11
11
  </div>
12
- <%= render partial: 'shared/admin/toggleable', locals: { entity: entity, url: toggle_admin_region_path(entity.id) } %>
12
+ <%= render partial: 'shared/admin/toggleable', locals: { entity: entity, url: toggle_admin_region_path(id: entity.id) } %>
13
13
 
14
14
  <ul class="actions">
15
15
  <li class="lockable <%= (entity.editable_by?(current_user) && !entity.locked?) ? '' : 'hidden' %>">
16
- <%= edit_icon edit_region_path(entity) %>
16
+ <%= edit_icon edit_region_path(id: entity.id) %>
17
17
  </li>
18
- <%= render partial: 'shared/actions/locks', locals: { entity: entity, path: lock_admin_region_path(entity) } %>
18
+ <%= render partial: 'shared/actions/locks', locals: { entity: entity, path: lock_admin_region_path(id: entity.id) } %>
19
19
  </ul>
20
20
  </div>
@@ -13,7 +13,7 @@
13
13
  <ul class="actions">
14
14
  <li><%= back_icon(admin_regions_path) %></li>
15
15
  <% if @entity.editable_by?(current_user) && !@entity.locked? %>
16
- <li><%= edit_icon edit_region_path(@entity.id) %></li>
16
+ <li><%= edit_icon edit_region_path(id: @entity.id) %></li>
17
17
  <% end %>
18
18
  </ul>
19
19
 
@@ -4,8 +4,8 @@ json.attributes do
4
4
  json.(region, :parent_id, :name, :short_name, :priority, :slug, :long_slug)
5
5
  end
6
6
  json.links do
7
- json.self region_path(region.id, format: :json)
8
- json.children children_region_path(region.id)
7
+ json.self region_path(id: region.id, format: :json)
8
+ json.children children_region_path(id: region.id)
9
9
  end
10
10
  json.meta do
11
11
  json.child_count region.children_cache.count
@@ -12,7 +12,7 @@
12
12
  <h1><%= t('.title') %></h1>
13
13
 
14
14
  <ul class="actions">
15
- <li><%= return_icon(admin_region_path(@entity.id)) %></li>
15
+ <li><%= return_icon(admin_region_path(id: @entity.id)) %></li>
16
16
  <li class="danger"><%= destroy_icon(@entity) %></li>
17
17
  </ul>
18
18
 
@@ -9,7 +9,7 @@
9
9
 
10
10
  <% unless @entity.parent.nil? %>
11
11
  <ul class="actions">
12
- <li><%= return_icon(admin_region_path(@entity.parent_id)) %></li>
12
+ <li><%= return_icon(admin_region_path(id: @entity.parent_id)) %></li>
13
13
  </ul>
14
14
  <% end %>
15
15
 
data/config/routes.rb CHANGED
@@ -1,21 +1,24 @@
1
1
  Rails.application.routes.draw do
2
+ scope '(:locale)', constraints: { locale: /ru|en/ } do
3
+ namespace :admin do
4
+ resources :regions, only: [:index, :show] do
5
+ member do
6
+ post 'priority', defaults: { format: :json }
7
+ post 'toggle', defaults: { format: :json }
8
+ put 'lock', defaults: { format: :json }
9
+ delete 'lock', action: :unlock, defaults: { format: :json }
10
+ end
11
+ end
12
+
13
+ # get 'privileges/:id/regions' => 'privileges#regions', as: :regions_admin_privilege, defaults: { format: :json }
14
+ end
2
15
 
3
- namespace :admin do
4
- resources :regions, only: [:index, :show] do
16
+ resources :regions, except: [:update, :destroy] do
5
17
  member do
6
- post 'priority', defaults: { format: :json }
7
- post 'toggle', defaults: { format: :json }
8
- put 'lock', defaults: { format: :json }
9
- delete 'lock', action: :unlock, defaults: { format: :json }
18
+ get 'children', defaults: { format: :json }
10
19
  end
11
20
  end
12
-
13
- # get 'privileges/:id/regions' => 'privileges#regions', as: :regions_admin_privilege, defaults: { format: :json }
14
21
  end
15
22
 
16
- resources :regions do
17
- member do
18
- get 'children', defaults: { format: :json }
19
- end
20
- end
23
+ resources :regions, only: [:update, :destroy]
21
24
  end
@@ -1,5 +1,5 @@
1
1
  module Biovision
2
2
  module Regions
3
- VERSION = '0.1.180316'
3
+ VERSION = '0.2.180419'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biovision-regions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.180316
4
+ version: 0.2.180419
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Khan-Magomedov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -240,7 +240,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
240
240
  version: '0'
241
241
  requirements: []
242
242
  rubyforge_project:
243
- rubygems_version: 2.7.3
243
+ rubygems_version: 2.7.6
244
244
  signing_key:
245
245
  specification_version: 4
246
246
  summary: Regional module for biovision-based application