diff --git a/Gemfile.lock b/Gemfile.lock index e1d6f0115..bf66a2fd4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -54,8 +54,8 @@ GEM arel (9.0.0) ast (2.4.0) aws-eventstream (1.0.1) - aws-partitions (1.104.0) - aws-sdk-core (3.27.1) + aws-partitions (1.105.0) + aws-sdk-core (3.28.0) aws-eventstream (~> 1.0) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) @@ -154,7 +154,7 @@ GEM i18n (1.1.0) concurrent-ruby (~> 1.0) ice_nine (0.11.2) - image_processing (1.7.0) + image_processing (1.7.1) mini_magick (~> 4.0) ruby-vips (>= 2.0.13, < 3) io-like (0.3.0) @@ -254,9 +254,9 @@ GEM responders (2.4.0) actionpack (>= 4.2.0, < 5.3) railties (>= 4.2.0, < 5.3) - rollbar (2.17.0) + rollbar (2.18.0) multi_json - rubocop (0.59.1) + rubocop (0.59.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.5, != 2.5.1.1) diff --git a/app/controllers/public_profile_controller.rb b/app/controllers/public_profile_controller.rb index 8209392fc..f651a8d46 100644 --- a/app/controllers/public_profile_controller.rb +++ b/app/controllers/public_profile_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class PublicProfileController < ApplicationController + include PagyBackendWithHelpers + skip_before_action :authenticate_user! before_action :set_user, only: %i[show vcard] before_action :set_employee, only: %i[show vcard] @@ -8,14 +10,12 @@ class PublicProfileController < ApplicationController def show; end - def index; end - - def vcard - send_data vcard_content(@identity), type: 'text/vcard; charset=utf-8; header=present', filename: 'contact.vcf' + def index + @users = User.joins(:employees).search(params[:term]) end - def search - @users = User.joins(:identities).search(params[:word]) + def vcard + send_data VcardBuilder.new(@identity), type: 'text/vcard; charset=utf-8; header=present', filename: 'contact.vcf' end private @@ -33,18 +33,4 @@ def check_identity @identity = @user.identities.user_identity not_found if @identity.blank? end - - def vcard_content(identity) - <<~VCARD - BEGIN:VCARD - VERSION:3.0 - N:#{identity.last_name};#{identity.first_name};;; - FN:#{identity.first_name} #{identity.last_name} - ORG:Ondokuz Mayıs Üniversitesi - TITLE:#{identity.user.title} - TEL;TYPE=WORK,VOICE:+90 (362) 312-1919 - EMAIL:#{identity.user.email} - END:VCARD - VCARD - end end diff --git a/app/jobs/kps/identity_save_job.rb b/app/jobs/kps/identity_save_job.rb index ed3cfa00e..462ac0ff6 100644 --- a/app/jobs/kps/identity_save_job.rb +++ b/app/jobs/kps/identity_save_job.rb @@ -12,9 +12,10 @@ def perform(user, student_id = nil) # callbacks after_perform do |job| - response = @response.merge(student_id: @student_id) - formal_address = job.arguments.first.identities.formal - formal_address.present? ? formal_address.update(response) : formal_address.create(response) + response = @response.merge(student_id: @student_id, type: 'formal') + user = job.arguments.first + formal_identity = user.identities.user_identity + formal_identity.present? ? formal_identity.update(response) : user.identities.create(response) end end end diff --git a/app/services/vcard_builder.rb b/app/services/vcard_builder.rb new file mode 100644 index 000000000..8041a51c1 --- /dev/null +++ b/app/services/vcard_builder.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +class VcardBuilder + def initialize(identity) + @identity = identity + end + + def build_vcard + <<~VCARD + BEGIN:VCARD + VERSION:3.0 + N:#{@identity.last_name};#{@identity.first_name};;; + FN:#{@identity.first_name} #{@identity.last_name} + ORG:#{Rails.application.config.tenant.name} + TITLE:#{@identity.user.title} + EMAIL:#{@identity.user.email} + END:VCARD + VCARD + end +end diff --git a/app/validators/duty_validator.rb b/app/validators/duty_validator.rb index fdc2bab71..6cc691da1 100644 --- a/app/validators/duty_validator.rb +++ b/app/validators/duty_validator.rb @@ -5,7 +5,7 @@ def validate(record) @duty = record @duties = record.employee.user.duties.where.not(id: @duty.id) - date_validation if @duty.start_date.present? && @duty.end_date.present? + date_validation if @duty.start_date? && @duty.end_date? restrict_duties if @duty.active? end diff --git a/app/validators/position_validator.rb b/app/validators/position_validator.rb index 60d6318e4..08df87804 100644 --- a/app/validators/position_validator.rb +++ b/app/validators/position_validator.rb @@ -5,7 +5,7 @@ def validate(record) @position = record @positions = record.duty.employee.user.positions.where.not(id: @position.id) - date_validation if @position.start_date.present? && @position.end_date.present? + date_validation if @position.start_date? && @position.end_date? restrict_positions if @position.active? end diff --git a/app/views/public_profile/_form.html.erb b/app/views/public_profile/_search.html.erb similarity index 56% rename from app/views/public_profile/_form.html.erb rename to app/views/public_profile/_search.html.erb index bc61c9a67..9d90f29a4 100644 --- a/app/views/public_profile/_form.html.erb +++ b/app/views/public_profile/_search.html.erb @@ -12,15 +12,20 @@

Bir arama yapın

- <%= form_tag profiles_search_path do |f| %> + <%= form_tag profiles_path, method: :get do |f| %>
- <%= text_field_tag :word, locals[:word], class: 'form-control', placeholder: 'Aramak istediğiniz isim, e-posta veya birim adı girin..', required: true, autocomplete: 'off' %> + <%= text_field_tag :term, + params[:term], + placeholder: 'Aramak istediğiniz isim, e-posta veya birim adı girin..', + required: true, + autocomplete: 'off', + class: 'form-control' %> - + <%= submit_tag t('search'), class: 'btn btn-primary' %>
<% end %>
- \ No newline at end of file + diff --git a/app/views/public_profile/index.html.erb b/app/views/public_profile/index.html.erb index aa54bba76..71c5e3e3c 100644 --- a/app/views/public_profile/index.html.erb +++ b/app/views/public_profile/index.html.erb @@ -1 +1,26 @@ -<%= render 'form', locals: { word: '' } %> +<%= render 'search', locals: { term: params[:term] } %> + +<% if params[:term] %> +
+
+
+ <%= fa_icon 'search' %> <%= params[:term] %> için arama sonuçları +
+
+
+ <% if @users.any? %> +
+ <% @users.each do |user| %> + <%= link_to profiles_show_path(user.slug), class: 'list-group-item list-group-item-action' do %> + [<%= user.try(:title) %>] - <%= full_name(user.identities.user_identity) %> + <% end %> + <% end %> +
+ <% else %> +

Aradığınız kriterlere göre bir sonuç bulunamadı...

+ <% end %> +
+
+
+
+<% end %> \ No newline at end of file diff --git a/app/views/public_profile/search.html.erb b/app/views/public_profile/search.html.erb deleted file mode 100644 index ef9f7a3a9..000000000 --- a/app/views/public_profile/search.html.erb +++ /dev/null @@ -1,25 +0,0 @@ -<%= render 'form', locals: { word: params[:word] } %> - -
-
-
- `<%= params[:word] %>` için arama sonuçları -
-
-
- <% if @users.count > 0 %> -
- <% @users.each do |user| %> - <%= link_to profiles_show_path(user.slug), class: 'list-group-item list-group-item-action' do %> - <%= full_name(user.identities.user_identity) %> - <%= user.try(:title) %> - <% end %> - <% end %> -
- <% else %> -

Aradığınız kriterlere göre bir sonuç bulunamadı...

- <% end %> -
-
-
-
\ No newline at end of file diff --git a/app/views/references/languages/index.html.erb b/app/views/references/languages/index.html.erb index caf6e52be..b4706dc4b 100644 --- a/app/views/references/languages/index.html.erb +++ b/app/views/references/languages/index.html.erb @@ -26,7 +26,6 @@ <%= language.name %> <%= language.iso %> - <%= link_to_show(language_path(language)) %> <%= link_to_edit(edit_language_path(language)) %> <%= link_to_destroy(language) %> diff --git a/app/views/units/_search.html.erb b/app/views/units/_search.html.erb index 29cabd55c..d316d2111 100644 --- a/app/views/units/_search.html.erb +++ b/app/views/units/_search.html.erb @@ -26,7 +26,7 @@
<%= label_tag :term, t('smart_search') %> - <%= text_field_tag :term, + <%= text_field_tag :term, params[:term], placeholder: t('.smart_search_placeholder'), class: 'form-control' %> @@ -35,7 +35,7 @@
<%= label_tag :duration, t('.duration') %> - <%= text_field_tag :duration, + <%= text_field_tag :duration, params[:duration], placeholder: "Öğretim Süresi (Yıl)", class: 'form-control' %> diff --git a/config/locales/layouts/shared/sidebar_tr.yml b/config/locales/layouts/shared/sidebar_tr.yml index 28418fbba..4f60a8268 100644 --- a/config/locales/layouts/shared/sidebar_tr.yml +++ b/config/locales/layouts/shared/sidebar_tr.yml @@ -11,7 +11,7 @@ tr: committee_units: Kurul/Komisyon Birimleri committees: Kurullar/Komisyonlar course_group_types: Ders Grup Türleri - course_management: Ders İşlemler + course_management: Ders İşlemleri course_unit_groups: Ders Grupları courses: Dersler curriculums: Müfredatlar diff --git a/config/routes.rb b/config/routes.rb index ec32e5c48..9d847874b 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -33,7 +33,7 @@ end scope module: :student_management do - resources :prospective_students do + resources :prospective_students, only: %i[index show] do get 'register', on: :member end end @@ -53,9 +53,7 @@ # public profiles get '/profiles', to: 'public_profile#index' - post '/profiles/search', to: 'public_profile#search' get '/profiles/:id', to: 'public_profile#show', as: :profiles_show - get '/profiles/:id', to: 'public_profile#show' get '/profiles/:id/vcard', to: 'public_profile#vcard', as: :profile_vcard scope module: :studies do