Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[#289] sort programs, hide empty courses, split descriptions to parapraphs #290

Merged
merged 1 commit into from
Oct 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/controllers/concerns/study_applicationable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module StudyApplicationable

def preset_applications_variables(person = current_person)
@application_person = application_person(person)
@programs = programs(current_person)
@programs = programs(current_person).order(visible: :desc, position: :asc)
@new_study_application = StudyApplication.new(person_id: @application_person.id) if @application_person.present?
end

Expand All @@ -15,7 +15,7 @@ def application_person(person)

def programs(person)
# TODO: move to policy
return if person.blank?
return Program.none if person.blank?

if person.can_act?('study_application:create')
Program.all
Expand Down
12 changes: 6 additions & 6 deletions app/views/shared/_study_application.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
= t('links.apply_to_program')
.panel-collapse.collapse{ id: "program-#{index}" }
.panel-body
%p
= program["description_#{locale}"]
%p
= t('content.courses')
- program["description_#{locale}"].to_s.split("\n").each do |part|
%p= part

- if program["courses_#{locale}"].any?
%p= t('content.courses')
%ul
- program["courses_#{locale}"].each do |course_title|
%li
= course_title
%li= course_title
- else
- if person.pending_docs.present?
.pending-docs.alert.alert-danger
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20181007124205_add_postion_to_program.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPostionToProgram < ActiveRecord::Migration[5.0]
def change
add_column :programs, :position, :integer
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20181006060751) do
ActiveRecord::Schema.define(version: 20181007124205) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand Down Expand Up @@ -188,6 +188,7 @@
t.text "courses_ru"
t.boolean "visible", default: false
t.integer "manager_id"
t.integer "position"
end

create_table "programs_questionnaires", id: false, force: :cascade do |t|
Expand Down
5 changes: 3 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ CREATE TABLE public.programs (
courses_uk text,
courses_ru text,
visible boolean DEFAULT false,
manager_id integer
manager_id integer,
"position" integer
);


Expand Down Expand Up @@ -1577,6 +1578,6 @@ ALTER TABLE ONLY public.unsubscribes

SET search_path TO "$user", public;

INSERT INTO schema_migrations (version) VALUES ('20131104153415'), ('20131104155157'), ('20131106111439'), ('20131106111610'), ('20131107081926'), ('20131107082541'), ('20131107082931'), ('20131107083056'), ('20131108154327'), ('20131108154741'), ('20131108155311'), ('20131108155502'), ('20131108155847'), ('20131108160759'), ('20131108183224'), ('20131108183425'), ('20131108183524'), ('20131108183652'), ('20131108183825'), ('20131108183921'), ('20131109141935'), ('20131109142219'), ('20131109143231'), ('20131206142539'), ('20131224122713'), ('20140206161732'), ('20140211153102'), ('20140211154720'), ('20140805135413'), ('20140805150150'), ('20140807144123'), ('20140812184858'), ('20140817064104'), ('20140817070939'), ('20140819191836'), ('20140821192744'), ('20140824053737'), ('20140903122128'), ('20140903122216'), ('20140905191018'), ('20140905191211'), ('20140905191326'), ('20140906113626'), ('20140918091449'), ('20140920200640'), ('20140921162651'), ('20141001130412'), ('20141018192218'), ('20141101170505'), ('20141101170540'), ('20141102090630'), ('20141102185707'), ('20141105202042'), ('20150107152356'), ('20150107162032'), ('20150107162204'), ('20150112113434'), ('20150113111530'), ('20150118122903'), ('20150118130719'), ('20150213222112'), ('20150507103929'), ('20150519132845'), ('20150519133309'), ('20150521082032'), ('20150521082127'), ('20150524193448'), ('20150602100341'), ('20150602145846'), ('20150604104338'), ('20150614072444'), ('20150625201045'), ('20150709064042'), ('20150821112132'), ('20151102155321'), ('20160309211822'), ('20160319204426'), ('20160430185957'), ('20160611125828'), ('20160921113729'), ('20160921113902'), ('20160928042653'), ('20161204045002'), ('20170123053701'), ('20171008122007'), ('20171016033728'), ('20171016034251'), ('20171021080023'), ('20171029195342'), ('20171104053938'), ('20180803092524'), ('20180803111634'), ('20180817083213'), ('20180918034821'), ('20180920035801'), ('20180920193530'), ('20180922042307'), ('20181003033911'), ('20181006060751');
INSERT INTO schema_migrations (version) VALUES ('20131104153415'), ('20131104155157'), ('20131106111439'), ('20131106111610'), ('20131107081926'), ('20131107082541'), ('20131107082931'), ('20131107083056'), ('20131108154327'), ('20131108154741'), ('20131108155311'), ('20131108155502'), ('20131108155847'), ('20131108160759'), ('20131108183224'), ('20131108183425'), ('20131108183524'), ('20131108183652'), ('20131108183825'), ('20131108183921'), ('20131109141935'), ('20131109142219'), ('20131109143231'), ('20131206142539'), ('20131224122713'), ('20140206161732'), ('20140211153102'), ('20140211154720'), ('20140805135413'), ('20140805150150'), ('20140807144123'), ('20140812184858'), ('20140817064104'), ('20140817070939'), ('20140819191836'), ('20140821192744'), ('20140824053737'), ('20140903122128'), ('20140903122216'), ('20140905191018'), ('20140905191211'), ('20140905191326'), ('20140906113626'), ('20140918091449'), ('20140920200640'), ('20140921162651'), ('20141001130412'), ('20141018192218'), ('20141101170505'), ('20141101170540'), ('20141102090630'), ('20141102185707'), ('20141105202042'), ('20150107152356'), ('20150107162032'), ('20150107162204'), ('20150112113434'), ('20150113111530'), ('20150118122903'), ('20150118130719'), ('20150213222112'), ('20150507103929'), ('20150519132845'), ('20150519133309'), ('20150521082032'), ('20150521082127'), ('20150524193448'), ('20150602100341'), ('20150602145846'), ('20150604104338'), ('20150614072444'), ('20150625201045'), ('20150709064042'), ('20150821112132'), ('20151102155321'), ('20160309211822'), ('20160319204426'), ('20160430185957'), ('20160611125828'), ('20160921113729'), ('20160921113902'), ('20160928042653'), ('20161204045002'), ('20170123053701'), ('20171008122007'), ('20171016033728'), ('20171016034251'), ('20171021080023'), ('20171029195342'), ('20171104053938'), ('20180803092524'), ('20180803111634'), ('20180817083213'), ('20180918034821'), ('20180920035801'), ('20180920193530'), ('20180922042307'), ('20181003033911'), ('20181006060751'), ('20181007124205');


2 changes: 1 addition & 1 deletion spec/controllers/people_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
Given { allow(person).to receive(:is_a?).with(Person).and_return(true) }
Given { allow(person).to receive(:reload).and_return(person) }
Given { allow(AcademicGroup).to receive_message_chain(:active, :select) { academic_groups } }
Given { allow(Program).to receive(:all) { programs } }
Given { allow(Program).to receive_message_chain(:all, :order) { programs } }

When { get :show, params: { id: 1 } }

Expand Down