wco_models 3.1.0.147 → 3.1.0.148

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: 9dda9cec9a14631ff34abd28542db031215e9431ebe422329e1f3c8a6fb295ea
4
- data.tar.gz: 0fa1061f925315c0894b17e73ea1fbdde9e588cc6d1094c9ad4c94f04b8f1b34
3
+ metadata.gz: 6d659451d072adbf696dd6a317cb383990bd0d8da8460b984c38f4adc7c867ff
4
+ data.tar.gz: 80b994dce92435205be381c9fb1b83f8fe889f9e7b455766cf133576a910de7e
5
5
  SHA512:
6
- metadata.gz: b25ec1622c39432e74881462374afcfb21822a3d686bef81eaf32fa3afec23bb52eac3a2daa58cf09c66ef26c1bed0760e5ddc93264c59b1745605bc1d84d995
7
- data.tar.gz: c2ae2e54509129cfcd18f56762bfb53861d55c4d6030f721a7739d1979a6324ec3fbfe3ec76ecb1984e94ff30ea0cacbf94a05292dd030178e7aec41aa416c61
6
+ metadata.gz: c5d4f74a454d00bda9c508502dcde00fcea82ab1ff2b07bf34176780127402e1d0788eec5fa4c9ec0df897d0fb6929edc15f8c0fda7c5cbfec33397efea190fb
7
+ data.tar.gz: dd976a05848a79c8fdd07820ccec5a0244892309d79cf3b1c6911f42f859d29fe76d7366168600ae1b145919335db004d60c278c17a63ec2df2252737d71e19a
@@ -26,10 +26,14 @@ class Wco::LeadsController < Wco::ApplicationController
26
26
  authorize! :index, Wco::Lead
27
27
  @leads = Wco::Lead.all
28
28
 
29
+
30
+
29
31
  if params[:q].present?
32
+ q = params[:q].downcase
30
33
  @leads = @leads.any_of(
31
- { email: /#{params[:q].downcase}/i },
32
- { name: /#{params[:q].downcase}/i } )
34
+ { email: /#{q}/i },
35
+ { name: /#{q}/i },
36
+ );
33
37
 
34
38
  if 1 == @leads.length
35
39
  redirect_to controller: 'wco/leads', action: 'show', id: @leads[0].id
@@ -1,6 +1,16 @@
1
1
 
2
2
  class Wco::ProfilesController < Wco::ApplicationController
3
3
 
4
+ def edit
5
+ @profile = Wco::Profile.find params[:id]
6
+ authorize! :update, @profile
7
+ end
8
+
9
+ def index
10
+ @profiles = Wco::Profile.all
11
+ authorize! :index, Wco::Profile
12
+ end
13
+
4
14
  def update
5
15
  @profile = Wco::Profile.find params[:id]
6
16
  authorize! :update, @profile
@@ -1,7 +1,7 @@
1
1
 
2
2
  class Wco::TagsController < Wco::ApplicationController
3
3
 
4
- before_action :set_lists, only: %i| show |
4
+ before_action :set_lists
5
5
 
6
6
  def create
7
7
  @tag = Wco::Tag.new params[:tag].permit!
@@ -37,7 +37,6 @@ class Wco::TagsController < Wco::ApplicationController
37
37
 
38
38
  def new
39
39
  authorize! :new, Wco::Tag
40
- @new_tag = Wco::Tag.new
41
40
  end
42
41
 
43
42
  def add_to
@@ -91,7 +90,9 @@ class Wco::TagsController < Wco::ApplicationController
91
90
  private
92
91
 
93
92
  def set_lists
93
+ @new_tag = Wco::Tag.new
94
94
  @tags = Wco::Tag.all.order_by( slug: :asc )
95
+ @tags_list = Wco::Tag.list
95
96
  end
96
97
 
97
98
 
@@ -16,6 +16,13 @@ class Wco::Profile
16
16
  has_many :newsitems, class_name: 'Wco::Newsitem'
17
17
  has_and_belongs_to_many :shared_galleries, class_name: 'Wco::Gallery', inverse_of: :shared_profiles
18
18
 
19
+ ROLE_ADMIN = 'admin'
20
+ ROLE_GUY = 'guy'
21
+ ROLES = [ ROLE_ADMIN, ROLE_GUY ]
22
+ field :role, type: :string, default: ROLE_GUY
23
+ def self.roles_list
24
+ [nil] + ROLES
25
+ end
19
26
 
20
27
  def to_s
21
28
  email
@@ -9,7 +9,8 @@ class Wco::Tag
9
9
  validates :slug, presence: true, uniqueness: true
10
10
  index({ slug: -1 })
11
11
 
12
- # parent-child
12
+ belongs_to :parent, class_name: 'Wco::Tag', inverse_of: :sons
13
+ has_many :sons, class_name: 'Wco::Tag', inverse_of: :parent
13
14
 
14
15
  has_many :email_filters, class_name: 'WcoEmail::EmailFilter', inverse_of: :tag
15
16
 
@@ -28,6 +28,7 @@
28
28
  %li= render '/wco/leads/header'
29
29
  %li= render '/wco/office_action_templates/header'
30
30
  %li= render '/wco/office_actions/header'
31
+ %li= render '/wco/profiles/header'
31
32
 
32
33
  %ul
33
34
  %li= render '/wco/sites/header'
@@ -0,0 +1,9 @@
1
+
2
+ .profiles--form
3
+ = form_for profile do |f|
4
+ .field
5
+ %label role
6
+ = f.select :role, options_for_select(Wco::Profile.roles_list, selected: profile.role )
7
+
8
+ .actions
9
+ = f.submit 'Go'
@@ -0,0 +1,6 @@
1
+
2
+ = link_to "Profiles (#{Wco::Profile.all.length})", wco.profiles_path
3
+ .inline-search
4
+ = form_tag wco.profiles_path, method: :get do
5
+ = text_field_tag :q
6
+ = link_to '[+]', wco.new_profile_path
@@ -0,0 +1,6 @@
1
+
2
+ .profiles-edit.maxwidth
3
+ .header
4
+ .title edit profile
5
+
6
+ = render 'form', profile: @profile
@@ -0,0 +1,10 @@
1
+
2
+ .profiles-index.maxwidth
3
+ .header
4
+ .title Profiles
5
+
6
+ %ul
7
+ - @profiles.each do |profile|
8
+ %li
9
+ = link_to '[~]', edit_profile_path(profile)
10
+ = profile.email
@@ -6,5 +6,9 @@
6
6
  %label slug
7
7
  = f.text_field :slug
8
8
 
9
+ .field.d-flex
10
+ %label parent
11
+ = f.select :parent_id, options_for_select(@tags_list, selected: tag.parent_id ), {}, class: 'select2'
12
+
9
13
  .actions
10
14
  = f.submit
@@ -1,4 +1,6 @@
1
1
 
2
2
  .tags-edit.maxwidth
3
+ .header
4
+ %h5.title Edit tag `#{@tag}`
3
5
 
4
6
  = render 'form', tag: @tag
@@ -6,4 +6,9 @@
6
6
  = render 'index', tags: @tags
7
7
 
8
8
  %hr
9
- = render 'form', tag: Wco::Tag.new
9
+
10
+ .tags-new.maxwidth
11
+ .header
12
+ %h5.title New tag
13
+
14
+ = render 'form', tag: @new_tag
@@ -0,0 +1,6 @@
1
+
2
+ .tags-new.maxwidth
3
+ .header
4
+ %h5.title New tag
5
+
6
+ = render 'form', tag: @new_tag
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wco_models
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0.147
4
+ version: 3.1.0.148
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Pudeyev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-25 00:00:00.000000000 Z
11
+ date: 2024-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -574,7 +574,11 @@ files:
574
574
  - app/views/wco/products/new.haml
575
575
  - app/views/wco/products/show.haml
576
576
  - app/views/wco/products/show.jbuilder
577
+ - app/views/wco/profiles/_form.haml
577
578
  - app/views/wco/profiles/_form_extra.haml
579
+ - app/views/wco/profiles/_header.haml
580
+ - app/views/wco/profiles/edit.haml
581
+ - app/views/wco/profiles/index.haml
578
582
  - app/views/wco/publishers/_form.haml
579
583
  - app/views/wco/publishers/_header.haml
580
584
  - app/views/wco/publishers/edit.haml