wco_models 3.1.0.146 → 3.1.0.148

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd48f5f6cbeccdf413bedcd4358c62a04b8732fe8f75bb785c09e0222810a195
4
- data.tar.gz: 64bf32188f9c2be4a0be446bd23a86e038cfd86e3e5b6a1398b31c601a129da5
3
+ metadata.gz: 6d659451d072adbf696dd6a317cb383990bd0d8da8460b984c38f4adc7c867ff
4
+ data.tar.gz: 80b994dce92435205be381c9fb1b83f8fe889f9e7b455766cf133576a910de7e
5
5
  SHA512:
6
- metadata.gz: 0772a4d001ca41e254a776757734f312108f9dfb67c2bc73ac1ad5a812d00bc91cfbec727125835f48ac8c1004bad6fb9f22dd1e497cbedd9212cc32b0c770f5
7
- data.tar.gz: 7e4c728c3cb83079b473f8990749e5d9edc328b759a8ba603a49e21472fbf7523cee1dbf2709167a0debe1ee1a229805991ba3d393cb92012d9431b07f47f6b4
6
+ metadata.gz: c5d4f74a454d00bda9c508502dcde00fcea82ab1ff2b07bf34176780127402e1d0788eec5fa4c9ec0df897d0fb6929edc15f8c0fda7c5cbfec33397efea190fb
7
+ data.tar.gz: dd976a05848a79c8fdd07820ccec5a0244892309d79cf3b1c6911f42f859d29fe76d7366168600ae1b145919335db004d60c278c17a63ec2df2252737d71e19a
@@ -17,6 +17,7 @@ class Wco::ApplicationController < ActionController::Base
17
17
  check_authorization
18
18
 
19
19
  before_action :current_profile
20
+ before_action :set_lists
20
21
 
21
22
  def home
22
23
  authorize! :home, Wco
@@ -80,4 +81,7 @@ class Wco::ApplicationController < ActionController::Base
80
81
  ["1", "t", "T", "true"].include?( which )
81
82
  end
82
83
 
84
+ def set_lists
85
+ end
86
+
83
87
  end
@@ -1,7 +1,6 @@
1
1
 
2
2
  class Wco::GalleriesController < Wco::ApplicationController
3
3
 
4
- before_action :set_lists, only: %i| show |
5
4
  before_action :set_gallery, only: %w| destroy edit j_show show update update_ordering |
6
5
 
7
6
  # Alphabetized! : )
@@ -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.146
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