From 5ee1e72aad98e8c3fb9d1e564a04f0278c881496 Mon Sep 17 00:00:00 2001 From: ecmelkytz Date: Wed, 13 Mar 2019 15:51:26 +0300 Subject: [PATCH 01/48] =?UTF-8?q?A=C3=A7=C4=B1lan=20derslerde=20en=20az=20?= =?UTF-8?q?1=20grup=20tan=C4=B1mlanmas=C4=B1n=C4=B1=20zorunlu=20yap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../available_courses_controller.rb | 10 ++-- app/decorators/curriculum_decorator.rb | 2 +- app/models/available_course.rb | 3 ++ .../available_courses/_form.html.erb | 19 ++++++-- .../available_courses/_group_fields.html.erb | 25 ++++++++++ .../available_courses/_js.html.erb | 23 +++++++++ .../_lecturer_fields.html.erb | 19 ++++++++ .../available_courses.en.yml | 5 ++ .../available_courses.tr.yml | 5 ++ .../available_courses_controller_test.rb | 48 +++++++++++++------ test/models/available_course_test.rb | 9 ++-- 11 files changed, 137 insertions(+), 31 deletions(-) create mode 100644 app/views/course_management/available_courses/_group_fields.html.erb create mode 100644 app/views/course_management/available_courses/_lecturer_fields.html.erb diff --git a/app/controllers/course_management/available_courses_controller.rb b/app/controllers/course_management/available_courses_controller.rb index dcc565eff..d28633854 100644 --- a/app/controllers/course_management/available_courses_controller.rb +++ b/app/controllers/course_management/available_courses_controller.rb @@ -22,15 +22,12 @@ def show def new @available_course = AvailableCourse.new + @available_course.groups.build.lecturers.build end def create @available_course = AvailableCourse.new(available_course_params) - if @available_course.save - redirect_to new_available_course_available_course_group_path(@available_course) - else - render(:new) - end + @available_course.save ? redirect_to(@available_course, notice: t('.success')) : render(:new) end def edit; end @@ -60,7 +57,8 @@ def set_available_course def available_course_params params.require(:available_course).permit( - :curriculum_id, :course_id, :unit_id, :coordinator_id + :curriculum_id, :course_id, :unit_id, :coordinator_id, + groups_attributes: [:id, :name, :quota, lecturers_attributes: %i[id lecturer_id coordinator _destroy]] ) end end diff --git a/app/decorators/curriculum_decorator.rb b/app/decorators/curriculum_decorator.rb index 840da3112..ce11add13 100644 --- a/app/decorators/curriculum_decorator.rb +++ b/app/decorators/curriculum_decorator.rb @@ -7,7 +7,7 @@ def openable_courses_for_active_term(appends: nil) return [] unless term courses = semesters.where(term: term) - .includes(:courses) + .includes(:courses, :curriculum_courses) .where.not(courses: { id: available_courses.pluck(:course_id) }) .order('courses.name') .map(&:courses) diff --git a/app/models/available_course.rb b/app/models/available_course.rb index daca6b956..8d0ee70ca 100644 --- a/app/models/available_course.rb +++ b/app/models/available_course.rb @@ -25,10 +25,13 @@ class AvailableCourse < ApplicationRecord belongs_to :unit has_many :evaluation_types, class_name: 'CourseEvaluationType', dependent: :destroy has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy + has_many :lecturers, through: :groups + accepts_nested_attributes_for :groups, reject_if: :all_blank, allow_destroy: true # validations validates :assessments_approved, inclusion: { in: [true, false] } validates :course, uniqueness: { scope: %i[academic_term curriculum] } + validates :groups, presence: true # delegates delegate :code, :name, :theoric, :practice, :laboratory, :credit, :program_type, to: :course diff --git a/app/views/course_management/available_courses/_form.html.erb b/app/views/course_management/available_courses/_form.html.erb index f5292f1b9..c87ddee18 100644 --- a/app/views/course_management/available_courses/_form.html.erb +++ b/app/views/course_management/available_courses/_form.html.erb @@ -18,7 +18,7 @@ <% end %> <% end %> -
+
<%= f.association :unit, collection: Unit.active.coursable.order(:name), @@ -41,11 +41,21 @@ <%= f.association :course, collection: [*courses] %>
-
- <%= f.button :submit, class: 'btn btn-outline-success btn-sm' %> - <%= link_to_back(:back) %> +
+ +

<%= t('.groups') %>

+
+ <%= f.simple_fields_for :groups do |group| %> + <%= render 'group_fields', f: group, dene: f %> + <% end %> +
+
+ <%= f.button :submit, class: 'btn btn-outline-success btn-sm' %> + <%= link_to_back(:back) %> +
<% end %>
@@ -53,3 +63,4 @@ <%= render 'js' %> +<%= javascript_include_tag 'shared/cocoon' %> diff --git a/app/views/course_management/available_courses/_group_fields.html.erb b/app/views/course_management/available_courses/_group_fields.html.erb new file mode 100644 index 000000000..1b26803bf --- /dev/null +++ b/app/views/course_management/available_courses/_group_fields.html.erb @@ -0,0 +1,25 @@ +
+
+
+
+
+ <%= f.input :name, required: true %> +
+
+ <%= f.input :quota, required: true %> +
+
+
+ <%= f.simple_fields_for :lecturers do |lecturer| %> + <%= render 'lecturer_fields', f: lecturer, dene: f %> + <% end %> + +
+
+ +
+
diff --git a/app/views/course_management/available_courses/_js.html.erb b/app/views/course_management/available_courses/_js.html.erb index 72df1546f..a786f4247 100644 --- a/app/views/course_management/available_courses/_js.html.erb +++ b/app/views/course_management/available_courses/_js.html.erb @@ -18,6 +18,15 @@ reset_selectors: '#available_course_curriculum_id, #available_course_course_id', placeholder: 'Müfredat Seçiniz' }, + { + el: '#available_course_unit_id', + target: '#group_lecturer_id', + params: { 'unit_id': '#available_course_unit_id' }, + source: '/units/:unit_id/employees/', + label_attribute: 'full_name', + reset_selectors: '#group_lecturer_id', + placeholder: 'Öğretim Elemanını Seçiniz' + }, { el: '#available_course_curriculum_id', target: '#available_course_course_id', @@ -38,5 +47,19 @@ ] var dynamic_select = new DynamicSelect(parameters) dynamic_select.init() + + configure_link_to_remove() + + function configure_link_to_remove() { + if ($('#groups.nested-fields:visible').length == 1) { + $('#groups.card-footer:visible').hide(); + } else { + $('#groups.card-footer:hidden').show(); + } + } + + $('#groups').on('cocoon:after-insert cocoon:after-remove', function() { + configure_link_to_remove() + }); }); diff --git a/app/views/course_management/available_courses/_lecturer_fields.html.erb b/app/views/course_management/available_courses/_lecturer_fields.html.erb new file mode 100644 index 000000000..8eb784868 --- /dev/null +++ b/app/views/course_management/available_courses/_lecturer_fields.html.erb @@ -0,0 +1,19 @@ +
+
+
+
+
+ <%= f.association :lecturer, collection: [*f.object&.group&.available_course&.unit&.subtree_employees], + label_method: lambda { |c| full_name(c) }, + input_html:{ id: 'group_lecturer_id' }%> +
+
+ <%= f.input :coordinator, collection: [[t('yes'), true], [t('no'), false]], required: true %> +
+
+
+ +
+
diff --git a/config/locales/controllers/course_management/available_courses.en.yml b/config/locales/controllers/course_management/available_courses.en.yml index b83c43af6..6a5a6d1b4 100644 --- a/config/locales/controllers/course_management/available_courses.en.yml +++ b/config/locales/controllers/course_management/available_courses.en.yml @@ -6,6 +6,7 @@ en: coordinator: Coordinator course: Course curriculum: Curriculum + groups: Groups unit: Unit course_management: available_courses: @@ -29,6 +30,8 @@ en: name: Group Name quota: Quota title: Title + group_fields: + add_lecturer: Add Lecturer index: <<: *available_course_attributes add_new_available_course: Add a New Available Course @@ -42,6 +45,8 @@ en: <<: *available_course_attributes smart_search_placeholder: Course Name / Course Code form: + add_group: Add Group + groups: Groups unit: Unit show: <<: *available_course_attributes diff --git a/config/locales/controllers/course_management/available_courses.tr.yml b/config/locales/controllers/course_management/available_courses.tr.yml index 5970b9192..e40cae1e1 100644 --- a/config/locales/controllers/course_management/available_courses.tr.yml +++ b/config/locales/controllers/course_management/available_courses.tr.yml @@ -6,6 +6,7 @@ tr: coordinator: Koordinatör course: Ders curriculum: Müfredat + groups: Gruplar unit: Birim course_management: available_courses: @@ -29,6 +30,8 @@ tr: name: Grup Adı quota: Kontenjan title: Ünvan + group_fields: + add_lecturer: Öğretim Elemanı Ekle index: <<: *available_course_attributes add_new_available_course: Yeni Açılan Ders Ekle @@ -42,6 +45,8 @@ tr: <<: *available_course_attributes smart_search_placeholder: Ders Adı / Ders Kodu form: + add_group: Grup Ekle + groups: Gruplar unit: Birim show: <<: *available_course_attributes diff --git a/test/controllers/course_management/available_courses_controller_test.rb b/test/controllers/course_management/available_courses_controller_test.rb index 125ec09a0..14fc8fd4e 100644 --- a/test/controllers/course_management/available_courses_controller_test.rb +++ b/test/controllers/course_management/available_courses_controller_test.rb @@ -25,24 +25,33 @@ class AvailableCoursesControllerTest < ActionDispatch::IntegrationTest end test 'should create available course' do - parameters = { - academic_term: academic_terms(:fall_2018_2019), - curriculum_id: curriculums(:one).id, - course_id: courses(:ydi).id, - coordinator_id: employees(:chief_john).id, - unit_id: units(:omu).id - } - assert_difference('AvailableCourse.count') do - post available_courses_path, params: { available_course: parameters } + post available_courses_path, params: { + available_course: { + curriculum_id: curriculums(:one).id, course_id: courses(:ydi).id, + coordinator_id: employees(:chief_john).id, unit_id: units(:omu).id, + groups_attributes: { + '0' => { + name: 'Group 1', quota: 20, + lecturers_attributes: { + '0' => { + lecturer_id: employees(:serhat_active).id, + coordinator: true + } + } + } + } + } + } end available_course = AvailableCourse.last - parameters.each do |attribute, value| - assert_equal value, available_course.send(attribute) - end - assert_redirected_to new_available_course_available_course_group_path(available_course) + assert_equal 'Group 1', available_course.groups.first.name + assert_equal 20, available_course.groups.first.quota + assert_equal employees(:serhat_active), available_course.lecturers.first.lecturer + assert available_course.lecturers.first.coordinator + assert_redirected_to available_course_path(available_course) end test 'should get edit' do @@ -55,7 +64,18 @@ class AvailableCoursesControllerTest < ActionDispatch::IntegrationTest available_course = AvailableCourse.last patch available_course_path(available_course), params: { available_course: { - curriculum_id: curriculums(:one).id, course_id: courses(:ydi).id + curriculum_id: curriculums(:one).id, course_id: courses(:ydi).id, + groups_attributes: { + '0' => { + name: 'Group 1', quota: 10, + lecturers_attributes: { + '0' => { + lecturer_id: employees(:serhat_active).id, + coordinator: true + } + } + } + } } } diff --git a/test/models/available_course_test.rb b/test/models/available_course_test.rb index 214018bb9..1565f9492 100644 --- a/test/models/available_course_test.rb +++ b/test/models/available_course_test.rb @@ -14,19 +14,16 @@ class AvailableCourseTest < ActiveSupport::TestCase belongs_to :unit has_many :evaluation_types, class_name: 'CourseEvaluationType', dependent: :destroy has_many :groups, class_name: 'AvailableCourseGroup', dependent: :destroy + has_many :lecturers, through: :groups + accepts_nested_attributes_for :groups, allow_destroy: true # callbacks before_validation :assign_academic_term # validations: uniqueness - test 'uniqueness validations for course of a academic term and curriculum' do + test 'uniqueness validations for available_course of a course' do fake = available_courses(:ati_fall_2018_2019).dup assert_not fake.valid? assert_not_empty fake.errors[:course] - fake.course = courses(:ydi) - assert fake.valid? - fake.academic_term = academic_terms(:fall_2017_2018) - fake.curriculum = curriculums(:two) - assert fake.valid? end end From f19e99b917bb6872f64c4f1cee5eb2d27046204d Mon Sep 17 00:00:00 2001 From: ecmelkytz Date: Wed, 13 Mar 2019 15:52:45 +0300 Subject: [PATCH 02/48] =?UTF-8?q?Ders=20grup=20say=C4=B1s=C4=B1=201=20ise?= =?UTF-8?q?=20grubun=20silinmesini=20engelle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/course_management/available_courses/_groups.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/course_management/available_courses/_groups.html.erb b/app/views/course_management/available_courses/_groups.html.erb index ca81c78aa..6d60eeb85 100644 --- a/app/views/course_management/available_courses/_groups.html.erb +++ b/app/views/course_management/available_courses/_groups.html.erb @@ -11,7 +11,8 @@
<%= fa_icon 'cube' %><%= group.name %> - <%= link_to_actions([@available_course, group], except: :show) %> + <% except = %i[show] << (:destroy if @groups.count == 1) %> + <%= link_to_actions([@available_course, group], except: except.compact)%>
From c4d986935b0a7c4f671dc0e6c6e8dbdcc648e8b5 Mon Sep 17 00:00:00 2001 From: ecmelkytz Date: Thu, 14 Mar 2019 09:46:51 +0300 Subject: [PATCH 03/48] =?UTF-8?q?=C3=87evirileri=20d=C3=BCzenle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../available_courses/_form.html.erb | 2 +- .../available_courses/_group_fields.html.erb | 2 +- .../available_courses/_js.html.erb | 8 ++++---- .../course_management/available_courses.en.yml | 13 ++++++++++--- .../course_management/available_courses.tr.yml | 13 ++++++++++--- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/app/views/course_management/available_courses/_form.html.erb b/app/views/course_management/available_courses/_form.html.erb index c87ddee18..9c2bec03c 100644 --- a/app/views/course_management/available_courses/_form.html.erb +++ b/app/views/course_management/available_courses/_form.html.erb @@ -49,7 +49,7 @@ <%= render 'group_fields', f: group, dene: f %> <% end %>
diff --git a/app/views/course_management/available_courses/_group_fields.html.erb b/app/views/course_management/available_courses/_group_fields.html.erb index 1b26803bf..81a0780ee 100644 --- a/app/views/course_management/available_courses/_group_fields.html.erb +++ b/app/views/course_management/available_courses/_group_fields.html.erb @@ -14,7 +14,7 @@ <%= render 'lecturer_fields', f: lecturer, dene: f %> <% end %>
diff --git a/app/views/course_management/available_courses/_js.html.erb b/app/views/course_management/available_courses/_js.html.erb index a786f4247..94fa6dcc1 100644 --- a/app/views/course_management/available_courses/_js.html.erb +++ b/app/views/course_management/available_courses/_js.html.erb @@ -16,7 +16,7 @@ params: { 'unit_id': '#available_course_unit_id' }, source: '/units/:unit_id/curriculums/', reset_selectors: '#available_course_curriculum_id, #available_course_course_id', - placeholder: 'Müfredat Seçiniz' + placeholder: "<%= t('.curriculum_placeholder') %>" }, { el: '#available_course_unit_id', @@ -25,7 +25,7 @@ source: '/units/:unit_id/employees/', label_attribute: 'full_name', reset_selectors: '#group_lecturer_id', - placeholder: 'Öğretim Elemanını Seçiniz' + placeholder: "<%= t('.lecturer_placeholder') %>" }, { el: '#available_course_curriculum_id', @@ -33,7 +33,7 @@ params: { 'curriculum_id': '#available_course_curriculum_id' }, source: '/curriculums/:curriculum_id/openable_courses', reset_selectors: '#available_course_course_id', - placeholder: 'Ders Seçiniz' + placeholder: "<%= t('.course_placeholder') %>" }, { el: '#available_course_unit_id', @@ -42,7 +42,7 @@ source: '/units/:unit_id/employees/', label_attribute: 'full_name', reset_selectors: '#available_course_coordinator_id', - placeholder: 'Koordinatör Seçiniz' + placeholder: "<%= t('.coordinator_placeholder') %>" } ] var dynamic_select = new DynamicSelect(parameters) diff --git a/config/locales/controllers/course_management/available_courses.en.yml b/config/locales/controllers/course_management/available_courses.en.yml index 6a5a6d1b4..529e8a635 100644 --- a/config/locales/controllers/course_management/available_courses.en.yml +++ b/config/locales/controllers/course_management/available_courses.en.yml @@ -8,6 +8,11 @@ en: curriculum: Curriculum groups: Groups unit: Unit + cocoon: + groups: + add: Add Group + lecturers: + add: Add Lecturer course_management: available_courses: create: @@ -30,8 +35,6 @@ en: name: Group Name quota: Quota title: Title - group_fields: - add_lecturer: Add Lecturer index: <<: *available_course_attributes add_new_available_course: Add a New Available Course @@ -39,13 +42,17 @@ en: course_code: Course Code group_count: Group Count quota: Quota + js: + coordinator_placeholder: Select a Coordinator + course_placeholder: Select a Course + curriculum_placeholder: Select a Curriculum + lecturer_placeholder: Select a Lecturer new: form_title: Create an Available Course search: <<: *available_course_attributes smart_search_placeholder: Course Name / Course Code form: - add_group: Add Group groups: Groups unit: Unit show: diff --git a/config/locales/controllers/course_management/available_courses.tr.yml b/config/locales/controllers/course_management/available_courses.tr.yml index e40cae1e1..b443d0fe4 100644 --- a/config/locales/controllers/course_management/available_courses.tr.yml +++ b/config/locales/controllers/course_management/available_courses.tr.yml @@ -8,6 +8,11 @@ tr: curriculum: Müfredat groups: Gruplar unit: Birim + cocoon: + groups: + add: Grup Ekle + lecturers: + add: Öğretim Elemanı Ekle course_management: available_courses: create: @@ -30,8 +35,6 @@ tr: name: Grup Adı quota: Kontenjan title: Ünvan - group_fields: - add_lecturer: Öğretim Elemanı Ekle index: <<: *available_course_attributes add_new_available_course: Yeni Açılan Ders Ekle @@ -39,13 +42,17 @@ tr: course_code: Ders Kodu group_count: Grup Sayısı quota: Kontenjan + js: + coordinator_placeholder: Koordinatör Seçiniz + course_placeholder: Ders Seçiniz + curriculum_placeholder: Müfredat Seçiniz + lecturer_placeholder: Öğretim Elemanı Seçiniz new: form_title: Ders Aç search: <<: *available_course_attributes smart_search_placeholder: Ders Adı / Ders Kodu form: - add_group: Grup Ekle groups: Gruplar unit: Birim show: From 35eeab481ca914acf201ec69ef9cd159c3ade099 Mon Sep 17 00:00:00 2001 From: ecmelkytz Date: Thu, 14 Mar 2019 10:03:53 +0300 Subject: [PATCH 04/48] Add confirm when deleting the lecturer in the group --- .../course_management/available_courses/_js.html.erb | 7 +++++++ .../available_courses/_lecturer_fields.html.erb | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/views/course_management/available_courses/_js.html.erb b/app/views/course_management/available_courses/_js.html.erb index 94fa6dcc1..ce135e76a 100644 --- a/app/views/course_management/available_courses/_js.html.erb +++ b/app/views/course_management/available_courses/_js.html.erb @@ -61,5 +61,12 @@ $('#groups').on('cocoon:after-insert cocoon:after-remove', function() { configure_link_to_remove() }); + + $('#lecturers').on('cocoon:before-remove', function(event, insertedItem) { + var confirmation = confirm("<%= t('are_you_sure') %>"); + if( confirmation === false ){ + event.preventDefault(); + } + }); }); diff --git a/app/views/course_management/available_courses/_lecturer_fields.html.erb b/app/views/course_management/available_courses/_lecturer_fields.html.erb index 8eb784868..7eade53ea 100644 --- a/app/views/course_management/available_courses/_lecturer_fields.html.erb +++ b/app/views/course_management/available_courses/_lecturer_fields.html.erb @@ -1,6 +1,9 @@ -
+
+ <%= link_to_remove_association f do %> + <%= button_tag(fa_icon('times'), class: 'close') %> + <% end %>
<%= f.association :lecturer, collection: [*f.object&.group&.available_course&.unit&.subtree_employees], @@ -12,8 +15,5 @@
-
From 79e0cb9fc2f4e89674c7478d94547f377f239d19 Mon Sep 17 00:00:00 2001 From: ecmelkytz Date: Thu, 14 Mar 2019 13:11:27 +0300 Subject: [PATCH 05/48] Add missing attribute to strong parameter --- .../course_management/available_courses_controller.rb | 3 ++- app/views/course_management/available_courses/_js.html.erb | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/course_management/available_courses_controller.rb b/app/controllers/course_management/available_courses_controller.rb index d28633854..cff3d6719 100644 --- a/app/controllers/course_management/available_courses_controller.rb +++ b/app/controllers/course_management/available_courses_controller.rb @@ -58,7 +58,8 @@ def set_available_course def available_course_params params.require(:available_course).permit( :curriculum_id, :course_id, :unit_id, :coordinator_id, - groups_attributes: [:id, :name, :quota, lecturers_attributes: %i[id lecturer_id coordinator _destroy]] + groups_attributes: [:id, :name, :quota, :_destroy, + lecturers_attributes: %i[id lecturer_id coordinator _destroy]] ) end end diff --git a/app/views/course_management/available_courses/_js.html.erb b/app/views/course_management/available_courses/_js.html.erb index ce135e76a..789bd5f13 100644 --- a/app/views/course_management/available_courses/_js.html.erb +++ b/app/views/course_management/available_courses/_js.html.erb @@ -51,10 +51,10 @@ configure_link_to_remove() function configure_link_to_remove() { - if ($('#groups.nested-fields:visible').length == 1) { - $('#groups.card-footer:visible').hide(); + if ($('#groups.nested-fields').length == 1) { + $('#groups.card-footer').hide(); } else { - $('#groups.card-footer:hidden').show(); + $('#groups.card-footer').show(); } } From d730341f6599d7426f31de40c6d2b923a49047ed Mon Sep 17 00:00:00 2001 From: ecmelkytz Date: Thu, 14 Mar 2019 15:52:52 +0300 Subject: [PATCH 06/48] Run erblint --- .../available_courses/_form.html.erb | 6 +-- .../available_courses/_group_fields.html.erb | 4 +- .../available_courses/_groups.html.erb | 2 +- .../available_courses/_js.html.erb | 2 +- .../_lecturer_fields.html.erb | 2 +- .../available_courses/_search.html.erb | 48 +++++++++---------- .../available_courses/index.html.erb | 12 ++--- .../available_courses/show.html.erb | 16 +++---- 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/app/views/course_management/available_courses/_form.html.erb b/app/views/course_management/available_courses/_form.html.erb index 9c2bec03c..c0354ad1b 100644 --- a/app/views/course_management/available_courses/_form.html.erb +++ b/app/views/course_management/available_courses/_form.html.erb @@ -10,9 +10,9 @@ <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> <% if f.object.errors.any? %> -
    +
      <% f.object.errors.full_messages.each do |message| %> -
    • +
    • <%= message %>
    • <% end %> @@ -46,7 +46,7 @@

      <%= t('.groups') %>

      <%= f.simple_fields_for :groups do |group| %> - <%= render 'group_fields', f: group, dene: f %> + <%= render 'group_fields', f: group %> <% end %>
      -
      +
      <%= f.simple_fields_for :lecturers do |lecturer| %> - <%= render 'lecturer_fields', f: lecturer, dene: f %> + <%= render 'lecturer_fields', f: lecturer %> <% end %>
diff --git a/app/views/course_management/available_courses/_js.html.erb b/app/views/course_management/available_courses/_js.html.erb index 789bd5f13..a4d6921c2 100644 --- a/app/views/course_management/available_courses/_js.html.erb +++ b/app/views/course_management/available_courses/_js.html.erb @@ -62,7 +62,7 @@ configure_link_to_remove() }); - $('#lecturers').on('cocoon:before-remove', function(event, insertedItem) { + $('form').on('cocoon:before-remove', function(event) { var confirmation = confirm("<%= t('are_you_sure') %>"); if( confirmation === false ){ event.preventDefault(); diff --git a/app/views/course_management/available_courses/_lecturer_fields.html.erb b/app/views/course_management/available_courses/_lecturer_fields.html.erb index 7eade53ea..5bcfe2fb0 100644 --- a/app/views/course_management/available_courses/_lecturer_fields.html.erb +++ b/app/views/course_management/available_courses/_lecturer_fields.html.erb @@ -8,7 +8,7 @@
<%= f.association :lecturer, collection: [*f.object&.group&.available_course&.unit&.subtree_employees], label_method: lambda { |c| full_name(c) }, - input_html:{ id: 'group_lecturer_id' }%> + input_html: { id: 'group_lecturer_id' } %>
<%= f.input :coordinator, collection: [[t('yes'), true], [t('no'), false]], required: true %> diff --git a/app/views/course_management/available_courses/_search.html.erb b/app/views/course_management/available_courses/_search.html.erb index fb5c828d5..d58151be7 100644 --- a/app/views/course_management/available_courses/_search.html.erb +++ b/app/views/course_management/available_courses/_search.html.erb @@ -1,36 +1,36 @@ -
-
-
@@ -39,9 +39,9 @@
-