diff --git a/app/assets/images/communication/blocks/templates/datatable.jpg b/app/assets/images/communication/blocks/templates/datatable.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de66f462ccf6e2ca5a376e7c32a6da9919036d5b Binary files /dev/null and b/app/assets/images/communication/blocks/templates/datatable.jpg differ diff --git a/app/assets/images/communication/blocks/templates/embed.jpg b/app/assets/images/communication/blocks/templates/embed.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de66f462ccf6e2ca5a376e7c32a6da9919036d5b Binary files /dev/null and b/app/assets/images/communication/blocks/templates/embed.jpg differ diff --git a/app/assets/images/communication/blocks/templates/files.jpg b/app/assets/images/communication/blocks/templates/files.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de66f462ccf6e2ca5a376e7c32a6da9919036d5b Binary files /dev/null and b/app/assets/images/communication/blocks/templates/files.jpg differ diff --git a/app/assets/images/communication/blocks/templates/image.jpg b/app/assets/images/communication/blocks/templates/image.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2655d4549f569d44d5ef2f38d143f04d28a4c8f4 Binary files /dev/null and b/app/assets/images/communication/blocks/templates/image.jpg differ diff --git a/app/assets/images/communication/blocks/templates/video.jpg b/app/assets/images/communication/blocks/templates/video.jpg new file mode 100644 index 0000000000000000000000000000000000000000..de66f462ccf6e2ca5a376e7c32a6da9919036d5b Binary files /dev/null and b/app/assets/images/communication/blocks/templates/video.jpg differ diff --git a/app/assets/stylesheets/admin/styles.sass b/app/assets/stylesheets/admin/styles.sass index 5a4ddc5e0c54bac3c3b08cfce911ce293a2e9b8b..83e6f9d8e45d0c75d234a14510de2950740f635c 100644 --- a/app/assets/stylesheets/admin/styles.sass +++ b/app/assets/stylesheets/admin/styles.sass @@ -35,4 +35,9 @@ h1 .img-circle aspect-ratio: 1/1 object-fit: cover - width: 100% \ No newline at end of file + width: 100% + +.card-actions + .accordion-button + box-shadow: none + padding: 0.5rem 0 diff --git a/app/controllers/admin/communication/blocks_controller.rb b/app/controllers/admin/communication/blocks_controller.rb index 37978e45799d3f99b8c3275075551d920d89c37f..325c5c14f9bc888f335805f8bdb04858272413ab 100644 --- a/app/controllers/admin/communication/blocks_controller.rb +++ b/app/controllers/admin/communication/blocks_controller.rb @@ -11,10 +11,6 @@ class Admin::Communication::BlocksController < Admin::Communication::Application end end - def show - breadcrumb - end - def new @block.about_type = params[:about_type] @block.about_id = params[:about_id] @@ -23,13 +19,13 @@ class Admin::Communication::BlocksController < Admin::Communication::Application def edit breadcrumb - add_breadcrumb t('edit') end def create @block.university = current_university if @block.save - redirect_to [:edit, :admin, @block], notice: t('admin.successfully_created_html', model: @block.to_s) + redirect_to [:edit, :admin, @block], + notice: t('admin.successfully_created_html', model: @block.to_s) else breadcrumb render :new, status: :unprocessable_entity @@ -38,7 +34,8 @@ class Admin::Communication::BlocksController < Admin::Communication::Application def update if @block.update(block_params) - redirect_to about_path, notice: t('admin.successfully_updated_html', model: @block.to_s) + redirect_to about_path, + notice: t('admin.successfully_updated_html', model: @block.to_s) else breadcrumb add_breadcrumb t('edit') @@ -49,7 +46,8 @@ class Admin::Communication::BlocksController < Admin::Communication::Application def destroy path = about_path @block.destroy - redirect_to path, notice: t('admin.successfully_destroyed_html', model: @block.to_s) + redirect_to path, + notice: t('admin.successfully_destroyed_html', model: @block.to_s) end protected @@ -71,7 +69,7 @@ class Admin::Communication::BlocksController < Admin::Communication::Application if @block.new_record? add_breadcrumb t('communication.block.choose_template') else - add_breadcrumb @block, [:admin, @block] + add_breadcrumb @block end end diff --git a/app/controllers/admin/communication/website/application_controller.rb b/app/controllers/admin/communication/websites/application_controller.rb similarity index 78% rename from app/controllers/admin/communication/website/application_controller.rb rename to app/controllers/admin/communication/websites/application_controller.rb index 9bf4fc7ceee6d79db9486169d58ca253e962a598..253b5a04ddf61d021238d3c2786457541fa161e6 100644 --- a/app/controllers/admin/communication/website/application_controller.rb +++ b/app/controllers/admin/communication/websites/application_controller.rb @@ -1,4 +1,4 @@ -class Admin::Communication::Website::ApplicationController < Admin::Communication::ApplicationController +class Admin::Communication::Websites::ApplicationController < Admin::Communication::ApplicationController load_and_authorize_resource :website, class: Communication::Website, through: :current_university, diff --git a/app/controllers/admin/communication/website/authors_controller.rb b/app/controllers/admin/communication/websites/authors_controller.rb similarity index 85% rename from app/controllers/admin/communication/website/authors_controller.rb rename to app/controllers/admin/communication/websites/authors_controller.rb index 934b4faf2871af0b3217c1392f278e957254051a..edb87a9a73ca1897da332b6ad11f08c0577c72e8 100644 --- a/app/controllers/admin/communication/website/authors_controller.rb +++ b/app/controllers/admin/communication/websites/authors_controller.rb @@ -1,7 +1,7 @@ -class Admin::Communication::Website::AuthorsController < Admin::Communication::Website::ApplicationController +class Admin::Communication::Websites::AuthorsController < Admin::Communication::Websites::ApplicationController has_scope :for_search_term - + def index @authors = apply_scopes(@website.authors.accessible_by(current_ability)) .ordered diff --git a/app/controllers/admin/communication/website/categories_controller.rb b/app/controllers/admin/communication/websites/categories_controller.rb similarity index 96% rename from app/controllers/admin/communication/website/categories_controller.rb rename to app/controllers/admin/communication/websites/categories_controller.rb index a6ca1a9b350a477ce2f6f6f68ff4a27eb3c76b4f..5be1a6b18748a7756e4f597052c2333a5be0419f 100644 --- a/app/controllers/admin/communication/website/categories_controller.rb +++ b/app/controllers/admin/communication/websites/categories_controller.rb @@ -1,4 +1,4 @@ -class Admin::Communication::Website::CategoriesController < Admin::Communication::Website::ApplicationController +class Admin::Communication::Websites::CategoriesController < Admin::Communication::Websites::ApplicationController load_and_authorize_resource class: Communication::Website::Category, through: :website before_action :get_root_categories, only: [:index, :new, :create, :edit, :update] diff --git a/app/controllers/admin/communication/website/menu/items_controller.rb b/app/controllers/admin/communication/websites/menus/items_controller.rb similarity index 86% rename from app/controllers/admin/communication/website/menu/items_controller.rb rename to app/controllers/admin/communication/websites/menus/items_controller.rb index 5779e978bf5d0e537f55348d34da5aec362e2be8..632b330c34ba6fe0b0de793d03c1eb5a157965c2 100644 --- a/app/controllers/admin/communication/website/menu/items_controller.rb +++ b/app/controllers/admin/communication/websites/menus/items_controller.rb @@ -1,6 +1,10 @@ -class Admin::Communication::Website::Menu::ItemsController < Admin::Communication::Website::ApplicationController - load_and_authorize_resource :menu, class: Communication::Website::Menu, id_param: :menu_id, through: :website - load_and_authorize_resource class: Communication::Website::Menu::Item, through: :menu +class Admin::Communication::Websites::Menus::ItemsController < Admin::Communication::Websites::ApplicationController + load_and_authorize_resource :menu, + class: Communication::Website::Menu, + id_param: :menu_id, + through: :website + load_and_authorize_resource class: Communication::Website::Menu::Item, + through: :menu def reorder parent_id = params[:parentId].blank? ? nil : params[:parentId] diff --git a/app/controllers/admin/communication/website/menus_controller.rb b/app/controllers/admin/communication/websites/menus_controller.rb similarity index 93% rename from app/controllers/admin/communication/website/menus_controller.rb rename to app/controllers/admin/communication/websites/menus_controller.rb index 499f917b3805cd34e629ad454a19d49532c8ad85..7f32950f9effbbd7f214922455716ae1f502a46b 100644 --- a/app/controllers/admin/communication/website/menus_controller.rb +++ b/app/controllers/admin/communication/websites/menus_controller.rb @@ -1,4 +1,4 @@ -class Admin::Communication::Website::MenusController < Admin::Communication::Website::ApplicationController +class Admin::Communication::Websites::MenusController < Admin::Communication::Websites::ApplicationController load_and_authorize_resource class: Communication::Website::Menu, through: :website def index diff --git a/app/controllers/admin/communication/website/pages_controller.rb b/app/controllers/admin/communication/websites/pages_controller.rb similarity index 94% rename from app/controllers/admin/communication/website/pages_controller.rb rename to app/controllers/admin/communication/websites/pages_controller.rb index 4ff6e684dd1d13fecef999c7e55f5b90f0a6762c..d4bb7ed163d2e42d696776656648b484f81be6e8 100644 --- a/app/controllers/admin/communication/website/pages_controller.rb +++ b/app/controllers/admin/communication/websites/pages_controller.rb @@ -1,5 +1,6 @@ -class Admin::Communication::Website::PagesController < Admin::Communication::Website::ApplicationController - load_and_authorize_resource class: Communication::Website::Page, through: :website +class Admin::Communication::Websites::PagesController < Admin::Communication::Websites::ApplicationController + load_and_authorize_resource class: Communication::Website::Page, + through: :website def index @homepage = @website.pages.kind_home.first diff --git a/app/controllers/admin/communication/website/posts/curations_controller.rb b/app/controllers/admin/communication/websites/posts/curations_controller.rb similarity index 85% rename from app/controllers/admin/communication/website/posts/curations_controller.rb rename to app/controllers/admin/communication/websites/posts/curations_controller.rb index 920ebe806a973e253070dd8448e99231159d7492..f659841f1e18d50b83ee14baf7ed0ce1c966c68d 100644 --- a/app/controllers/admin/communication/website/posts/curations_controller.rb +++ b/app/controllers/admin/communication/websites/posts/curations_controller.rb @@ -1,4 +1,4 @@ -class Admin::Communication::Website::Posts::CurationsController < Admin::Communication::Website::ApplicationController +class Admin::Communication::Websites::Posts::CurationsController < Admin::Communication::Websites::ApplicationController def new breadcrumb end diff --git a/app/controllers/admin/communication/website/posts_controller.rb b/app/controllers/admin/communication/websites/posts_controller.rb similarity index 96% rename from app/controllers/admin/communication/website/posts_controller.rb rename to app/controllers/admin/communication/websites/posts_controller.rb index b1fdd519511e9b1e13617466e267d86f162b7973..3c711ef52fd17b9dafd94f0f68c83b0a299f38b9 100644 --- a/app/controllers/admin/communication/website/posts_controller.rb +++ b/app/controllers/admin/communication/websites/posts_controller.rb @@ -1,4 +1,4 @@ -class Admin::Communication::Website::PostsController < Admin::Communication::Website::ApplicationController +class Admin::Communication::Websites::PostsController < Admin::Communication::Websites::ApplicationController skip_before_action :load_filters load_and_authorize_resource class: Communication::Website::Post, through: :website diff --git a/app/controllers/admin/education/diplomas_controller.rb b/app/controllers/admin/education/diplomas_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..4fe3bd48b12947678b5689f9bcd6bced7dbb2511 --- /dev/null +++ b/app/controllers/admin/education/diplomas_controller.rb @@ -0,0 +1,63 @@ +class Admin::Education::DiplomasController < Admin::Education::ApplicationController + load_and_authorize_resource class: Education::Diploma, + through: :current_university + + def index + breadcrumb + end + + def show + @programs = @diploma.programs.ordered.page params[:page] + breadcrumb + end + + def new + breadcrumb + end + + def edit + breadcrumb + add_breadcrumb t('edit') + end + + def create + @diploma.university = current_university + if @diploma.save_and_sync + redirect_to [:admin, @diploma], + notice: t('admin.successfully_created_html', model: @diploma.to_s) + else + breadcrumb + render :new, status: :unprocessable_entity + end + end + + def update + if @diploma.update_and_sync(diploma_params) + redirect_to [:admin, @diploma], + notice: t('admin.successfully_updated_html', model: @diploma.to_s) + else + breadcrumb + add_breadcrumb t('edit') + render :edit, status: :unprocessable_entity + end + end + + def destroy + @diploma.destroy_and_sync + redirect_to admin_education_diplomas_url, + notice: t('admin.successfully_destroyed_html', model: @diploma.to_s) + end + + private + + def breadcrumb + super + add_breadcrumb Education::Diploma.model_name.human(count: 2), admin_education_diplomas_path + breadcrumb_for @diploma + end + + def diploma_params + params.require(:education_diploma) + .permit(:name, :short_name, :level) + end +end diff --git a/app/controllers/admin/education/program/application_controller.rb b/app/controllers/admin/education/programs/application_controller.rb similarity index 82% rename from app/controllers/admin/education/program/application_controller.rb rename to app/controllers/admin/education/programs/application_controller.rb index 554e00c4b4c480005785d9c99a6aaf690f380231..33259891bfe0503059dd3bfc207a514f63c8ce75 100644 --- a/app/controllers/admin/education/program/application_controller.rb +++ b/app/controllers/admin/education/programs/application_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::Program::ApplicationController < Admin::Education::ApplicationController +class Admin::Education::Programs::ApplicationController < Admin::Education::ApplicationController load_and_authorize_resource :program, class: Education::Program, through: :current_university, diff --git a/app/controllers/admin/education/program/role/people_controller.rb b/app/controllers/admin/education/programs/roles/people_controller.rb similarity index 84% rename from app/controllers/admin/education/program/role/people_controller.rb rename to app/controllers/admin/education/programs/roles/people_controller.rb index 722f2ab8169da868615c2779afa61acc50fa104f..5cce73ce05f5333dfe361333d276930bad41b64e 100644 --- a/app/controllers/admin/education/program/role/people_controller.rb +++ b/app/controllers/admin/education/programs/roles/people_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::Program::Role::PeopleController < Admin::Education::Program::ApplicationController +class Admin::Education::Programs::Roles::PeopleController < Admin::Education::Programs::ApplicationController load_and_authorize_resource :role, class: University::Role, through: :program, param: :role_id, through_association: :university_roles load_and_authorize_resource :involvement, class: University::Person::Involvement, through: :role, parent: false diff --git a/app/controllers/admin/education/program/roles_controller.rb b/app/controllers/admin/education/programs/roles_controller.rb similarity index 94% rename from app/controllers/admin/education/program/roles_controller.rb rename to app/controllers/admin/education/programs/roles_controller.rb index dfa7e8fa64f16c3267809221a5e30a1135220949..d934a5c64c7e4a40896052da431beff06e8f0a51 100644 --- a/app/controllers/admin/education/program/roles_controller.rb +++ b/app/controllers/admin/education/programs/roles_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::Program::RolesController < Admin::Education::Program::ApplicationController +class Admin::Education::Programs::RolesController < Admin::Education::Programs::ApplicationController load_and_authorize_resource class: University::Role, through: :program, through_association: :university_roles include Admin::Reorderable diff --git a/app/controllers/admin/education/program/teachers_controller.rb b/app/controllers/admin/education/programs/teachers_controller.rb similarity index 95% rename from app/controllers/admin/education/program/teachers_controller.rb rename to app/controllers/admin/education/programs/teachers_controller.rb index f469eecb8801d2ad5a09e442b854b615d26220f8..00261353a60815b84ad4dc2766f830924fcb5233 100644 --- a/app/controllers/admin/education/program/teachers_controller.rb +++ b/app/controllers/admin/education/programs/teachers_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::Program::TeachersController < Admin::Education::Program::ApplicationController +class Admin::Education::Programs::TeachersController < Admin::Education::Programs::ApplicationController load_and_authorize_resource :involvement, class: University::Person::Involvement, through: :program, diff --git a/app/controllers/admin/education/programs_controller.rb b/app/controllers/admin/education/programs_controller.rb index 2e23f18aee585409d4aa077adc491c74731f625d..a074a9d522c04c153b3839223b2524c88b573f02 100644 --- a/app/controllers/admin/education/programs_controller.rb +++ b/app/controllers/admin/education/programs_controller.rb @@ -5,9 +5,18 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro before_action :load_teacher_people, only: [:new, :edit, :create, :update] + has_scope :for_search_term + has_scope :for_diploma + def index + @programs = apply_scopes(@programs).ordered_by_name.page(params[:page]) + breadcrumb + end + + def tree @programs = @programs.root.ordered breadcrumb + add_breadcrumb t('.title') end def reorder @@ -89,11 +98,11 @@ class Admin::Education::ProgramsController < Admin::Education::ApplicationContro def program_params params.require(:education_program).permit( - :name, :slug, :level, :capacity, :ects, :continuing, :description, :published, + :name, :short_name, :slug, :level, :capacity, :ects, :continuing, :description, :published, :featured_image, :featured_image_delete, :featured_image_infos, :featured_image_alt, :featured_image_credit, :prerequisites, :objectives, :duration, :presentation, :registration, :pedagogy, :content, - :evaluation, :accessibility, :pricing, :contacts, :opportunities, :results, :other, :main_information, - :parent_id, school_ids: [], + :evaluation, :accessibility, :pricing, :contacts, :opportunities, :results, :other, :main_information, + :parent_id, :diploma_id, school_ids: [], university_person_involvements_attributes: [:id, :person_id, :description, :position, :_destroy] ) end diff --git a/app/controllers/admin/education/school/application_controller.rb b/app/controllers/admin/education/schools/application_controller.rb similarity index 82% rename from app/controllers/admin/education/school/application_controller.rb rename to app/controllers/admin/education/schools/application_controller.rb index 56a79f71492195875c2a9aaa3cd17481e8cf5ed8..25f5493e8e219bcb51351bcf2384808c0c7e6f7c 100644 --- a/app/controllers/admin/education/school/application_controller.rb +++ b/app/controllers/admin/education/schools/application_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::School::ApplicationController < Admin::Education::ApplicationController +class Admin::Education::Schools::ApplicationController < Admin::Education::ApplicationController load_and_authorize_resource :school, class: Education::School, through: :current_university, diff --git a/app/controllers/admin/education/school/role/people_controller.rb b/app/controllers/admin/education/schools/roles/people_controller.rb similarity index 84% rename from app/controllers/admin/education/school/role/people_controller.rb rename to app/controllers/admin/education/schools/roles/people_controller.rb index 2a9c8fa74f2cfe3308f5b5b8606ee0fe52e23964..1a0961a46576fb615058a8bc6602f8439bd86d2b 100644 --- a/app/controllers/admin/education/school/role/people_controller.rb +++ b/app/controllers/admin/education/schools/roles/people_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::School::Role::PeopleController < Admin::Education::School::ApplicationController +class Admin::Education::Schools::Roles::PeopleController < Admin::Education::Schools::ApplicationController load_and_authorize_resource :role, class: University::Role, through: :school, param: :role_id, through_association: :university_roles load_and_authorize_resource :involvement, class: University::Person::Involvement, through: :role, parent: false diff --git a/app/controllers/admin/education/school/roles_controller.rb b/app/controllers/admin/education/schools/roles_controller.rb similarity index 95% rename from app/controllers/admin/education/school/roles_controller.rb rename to app/controllers/admin/education/schools/roles_controller.rb index 7ab46b743b6a18ddeb7ae3c95e381842896a8173..8c1e62e8b8dbbe548f600e08304baa95fcf65a7d 100644 --- a/app/controllers/admin/education/school/roles_controller.rb +++ b/app/controllers/admin/education/schools/roles_controller.rb @@ -1,4 +1,4 @@ -class Admin::Education::School::RolesController < Admin::Education::School::ApplicationController +class Admin::Education::Schools::RolesController < Admin::Education::Schools::ApplicationController load_and_authorize_resource class: University::Role, through: :school, through_association: :university_roles include Admin::Reorderable diff --git a/app/controllers/admin/education/teachers_controller.rb b/app/controllers/admin/education/teachers_controller.rb index c24b805575eb5016d6607c76282fe09662793922..5988c9d2cd5b5eb8cd9b08353c02cac03573589d 100644 --- a/app/controllers/admin/education/teachers_controller.rb +++ b/app/controllers/admin/education/teachers_controller.rb @@ -5,12 +5,19 @@ class Admin::Education::TeachersController < Admin::Education::ApplicationContro has_scope :for_program def index - @teachers = apply_scopes(current_university.people.teachers.accessible_by(current_ability)).ordered.page(params[:page]) + @teachers = apply_scopes( + current_university.people + .teachers + .accessible_by(current_ability) + ).ordered.page(params[:page]) breadcrumb end def show - @involvements = @teacher.involvements_as_teacher.includes(:target).ordered_by_date.page(params[:page]) + @involvements = @teacher.involvements_as_teacher + .includes(:target) + .ordered_by_date + .page(params[:page]) breadcrumb end @@ -40,7 +47,10 @@ class Admin::Education::TeachersController < Admin::Education::ApplicationContro end def load_teacher - @teacher = current_university.people.teachers.accessible_by(current_ability).find(params[:id]) + @teacher = current_university.people + .teachers + .accessible_by(current_ability) + .find(params[:id]) end def teacher_params diff --git a/app/controllers/admin/research/journal/application_controller.rb b/app/controllers/admin/research/journals/application_controller.rb similarity index 79% rename from app/controllers/admin/research/journal/application_controller.rb rename to app/controllers/admin/research/journals/application_controller.rb index 85da4184f6c544f3af365d7a2162ecba01a68d12..61b13d5ee541230c769006cccbc318c7ace1ab20 100644 --- a/app/controllers/admin/research/journal/application_controller.rb +++ b/app/controllers/admin/research/journals/application_controller.rb @@ -1,4 +1,4 @@ -class Admin::Research::Journal::ApplicationController < Admin::Research::ApplicationController +class Admin::Research::Journals::ApplicationController < Admin::Research::ApplicationController load_and_authorize_resource :journal, class: Research::Journal, through: :current_university, diff --git a/app/controllers/admin/research/journal/articles_controller.rb b/app/controllers/admin/research/journals/articles_controller.rb similarity index 94% rename from app/controllers/admin/research/journal/articles_controller.rb rename to app/controllers/admin/research/journals/articles_controller.rb index 986777174ed261094f1ebd24ce558936ff100602..50fe4b3bbd71492cd8bb4447fe4370eb26da8714 100644 --- a/app/controllers/admin/research/journal/articles_controller.rb +++ b/app/controllers/admin/research/journals/articles_controller.rb @@ -1,4 +1,4 @@ -class Admin::Research::Journal::ArticlesController < Admin::Research::Journal::ApplicationController +class Admin::Research::Journals::ArticlesController < Admin::Research::Journals::ApplicationController load_and_authorize_resource class: Research::Journal::Article, through: :journal include Admin::Reorderable diff --git a/app/controllers/admin/research/journal/volumes_controller.rb b/app/controllers/admin/research/journals/volumes_controller.rb similarity index 94% rename from app/controllers/admin/research/journal/volumes_controller.rb rename to app/controllers/admin/research/journals/volumes_controller.rb index 321de51ce7970433d87913b95f1dcafe23114192..3805ef140a1b67b35a494d34e666739483270c19 100644 --- a/app/controllers/admin/research/journal/volumes_controller.rb +++ b/app/controllers/admin/research/journals/volumes_controller.rb @@ -1,4 +1,4 @@ -class Admin::Research::Journal::VolumesController < Admin::Research::Journal::ApplicationController +class Admin::Research::Journals::VolumesController < Admin::Research::Journals::ApplicationController load_and_authorize_resource class: Research::Journal::Volume, through: :journal def index diff --git a/app/controllers/admin/research/laboratory/application_controller.rb b/app/controllers/admin/research/laboratories/application_controller.rb similarity index 79% rename from app/controllers/admin/research/laboratory/application_controller.rb rename to app/controllers/admin/research/laboratories/application_controller.rb index a43dc2d32f33bd9a68f99c258ee09b3d7830bcb0..343066b58ef9d47431ee5b74d56f9ceadc4e72fc 100644 --- a/app/controllers/admin/research/laboratory/application_controller.rb +++ b/app/controllers/admin/research/laboratories/application_controller.rb @@ -1,4 +1,4 @@ -class Admin::Research::Laboratory::ApplicationController < Admin::Research::ApplicationController +class Admin::Research::Laboratories::ApplicationController < Admin::Research::ApplicationController load_and_authorize_resource :laboratory, class: Research::Laboratory, through: :current_university, diff --git a/app/controllers/admin/research/laboratory/axes_controller.rb b/app/controllers/admin/research/laboratories/axes_controller.rb similarity index 92% rename from app/controllers/admin/research/laboratory/axes_controller.rb rename to app/controllers/admin/research/laboratories/axes_controller.rb index 293def8bcfd4b36df1985fd6a65d495e0a8aaf84..5c672627a7cf8ea7e19a15b3adaf0aed281ccccb 100644 --- a/app/controllers/admin/research/laboratory/axes_controller.rb +++ b/app/controllers/admin/research/laboratories/axes_controller.rb @@ -1,4 +1,4 @@ -class Admin::Research::Laboratory::AxesController < Admin::Research::Laboratory::ApplicationController +class Admin::Research::Laboratories::AxesController < Admin::Research::Laboratories::ApplicationController load_and_authorize_resource class: Research::Laboratory::Axis, through: :laboratory include Admin::Reorderable diff --git a/app/controllers/admin/university/organization/imports_controller.rb b/app/controllers/admin/university/organizations/imports_controller.rb similarity index 72% rename from app/controllers/admin/university/organization/imports_controller.rb rename to app/controllers/admin/university/organizations/imports_controller.rb index 493f55a4459758e7c27afce60d0892f6c1268cd2..608d208acff9fe86b43d44d18a64f8ca6d8ac13e 100644 --- a/app/controllers/admin/university/organization/imports_controller.rb +++ b/app/controllers/admin/university/organizations/imports_controller.rb @@ -1,4 +1,4 @@ -class Admin::University::Organization::ImportsController < Admin::University::ApplicationController +class Admin::University::Organizations::ImportsController < Admin::University::ApplicationController load_and_authorize_resource class: University::Organization::Import, through: :current_university, through_association: :organization_imports @@ -32,8 +32,10 @@ class Admin::University::Organization::ImportsController < Admin::University::Ap add_breadcrumb University::Organization.model_name.human(count: 2), admin_university_organizations_path add_breadcrumb University::Organization::Import.model_name.human(count: 2), - admin_university_organization_imports_path - breadcrumb_for @import + admin_university_organizations_imports_path + return unless @import + @import.persisted? ? add_breadcrumb(@import, admin_university_organizations_import_path(@import)) + : add_breadcrumb(t('create')) end def import_params diff --git a/app/controllers/admin/university/person/alumnus/imports_controller.rb b/app/controllers/admin/university/people/alumni/imports_controller.rb similarity index 68% rename from app/controllers/admin/university/person/alumnus/imports_controller.rb rename to app/controllers/admin/university/people/alumni/imports_controller.rb index b8f7b52a12ce18b78126eb3b1bb85297b2e4b143..66b44d7499842bcae400aa6f4585e915e3d05d46 100644 --- a/app/controllers/admin/university/person/alumnus/imports_controller.rb +++ b/app/controllers/admin/university/people/alumni/imports_controller.rb @@ -1,4 +1,4 @@ -class Admin::University::Person::Alumnus::ImportsController < Admin::University::ApplicationController +class Admin::University::People::Alumni::ImportsController < Admin::University::ApplicationController load_and_authorize_resource class: University::Person::Alumnus::Import, through: :current_university, through_association: :person_alumnus_imports @@ -30,10 +30,12 @@ class Admin::University::Person::Alumnus::ImportsController < Admin::University: def breadcrumb super add_breadcrumb University::Person::Alumnus.model_name.human(count: 2), - admin_university_person_alumni_path + admin_university_people_alumni_path add_breadcrumb University::Person::Alumnus::Import.model_name.human(count: 2), - admin_university_person_alumnus_imports_path - breadcrumb_for @import + admin_university_people_alumni_imports_path + return unless @import + @import.persisted? ? add_breadcrumb(@import, admin_university_people_alumni_import_path(@import)) + : add_breadcrumb(t('create')) end def import_params diff --git a/app/controllers/admin/university/person/alumni_controller.rb b/app/controllers/admin/university/people/alumni_controller.rb similarity index 84% rename from app/controllers/admin/university/person/alumni_controller.rb rename to app/controllers/admin/university/people/alumni_controller.rb index 47726139fa01c24d12ed5bde77041bcdfa76e465..0123d44b7918016c381292720043a467928263dc 100644 --- a/app/controllers/admin/university/person/alumni_controller.rb +++ b/app/controllers/admin/university/people/alumni_controller.rb @@ -1,4 +1,4 @@ -class Admin::University::Person::AlumniController < Admin::University::ApplicationController +class Admin::University::People::AlumniController < Admin::University::ApplicationController load_and_authorize_resource class: University::Person::Alumnus, through: :current_university, through_association: :people @@ -40,8 +40,8 @@ class Admin::University::Person::AlumniController < Admin::University::Applicati def breadcrumb super add_breadcrumb University::Person::Alumnus.model_name.human(count: 2), - admin_university_person_alumni_path - breadcrumb_for @alumnus + admin_university_people_alumni_path + add_breadcrumb @alumnus, admin_university_person_alumnus_path(@alumnus) if @alumnus end def alumnus_params diff --git a/app/controllers/server/blocks_controller.rb b/app/controllers/server/blocks_controller.rb new file mode 100644 index 0000000000000000000000000000000000000000..672b50b16fa45a0f422ec3bc441a5c20335f6624 --- /dev/null +++ b/app/controllers/server/blocks_controller.rb @@ -0,0 +1,27 @@ +class Server::BlocksController < Server::ApplicationController + def index + @templates = Communication::Block.template_kinds.keys + breadcrumb + end + + def show + @template = params[:id] + @blocks = Communication::Block.send(@template) + breadcrumb + add_breadcrumb t("enums.communication.block.template_kind.#{@template}") + end + + def resave + @template = params[:id] + @blocks = Communication::Block.send(@template) + @blocks.find_each &:save + redirect_to server_block_path(@template), notice: "#{@blocks.count} blocks saved" + end + + protected + + def breadcrumb + super + add_breadcrumb Communication::Block.model_name.human(count: 2), server_blocks_path + end +end diff --git a/app/models/ability.rb b/app/models/ability.rb index 687a45581f0ebf746e3bc5f740a90c2384c18d08..29332288083fcc314db3c286b506f2527e85eb86 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -20,6 +20,7 @@ class Ability can :read, Communication::Website::Imported::Website, university_id: @user.university_id can :read, Communication::Website::Imported::Page, university_id: @user.university_id can :read, Communication::Website::Imported::Post, university_id: @user.university_id + can :read, Education::Diploma, university_id: @user.university_id can :read, Education::Program, university_id: @user.university_id can :read, Education::School, university_id: @user.university_id can :read, Research::Journal, university_id: @user.university_id @@ -100,6 +101,7 @@ class Ability can :manage, Education::AcademicYear, university_id: @user.university_id can :manage, Education::Cohort, university_id: @user.university_id can :manage, Education::School, university_id: @user.university_id + can :manage, Education::Diploma, university_id: @user.university_id can :manage, Education::Program, university_id: @user.university_id can :manage, :all_programs # needed to prevent program_manager to access specific global screens can :manage, Research::Journal, university_id: @user.university_id diff --git a/app/models/communication/block.rb b/app/models/communication/block.rb index fa0d1fbfbbaa197d520206e949ef1599b81d69ea..733a971a2bcca774877080b7b140ffcebccc930c 100644 --- a/app/models/communication/block.rb +++ b/app/models/communication/block.rb @@ -32,15 +32,20 @@ class Communication::Block < ApplicationRecord enum template_kind: { chapter: 50, - organization_chart: 100, - partners: 200, + image: 51, gallery: 300, + video: 52, + datatable: 54, + files: 55, + embed: 53, + call_to_action: 900, testimonials: 400, - posts: 500, - pages: 600, timeline: 700, definitions: 800, - call_to_action: 900, + organization_chart: 100, + partners: 200, + posts: 500, + pages: 600, } before_save :update_template_images diff --git a/app/models/communication/block/template.rb b/app/models/communication/block/template.rb index 2eed4643d11775c3ae08abde14ce3cf2f5c03790..66cae4fd3495e62136e85f2ececa232d1f6e9621 100644 --- a/app/models/communication/block/template.rb +++ b/app/models/communication/block/template.rb @@ -37,6 +37,20 @@ class Communication::Block::Template university.active_storage_blobs.find id end + def extract_image_alt_and_credit(source, variable) + blob = find_blob source, variable + return if blob.nil? + alt = source["alt"] || source["#{variable}_alt"] + credit = source["credit"] || source["#{variable}_credit"] + text = source["text"] || source["#{variable}_text"] + { + blob: blob, + alt: alt, + credit: credit, + text: text + }.to_dot + end + def data block.data || {} end diff --git a/app/models/communication/block/template/call_to_action.rb b/app/models/communication/block/template/call_to_action.rb index c2592194b24a0a3cda6c8d8e8f63886fdb27c2b4..57ea19c92cd70a957c2b7933313e429fe0672f34 100644 --- a/app/models/communication/block/template/call_to_action.rb +++ b/app/models/communication/block/template/call_to_action.rb @@ -23,18 +23,15 @@ class Communication::Block::Template::CallToAction < Communication::Block::Templ "#{data['button_secondary']}" end - def image - image_with_alt + def url_tertiary + "#{data['url_tertiary']}" end - protected + def button_tertiary + "#{data['button_tertiary']}" + end - def image_with_alt - blob = find_blob data, 'image' - return if blob.nil? - { - blob: blob, - alt: data['image_alt'] - }.to_dot + def image + extract_image_alt_and_credit data, 'image' end end diff --git a/app/models/communication/block/template/chapter.rb b/app/models/communication/block/template/chapter.rb index e51d0996619ff2807e9cafcb79d2dfd4f1da58fb..992a493a05bd55ab7eeb8cfab90b440ebb2f9d2a 100644 --- a/app/models/communication/block/template/chapter.rb +++ b/app/models/communication/block/template/chapter.rb @@ -1,6 +1,10 @@ class Communication::Block::Template::Chapter < Communication::Block::Template def build_git_dependencies - # pas d'images dans summernote, donc rien à déclarer ! + add_dependency image&.blob + end + + def image + extract_image_alt_and_credit data, 'image' end def text diff --git a/app/models/communication/block/template/datatable.rb b/app/models/communication/block/template/datatable.rb new file mode 100644 index 0000000000000000000000000000000000000000..6a764e8e1c88262b9f56d80585b4b937e4a92f38 --- /dev/null +++ b/app/models/communication/block/template/datatable.rb @@ -0,0 +1,4 @@ +class Communication::Block::Template::Datatable < Communication::Block::Template + def build_git_dependencies + end +end diff --git a/app/models/communication/block/template/embed.rb b/app/models/communication/block/template/embed.rb new file mode 100644 index 0000000000000000000000000000000000000000..c7075906320f1ca72df2262cc8759b3ed5052362 --- /dev/null +++ b/app/models/communication/block/template/embed.rb @@ -0,0 +1,4 @@ +class Communication::Block::Template::Embed < Communication::Block::Template + def build_git_dependencies + end +end diff --git a/app/models/communication/block/template/file.rb b/app/models/communication/block/template/file.rb new file mode 100644 index 0000000000000000000000000000000000000000..0c27e046a361be35560d44cff26f737e611d2ff3 --- /dev/null +++ b/app/models/communication/block/template/file.rb @@ -0,0 +1,4 @@ +class Communication::Block::Template::File < Communication::Block::Template + def build_git_dependencies + end +end diff --git a/app/models/communication/block/template/gallery.rb b/app/models/communication/block/template/gallery.rb index 834169a4de18ae5a13948d1a58bfaaea25a188c0..91e6e4c22e2e55734d1fd6dc1d955ebab4135b36 100644 --- a/app/models/communication/block/template/gallery.rb +++ b/app/models/communication/block/template/gallery.rb @@ -4,24 +4,13 @@ class Communication::Block::Template::Gallery < Communication::Block::Template end def images_with_alt - @images_with_alt ||= elements.map { |element| image_with_alt(element) } - .compact + @images_with_alt ||= elements.map { |element| + extract_image_alt_and_credit element, 'file' + }.compact end def active_storage_blobs @active_storage_blobs ||= images_with_alt.map { |hash| hash.blob } .compact end - - protected - - def image_with_alt(element) - blob = find_blob element, 'file' - return if blob.nil? - { - blob: blob, - alt: element['alt'], - text: element['text'] - }.to_dot - end end diff --git a/app/models/communication/block/template/image.rb b/app/models/communication/block/template/image.rb new file mode 100644 index 0000000000000000000000000000000000000000..a306ec700532e92f1d0e2284d8e453c4edd0a0a3 --- /dev/null +++ b/app/models/communication/block/template/image.rb @@ -0,0 +1,14 @@ +class Communication::Block::Template::Image < Communication::Block::Template + def build_git_dependencies + add_dependency image&.blob + end + + def image + extract_image_alt_and_credit data, 'image' + end + + def text + "#{data['text']}" + end + +end diff --git a/app/models/communication/block/template/page.rb b/app/models/communication/block/template/page.rb index dd60b571e3c046c63e06f055ddbece03b4b1b140..41b048fdb26117ddb85ffd3bbcf43b3509d5d797 100644 --- a/app/models/communication/block/template/page.rb +++ b/app/models/communication/block/template/page.rb @@ -1,25 +1,25 @@ class Communication::Block::Template::Page < Communication::Block::Template def build_git_dependencies add_dependency main_page - selected_pages.each do |hash| - page = hash.page + selected_pages.each do |page| add_dependency page add_dependency page.active_storage_blobs end end def selected_pages - @selected_pages ||= elements.map { |element| - p = page(element['id']) - next if p.nil? - hash_from_page(p, element) - }.compact + # kind could be: selection (default), children + @selected_pages ||= send "selected_pages_#{kind}" end def main_page @main_page ||= page(data['page_id']) end + def show_main_description + data['show_main_description'] || false + end + def show_description data['show_description'] || false end @@ -30,12 +30,21 @@ class Communication::Block::Template::Page < Communication::Block::Template protected - def hash_from_page(page, element) - { - page: page, - show_description: element['show_description'] || false, - show_image: element['show_image'] || false - }.to_dot + def kind + @kind ||= data['kind'] || 'selection' + end + + def selected_pages_selection + elements.map { |element| + page element['id'] + }.compact + end + + def selected_pages_children + return [] unless main_page + main_page.children + .published + .ordered end def page(id) diff --git a/app/models/communication/block/template/partner.rb b/app/models/communication/block/template/partner.rb index 930e858e956f48b73502fcf49a0186adcf221962..7a30863eac08dca4f45c93373a3f2eda3c878d40 100644 --- a/app/models/communication/block/template/partner.rb +++ b/app/models/communication/block/template/partner.rb @@ -8,20 +8,23 @@ class Communication::Block::Template::Partner < Communication::Block::Template end def partners - @partners ||= elements.map { |element| partner(element) } - .compact + @partners ||= elements.map { |element| + partner(element) + }.compact end def active_storage_blobs - @active_storage_blobs ||= partners.map { |partner| partner.blob } - .compact + @active_storage_blobs ||= partners.map { |partner| + partner.blob + }.compact end protected def organizations - @organizations ||= partners.map { |partner| partner.organization } - .compact + @organizations ||= partners.map { |partner| + partner.organization + }.compact end def partner(element) diff --git a/app/models/communication/block/template/post.rb b/app/models/communication/block/template/post.rb index 90df81731bc1dc28b994b73cc4540f5fddf9ef44..b25c07e1a0efdbe1d21c8fd8a618e937380ea4c7 100644 --- a/app/models/communication/block/template/post.rb +++ b/app/models/communication/block/template/post.rb @@ -49,8 +49,9 @@ class Communication::Block::Template::Post < Communication::Block::Template end def selected_posts_selection - elements.map { |element| post(element['id']) } - .compact + elements.map { |element| + post(element['id']) + }.compact end def post(id) diff --git a/app/models/communication/block/template/video.rb b/app/models/communication/block/template/video.rb new file mode 100644 index 0000000000000000000000000000000000000000..1f3d5d7dd746493ac8cfc53b9d1495ab174fb8ea --- /dev/null +++ b/app/models/communication/block/template/video.rb @@ -0,0 +1,4 @@ +class Communication::Block::Template::Video < Communication::Block::Template + def build_git_dependencies + end +end diff --git a/app/models/communication/website/category.rb b/app/models/communication/website/category.rb index 4a73a15d7fb05e5272638b4305e00038784ef933..9a0a29279ed8171405dd6d1e65039ecfc2b40eed 100644 --- a/app/models/communication/website/category.rb +++ b/app/models/communication/website/category.rb @@ -82,6 +82,10 @@ class Communication::Website::Category < ApplicationRecord "content/categories/#{path}/_index.html" end + def template_static + "admin/communication/websites/categories/static" + end + def git_dependencies(website) [self] + descendants + active_storage_blobs + posts + website.menus end diff --git a/app/models/communication/website/configs/base_url.rb b/app/models/communication/website/configs/base_url.rb index a2510c716f8662e46e01f66222730e6c680e3505..b44e75e045c8c07eb498723865d16f14d4a69351 100644 --- a/app/models/communication/website/configs/base_url.rb +++ b/app/models/communication/website/configs/base_url.rb @@ -34,4 +34,8 @@ class Communication::Website::Configs::BaseUrl < Communication::Website "config/production/config.yaml" end + def template_static + "admin/communication/websites/configs/base_urls/static" + end + end diff --git a/app/models/communication/website/configs/permalinks.rb b/app/models/communication/website/configs/permalinks.rb index 04a9cc323c8d694bff15d5cfa331c933edde9025..2bd9c6bae0b742f785e019e56d5d2ece2c136c67 100644 --- a/app/models/communication/website/configs/permalinks.rb +++ b/app/models/communication/website/configs/permalinks.rb @@ -34,4 +34,8 @@ class Communication::Website::Configs::Permalinks < Communication::Website "config/_default/permalinks.yaml" end + def template_static + "admin/communication/websites/configs/permalinks/static" + end + end diff --git a/app/models/communication/website/git_file.rb b/app/models/communication/website/git_file.rb index 7e3dae0e4c9c93cddf13c1af029c77c2a2277195..2514920234e1d429ce0fd2c0da8ed9cf9717f883 100644 --- a/app/models/communication/website/git_file.rb +++ b/app/models/communication/website/git_file.rb @@ -63,7 +63,7 @@ class Communication::Website::GitFile < ApplicationRecord def to_s @to_s ||= ApplicationController.render( - template: "admin/#{about.class.name.underscore.pluralize}/static", + template: template_static, layout: false, assigns: { about: about, @@ -74,6 +74,14 @@ class Communication::Website::GitFile < ApplicationRecord protected + def template_static + if about.respond_to? :template_static + about.template_static + else + "admin/#{about.class.name.underscore.pluralize}/static" + end + end + # Real sha on the git repo def git_sha_for(path) website.git_repository.git_sha path diff --git a/app/models/communication/website/menu.rb b/app/models/communication/website/menu.rb index 24f8df696b480e62085385e77032640ac7d278a0..9a792698bd684c1af01c3977744b6e1cf02b22a9 100644 --- a/app/models/communication/website/menu.rb +++ b/app/models/communication/website/menu.rb @@ -41,4 +41,8 @@ class Communication::Website::Menu < ApplicationRecord def git_path(website) "data/menus/#{identifier}.yml" end + + def template_static + "admin/communication/websites/menus/static" + end end diff --git a/app/models/communication/website/page.rb b/app/models/communication/website/page.rb index 121a75e1d55994fd6b5c4e206f7c320176be9943..0a8959ca643a67e935023e428b42be5b06c5141b 100644 --- a/app/models/communication/website/page.rb +++ b/app/models/communication/website/page.rb @@ -117,6 +117,10 @@ class Communication::Website::Page < ApplicationRecord end end + def template_static + "admin/communication/websites/pages/static" + end + def git_dependencies(website) dependencies = [self] + website.menus + diff --git a/app/models/communication/website/post.rb b/app/models/communication/website/post.rb index 1df229eb4a0cdc2d7514dafc1094e16893ec0c6d..5f9cae573da89c6c0b86ba56391f696dd6c9d383 100644 --- a/app/models/communication/website/post.rb +++ b/app/models/communication/website/post.rb @@ -93,6 +93,10 @@ class Communication::Website::Post < ApplicationRecord "content/posts/#{published_at.year}/#{published_at.strftime "%Y-%m-%d"}-#{slug}.html" if published && published_at end + def template_static + "admin/communication/websites/posts/static" + end + def git_dependencies(website) dependencies = [self] + website.menus dependencies += categories diff --git a/app/models/education/diploma.rb b/app/models/education/diploma.rb new file mode 100644 index 0000000000000000000000000000000000000000..8f6763d8e6113de84755aa6b6b256991a8a1db7d --- /dev/null +++ b/app/models/education/diploma.rb @@ -0,0 +1,51 @@ +# == Schema Information +# +# Table name: education_diplomas +# +# id :uuid not null, primary key +# level :integer default("not_applicable") +# name :string +# short_name :string +# slug :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_education_diplomas_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_6cb2e9fa90 (university_id => universities.id) +# +class Education::Diploma < ApplicationRecord + include WithUniversity + include WithGit + include WithSlug + + has_many :programs + + scope :ordered, -> { order(:level, :name) } + + enum level: { + not_applicable: 0, + primary: 40, + secondary: 60, + high: 80, + first_year: 100, + second_year: 200, + third_year: 300, + fourth_year: 500, + master: 500, + doctor: 800 + } + + def git_path(website) + "content/diplomas/#{slug}/_index.html" + end + + def to_s + "#{name}" + end +end diff --git a/app/models/education/program.rb b/app/models/education/program.rb index 2ed2c2351302d09aed180b0e48c1b7fe5bd89a4c..e7fcc5e9aeee0d41aaadc0eb32a049d0c4f9dc6f 100644 --- a/app/models/education/program.rb +++ b/app/models/education/program.rb @@ -15,7 +15,6 @@ # featured_image_alt :string # featured_image_credit :text # level :integer -# main_information :text # name :string # objectives :text # opportunities :text @@ -29,14 +28,17 @@ # published :boolean default(FALSE) # registration :text # results :text +# short_name :string # slug :string # created_at :datetime not null # updated_at :datetime not null +# diploma_id :uuid indexed # parent_id :uuid indexed # university_id :uuid not null, indexed # # Indexes # +# index_education_programs_on_diploma_id (diploma_id) # index_education_programs_on_parent_id (parent_id) # index_education_programs_on_university_id (university_id) # @@ -84,6 +86,9 @@ class Education::Program < ApplicationRecord class_name: 'Education::Program', foreign_key: :parent_id, dependent: :destroy + belongs_to :diploma, + class_name: 'Education::Diploma', + optional: true has_many :university_roles, class_name: 'University::Role', as: :target, @@ -173,6 +178,13 @@ class Education::Program < ApplicationRecord after_save_commit :set_websites_categories, unless: :skip_websites_categories_callback scope :published, -> { where(published: true) } + scope :ordered_by_name, -> { order(:name) } + scope :for_search_term, -> (term) { + where(" + unaccent(education_programs.name) ILIKE unaccent(:term) + ", term: "%#{sanitize_sql_like(term)}%") + } + scope :for_diploma, -> (diploma_id) { where(diploma_id: diploma_id) } def to_s "#{name}" diff --git a/app/models/university/person/administrator.rb b/app/models/university/person/administrator.rb index 387c93a640f1446247ac545493cbc6ab290b2d42..e2287f0fa3b2f1fda0abfb7bc99005180b2a63c0 100644 --- a/app/models/university/person/administrator.rb +++ b/app/models/university/person/administrator.rb @@ -46,6 +46,10 @@ class University::Person::Administrator < University::Person "content/administrators/#{slug}/_index.html" if for_website?(website) end + def template_static + "admin/university/people/administrators/static" + end + def for_website?(website) is_administration && website.has_administrators? && website.administrators.pluck(:id).include?(self.id) end diff --git a/app/models/university/person/alumnus.rb b/app/models/university/person/alumnus.rb index 2e140c8c5a3c4c64f2172aea733483431d94cc74..6340ea7140be754b7c02ee95c5f2c5c329a0a311 100644 --- a/app/models/university/person/alumnus.rb +++ b/app/models/university/person/alumnus.rb @@ -42,11 +42,15 @@ class University::Person::Alumnus < University::Person 'University::Person::Alumnus' end + def template_static + "admin/university/people/alumni/static" + end + def git_path(website) - # TODO + # No alumni on websites end def for_website?(website) - # TODO + false end end diff --git a/app/models/university/person/author.rb b/app/models/university/person/author.rb index a51eadb10d87ba126e899071f130495f7b315e13..ae695b0b91fc413ea050a69b95184b6e95f01bd3 100644 --- a/app/models/university/person/author.rb +++ b/app/models/university/person/author.rb @@ -46,6 +46,10 @@ class University::Person::Author < University::Person "content/authors/#{slug}/_index.html" if for_website?(website) end + def template_static + "admin/university/people/authors/static" + end + def for_website?(website) website.has_authors? && website.authors.pluck(:id).include?(self.id) end diff --git a/app/models/university/person/researcher.rb b/app/models/university/person/researcher.rb index 44616e8492facc2bcb1908e8519bdcccff2d8bac..c00c664d88d18d7868d6a64d691333991fe67e63 100644 --- a/app/models/university/person/researcher.rb +++ b/app/models/university/person/researcher.rb @@ -46,6 +46,10 @@ class University::Person::Researcher < University::Person "content/researchers/#{slug}/_index.html" if for_website?(website) end + def template_static + "admin/university/people/researchers/static" + end + def for_website?(website) is_researcher && website.has_researchers? && website.researchers.pluck(:id).include?(self.id) end diff --git a/app/models/university/person/teacher.rb b/app/models/university/person/teacher.rb index 0f83e630a46a59a4431fdfeb88b3221d72932427..e26b9e332626b2f843d09f68e39b612d01e2b5b8 100644 --- a/app/models/university/person/teacher.rb +++ b/app/models/university/person/teacher.rb @@ -47,6 +47,10 @@ class University::Person::Teacher < University::Person "content/teachers/#{slug}/_index.html" if for_website?(website) end + def template_static + "admin/university/people/teachers/static" + end + def for_website?(website) is_teacher && website.has_teachers? && website.teachers.pluck(:id).include?(self.id) end diff --git a/app/models/university/with_education.rb b/app/models/university/with_education.rb index 95b2d605b02dcbfa2fc723b00573f8804211766d..d6852f6242e9c4d40009c81113a307f35e389352 100644 --- a/app/models/university/with_education.rb +++ b/app/models/university/with_education.rb @@ -7,6 +7,11 @@ module University::WithEducation dependent: :destroy alias_attribute :cohorts, :education_cohorts + has_many :education_diplomas, + class_name: 'Education::Diploma', + dependent: :destroy + alias_attribute :diplomas, :education_diplomas + has_many :education_programs, class_name: 'Education::Program', dependent: :destroy diff --git a/app/services/filters/admin/education/programs.rb b/app/services/filters/admin/education/programs.rb new file mode 100644 index 0000000000000000000000000000000000000000..5680fa3aca700bf39c6fbb07d677c925fdad5843 --- /dev/null +++ b/app/services/filters/admin/education/programs.rb @@ -0,0 +1,16 @@ +module Filters + class Admin::Education::Programs < Filters::Base + def initialize(user) + super + add_search + add :for_diploma, + user.university.education_diplomas, + I18n.t( + 'filters.attributes.element', + element: I18n.t('activerecord.models.education/diploma.one').downcase + ), + false, + false + end + end +end diff --git a/app/services/filters/admin/education/schools.rb b/app/services/filters/admin/education/schools.rb index 3e0e5dfeef8d04e761b566f8184046eb46da34db..89712eb5732d29ec356026e3d1a670535a3c0ebc 100644 --- a/app/services/filters/admin/education/schools.rb +++ b/app/services/filters/admin/education/schools.rb @@ -3,7 +3,14 @@ module Filters def initialize(user) super add_search - add :for_program, user.university.education_programs, I18n.t('filters.attributes.element', element: I18n.t('activerecord.models.education/program.one').downcase), false, true + add :for_program, + user.university.education_programs, + I18n.t( + 'filters.attributes.element', + element: I18n.t('activerecord.models.education/program.one').downcase + ), + false, + true end end end diff --git a/app/services/filters/admin/education/teachers.rb b/app/services/filters/admin/education/teachers.rb index baa883f7b9c54d1c0c6f596fde610678cf3abeaa..a6f2a0c04a84c4992a29a71e4bd3907d0c764d23 100644 --- a/app/services/filters/admin/education/teachers.rb +++ b/app/services/filters/admin/education/teachers.rb @@ -3,7 +3,14 @@ module Filters def initialize(user) super add_search - add :for_program, user.university.education_programs, I18n.t('filters.attributes.element', element: I18n.t('activerecord.models.education/program.one').downcase), false, true + add :for_program, + user.university.education_programs, + I18n.t( + 'filters.attributes.element', + element: I18n.t('activerecord.models.education/program.one').downcase + ), + false, + true end end end diff --git a/app/views/admin/application/_nav.html.erb b/app/views/admin/application/_nav.html.erb index ae1ae913b18fbc8acb4c095ebf7d5ba134ac5f1b..d29518d0eb758811fc9bc34589dc8d3211ad8760 100644 --- a/app/views/admin/application/_nav.html.erb +++ b/app/views/admin/application/_nav.html.erb @@ -4,32 +4,5 @@ <%= image_tag 'osuny-white.svg', class: 'img-fluid' %> <% end %> <%= render_navigation context: :admin %> - - - <footer class="small my-5"> - <hr> - <div class="sidebar-header"> - <p class="small"> - <%= t('admin.number_of_enqueued_tasks', tasks: Delayed::Job.all.length) %> - </p> - </div> - <hr> - <%= link_to 'API', api_root_path, class: 'sidebar-link' %> - <% - [ - :terms_of_service, - :privacy_policy, - :cookies_policy - ].each do |term| %> - <%= link_to t("#{term}"), - t("#{term}_url"), - target: '_blank', - rel: 'noreferrer', - class: 'sidebar-link' %> - <% end %> - <%= link_to t('cookies_consent_choice'), - '', - class: 'sidebar-link js-gdpr__cookie_consent__display_again' %> - </footer> </div> </nav> diff --git a/app/views/admin/application/featured_image/_edit.html.erb b/app/views/admin/application/featured_image/_edit.html.erb index 849fdaa5655339cd2f4d7be1b08a48cf614739fc..51543902229d4bb3bedf488752eab4894c7661a0 100644 --- a/app/views/admin/application/featured_image/_edit.html.erb +++ b/app/views/admin/application/featured_image/_edit.html.erb @@ -1,20 +1,27 @@ <div class="card flex-fill w-100"> <div class="card-header"> - <h5 class="card-title mb-0"><%= t('activerecord.attributes.communication/website/post.featured_image') %></h5> + <h5 class="card-title mb-0"> + <%= t('featured_image.title') %> + </h5> </div> <div class="card-body"> <%= f.input :featured_image, as: :single_deletable_file, direct_upload: true, label: false, + hint: '.jpg, .jpeg, .png, .svg', input_html: { accept: '.jpg,.jpeg,.png,.svg' }, preview: true %> - <%= f.input :featured_image_alt %> + <%= f.input :featured_image_alt, + label: t('featured_image.alt.label'), + hint: t('featured_image.alt.hint') %> <%= f.input :featured_image_credit, as: :summernote, + label: t('featured_image.credit.label'), + hint: t('featured_image.credit.hint'), input_html: { data: { 'summernote-config' => 'mini' } } %> - <%= render 'admin/communication/unsplash/selector', about: about, f:f %> + <%= render 'admin/communication/unsplash/selector', about: about, f:f %> </div> </div> diff --git a/app/views/admin/communication/blocks/_list.html.erb b/app/views/admin/communication/blocks/_list.html.erb index 57474428928ba829e1b05f3a2a9cdfd7cfc9de57..91077fb53590a8dcf6e872071c1546842645f4d6 100644 --- a/app/views/admin/communication/blocks/_list.html.erb +++ b/app/views/admin/communication/blocks/_list.html.erb @@ -9,6 +9,7 @@ <%= Communication::Block.model_name.human(count: 2) %> </h2> </div> + <% if about.blocks.any? %> <table class="<%= table_classes %>"> <thead> <tr> @@ -26,9 +27,7 @@ <% if can? :reorder, Communication::Block %> <td><i class="fa fa-bars handle"></i></td> <% end %> - <td><%= link_to_if can?(:read, block), - block.to_s.truncate(50), - admin_communication_block_path(block) %></td> + <td><%= block.to_s.truncate(50) %></td> <td><%= block.template_kind_i18n %></td> <td class="text-end"> <div class="btn-group" role="group"> @@ -40,4 +39,5 @@ <% end %> </tbody> </table> + <% end %> </div> diff --git a/app/views/admin/communication/blocks/_preview.html.erb b/app/views/admin/communication/blocks/_preview.html.erb index 72d57e3ae7ad6244f32e791ac6204ec3af38cd3a..40d11ae7eaa06d15231a62d9f5a8b52c989891f0 100644 --- a/app/views/admin/communication/blocks/_preview.html.erb +++ b/app/views/admin/communication/blocks/_preview.html.erb @@ -3,4 +3,4 @@ @block = block @preview = true %> -<%= render "admin/communication/blocks/templates/#{@block.template_kind}/show" %> +<%= render "admin/communication/blocks/templates/#{@block.template_kind}/preview" %> diff --git a/app/views/admin/communication/blocks/show.html.erb b/app/views/admin/communication/blocks/show.html.erb deleted file mode 100644 index 8ae4009e2bc14f54b5c3151f7b3b488b911dc51b..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/show.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% content_for :title, @block %> - -<%= render "admin/communication/blocks/templates/#{@block.template_kind}/show" %> - -<% content_for :action_bar_right do %> - <%= edit_link @block %> -<% end %> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb index 74caee4a0f55716c0f7d1eb925d5abbd42cbc358..209a0b71b7bf1cfa67961af5288c54097be6b24d 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_edit.html.erb @@ -19,7 +19,7 @@ for="image"> <%= t '.image_title' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, data, 'image' )" @@ -43,14 +43,23 @@ </label> <input id="image_alt" type="text" - class="form-control" + class="form-control mb-2" v-model="data.image_alt" placeholder="<%= t '.image_alt_placeholder' %>" /> + <label class="form-label" + for="image_credit"> + <%= t '.image_credit_label' %> + </label> + <input id="image_credit" + type="text" + class="form-control" + v-model="data.image_credit" + placeholder="<%= t '.image_credit_placeholder' %>" /> </div> </div> <h2><%= t '.buttons' %></h2> <div class="row"> - <div class="col-xxl-4 col-md-6"> + <div class="col-xxl-4 col-md-6 mb-4"> <h3 class="h4"><%= t '.button_1' %></h3> <label class="form-label" for="button"> @@ -72,10 +81,10 @@ placeholder="<%= t '.url_placeholder' %>" /> </div> - <div class="col-xxl-4 col-md-6"> + <div class="col-xxl-4 col-md-6 mb-4"> <h3 class="h4"><%= t '.button_2' %></h3> - <label class="form-label" for="button"> + <label class="form-label" for="button_secondary"> <%= t '.button_label' %> </label> <input id="button_secondary" @@ -93,4 +102,25 @@ v-model="data.url_secondary" placeholder="<%= t '.url_placeholder' %>" /> </div> + <div class="col-xxl-4 col-md-6 mb-4"> + <h3 class="h4"><%= t '.button_3' %></h3> + + <label class="form-label" for="button_tertiary"> + <%= t '.button_label' %> + </label> + <input id="button_tertiary" + type="text" + class="form-control" + v-model="data.button_tertiary" + placeholder="<%= t '.button_placeholder' %>" /> + + <label class="form-label mt-3" for="url_tertiary"> + <%= t '.url_label' %> + </label> + <input id="url_tertiary" + type="url" + class="form-control" + v-model="data.url_tertiary" + placeholder="<%= t '.url_placeholder' %>" /> + </div> </div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e3fda0a16515dbaa7c135ebb8d869b5b8c959be0 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/call_to_action/_preview.html.erb @@ -0,0 +1,39 @@ +<div class="card"> + <div class="card-body"> + <% if @block.template.image %> + <div style= "max-width: 200px;" class="me-3"> + <%= kamifusen_tag @block.template.image.blob, + width: 200, + alt: @block.template.image.alt, + class: 'img-fluid' %> + <caption><%= @block.template.image.alt %></caption> + </div> + <hr> + <% end %> + <%= @block.template.text.html_safe %> + <% unless @block.template.url.blank? %> + <a href="<%= @block.template.url %>" + class="btn btn-primary" + target="_blank" + rel="noopener"> + <%= @block.template.button %> + </a> + <% end %> + <% unless @block.template.url_secondary.blank? %> + <a href="<%= @block.template.url_secondary %>" + class="btn btn-primary" + target="_blank" + rel="noopener"> + <%= @block.template.button_secondary %> + </a> + <% end %> + <% unless @block.template.url_tertiary.blank? %> + <a href="<%= @block.template.url_tertiary %>" + class="btn btn-primary" + target="_blank" + rel="noopener"> + <%= @block.template.button_tertiary %> + </a> + <% end %> + </div> +</div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb deleted file mode 100644 index bb36af7503343bb9e10a3630df0e96522018e057..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/call_to_action/_show.html.erb +++ /dev/null @@ -1,35 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <div class="<%= 'col-md-8 col-xl-6' unless @preview %>"> - <div class="card"> - <div class="card-body"> - <% if @block.template.image %> - <div style= "max-width: 200px;" class="me-3"> - <%= kamifusen_tag @block.template.image.blob, - width: 200, - alt: @block.template.image.alt, - class: 'img-fluid' %> - <caption><%= @block.template.image.alt %></caption> - </div> - <hr> - <% end %> - <%= @block.template.text.html_safe %> - <% unless @block.template.url.blank? %> - <a href="<%= @block.template.url %>" - class="btn btn-primary" - target="_blank" - rel="noopener"> - <%= @block.template.button %> - </a> - <% end %> - <% unless @block.template.url_secondary.blank? %> - <a href="<%= @block.template.url_secondary %>" - class="btn btn-secondary" - target="_blank" - rel="noopener"> - <%= @block.template.button_secondary %> - </a> - <% end %> - </div> - </div> - </div> -</div> diff --git a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb index ce72af2ac25f6e1dead7dec99f16466915a10894..63b1e92a60f37ad2e251e1f0a67f85a3c0c84c79 100644 --- a/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/call_to_action/_static.html.erb @@ -2,8 +2,10 @@ <%= prepare_html_for_static block.template.text, about.university %> <% if block.template.image %> image: + id: "<%= block.template.image.blob.id %>" file: "<%= block.template.image.blob.id %>" alt: <%= prepare_text_for_static block.template.image.alt %> + credit: <%= prepare_text_for_static block.template.image.credit %> <% end %> button: text: >- @@ -15,3 +17,8 @@ <%= prepare_text_for_static block.template.button_secondary %> url: >- <%= prepare_text_for_static block.template.url_secondary %> + button_tertiary: + text: >- + <%= prepare_text_for_static block.template.button_tertiary %> + url: >- + <%= prepare_text_for_static block.template.url_tertiary %> diff --git a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb index f9af3e9f1f779e9f5545b946b570b0abc9d331da..860e81f9048569a1d23b038547b15e12f5aafc30 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_edit.html.erb @@ -4,17 +4,13 @@ for="text"> <%= t '.text_label' %> </label> - <div class="summernote"> + <div class="summernote mb-3"> <textarea id="text" class="form-control summernote-vue" v-model="data.text" data-summernote-config="mini-list" placeholder="<%= t '.text_placeholder' %>"></textarea> </div> - </div> -</div> -<div class="row"> - <div class="col-md-6"> <label class="form-label" for="notes"> <%= t '.notes_label' %> @@ -27,4 +23,50 @@ placeholder="<%= t '.notes_placeholder' %>"></textarea> </div> </div> + <div class="col-md-6"> + <div class="mb-3"> + <div v-if="!data.image"> + <label class="form-label" + for="image"> + <%= t 'admin.communication.blocks.components.image.input.label' %> + </label> + <input class="form-control" + type="file" + accept="image/*" + @change="onFileImageChange( $event, data, 'image' )" + id="image"> + </div> + <div v-if="data.image"> + <img :src="getImageUrl(data.image)" + class="img-fluid" + style="max-height: 80px" + /> + <br> + <a class="btn btn-sm btn-danger mt-2" + v-on:click="data.image=null"> + <i class="fas fa-times"></i> + <%= t 'admin.communication.blocks.components.image.input.remove' %> + </a> + </div> + </div> + <label class="form-label" + for="image_alt"> + <%= t 'admin.communication.blocks.components.image.alt.label' %> + </label> + <input id="image_alt" + type="text" + class="form-control mb-3" + v-model="data.image_alt" + placeholder="<%= t 'admin.communication.blocks.components.image.alt.placeholder' %>" /> + + <label class="form-label" + for="image_credit"> + <%= t 'admin.communication.blocks.components.image.credit.label' %> + </label> + <input id="image_alt" + type="text" + class="form-control" + v-model="data.image_credit" + placeholder="<%= t 'admin.communication.blocks.components.image.credit.placeholder' %>" /> + </div> </div> diff --git a/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb b/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..8b63ba0183fff679fcf0721ee4d78009c26f20c3 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/chapter/_preview.html.erb @@ -0,0 +1,8 @@ +<% if @block.template.image %> + <%= kamifusen_tag @block.template.image.blob, + width: 600, + alt: @block.template.image.alt, + class: 'img-fluid' %> +<% end %> +<%= @block.template.text.html_safe %> +<%= @block.template.notes.html_safe %> diff --git a/app/views/admin/communication/blocks/templates/chapter/_show.html.erb b/app/views/admin/communication/blocks/templates/chapter/_show.html.erb deleted file mode 100644 index 868577d6eff62a0ce96921d9b56a4195f5eaaf2e..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/chapter/_show.html.erb +++ /dev/null @@ -1,2 +0,0 @@ -<%= @block.template.text.html_safe %> -<%= @block.template.notes.html_safe %> diff --git a/app/views/admin/communication/blocks/templates/chapter/_static.html.erb b/app/views/admin/communication/blocks/templates/chapter/_static.html.erb index 1dcbc92180d28edca1d4f8f2b2dec4fface6340e..169f9ad0cab6b453dd3802bdf5e2047671feeae7 100644 --- a/app/views/admin/communication/blocks/templates/chapter/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/chapter/_static.html.erb @@ -2,3 +2,10 @@ <%= prepare_html_for_static block.template.text, about.university %> notes: >- <%= prepare_html_for_static block.template.notes, about.university %> + <% if block.template.image %> + image: + id: "<%= block.template.image.blob.id %>" + file: "<%= block.template.image.blob.id %>" + alt: <%= prepare_text_for_static block.template.image.alt %> + credit: <%= prepare_text_for_static block.template.image.credit %> + <% end %> diff --git a/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb b/app/views/admin/communication/blocks/templates/datatable/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb b/app/views/admin/communication/blocks/templates/datatable/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/datatable/_static.html.erb b/app/views/admin/communication/blocks/templates/datatable/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb index 08b6904d07cd7bda91fc900bf8bb1ec07456b0fe..8e3741feaed7a720d61a62d7b2b7ec32e989cf52 100644 --- a/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/definitions/_edit.html.erb @@ -16,7 +16,7 @@ <div class="flex-fill"> <label class="form-label" :for="'definition-' + index + '-title'"><%= t '.title_label' %></label> - <input class="form-control mb-2" + <input class="form-control mb-3" v-model="definition.title" placeholder="<%= t '.title_placeholder' %>" type="text" @@ -24,7 +24,7 @@ <label class="form-label" :for="'definition-' + index + '-text'"><%= t '.text_label' %></label> - <textarea class="form-control mb-2" + <textarea class="form-control mb-3" rows="3" v-model="definition.text" placeholder="<%= t '.text_placeholder' %>" diff --git a/app/views/admin/communication/blocks/templates/definitions/_show.html.erb b/app/views/admin/communication/blocks/templates/definitions/_preview.html.erb similarity index 100% rename from app/views/admin/communication/blocks/templates/definitions/_show.html.erb rename to app/views/admin/communication/blocks/templates/definitions/_preview.html.erb diff --git a/app/views/admin/communication/blocks/templates/embed/_edit.html.erb b/app/views/admin/communication/blocks/templates/embed/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/embed/_preview.html.erb b/app/views/admin/communication/blocks/templates/embed/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/embed/_static.html.erb b/app/views/admin/communication/blocks/templates/embed/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/files/_edit.html.erb b/app/views/admin/communication/blocks/templates/files/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/files/_preview.html.erb b/app/views/admin/communication/blocks/templates/files/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/files/_static.html.erb b/app/views/admin/communication/blocks/templates/files/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb index bb2d880de4cf79f95dd91b8c35bf9d9fa13c4ec9..8ac88883e05e4594248bbe503f7a90fd1a114945 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_edit.html.erb @@ -1,5 +1,5 @@ <a class="<%= button_classes('mb-4') %>" - v-on:click="data.elements.push({alt: '', file: {}})"> + v-on:click="data.elements.push({alt: '', credit: '', file: {}})"> <%= t '.add_image' %> </a> @@ -20,33 +20,48 @@ </div> <img :src="getImageUrl(image.file)" class="img-fluid d-block" v-if="image.file.id" /> <div class="card-body"> + <label class="form-label" :for="'image-file-' + imageIndex"> <%= t '.image_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, image, 'file' )" :id="'image-file-' + imageIndex"> + <div class="mb-3"> - <label aria-label="<%= t '.alt_label' %>" + <label class="form-label" + aria-label="<%= t '.alt_label' %>" :for="'image-alt-' + imageIndex"> <%= t '.alt_label' %> </label> - <input class="form-control" + <input class="form-control mb-2" type="text" v-model="image.alt" placeholder="<%= t '.alt_placeholder' %>" :id="'image-alt-' + imageIndex"> - <label aria-label="<%= t '.text_label' %>" + + <label class="form-label" + aria-label="<%= t '.text_label' %>" :for="'image-text-' + imageIndex"> <%= t '.text_label' %> </label> - <textarea class="form-control" + <textarea class="form-control mb-2" v-model="image.text" placeholder="<%= t '.text_placeholder' %>" :id="'image-text-' + imageIndex"></textarea> + + <label class="form-label" + :for="'image-credit-' + imageIndex"> + <%= t '.credit_label' %> + </label> + <input type="text" + class="form-control" + v-model="image.credit" + :id="'image-credit-' + imageIndex" + placeholder="<%= t '.credit_placeholder' %>" /> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..baa661e3c126e45e493b906aa00c6cbb47fbcff5 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/gallery/_preview.html.erb @@ -0,0 +1,11 @@ +<% @block.template.images_with_alt.each do |image| %> + <article class="card"> + <% if image.blob %> + <%= kamifusen_tag image.blob, width: 500, class: 'img-fluid mb-3' %> + <% end %> + <div class="card-body"> + <p class="mb-0"><%= image.alt %></p> + <p class="mb-0 small"><%= image.text %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb b/app/views/admin/communication/blocks/templates/gallery/_show.html.erb deleted file mode 100644 index 85b3ef064ef15f41b44eeade08097b24746e3299..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/gallery/_show.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.images_with_alt.each do |image| %> - <div class="<%= 'col-xxl-2 col-xl-3 col-6' unless @preview %>"> - <article class="card"> - <% if image.blob %> - <%= kamifusen_tag image.blob, width: 500, class: 'img-fluid mb-2' %> - <% end %> - <div class="card-body"> - <p class="mb-0"><%= image.alt %></p> - <p class="mb-0 small"><%= image.text %></p> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb index 465dae402dc128b1fe84a6dbabb1aa450c6dec4a..88441ae9d4da5f2713df035cbb7914ad75839f0c 100644 --- a/app/views/admin/communication/blocks/templates/gallery/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/gallery/_static.html.erb @@ -1,8 +1,12 @@ images: <% block.template.images_with_alt.each do |image| %> - - alt: > + - id: "<%= image.blob.id %>" + file: "<%= image.blob.id %>" + alt: > <%= prepare_text_for_static image.alt %> + credit: > + <%= prepare_text_for_static image.credit %> text: > <%= prepare_text_for_static image.text %> - file: "<%= image.blob.id %>" + <% end %> diff --git a/app/views/admin/communication/blocks/templates/image/_edit.html.erb b/app/views/admin/communication/blocks/templates/image/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..f017fe6a31054413cca215bca389a74b1a5c2dea --- /dev/null +++ b/app/views/admin/communication/blocks/templates/image/_edit.html.erb @@ -0,0 +1,60 @@ +<div class="row mb-5"> + <div class="col-xxl-4 col-md-6"> + <div v-if="!data.image"> + <label class="form-label" + for="image"> + <%= t 'admin.communication.blocks.components.image.input.label' %> + </label> + <input class="form-control mb-4" + type="file" + accept="image/*" + @change="onFileImageChange( $event, data, 'image' )" + id="image"> + </div> + <div v-if="data.image"> + <img :src="getImageUrl(data.image)" + class="img-fluid" + style="max-height: 80px" + /> + <br> + <a class="btn btn-sm btn-danger mt-2" + v-on:click="data.image=null"> + <i class="fas fa-times"></i> + <%= t 'admin.communication.blocks.components.image.input.remove' %> + </a> + </div> + </div> + <div class="col-xxl-4 col-md-6"> + <label class="form-label" + for="image_alt"> + <%= t 'admin.communication.blocks.components.image.alt.label' %> + </label> + <input id="image_alt" + type="text" + class="form-control mb-3" + v-model="data.image_alt" + placeholder="<%= t 'admin.communication.blocks.components.image.alt.placeholder' %>" /> + + <label class="form-label" + for="image_credit"> + <%= t 'admin.communication.blocks.components.image.credit.label' %> + </label> + <input id="image_credit" + type="text" + class="form-control mb-3" + v-model="data.image_credit" + placeholder="<%= t 'admin.communication.blocks.components.image.credit.placeholder' %>" /> + + <label class="form-label" + for="text"> + <%= t 'admin.communication.blocks.components.text.label' %> + </label> + <div class="summernote"> + <textarea id="text" + class="form-control summernote-vue" + v-model="data.text" + data-summernote-config="mini" + placeholder="<%= t 'admin.communication.blocks.components.text.placeholder' %>"></textarea> + </div> + </div> +</div> diff --git a/app/views/admin/communication/blocks/templates/image/_preview.html.erb b/app/views/admin/communication/blocks/templates/image/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..bd8956bf2c34ebac1235edc452114b456195695b --- /dev/null +++ b/app/views/admin/communication/blocks/templates/image/_preview.html.erb @@ -0,0 +1,9 @@ +<% if @block.template.image&.blob %> + <%= kamifusen_tag @block.template.image.blob, + width: 600, + alt: @block.template.image.alt, + class: 'img-fluid' if @block.template.image %> + <caption><%= @block.template.image.alt %></caption> + <p class="small"><%= @block.template.image.credit %></p> + <%= @block.template.text.html_safe %> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/image/_static.html.erb b/app/views/admin/communication/blocks/templates/image/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..5c085b71e2fb240b0e53c1ee043d9b622a9df19c --- /dev/null +++ b/app/views/admin/communication/blocks/templates/image/_static.html.erb @@ -0,0 +1,9 @@ + text: >- + <%= prepare_html_for_static block.template.text, about.university %> + <% if block.template.image %> + image: + id: "<%= block.template.image.blob.id %>" + file: "<%= block.template.image.blob.id %>" + alt: <%= prepare_text_for_static block.template.image.alt %> + credit: <%= prepare_text_for_static block.template.image.credit %> + <% end %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1ba8ba5a07ea9f15432677b2ab1db74cf3521431 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/organization_chart/_preview.html.erb @@ -0,0 +1,15 @@ +<% @block.template.persons_with_role.each do |person_with_role| + person = person_with_role.person %> + <article class="card"> + <div class="card-body"> + <% if person.best_picture.attached? %> + <div style="max-width: 80px" class="float-end"> + <%= kamifusen_tag person.best_picture, + class: 'img-fluid rounded-circle' %> + </div> + <% end %> + <h3 class="card-title h5"><%= link_to person, [:admin, person] %></h3> + <p class="mb-0"><%= person_with_role.role %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb b/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb deleted file mode 100644 index f0181c8f801110e335636fdf6937065c9b3c0b5c..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/organization_chart/_show.html.erb +++ /dev/null @@ -1,19 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.persons_with_role.each do |person_with_role| - person = person_with_role.person %> - <div class="<%= 'col-md-3' unless @preview %>"> - <article class="card"> - <div class="card-body"> - <% if person.best_picture.attached? %> - <div style="max-width: 80px" class="float-end"> - <%= kamifusen_tag person.best_picture, - class: 'img-fluid rounded-circle' %> - </div> - <% end %> - <h3 class="card-title h5"><%= link_to person, [:admin, person] %></h3> - <p class="mb-0"><%= person_with_role.role %></p> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb index 8ac8909e21b1df8673b76a3a33f7539b34186f32..2e9fe6ef48799468c63c32716f109e4308167c70 100644 --- a/app/views/admin/communication/blocks/templates/pages/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_edit.html.erb @@ -1,8 +1,69 @@ <% pages = collection_tree(@block.about&.website.pages) %> -<h2 class="mt-5">Page principale</h2> -<div class="row mb-1"> +<div class="row mb-4"> <div class="col-md-6"> + <h2 class="h3">Type de liste</h2> + <div class="form-check form-check-inline mb-3"> + <input class="form-check-input" + type="radio" + name="kind" + v-model="data.kind" + value="children" + id="kind-children"> + <label class="form-check-label" for="kind-children"> + La page principale et ses enfants + </label> + </div> + <div class="form-check form-check-inline"> + <input class="form-check-input" + type="radio" + name="kind" + v-model="data.kind" + value="selection" + id="kind-selection"> + <label class="form-check-label" for="kind-selection"> + Une sélection spécifique de pages + </label> + </div> + </div> + <div class="col-md-6"> + <h2 class="h3">Options d'affichage</h2> + <div class="form-check"> + <input v-model="data.show_main_description" + class="form-check-input boolean optional" + id="show_main_description" + type="checkbox"> + <label class="form-check-label boolean optional" + for="show_main_description"> + Afficher la description courte de la page principale + </label> + </div> + <div class="form-check"> + <input v-model="data.show_description" + class="form-check-input boolean optional" + id="show_description" + type="checkbox"> + <label class="form-check-label boolean optional" + for="show_description"> + Afficher les descriptions courtes des pages + </label> + </div> + <div class="form-check"> + <input v-model="data.show_image" + class="form-check-input boolean optional" + id="show_image" + type="checkbox"> + <label class="form-check-label boolean optional" + for="show_image"> + Afficher les images des pages + </label> + </div> + </div> +</div> + +<div class="row"> + <div class="col-md-6"> + <h2 class="h3">Page principale</h2> <label class="form-label" for="page_id">Sélectionnez une page principale</label> <select id="page_id" @@ -13,69 +74,40 @@ <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> <% end %> </select> + <div class="form-text">Cette page principale définira le titre et le lien du bloc. Si vous choisissez une page sans remplir le titre ci-dessus, le titre de la page sera utilisé. Si le titre est rempli, il remplacera le titre de la page sélectionnée, en utilisant le lien de la page.</div> </div> - <div class="col-md-6"> - <label class="form-label">Option d'affichage</label> - <div class="form-check"> - <input v-model="data.show_description" class="form-check-input boolean optional" id="show_description" type="checkbox"> - <label class="form-check-label boolean optional" - for="show_description">Afficher la description courte</label> - </div> - <div class="form-check"> - <input v-model="data.show_image" class="form-check-input boolean optional" :id="'show_image'" type="checkbox"> - <label class="form-check-label boolean optional" - :for="'show_image'">Afficher l'image</label> - </div> - </div> - <div v-if="!data.category_id" class="col-md-12 mt-5"> - <h2>Ajouter des pages</h2> - <a class="<%= button_classes('mb-4') %>" + <div class="col-md-6" v-if="data.kind == 'selection'"> + <h2 class="h3">Pages sélectionnées</h2> + <a class="<%= button_classes('mb-3') %>" v-on:click="data.elements.push({id: ''})"> <%= t '.add_page' %> </a> - <draggable :list="data.elements" handle=".dragHandle"> - <div v-for="(page, index) in data.elements"> - <div class="card"> - <div class="card-body"> - <div class="row"> - <div class="mb-2"> - <a class="btn btn-sm btn-danger float-end" - v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" - title="Delete"> - <i class="fas fa-times"></i> - </a> - <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> - <i class="fa fa-bars handle"></i> - </a> - </div> - <div class="col-6"> - <label class="form-label" - :for="'page-' + index + '-name'">Page secondaire</label> - <select :id="'page-' + index + '-name'" - class="form-select select" - v-model="page.id"> - <option value="" disabled>Aucune page</option> - <% pages.each_with_index do |page, index| %> - <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> - <% end %> - </select> - </div> - <div class="col-6"> - <div class="col-md-6"> - <label class="form-label">Options d'affichage</label> - <div class="form-check"> - <input v-model="page.show_description" class="form-check-input boolean optional" :id="'page-' + index + '-show_short_description'" type="checkbox"> - <label class="form-check-label boolean optional" - :for="'page-' + index + '-show_short_description'">Afficher la description courte</label> - </div> - <div class="form-check"> - <input v-model="page.show_image" class="form-check-input boolean optional" :id="'page-' + index + '-show_image'" type="checkbox"> - <label class="form-check-label boolean optional" - :for="'page-' + index + '-show_image'">Afficher l'image</label> - </div> - </div> - </div> - </div> + <draggable :list="data.elements" handle=".dragHandle" class="list-group"> + <div v-for="(page, index) in data.elements" class="list-group-item"> + <div class="d-flex"> + <div> + <a class="btn ps-0 pt-0 dragHandle" title="Drag and drop"> + <i class="fa fa-bars handle"></i> + </a> + </div> + <div class="flex-fill"> + <label class="form-label d-none" + :for="'page-' + index + '-name'">Page</label> + <select :id="'page-' + index + '-name'" + class="form-select select" + v-model="page.id"> + <option value="" disabled>Aucune page</option> + <% pages.each_with_index do |page, index| %> + <option value="<%= page[:id] %>"><%= page[:label].html_safe %></option> + <% end %> + </select> + </div> + <div> + <a class="btn btn-sm btn-danger ms-3" + v-on:click="data.elements.splice(data.elements.indexOf(page), 1)" + title="Supprimer"> + <i class="fas fa-times"></i> + </a> </div> </div> </div> diff --git a/app/views/admin/communication/blocks/templates/pages/_preview.html.erb b/app/views/admin/communication/blocks/templates/pages/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e7b02fc82c1362f238c8e260fde632fbb06d7dd6 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/pages/_preview.html.erb @@ -0,0 +1,21 @@ +<% if @block.data %> + <% if @block.template.main_page %> + <h2 class="h5 mb-4"><%= @block.template.main_page.slug %></h2> + <% end %> + <% @block.template.selected_pages.each do |element| %> + <div class="card mb-4"> + <div class="card-header"> + <h3 class="card-title h5"><%= element %></h3> + </div> + <div class="card-body"> + <% if @block.template.show_image && element.featured_image.attached? %> + <%= kamifusen_tag element.featured_image, + class: 'img-fluid mb-3' %> + <% end %> + <% if @block.template.show_description %> + <p><%= element.description_short %></p> + <% end %> + </div> + </div> + <% end %> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/pages/_show.html.erb b/app/views/admin/communication/blocks/templates/pages/_show.html.erb deleted file mode 100644 index 2175cc87a7b1a018eda00daa0059ecf2c3d2a79f..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/pages/_show.html.erb +++ /dev/null @@ -1,27 +0,0 @@ -<% if @block.data %> - <% if @block.template.main_page %> - <h2 class="mb-4"><%= @block.template.main_page.slug %></h2> - <% end %> - <% if @block.template.selected_pages.any? %> - <div class="<%= 'row' unless @preview %>"> - <% @block.template.selected_pages.each do |element| %> - <div class="<%= 'col-md-4' unless @preview %>"> - <div class="card"> - <div class="card-header"> - <h3 class="card-title h5"><%= element.page %></h3> - </div> - <div class="card-body"> - <div class="mb-3"> - <% if element.show_image %> - <%= kamifusen_tag element.page.featured_image, - class: 'img-fluid' if element.page.featured_image.attached? && element.page.featured_image.variable? %> - <% end %> - </div> - <p><%= element.page.description_short if element.show_description %></p> - </div> - </div> - </div> - <% end %> - </div> - <% end %> -<% end %> diff --git a/app/views/admin/communication/blocks/templates/pages/_static.html.erb b/app/views/admin/communication/blocks/templates/pages/_static.html.erb index 1790aede14bbeb5e652dd91905b280b06eb703ea..d6fe87c3325603d33639cdea8da7341917770bf1 100644 --- a/app/views/admin/communication/blocks/templates/pages/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/pages/_static.html.erb @@ -1,11 +1,11 @@ <% if block.template.main_page %> page: <%= block.template.main_page.generated_path %> - show_description: <%= block.template.show_description %> - show_image: <%= block.template.show_image %> <% end %> + show_main_description: <%= block.template.show_main_description %> + show_descriptions: <%= block.template.show_description %> + show_images: <%= block.template.show_image %> pages: <% block.template.selected_pages.each do |element| %> - - slug: <%= element.page.generated_path %> - show_description: <%= element.show_description %> - show_image: <%= element.show_image %> + - page: <%= element.generated_path %> + slug: <%= element.generated_path %> <% end %> diff --git a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb index 476799fa01a5adf804428f42625b1c5c1dfc51ac..cd3b51853de9304519b47bad410fc7437f67c18f 100644 --- a/app/views/admin/communication/blocks/templates/partners/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/partners/_edit.html.erb @@ -11,7 +11,7 @@ </a> </div> <div class="flex-fill"> - <div class="row mb-3"> + <div class="row"> <div class="col-lg-4"> <select :id="'organization-' + index + '-id'" class="form-select select" @@ -23,12 +23,12 @@ </select> </div> </div> - <div class="row" v-if="!partner.id"> + <div class="row mt-3" v-if="!partner.id"> <div class="col-lg-4"> <label class="form-label" :for="'partner-' + index + '-name'"><%= t '.partner_name_label' %></label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="text" v-model="partner.name" placeholder="<%= t '.partner_name_placeholder' %>" @@ -39,7 +39,7 @@ :for="'partner-' + index + '-url'"> <%= t '.partner_url_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="url" v-model="partner.url" placeholder="<%= t '.partner_url_placeholder' %>" @@ -52,7 +52,7 @@ :for="'partner-' + index + '-logo'"> <%= t '.partner_logo_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, partner, 'logo' )" diff --git a/app/views/admin/communication/blocks/templates/partners/_preview.html.erb b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..989a14a51f02d21ed622135ce2120ebecea75d71 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/partners/_preview.html.erb @@ -0,0 +1,11 @@ +<% @block.template.partners.each do |partner| %> + <article class="card"> + <%= kamifusen_tag partner.blob, + width: 300, + class: 'img-fluid mb-3' unless partner.blob.nil? %> + <div class="card-body"> + <h3 class="card-title h5"><%= partner.name %></h3> + <p class="mb-0"><%= partner.url %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/partners/_show.html.erb b/app/views/admin/communication/blocks/templates/partners/_show.html.erb deleted file mode 100644 index 6c9a10ff598b736478c2963eee42186f3c0a2194..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/partners/_show.html.erb +++ /dev/null @@ -1,15 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.partners.each do |partner| %> - <div class="<%= 'col-md-2' unless @preview %>"> - <article class="card"> - <%= kamifusen_tag partner.blob, - width: 300, - class: 'img-fluid mb-2' unless partner.blob.nil? %> - <div class="card-body"> - <h3 class="card-title h5"><%= partner.name %></h3> - <p class="mb-0"><%= partner.url %></p> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb index a85581f9f7979ee75b50cc3938fd51f8ffd19feb..fc343bc2c34e1cadd52935c0af4062365ee271d2 100644 --- a/app/views/admin/communication/blocks/templates/posts/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/posts/_edit.html.erb @@ -24,8 +24,8 @@ </label> </div> </div> - - <div v-if="data.kind === 'category'" class="mb-2"> + + <div v-if="data.kind === 'category'" class="mb-3"> <label class="form-label" for="category_id">Sélectionnez une catégorie</label> <select id="category_id" @@ -49,7 +49,7 @@ </div> </div> <div v-if="data.kind === 'selection'"> - <a class="<%= button_classes('mb-2') %>" + <a class="<%= button_classes('mb-3') %>" v-on:click="data.elements.push({id: ''})"> <%= t '.add_post' %> </a> @@ -57,7 +57,7 @@ <div v-for="(post, index) in data.elements" class="col-xxl-3 col-lg-4"> <div class="card"> <div class="card-body"> - <div class="mb-2"> + <div class="mb-3"> <a class="btn btn-sm btn-danger float-end" v-on:click="data.elements.splice(data.elements.indexOf(post), 1)" title="Delete"> diff --git a/app/views/admin/communication/blocks/templates/posts/_preview.html.erb b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..1f264f7d24473f489902919f986275c803850c9b --- /dev/null +++ b/app/views/admin/communication/blocks/templates/posts/_preview.html.erb @@ -0,0 +1,15 @@ +<% if @block.data %> + <% if @block.template.category %> + <h2 class="mb-4"><%= @block.template.category %></h2> + <% end %> + <% @block.template.selected_posts.each do |post| %> + <div class="card"> + <div class="card-header"> + <h3 class="card-title h5"><%= post %></h3> + </div> + <div class="card-body"> + <%= post.description_short %> + </div> + </div> + <% end %> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/posts/_show.html.erb b/app/views/admin/communication/blocks/templates/posts/_show.html.erb deleted file mode 100644 index 7f6d68cf166042ca1dddb307bacb87b7910d598e..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/posts/_show.html.erb +++ /dev/null @@ -1,21 +0,0 @@ -<% if @block.data %> - <% if @block.template.category %> - <h2 class="mb-4"><%= @block.template.category %></h2> - <% end %> - <% if @block.template.selected_posts.any? %> - <div class="<%= 'row' unless @preview %>"> - <% @block.template.selected_posts.each do |post| %> - <div class="<%= 'col-md-4' unless @preview %>"> - <div class="card"> - <div class="card-header"> - <h3 class="card-title h5"><%= post %></h3> - </div> - <div class="card-body"> - <%= post.description_short %> - </div> - </div> - </div> - <% end %> - </div> - <% end %> -<% end %> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb index 7cebbc2d6ba4038d7a9997403d9b2bc2c5d528af..7a5666854d549272d51eda15bcd6a1436f650231 100644 --- a/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/testimonials/_edit.html.erb @@ -16,7 +16,7 @@ <div class="col-lg-4"> <label class="form-label" :for="'testimonial-' + index + '-text'"><%= t '.text_label' %></label> - <textarea class="form-control mb-2" + <textarea class="form-control mb-3" rows="3" v-model="testimonial.text" placeholder="<%= t '.text_placeholder' %>" @@ -27,7 +27,7 @@ :for="'testimonial-' + index + '-author'"> <%= t '.author_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="text" v-model="testimonial.author" placeholder="<%= t '.author_placeholder' %>" @@ -36,7 +36,7 @@ :for="'testimonial-' + index + '-job'"> <%= t '.job_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="text" v-model="testimonial.job" placeholder="<%= t '.job_placeholder' %>" @@ -49,7 +49,7 @@ :for="'testimonial-' + index + '-photo'"> <%= t '.photo_label' %> </label> - <input class="form-control mb-2" + <input class="form-control mb-3" type="file" accept="image/*" @change="onFileImageChange( $event, testimonial, 'photo' )" diff --git a/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e12a4fc2630069d82954b3322538a01cd43c40e8 --- /dev/null +++ b/app/views/admin/communication/blocks/templates/testimonials/_preview.html.erb @@ -0,0 +1,22 @@ +<% @block.template.testimonials.each do |testimonial| %> + <article class="card"> + <div class="card-body"> + <p class="lead"> + <%= testimonial.text %> + </p> + <div class="d-flex align-items-center"> + <% if testimonial.blob %> + <div style="max-width: 80px;" class="me-3"> + <%= kamifusen_tag testimonial.blob, + width: 80, + class: 'img-fluid rounded-circle img-circle' %> + </div> + <% end %> + <p class="flex-fill mb-0"> + <b><%= testimonial.author %></b><br> + <%= testimonial.job %> + </p> + </div> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb b/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb deleted file mode 100644 index 1237e4918d078c790a58ec14957646e7a873242d..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/testimonials/_show.html.erb +++ /dev/null @@ -1,26 +0,0 @@ -<div class="<%= 'row' unless @preview %>"> - <% @block.template.testimonials.each do |testimonial| %> - <div class="<%= 'col-xxl-4 col-xl-6' unless @preview %>"> - <article class="card"> - <div class="card-body"> - <p class="lead"> - <%= testimonial.text %> - </p> - <div class="d-flex align-items-center"> - <% if testimonial.blob %> - <div style="max-width: 80px;" class="me-3"> - <%= kamifusen_tag testimonial.blob, - width: 80, - class: 'img-fluid rounded-circle img-circle' %> - </div> - <% end %> - <p class="flex-fill mb-0"> - <b><%= testimonial.author %></b><br> - <%= testimonial.job %> - </p> - </div> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb index 6a9f54f1c4fddc6b0d979dfe9dc53ca6af078af4..924cd55f7d073f6fead00a8c79c10b7963b38f2b 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_edit.html.erb @@ -1,10 +1,3 @@ -<label for="description"><%= t '.description_placeholder' %></label> -<textarea class="form-control mb-2" - rows="3" - v-model="data.description" - placeholder="<%= t '.description_placeholder' %>" - id="description"></textarea> - <a class="<%= button_classes('mb-4') %>" v-on:click="data.elements.push({title: '', text: ''})"> <%= t '.add_event' %> @@ -23,7 +16,7 @@ <div class="flex-fill"> <label class="form-label" :for="'event-' + index + '-title'"><%= t '.title_label' %></label> - <input class="form-control mb-2" + <input class="form-control mb-3" v-model="event.title" placeholder="<%= t '.title_placeholder' %>" type="text" @@ -31,7 +24,7 @@ <label class="form-label" :for="'event-' + index + '-text'"><%= t '.text_label' %></label> - <textarea class="form-control mb-2" + <textarea class="form-control mb-3" rows="3" v-model="event.text" placeholder="<%= t '.text_placeholder' %>" diff --git a/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..aa27fd7a3c72f1b18bb83a59655494ad72fe80cf --- /dev/null +++ b/app/views/admin/communication/blocks/templates/timeline/_preview.html.erb @@ -0,0 +1,8 @@ +<% @block.template.events.each do |event| %> + <article class="card"> + <div class="card-body"> + <p class="lead"><%= event.title %></p> + <p><%= event.text %></p> + </div> + </article> +<% end %> diff --git a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb b/app/views/admin/communication/blocks/templates/timeline/_show.html.erb deleted file mode 100644 index 0bbdf7c177564249e2b38b7bf99ccb84bce72848..0000000000000000000000000000000000000000 --- a/app/views/admin/communication/blocks/templates/timeline/_show.html.erb +++ /dev/null @@ -1,13 +0,0 @@ -<p><%= @block.template.description %></p> -<div class="<%= 'row' unless @preview %>"> - <% @block.template.events.each do |event| %> - <div class="<%= 'col-xxl-4 col-xl-6' unless @preview %>"> - <article class="card"> - <div class="card-body"> - <p class="lead"><%= event.title %></p> - <p><%= event.text %></p> - </div> - </article> - </div> - <% end %> -</div> diff --git a/app/views/admin/communication/blocks/templates/timeline/_static.html.erb b/app/views/admin/communication/blocks/templates/timeline/_static.html.erb index dd1e3dd4d9134d6532ccb6f2f8adc9367f4d9a77..4f6e0d2fca529289a3ae0a882a7c8a9b22b8a5b2 100644 --- a/app/views/admin/communication/blocks/templates/timeline/_static.html.erb +++ b/app/views/admin/communication/blocks/templates/timeline/_static.html.erb @@ -1,5 +1,3 @@ - description: >- - <%= prepare_text_for_static block.template.description, 4 %> events: <% block.template.events.each do |event| %> - title: >- diff --git a/app/views/admin/communication/blocks/templates/video/_edit.html.erb b/app/views/admin/communication/blocks/templates/video/_edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/video/_preview.html.erb b/app/views/admin/communication/blocks/templates/video/_preview.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/blocks/templates/video/_static.html.erb b/app/views/admin/communication/blocks/templates/video/_static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/app/views/admin/communication/extranets/show.html.erb b/app/views/admin/communication/extranets/show.html.erb index 1a270a1963698411e4cee1326a69b7202cba0cf3..27c4abcd11070866e1fb731dcfd863384b7f0f9f 100644 --- a/app/views/admin/communication/extranets/show.html.erb +++ b/app/views/admin/communication/extranets/show.html.erb @@ -35,7 +35,10 @@ </p> <% end %> +<% content_for :action_bar_left do %> + <%= destroy_link @extranet %> +<% end %> + <% content_for :action_bar_right do %> <%= edit_link @extranet %> - <%= destroy_link @extranet %> <% end %> diff --git a/app/views/admin/communication/unsplash/_selector.html.erb b/app/views/admin/communication/unsplash/_selector.html.erb index 31a02eff1287f99878d8b7abf8a42480b7377287..423b4be6f1057da5538a4e44da20e0b6f65d94e5 100644 --- a/app/views/admin/communication/unsplash/_selector.html.erb +++ b/app/views/admin/communication/unsplash/_selector.html.erb @@ -25,7 +25,7 @@ path = admin_communication_unsplash_path(website_id: nil, format: :json) data-bs-toggle="modal" data-bs-target="#unsplashModal" > - Chercher une image + <%= t 'unsplash.open' %> </button> <input class="form-control string optional" type="hidden" @@ -39,7 +39,9 @@ path = admin_communication_unsplash_path(website_id: nil, format: :json) <div class="modal-dialog modal-xl modal-dialog-centered modal-dialog-scrollable"> <div class="modal-content"> <div class="modal-header"> - <h5 class="modal-title" id="exampleModalLabel">Recherche d'image sur Unsplash</h5> + <h5 class="modal-title" id="exampleModalLabel"> + <%= t 'unsplash.title' %> + </h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> @@ -47,7 +49,7 @@ path = admin_communication_unsplash_path(website_id: nil, format: :json) <div class="col-lg-9"> <input type="text" name="search" - placeholder="Recherche en anglais..." + placeholder="<%= t 'unsplash.placeholder' %>" v-model="query" class="form-control"> </div> @@ -55,13 +57,15 @@ path = admin_communication_unsplash_path(website_id: nil, format: :json) <button type="button" class="btn btn-primary" v-on:click="research" - aria-label="Chercher"> - Chercher + aria-label="<%= t 'unsplash.search' %>"> + <%= t 'unsplash.search' %> </button> </div> </div> <div class="row" ref="results"> - <p v-if="data.results.length === 0 || !data" >Aucun résultat</p> + <p v-if="data.results.length === 0 || !data" > + <%= t 'unsplash.nothing' %> + </p> <div v-for="image in data.results" class="col-6 col-lg-2"> <img :src="image.thumb" @@ -76,11 +80,11 @@ path = admin_communication_unsplash_path(website_id: nil, format: :json) <div href="#" v-if="page > 1" v-on:click="page = page - 1" - class="btn btn-light btn-sm">Page précédente</div> + class="btn btn-light btn-sm"><%= t 'unsplash.previous' %></div> <div href="#" v-if="page < data.total_pages" v-on:click="page = page + 1" - class="btn btn-light bt-sm">Page suivante</div> + class="btn btn-light bt-sm"><%= t 'unsplash.next' %></div> </div> </div> </div> diff --git a/app/views/admin/communication/website/authors/_list.html.erb b/app/views/admin/communication/websites/authors/_list.html.erb similarity index 100% rename from app/views/admin/communication/website/authors/_list.html.erb rename to app/views/admin/communication/websites/authors/_list.html.erb diff --git a/app/views/admin/communication/website/authors/index.html.erb b/app/views/admin/communication/websites/authors/index.html.erb similarity index 88% rename from app/views/admin/communication/website/authors/index.html.erb rename to app/views/admin/communication/websites/authors/index.html.erb index 109407dc582a4483e063cca7195a17f2a63e3392..d254cda93ffaf2e50012d10dab30bac88d85af22 100644 --- a/app/views/admin/communication/website/authors/index.html.erb +++ b/app/views/admin/communication/websites/authors/index.html.erb @@ -4,7 +4,7 @@ <%= render 'filters', current_path: admin_communication_website_authors_path, filters: @filters if @filters.any? %> <div class="card"> - <%= render 'admin/communication/website/authors/list', authors: @authors %> + <%= render 'admin/communication/websites/authors/list', authors: @authors %> <% if @authors.total_pages > 1 %> <div class="card-footer"> <%= paginate @authors, theme: 'bootstrap-5' %> diff --git a/app/views/admin/communication/website/authors/show.html.erb b/app/views/admin/communication/websites/authors/show.html.erb similarity index 86% rename from app/views/admin/communication/website/authors/show.html.erb rename to app/views/admin/communication/websites/authors/show.html.erb index d9d7e9b21a598c579a5f3e309943a5f5e48ecc7e..acbdfd209ea086819e7fa99e6c5d306c30055eb1 100644 --- a/app/views/admin/communication/website/authors/show.html.erb +++ b/app/views/admin/communication/websites/authors/show.html.erb @@ -8,7 +8,7 @@ <div class="card-header"> <h5><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h5> </div> - <%= render 'admin/communication/website/posts/list', posts: @posts, hide_author: true %> + <%= render 'admin/communication/websites/posts/list', posts: @posts, hide_author: true %> <% if @posts.total_pages > 1 %> <div class="card-footer"> <%= paginate @posts, theme: 'bootstrap-5' %> diff --git a/app/views/admin/communication/website/categories/_form.html.erb b/app/views/admin/communication/websites/categories/_form.html.erb similarity index 97% rename from app/views/admin/communication/website/categories/_form.html.erb rename to app/views/admin/communication/websites/categories/_form.html.erb index e31341944f1364b21218cd3ef40b7b71e5e4938a..4f541fc6b91383181ef9e27d1ec186c426afe5e5 100644 --- a/app/views/admin/communication/website/categories/_form.html.erb +++ b/app/views/admin/communication/websites/categories/_form.html.erb @@ -13,6 +13,14 @@ <%= f.input :text, as: :summernote %> </div> </div> + <div class="card"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> + </div> + </div> </div> <div class="col-md-4"> <div class="card flex-fill w-100"> @@ -35,14 +43,6 @@ </div> </div> <%= render 'admin/application/featured_image/edit', about: category, f: f %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('seo') %></h5> - </div> - <div class="card-body"> - <%= f.input :description %> - </div> - </div> </div> </div> <% content_for :action_bar_right do %> diff --git a/app/views/admin/communication/website/categories/_list.html.erb b/app/views/admin/communication/websites/categories/_list.html.erb similarity index 100% rename from app/views/admin/communication/website/categories/_list.html.erb rename to app/views/admin/communication/websites/categories/_list.html.erb diff --git a/app/views/admin/communication/website/categories/_treebranch.html.erb b/app/views/admin/communication/websites/categories/_treebranch.html.erb similarity index 100% rename from app/views/admin/communication/website/categories/_treebranch.html.erb rename to app/views/admin/communication/websites/categories/_treebranch.html.erb diff --git a/app/views/admin/communication/website/categories/children.js.erb b/app/views/admin/communication/websites/categories/children.js.erb similarity index 100% rename from app/views/admin/communication/website/categories/children.js.erb rename to app/views/admin/communication/websites/categories/children.js.erb diff --git a/app/views/admin/communication/website/categories/edit.html.erb b/app/views/admin/communication/websites/categories/edit.html.erb similarity index 100% rename from app/views/admin/communication/website/categories/edit.html.erb rename to app/views/admin/communication/websites/categories/edit.html.erb diff --git a/app/views/admin/communication/website/categories/index.html.erb b/app/views/admin/communication/websites/categories/index.html.erb similarity index 100% rename from app/views/admin/communication/website/categories/index.html.erb rename to app/views/admin/communication/websites/categories/index.html.erb diff --git a/app/views/admin/communication/website/categories/new.html.erb b/app/views/admin/communication/websites/categories/new.html.erb similarity index 100% rename from app/views/admin/communication/website/categories/new.html.erb rename to app/views/admin/communication/websites/categories/new.html.erb diff --git a/app/views/admin/communication/website/categories/show.html.erb b/app/views/admin/communication/websites/categories/show.html.erb similarity index 96% rename from app/views/admin/communication/website/categories/show.html.erb rename to app/views/admin/communication/websites/categories/show.html.erb index 569001f70f81fbc29aa2995d309a0bb886c81203..365b6cb6c366d3bd892644c49a382945d023c3a9 100644 --- a/app/views/admin/communication/website/categories/show.html.erb +++ b/app/views/admin/communication/websites/categories/show.html.erb @@ -56,7 +56,7 @@ </div> <% end %> <% if @category.description.present? %> - <div class="card flex-fill w-100"> + <div class="card"> <div class="card-header"> <h5 class="card-title mb-0"><%= t('seo') %></h5> </div> @@ -73,7 +73,7 @@ <div class="card-header"> <h5><%= "#{Communication::Website::Post.model_name.human(count: 2)} (#{@posts.total_count})" %></h5> </div> - <%= render 'admin/communication/website/posts/list', posts: @posts, hide_category: true %> + <%= render 'admin/communication/websites/posts/list', posts: @posts, hide_category: true %> <div class="card-footer"> <%= paginate @posts, theme: 'bootstrap-5' %> </div> @@ -82,6 +82,7 @@ <% end %> <% content_for :action_bar_left do %> + <%= destroy_link @category %> <%= link_to t('static'), static_admin_communication_website_category_path(@category), class: button_classes('btn-light') if current_user.server_admin? %> @@ -89,5 +90,4 @@ <% content_for :action_bar_right do %> <%= edit_link @category %> - <%= destroy_link @category %> <% end %> diff --git a/app/views/admin/communication/website/categories/static.html.erb b/app/views/admin/communication/websites/categories/static.html.erb similarity index 100% rename from app/views/admin/communication/website/categories/static.html.erb rename to app/views/admin/communication/websites/categories/static.html.erb diff --git a/app/views/admin/communication/website/configs/base_urls/static.html.erb b/app/views/admin/communication/websites/configs/base_urls/static.html.erb similarity index 100% rename from app/views/admin/communication/website/configs/base_urls/static.html.erb rename to app/views/admin/communication/websites/configs/base_urls/static.html.erb diff --git a/app/views/admin/communication/website/configs/permalinks/static.html.erb b/app/views/admin/communication/websites/configs/permalinks/static.html.erb similarity index 100% rename from app/views/admin/communication/website/configs/permalinks/static.html.erb rename to app/views/admin/communication/websites/configs/permalinks/static.html.erb diff --git a/app/views/admin/communication/website/menus/_form.html.erb b/app/views/admin/communication/websites/menus/_form.html.erb similarity index 100% rename from app/views/admin/communication/website/menus/_form.html.erb rename to app/views/admin/communication/websites/menus/_form.html.erb diff --git a/app/views/admin/communication/website/menus/_list.html.erb b/app/views/admin/communication/websites/menus/_list.html.erb similarity index 100% rename from app/views/admin/communication/website/menus/_list.html.erb rename to app/views/admin/communication/websites/menus/_list.html.erb diff --git a/app/views/admin/communication/website/menus/edit.html.erb b/app/views/admin/communication/websites/menus/edit.html.erb similarity index 100% rename from app/views/admin/communication/website/menus/edit.html.erb rename to app/views/admin/communication/websites/menus/edit.html.erb diff --git a/app/views/admin/communication/website/menus/index.html.erb b/app/views/admin/communication/websites/menus/index.html.erb similarity index 85% rename from app/views/admin/communication/website/menus/index.html.erb rename to app/views/admin/communication/websites/menus/index.html.erb index 188904d98ba4573252f927550b04d0a9921acdb0..abf7cc422516318c3565b459c75f7eadcb32dbfa 100644 --- a/app/views/admin/communication/website/menus/index.html.erb +++ b/app/views/admin/communication/websites/menus/index.html.erb @@ -2,7 +2,7 @@ <%= render 'admin/communication/websites/sidebar' do %> <div class="card"> - <%= render 'admin/communication/website/menus/list', menus: @menus %> + <%= render 'admin/communication/websites/menus/list', menus: @menus %> <% if @menus.total_pages > 1 %> <div class="card-footer"> <%= paginate @menus, theme: 'bootstrap-5' %> diff --git a/app/views/admin/communication/website/menu/items/_form.html.erb b/app/views/admin/communication/websites/menus/items/_form.html.erb similarity index 100% rename from app/views/admin/communication/website/menu/items/_form.html.erb rename to app/views/admin/communication/websites/menus/items/_form.html.erb diff --git a/app/views/admin/communication/website/menu/items/_list.html.erb b/app/views/admin/communication/websites/menus/items/_list.html.erb similarity index 77% rename from app/views/admin/communication/website/menu/items/_list.html.erb rename to app/views/admin/communication/websites/menus/items/_list.html.erb index d66c09528f67fb2c94d203478829f7b067327fe9..9ce7cd507599143f1a7c42cdba82f31f5bdb62b1 100644 --- a/app/views/admin/communication/website/menu/items/_list.html.erb +++ b/app/views/admin/communication/websites/menus/items/_list.html.erb @@ -2,5 +2,5 @@ <ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @menu) %>" data-id="<%= item&.id %>" data-sort-url="<%= reorder_admin_communication_website_menu_items_path(@menu) %>"> - <%= render 'admin/communication/website/menu/items/treebranch', items: items %> + <%= render 'admin/communication/websites/menus/items/treebranch', items: items %> </ul> diff --git a/app/views/admin/communication/website/menu/items/_treebranch.html.erb b/app/views/admin/communication/websites/menus/items/_treebranch.html.erb similarity index 100% rename from app/views/admin/communication/website/menu/items/_treebranch.html.erb rename to app/views/admin/communication/websites/menus/items/_treebranch.html.erb diff --git a/app/views/admin/communication/website/menu/items/children.js.erb b/app/views/admin/communication/websites/menus/items/children.js.erb similarity index 76% rename from app/views/admin/communication/website/menu/items/children.js.erb rename to app/views/admin/communication/websites/menus/items/children.js.erb index 4459d72aa09d2f97acd881df31f15b17817485ba..c9aee712f4e2506e065d1102d936af9ef973d27c 100644 --- a/app/views/admin/communication/website/menu/items/children.js.erb +++ b/app/views/admin/communication/websites/menus/items/children.js.erb @@ -1,6 +1,6 @@ $branch = $('.js-treeview-element[data-id=<%= @item.id %>]'); <% if @children.any? %> - $('.js-treeview-children', $branch).append("<%= escape_javascript(render 'admin/communication/website/menu/items/treebranch', items: @children) %>"); + $('.js-treeview-children', $branch).append("<%= escape_javascript(render 'admin/communication/websites/menus/items/treebranch', items: @children) %>"); <% else %> $branch.addClass('treeview__element--empty'); <% end %> diff --git a/app/views/admin/communication/website/menu/items/edit.html.erb b/app/views/admin/communication/websites/menus/items/edit.html.erb similarity index 100% rename from app/views/admin/communication/website/menu/items/edit.html.erb rename to app/views/admin/communication/websites/menus/items/edit.html.erb diff --git a/app/views/admin/communication/website/menu/items/kind_switch.js.erb b/app/views/admin/communication/websites/menus/items/kind_switch.js.erb similarity index 100% rename from app/views/admin/communication/website/menu/items/kind_switch.js.erb rename to app/views/admin/communication/websites/menus/items/kind_switch.js.erb diff --git a/app/views/admin/communication/website/menu/items/new.html.erb b/app/views/admin/communication/websites/menus/items/new.html.erb similarity index 100% rename from app/views/admin/communication/website/menu/items/new.html.erb rename to app/views/admin/communication/websites/menus/items/new.html.erb diff --git a/app/views/admin/communication/website/menu/items/show.html.erb b/app/views/admin/communication/websites/menus/items/show.html.erb similarity index 93% rename from app/views/admin/communication/website/menu/items/show.html.erb rename to app/views/admin/communication/websites/menus/items/show.html.erb index c532a3e1fe9d305442af4809bb4f3daddd642f60..fc9bc13687011e54597764925e40f9d079b629ad 100644 --- a/app/views/admin/communication/website/menu/items/show.html.erb +++ b/app/views/admin/communication/websites/menus/items/show.html.erb @@ -8,7 +8,7 @@ <h2 class="card-title mb-2 h5"> <%= "#{Communication::Website::Menu::Item.human_attribute_name('children')} (#{@children.size})" %> </h2> - <%= render 'admin/communication/website/menu/items/list', items: @children, item: @item if @children.any? %> + <%= render 'admin/communication/websites/menus/items/list', items: @children, item: @item if @children.any? %> <%= link_to t('create'), new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id, parent_id: @item.id), class: button_classes if can?(:create, Communication::Website::Menu::Item) %> diff --git a/app/views/admin/communication/website/menus/new.html.erb b/app/views/admin/communication/websites/menus/new.html.erb similarity index 100% rename from app/views/admin/communication/website/menus/new.html.erb rename to app/views/admin/communication/websites/menus/new.html.erb diff --git a/app/views/admin/communication/website/menus/show.html.erb b/app/views/admin/communication/websites/menus/show.html.erb similarity index 91% rename from app/views/admin/communication/website/menus/show.html.erb rename to app/views/admin/communication/websites/menus/show.html.erb index 0c4e6556749a6dd516dd732a6159193e83c90c4d..5598263a0dc6a8f9a84aad808556c98354c476d4 100644 --- a/app/views/admin/communication/website/menus/show.html.erb +++ b/app/views/admin/communication/websites/menus/show.html.erb @@ -8,7 +8,7 @@ <h2 class="card-title mb-2 h5"> <%= "#{Communication::Website::Menu::Item.model_name.human(count: 2)} (#{@root_items.size})" %> </h2> - <%= render 'admin/communication/website/menu/items/list', items: @root_items if @items.any? %> + <%= render 'admin/communication/websites/menus/items/list', items: @root_items if @items.any? %> <%= link_to t('create'), new_admin_communication_website_menu_item_path(website_id: @website, menu_id: @menu.id), class: button_classes if can?(:create, Communication::Website::Menu::Item) %> @@ -30,9 +30,9 @@ <% end %> <% content_for :action_bar_left do %> - <%= edit_link @menu %> + <%= destroy_link @menu %> <% end %> <% content_for :action_bar_right do %> - <%= destroy_link @menu %> + <%= edit_link @menu %> <% end %> diff --git a/app/views/admin/communication/website/menus/static.html.erb b/app/views/admin/communication/websites/menus/static.html.erb similarity index 100% rename from app/views/admin/communication/website/menus/static.html.erb rename to app/views/admin/communication/websites/menus/static.html.erb diff --git a/app/views/admin/communication/website/pages/_form.html.erb b/app/views/admin/communication/websites/pages/_form.html.erb similarity index 91% rename from app/views/admin/communication/website/pages/_form.html.erb rename to app/views/admin/communication/websites/pages/_form.html.erb index ebbb2feadcfb269e22a88760749e8823e832f353..d334eca970ce2a42d5bb7d7a00a8b345ad720640 100644 --- a/app/views/admin/communication/website/pages/_form.html.erb +++ b/app/views/admin/communication/websites/pages/_form.html.erb @@ -24,16 +24,12 @@ value_method: ->(p) { p[:id] } if @website.categories.any? && page.is_regular_page? %> </div> </div> - <div class="row"> - <div class="col-md-6"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('seo') %></h5> - </div> - <div class="card-body"> - <%= f.input :description %> - </div> - </div> + <div class="card"> + <div class="card-header"> + <h5 class="card-title mb-0"><%= t('seo') %></h5> + </div> + <div class="card-body"> + <%= f.input :description %> </div> </div> </div> diff --git a/app/views/admin/communication/website/pages/_list.html.erb b/app/views/admin/communication/websites/pages/_list.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/_list.html.erb rename to app/views/admin/communication/websites/pages/_list.html.erb diff --git a/app/views/admin/communication/website/pages/_treebranch.html.erb b/app/views/admin/communication/websites/pages/_treebranch.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/_treebranch.html.erb rename to app/views/admin/communication/websites/pages/_treebranch.html.erb diff --git a/app/views/admin/communication/website/pages/children.js.erb b/app/views/admin/communication/websites/pages/children.js.erb similarity index 100% rename from app/views/admin/communication/website/pages/children.js.erb rename to app/views/admin/communication/websites/pages/children.js.erb diff --git a/app/views/admin/communication/website/pages/edit.html.erb b/app/views/admin/communication/websites/pages/edit.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/edit.html.erb rename to app/views/admin/communication/websites/pages/edit.html.erb diff --git a/app/views/admin/communication/website/pages/index.html.erb b/app/views/admin/communication/websites/pages/index.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/index.html.erb rename to app/views/admin/communication/websites/pages/index.html.erb diff --git a/app/views/admin/communication/website/pages/new.html.erb b/app/views/admin/communication/websites/pages/new.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/new.html.erb rename to app/views/admin/communication/websites/pages/new.html.erb diff --git a/app/views/admin/communication/website/pages/show.html.erb b/app/views/admin/communication/websites/pages/show.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/show.html.erb rename to app/views/admin/communication/websites/pages/show.html.erb diff --git a/app/views/admin/communication/website/pages/static.html.erb b/app/views/admin/communication/websites/pages/static.html.erb similarity index 100% rename from app/views/admin/communication/website/pages/static.html.erb rename to app/views/admin/communication/websites/pages/static.html.erb diff --git a/app/views/admin/communication/website/posts/_form.html.erb b/app/views/admin/communication/websites/posts/_form.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/_form.html.erb rename to app/views/admin/communication/websites/posts/_form.html.erb diff --git a/app/views/admin/communication/website/posts/_list.html.erb b/app/views/admin/communication/websites/posts/_list.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/_list.html.erb rename to app/views/admin/communication/websites/posts/_list.html.erb diff --git a/app/views/admin/communication/website/posts/curations/new.html.erb b/app/views/admin/communication/websites/posts/curations/new.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/curations/new.html.erb rename to app/views/admin/communication/websites/posts/curations/new.html.erb diff --git a/app/views/admin/communication/website/posts/edit.html.erb b/app/views/admin/communication/websites/posts/edit.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/edit.html.erb rename to app/views/admin/communication/websites/posts/edit.html.erb diff --git a/app/views/admin/communication/website/posts/index.html.erb b/app/views/admin/communication/websites/posts/index.html.erb similarity index 90% rename from app/views/admin/communication/website/posts/index.html.erb rename to app/views/admin/communication/websites/posts/index.html.erb index bdfc24a223644721d5a01920b125e29d7c7fa7f1..3f6fc4ecc002f40a406488769fa5cdf39f4771c9 100644 --- a/app/views/admin/communication/website/posts/index.html.erb +++ b/app/views/admin/communication/websites/posts/index.html.erb @@ -5,7 +5,7 @@ <div class="card" data-batch-selectable> <%= form_tag publish_admin_communication_website_posts_path do %> - <%= render 'admin/communication/website/posts/list', posts: @posts, selectable: true %> + <%= render 'admin/communication/websites/posts/list', posts: @posts, selectable: true %> <div class="card-footer"> <% if @posts.total_pages > 1 %> <div class="float-end mb-3"> @@ -46,7 +46,7 @@ <ul class="list-unstyled treeview treeview--sortable js-treeview js-treeview-sortable js-treeview-sortable-container" data-id="" data-sort-url="<%= reorder_admin_communication_website_categories_path %>"> - <%= render 'admin/communication/website/categories/treebranch', categories: @root_categories %> + <%= render 'admin/communication/websites/categories/treebranch', categories: @root_categories %> </ul> </div> </div> @@ -56,7 +56,7 @@ <div class="card-header"> <h2 class="card-title"><%= t('communication.authors', count: 2) %></h2> </div> - <%= render 'admin/communication/website/authors/list', authors: @authors %> + <%= render 'admin/communication/websites/authors/list', authors: @authors %> <% if @authors.total_pages > 1 %> <div class="card-footer"> <%= paginate @authors, theme: 'bootstrap-5', param_name: :authors_page %> diff --git a/app/views/admin/communication/website/posts/new.html.erb b/app/views/admin/communication/websites/posts/new.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/new.html.erb rename to app/views/admin/communication/websites/posts/new.html.erb diff --git a/app/views/admin/communication/website/posts/show.html.erb b/app/views/admin/communication/websites/posts/show.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/show.html.erb rename to app/views/admin/communication/websites/posts/show.html.erb diff --git a/app/views/admin/communication/website/posts/static.html.erb b/app/views/admin/communication/websites/posts/static.html.erb similarity index 100% rename from app/views/admin/communication/website/posts/static.html.erb rename to app/views/admin/communication/websites/posts/static.html.erb diff --git a/app/views/admin/communication/websites/show.html.erb b/app/views/admin/communication/websites/show.html.erb index 89747b56bdd697807c6271e9d0733543232323a1..04543e484172bfef99ad86a914ce8a4cb4d54fa8 100644 --- a/app/views/admin/communication/websites/show.html.erb +++ b/app/views/admin/communication/websites/show.html.erb @@ -6,7 +6,9 @@ <% end %> <%= I18n.t("activerecord.attributes.communication/website.about_#{@website.about_type}") %> <% if @website.about %> - (<%= link_to_if can?(:read, @website.about), @website.about, [:admin, @website.about] unless @website.about.nil? %>) + (<%= link_to_if can?(:read, @website.about), + @website.about, + [:admin, @website.about] unless @website.about.nil? %>) <% end %> <% end %> @@ -16,6 +18,7 @@ <% end %> <% content_for :action_bar_left do %> + <%= destroy_link @website %> <% if can? :read, Communication::Website::Imported::Website %> <% if @website.imported? %> <%= link_to t('communication.website.imported.show'), @@ -32,5 +35,4 @@ <% content_for :action_bar_right do %> <%= edit_link @website %> - <%= destroy_link @website %> <% end %> diff --git a/app/views/admin/communication/websites/show/_pages.html.erb b/app/views/admin/communication/websites/show/_pages.html.erb index 7d08d81264b493aff2b68c5b70c4ba381161e761..cbc93af84fa326ed0d8544f62078a06eb2cb5006 100644 --- a/app/views/admin/communication/websites/show/_pages.html.erb +++ b/app/views/admin/communication/websites/show/_pages.html.erb @@ -15,5 +15,5 @@ <% end %> </h2> </div> - <%= render 'admin/communication/website/pages/list', pages: @website.pages.recent %> + <%= render 'admin/communication/websites/pages/list', pages: @website.pages.recent %> </div> diff --git a/app/views/admin/communication/websites/show/_posts.html.erb b/app/views/admin/communication/websites/show/_posts.html.erb index 34483c9bdac5e240926c39c651468bb5f4fd9098..d1d97da049fd65efe94398e424f9de5b5c935672 100644 --- a/app/views/admin/communication/websites/show/_posts.html.erb +++ b/app/views/admin/communication/websites/show/_posts.html.erb @@ -18,5 +18,5 @@ <% end %> </h2> </div> - <%= render 'admin/communication/website/posts/list', posts: @website.posts.recent, hide_author: true, hide_category: true %> + <%= render 'admin/communication/websites/posts/list', posts: @website.posts.recent, hide_author: true, hide_category: true %> </div> diff --git a/app/views/admin/dashboard/index.html.erb b/app/views/admin/dashboard/index.html.erb index 3ce8510ebcbc25717e780df003f37052023eb669..f287caf8b2dd5bbcad3292019aa13cdf45fe6d3a 100644 --- a/app/views/admin/dashboard/index.html.erb +++ b/app/views/admin/dashboard/index.html.erb @@ -1,8 +1,9 @@ <% content_for :title, t('admin.dashboard') %> +<% classes = 'col-md-6 col-xl-4 col-xxl-3 d-flex' %> <div class="row"> - <div class="col-md-4"> - <div class="card"> + <div class="<%= classes %>"> + <div class="card flex-fill"> <div class="card-body"> <h4><%= t('hello', name: current_user.first_name) %></h4> <% if current_university.logo.attached? %> @@ -13,6 +14,24 @@ </div> </div> </div> + <div class="<%= classes %>"> + <div class="card flex-fill"> + <div class="card-body py-4"> + <div class="d-flex align-items-start"> + <div class="flex-grow-1"> + <h3 class="mb-2"><%= Delayed::Job.all.length %></h3> + <p class="mb-0"><%= t 'admin.pending_tasks.label' %></p> + <p class="mb-0 small"><%= t 'admin.pending_tasks.hint' %></p> + </div> + <div class="d-inline-block ms-3"> + <div class="stat stat-sm"> + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock align-baseline"><circle cx="12" cy="12" r="10"></circle><polyline points="12 6 12 12 16 14"></polyline></svg> + </div> + </div> + </div> + </div> + </div> + </div> </div> <% if current_university.research_journals.any? && can?(:read, Research::Journal) %> @@ -20,10 +39,12 @@ <div class="row"> <% current_university.research_journals.each do |journal| %> <% next unless can?(:read, journal) %> - <div class="col-md-4"> - <div class="card"> + <div class="<%= classes %>"> + <div class="card flex-fill"> <div class="card-body"> - <span class="float-end"><i class="fas fa-newspaper fa-2x"></i></span> + <span class="float-end"> + <i class="fas fa-newspaper fa-2x"></i> + </span> <h4><%= journal %></h4> <p> </p> <%= link_to t('show'), [:admin, journal], class: button_classes('stretched-link') %> @@ -39,10 +60,12 @@ <div class="row"> <% current_university.communication_websites.each do |website| %> <% next unless can?(:read, website) %> - <div class="col-md-4"> - <div class="card"> + <div class="<%= classes %>"> + <div class="card flex-fill"> <div class="card-body"> - <span class="float-end"><i class="fas fa-sitemap fa-2x"></i></span> + <span class="float-end"> + <i class="fas fa-sitemap fa-2x"></i> + </span> <h4><%= website %></h4> <p class="small"><%= website.url %></p> <%= link_to t('show'), [:admin, website], class: button_classes('stretched-link') %> @@ -58,10 +81,12 @@ <div class="row"> <% current_university.communication_extranets.each do |extranet| %> <% next unless can?(:read, extranet) %> - <div class="col-md-4"> - <div class="card"> + <div class="<%= classes %>"> + <div class="card flex-fill"> <div class="card-body"> - <span class="float-end"><i class="fas fa-project-diagram fa-2x"></i></span> + <span class="float-end"> + <i class="fas fa-project-diagram fa-2x"></i> + </span> <h4><%= extranet %></h4> <p class="small"><%= extranet.url %></p> <%= link_to t('show'), [:admin, extranet], class: button_classes('stretched-link') %> @@ -71,3 +96,24 @@ <% end %> </div> <% end %> + +<div class="small mt-5"> + <ul class="list-inline"> + <li class="list-inline-item"> + <%= link_to 'API', api_root_path %> + </li> + <% + [ + :terms_of_service, + :privacy_policy, + :cookies_policy + ].each do |term| %> + <li class="list-inline-item"> + <%= link_to t("#{term}"), t("#{term}_url"), target: '_blank', rel: 'noreferrer' %> + </li> + <% end %> + <li class="list-inline-item"> + <%= link_to t('cookies_consent_choice'), '', class: 'js-gdpr__cookie_consent__display_again' %> + </li> + </ul> +</div> diff --git a/app/views/admin/education/cohorts/_form.html.erb b/app/views/admin/education/cohorts/_form.html.erb index c2ed9f568c4c8921e94b008ef4dedf0c803d7fb7..17a5811a75b5ece471cfcf6eecc0dba0315c539f 100644 --- a/app/views/admin/education/cohorts/_form.html.erb +++ b/app/views/admin/education/cohorts/_form.html.erb @@ -1,4 +1,3 @@ - <%= simple_form_for(@education_cohort) do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> diff --git a/app/views/admin/education/cohorts/new.html.erb b/app/views/admin/education/cohorts/new.html.erb index 7ac730f56df5d2ff85434b24e392f444c24d1918..bb0dcdab4fdf49914dbeb45a41c5a6be70417927 100644 --- a/app/views/admin/education/cohorts/new.html.erb +++ b/app/views/admin/education/cohorts/new.html.erb @@ -1,5 +1,3 @@ -<h1>New Education Cohort</h1> +<% content_for :title, Education::Cohort.model_name.human %> -<%= render 'form', education_cohort: @education_cohort %> - -<%= link_to 'Back', education_cohorts_path %> +<%= render 'form', cohort: @cohort %> diff --git a/app/views/admin/education/cohorts/show.html.erb b/app/views/admin/education/cohorts/show.html.erb index 1a73e37ce088fb3dfccc7a2628cca237a581a291..f6e8735f6c31f4662dc5380956e0d970ea36fdbc 100644 --- a/app/views/admin/education/cohorts/show.html.erb +++ b/app/views/admin/education/cohorts/show.html.erb @@ -12,4 +12,4 @@ <h2><%= University::Person::Alumnus.model_name.human(count: 2) %></h2> -<%= render 'admin/university/person/alumni/list', alumni: @cohort.people.ordered %> +<%= render 'admin/university/people/alumni/list', alumni: @cohort.people.ordered %> diff --git a/app/views/admin/education/diplomas/_form.html.erb b/app/views/admin/education/diplomas/_form.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..04f3a2d6e22b9fb6e10d16319036b092dd606b0d --- /dev/null +++ b/app/views/admin/education/diplomas/_form.html.erb @@ -0,0 +1,20 @@ +<%= simple_form_for [:admin, diploma] do |f| %> + <%= f.error_notification %> + <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> + + <div class="row"> + <div class="col-lg-6"> + <%= f.input :name %> + </div> + <div class="col-lg-3"> + <%= f.input :short_name %> + </div> + <div class="col-lg-3"> + <%= f.input :level, include_blank: false %> + </div> + </div> + + <% content_for :action_bar_right do %> + <%= submit f %> + <% end %> +<% end %> diff --git a/app/views/admin/education/diplomas/_list.html.erb b/app/views/admin/education/diplomas/_list.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e7adc544efca6f34d7256ee8b0c5d22695b5a1f2 --- /dev/null +++ b/app/views/admin/education/diplomas/_list.html.erb @@ -0,0 +1,27 @@ +<table class="<%= table_classes %>"> + <thead> + <tr> + <th><%= Education::Diploma.human_attribute_name('name') %></th> + <th><%= Education::Diploma.human_attribute_name('short_name') %></th> + <th><%= Education::Diploma.human_attribute_name('level') %></th> + <th><%= Education::Diploma.human_attribute_name('programs') %></th> + <th></th> + </tr> + </thead> + <tbody> + <% diplomas.ordered.each do |diploma| %> + <tr> + <td><%= link_to diploma, [:admin, diploma] %></td> + <td><%= diploma.short_name %></td> + <td><%= diploma.level_i18n %></td> + <td><%= diploma.programs.count %></td> + <td class="text-end"> + <div class="btn-group" role="group"> + <%= edit_link diploma %> + <%= destroy_link diploma %> + </div> + </td> + </tr> + <% end %> + </tbody> +</table> diff --git a/app/views/admin/education/diplomas/edit.html.erb b/app/views/admin/education/diplomas/edit.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..49c3650d8b84243895a6512326a79186f6426f79 --- /dev/null +++ b/app/views/admin/education/diplomas/edit.html.erb @@ -0,0 +1,3 @@ +<% content_for :title, @diploma %> + +<%= render 'form', diploma: @diploma %> diff --git a/app/views/admin/education/diplomas/index.html.erb b/app/views/admin/education/diplomas/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..98c19f66ff8835299b5c0ae97c8c335c7791bb3a --- /dev/null +++ b/app/views/admin/education/diplomas/index.html.erb @@ -0,0 +1,7 @@ +<% content_for :title, Education::Diploma.model_name.human(count: 2) %> + +<%= render 'admin/education/diplomas/list', diplomas: @diplomas %> + +<% content_for :action_bar_right do %> + <%= create_link Education::Diploma %> +<% end %> diff --git a/app/views/admin/education/diplomas/new.html.erb b/app/views/admin/education/diplomas/new.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..2542f8abe844669622e670eaa3f0765edea42640 --- /dev/null +++ b/app/views/admin/education/diplomas/new.html.erb @@ -0,0 +1,3 @@ +<% content_for :title, Education::Diploma.model_name.human %> + +<%= render 'form', diploma: @diploma %> diff --git a/app/views/admin/education/diplomas/show.html.erb b/app/views/admin/education/diplomas/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..406d2fe7f118529fbf5f51628f614e7dd9b27f9f --- /dev/null +++ b/app/views/admin/education/diplomas/show.html.erb @@ -0,0 +1,29 @@ +<% content_for :title, @diploma %> + +<div class="row"> + <div class="col-lg-6"> + <p> + <strong><%= Education::Diploma.human_attribute_name('short_name') %></strong> + <%= @diploma.short_name %> + </p> + </div> + <div class="col-lg-6"> + <p> + <strong><%= Education::Diploma.human_attribute_name('level') %></strong> + <%= @diploma.level_i18n %> + </p> + </div> +</div> + + +<%= render 'admin/education/programs/list', + programs: @programs, + hide_diploma: true %> + +<% content_for :action_bar_left do %> + <%= destroy_link @diploma %> +<% end %> + +<% content_for :action_bar_right do %> + <%= edit_link @diploma %> +<% end %> diff --git a/app/views/admin/education/diplomas/static.html.erb b/app/views/admin/education/diplomas/static.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..e0ca041da5dc6b06ef4292e9778105906b056ee6 --- /dev/null +++ b/app/views/admin/education/diplomas/static.html.erb @@ -0,0 +1,6 @@ +--- +title: > + <%= @about.name %> +short_name: > + <%= @about.short_name %> +--- diff --git a/app/views/admin/education/programs/_form.html.erb b/app/views/admin/education/programs/_form.html.erb index a44339e3b1b413294bc663461fff156f127415d5..4fbc4ae857b63c6b692304d9c864fc84f4dca70e 100644 --- a/app/views/admin/education/programs/_form.html.erb +++ b/app/views/admin/education/programs/_form.html.erb @@ -4,32 +4,19 @@ <div class="row"> <div class="col-md-3"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('education.program.main_informations') %></h5> - </div> - <div class="card-body"> - <%= f.input :name %> - <%= f.input :slug, - as: :string, - input_html: program.persisted? ? {} : { - class: 'js-slug-input', - data: { source: '#education_program_name' } - } %> - <%= f.input :published %> - <%= f.input :level, include_blank: false %> - <%= f.input :capacity %> - <%= f.input :ects %> - <%= f.input :continuing %> - <%= f.association :schools, - as: :check_boxes, - collection: current_university.education_schools.ordered %> - <%= f.association :parent, - collection: collection_tree(current_university.education_programs, program), - label_method: ->(p) { sanitize p[:label] }, - value_method: ->(p) { p[:id] } %> - </div> - </div> + <%= render 'admin/education/programs/forms/part', part: :technical do %> + <%= f.input :published %> + <%= f.input :slug, + as: :string, + input_html: program.persisted? ? {} : { + class: 'js-slug-input', + data: { source: '#education_program_name' } + } %> + <%= f.association :parent, + collection: collection_tree(current_university.education_programs, program), + label_method: ->(p) { sanitize p[:label] }, + value_method: ->(p) { p[:id] } %> + <% end %> <%= render 'admin/application/featured_image/edit', about: program, f: f %> <div class="card flex-fill w-100"> <div class="card-header"> @@ -41,66 +28,130 @@ </div> </div> <div class="col-md-9"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('education.program.useful_informations') %></h5> + <%= render 'admin/education/programs/forms/part', part: :essential do %> + <div class="row"> + <div class="col-lg-9"> + <%= f.input :name %> + </div> + <div class="col-lg-3"> + <%= f.input :short_name %> + </div> </div> - <div class="card-body"> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :main_information %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :presentation %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :objectives %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :opportunities %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :results %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :accessibility %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :duration %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :pricing %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :content %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :pedagogy %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :evaluation %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :prerequisites %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :registration %> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :other %> + <div class="row"> + <div class="col-lg-6"> + <%= f.association :diploma, + collection: current_university.diplomas.ordered %> + <%= f.input :level, include_blank: false %> + <%= f.input :ects %> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :duration %> + </div> + <div class="col-lg-6"> + <%= f.input :capacity %> + <%= f.input :continuing %> + <%= f.association :schools, + as: :check_boxes, + collection: current_university.education_schools.ordered %> + </div> </div> - </div> + <% end %> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('activerecord.attributes.education/program.team') %></h5> + <%= render 'admin/education/programs/forms/part', part: :presentation do %> + <div class="row"> + <div class="col-xxl-6"> + <%= f.input :presentation %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :objectives %> + </div> </div> - <div class="card-body"> - <%= render 'admin/education/programs/forms/input_with_inheritance', f: f, property: :contacts %> + <% end %> + + <%= render 'admin/education/programs/forms/part', part: :pedagogy do %> + <div class="row"> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :content %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :pedagogy %> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :evaluation %> + </div> </div> - <div class="card-body"> - <div class="row mb-2"> - <div class="col-md-8"> - <label class="form-label"><%= Education::Program.human_attribute_name('teachers') %></label> - </div> - <div class="col-md-4 text-end"> - <%= link_to_add_association t('add'), - f, - :university_person_involvements, - class: button_classes, - partial: 'admin/education/programs/involvement_fields', - data: { - 'association-insertion-method': 'append', - 'association-insertion-node': '#involvements', - } %> - </div> + <div class="row mb-2"> + <div class="col-md-8"> + <label class="form-label"> + <%= Education::Program.human_attribute_name('teachers') %> + </label> </div> - <div id="involvements"> - <% - sorted_involvements = program.university_person_involvements.sort_by { |involvement| - [involvement.person&.last_name, involvement.person&.first_name] - } - %> - <%= f.simple_fields_for :university_person_involvements, sorted_involvements, include_id: false do |involvement_f| %> - <%= render 'admin/education/programs/involvement_fields', f: involvement_f, include_id: true %> - <% end %> + <div class="col-md-4 text-end"> + <%= link_to_add_association t('add'), + f, + :university_person_involvements, + class: button_classes, + partial: 'admin/education/programs/involvement_fields', + data: { + 'association-insertion-method': 'append', + 'association-insertion-node': '#involvements', + } %> </div> </div> - </div> + <div id="involvements"> + <% + sorted_involvements = program.university_person_involvements + .sort_by { |involvement| + [involvement.person&.last_name, involvement.person&.first_name] + } + %> + <%= f.simple_fields_for :university_person_involvements, + sorted_involvements, + include_id: false do |involvement_f| %> + <%= render 'admin/education/programs/involvement_fields', + f: involvement_f, + include_id: true %> + <% end %> + </div> + <% end %> + + <%= render 'admin/education/programs/forms/part', part: :results do %> + <div class="row"> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :opportunities %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :results %> + </div> + </div> + <% end %> + + <%= render 'admin/education/programs/forms/part', part: :admission do %> + <div class="row"> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :prerequisites %> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :accessibility %> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :other %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :pricing %> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :registration %> + <%= render 'admin/education/programs/forms/input_with_inheritance', + f: f, property: :contacts %> + </div> + </div> + <% end %> </div> </div> + <% content_for :action_bar_right do %> <%= submit f %> <% end %> diff --git a/app/views/admin/education/programs/_list.html.erb b/app/views/admin/education/programs/_list.html.erb index 0aa706121699f7dc97becf241a58eebc82096b56..58e29ae462f0048e9031a789e287b4afa81aa5e1 100644 --- a/app/views/admin/education/programs/_list.html.erb +++ b/app/views/admin/education/programs/_list.html.erb @@ -1,16 +1,34 @@ -<table class="table"> +<% + hide_diploma |= false + hide_parent |= false +%> +<table class="<%= table_classes %>"> <thead> <tr> <th><%= Education::Program.model_name.human %></th> - <th><%= Education::Program.human_attribute_name('level') %></th> + <% unless hide_diploma %> + <th><%= Education::Program.human_attribute_name('diploma') %></th> + <% end %> + <% unless hide_parent %> + <th><%= Education::Program.human_attribute_name('parent') %></th> + <% end %> <th></th> </tr> </thead> <tbody> <% programs.each do |program| %> + <% + parent = program.parent + diploma = program.diploma + %> <tr> <td><%= link_to_if can?(:read, program), program, [:admin, program] %></td> - <td><%= program.level_i18n %></td> + <% unless hide_diploma %> + <td><%= link_to_if can?(:read, diploma), diploma, [:admin, diploma] if diploma %></td> + <% end %> + <% unless hide_parent %> + <td><%= link_to_if can?(:read, parent), parent, [:admin, parent] if parent %></td> + <% end %> <td class="text-end pe-0"> <div class="btn-group" role="group"> <%= link_to t('edit'), diff --git a/app/views/admin/education/programs/forms/_input_with_inheritance.html.erb b/app/views/admin/education/programs/forms/_input_with_inheritance.html.erb index 2fd2b5fcd8a60009a89f0356886a602af9b106e5..4e36d1056a990ce9c6ec7ceffd01ff6ecb6a1a0d 100644 --- a/app/views/admin/education/programs/forms/_input_with_inheritance.html.erb +++ b/app/views/admin/education/programs/forms/_input_with_inheritance.html.erb @@ -17,7 +17,13 @@ id = "#{property}Collapse" </a> </div> <div class="collapse" id="<%= id %>"> - <%= f.input property, as: :summernote, label: false %> + <%= f.input property, + as: :summernote, + label: false, + input_html: { + data: { 'summernote-config' => 'mini' } + } + %> <div class="bg-light p-2 mt-n2"> <b><%= t 'admin.inheritance.sentence_html', link: link_to(best_prop_source, [:admin, best_prop_source]) %></b><br> <%= best_prop_value %> @@ -25,5 +31,9 @@ id = "#{property}Collapse" </div> </div> <% else %> - <%= f.input property, as: :summernote %> + <%= f.input property, + as: :summernote, + input_html: { + data: { 'summernote-config' => 'mini' } + } %> <% end %> diff --git a/app/views/admin/education/programs/forms/_part.html.erb b/app/views/admin/education/programs/forms/_part.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..3db5703076844166c153e224040e1f597cedecd1 --- /dev/null +++ b/app/views/admin/education/programs/forms/_part.html.erb @@ -0,0 +1,24 @@ +<% +collapsed ||= false +id = "part-#{part}" +%> +<div class="card"> + <div class="card-header"> + <div class="card-actions float-end"> + <button class="accordion-button bg-transparent <%= 'collapsed' if collapsed %>" + type="button" + data-bs-toggle="collapse" + data-bs-target="#<%= id %>" + aria-expanded="<%= !collapsed %>" + aria-controls="part-<%= part %>"> + </button> + </div> + <h5 class="card-title mb-1"> + <%= t("education.program.parts.#{part}.label") %> + </h5> + <p class="mb-0"><%= t("education.program.parts.#{part}.hint") %></p> + </div> + <div class="card-body collapse <%= 'show' unless collapsed %>" id="<%= id %>"> + <%= yield %> + </div> +</div> diff --git a/app/views/admin/education/programs/index.html.erb b/app/views/admin/education/programs/index.html.erb index 9bf782f6057f0d3bcdac0ec886ff40d4f52d0edd..3af4cee5040b267c4161bafcd38185da32a2b2d5 100644 --- a/app/views/admin/education/programs/index.html.erb +++ b/app/views/admin/education/programs/index.html.erb @@ -1,8 +1,17 @@ <% content_for :title, Education::Program.model_name.human(count: 2) %> -<ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @programs.first) %>" data-id="" data-sort-url="<%= reorder_admin_education_programs_path %>"> - <%= render 'treebranch', programs: @programs %> -</ul> +<%= render 'filters', + current_path: admin_education_programs_path, + filters: @filters if @filters.any? %> + +<%= render 'admin/education/programs/list', programs: @programs %> +<%= paginate @programs, theme: 'bootstrap-5' %> + +<% content_for :action_bar_left do %> + <%= link_to t('admin.education.programs.view_as_tree'), + tree_admin_education_programs_path, + class: button_classes %> +<% end %> <% content_for :action_bar_right do %> <%= create_link Education::Program %> diff --git a/app/views/admin/education/program/roles/_form.html.erb b/app/views/admin/education/programs/roles/_form.html.erb similarity index 93% rename from app/views/admin/education/program/roles/_form.html.erb rename to app/views/admin/education/programs/roles/_form.html.erb index 433ceb7b4f6318ea85ad2f25d2d22643daa42597..08cfb054eff66f7b189b4593cfb47bf2c86200a9 100644 --- a/app/views/admin/education/program/roles/_form.html.erb +++ b/app/views/admin/education/programs/roles/_form.html.erb @@ -28,7 +28,7 @@ <div class="mb-3" id="involvements" data-sortable="inputs"> <%= f.simple_fields_for :involvements, role.involvements.sort_by(&:position), include_id: false do |involvement_f| %> - <%= render 'admin/education/program/roles/involvement_fields', f: involvement_f, include_id: true %> + <%= render 'admin/education/programs/roles/involvement_fields', f: involvement_f, include_id: true %> <% end %> </div> </div> diff --git a/app/views/admin/education/program/roles/_involvement_fields.html.erb b/app/views/admin/education/programs/roles/_involvement_fields.html.erb similarity index 100% rename from app/views/admin/education/program/roles/_involvement_fields.html.erb rename to app/views/admin/education/programs/roles/_involvement_fields.html.erb diff --git a/app/views/admin/education/program/roles/_list.html.erb b/app/views/admin/education/programs/roles/_list.html.erb similarity index 100% rename from app/views/admin/education/program/roles/_list.html.erb rename to app/views/admin/education/programs/roles/_list.html.erb diff --git a/app/views/admin/education/program/roles/edit.html.erb b/app/views/admin/education/programs/roles/edit.html.erb similarity index 100% rename from app/views/admin/education/program/roles/edit.html.erb rename to app/views/admin/education/programs/roles/edit.html.erb diff --git a/app/views/admin/education/program/roles/index.html.erb b/app/views/admin/education/programs/roles/index.html.erb similarity index 81% rename from app/views/admin/education/program/roles/index.html.erb rename to app/views/admin/education/programs/roles/index.html.erb index 9efa6d56e14ba8f10e242c7b5c1f5a30f897031b..f4f8923098359357d5ddb3fc01fccfeeceae8798 100644 --- a/app/views/admin/education/program/roles/index.html.erb +++ b/app/views/admin/education/programs/roles/index.html.erb @@ -1,5 +1,5 @@ <% content_for :title, University::Role.model_name.human(count: 2) %> -<%= render 'admin/education/program/roles/list', roles: @roles %> +<%= render 'admin/education/programs/roles/list', roles: @roles %> <% content_for :action_bar_right do %> <%= link_to t('create'), diff --git a/app/views/admin/education/program/roles/new.html.erb b/app/views/admin/education/programs/roles/new.html.erb similarity index 100% rename from app/views/admin/education/program/roles/new.html.erb rename to app/views/admin/education/programs/roles/new.html.erb diff --git a/app/views/admin/education/program/roles/show.html.erb b/app/views/admin/education/programs/roles/show.html.erb similarity index 100% rename from app/views/admin/education/program/roles/show.html.erb rename to app/views/admin/education/programs/roles/show.html.erb diff --git a/app/views/admin/education/programs/show.html.erb b/app/views/admin/education/programs/show.html.erb index 01d89abdd71237e7bbe79fcb12b5fd0a5501a63a..62633b0455335dd75a96eac7748155a4478a5b4c 100644 --- a/app/views/admin/education/programs/show.html.erb +++ b/app/views/admin/education/programs/show.html.erb @@ -1,33 +1,17 @@ <% content_for :title, @program %> <div class="row"> - <div class="col-md-3"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h2 class="card-title mb-0 h5"><%= t('education.program.main_informations') %></h2> - </div> - <div class="card-body"> - <h3 class="h5"><%= Education::Program.human_attribute_name('name') %></h3> - <%= @program.name %> - <h3 class="h5 mt-4"><%= Education::Program.human_attribute_name('level') %></h3> - <%= @program.level_i18n %> - <h3 class="h5 mt-4"><%= Education::Program.human_attribute_name('capacity') %></h3> - <%= @program.capacity %> - <h3 class="h5 mt-4"><%= Education::Program.human_attribute_name('ects') %></h3> - <%= @program.ects %> - <h3 class="h5 mt-4"><%= Education::Program.human_attribute_name('continuing') %></h3> - <%= t @program.continuing %> - <% if @program.schools.any? %> - <h3 class="h5 mt-4"><%= Education::Program.human_attribute_name('schools') %></h3> - <ul class="list-unstyled"> - <% @program.schools.ordered.each do |school| %> - <li><%= link_to_if can?(:read, school), school, [:admin, school] %></li> - <% end %> - </ul> - <% end %> - </div> - </div> + <%= render 'admin/education/programs/forms/part', part: :technical do %> + <h3 class="h5"><%= Education::Program.human_attribute_name('published') %></h3> + <p><%= t @program.published %></p> + <h3 class="h5"><%= Education::Program.human_attribute_name('slug') %></h3> + <p><%= @program.slug %></p> + <% if @program.parent %> + <h3 class="h5"><%= Education::Program.human_attribute_name('parent') %></h3> + <p><%= link_to @program.parent, [:admin, @program.parent] %></p> + <% end %> + <% end %> <%= render 'admin/application/featured_image/show', about: @program %> <% if @program.description.present? %> <div class="card flex-fill w-100"> @@ -42,45 +26,141 @@ <% end %> </div> <div class="col-md-9"> - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= t('education.program.useful_informations') %></h5> + <%= render 'admin/education/programs/forms/part', + part: :essential, + collapsed: false do %> + <div class="row"> + <div class="col-lg-6"> + <h3 class="h5"> + <%= Education::Program.human_attribute_name('name') %> + </h3> + <p><%= @program.name %></p> + <h3 class="h5 mt-4"> + <%= Education::Program.human_attribute_name('diploma') %> + </h3> + <p><%= link_to @program.diploma, [:admin, @program.diploma] if @program.diploma %></p> + <h3 class="h5 mt-4"> + <%= Education::Program.human_attribute_name('level') %> + </h3> + <p><%= @program.level_i18n %></p> + <h3 class="h5 mt-4"> + <%= Education::Program.human_attribute_name('ects') %> + </h3> + <p><%= @program.ects %></p> + <%= render 'admin/application/property/text', + object: @program, + property: :duration %> + </div> + <div class="col-lg-6"> + <h3 class="h5"> + <%= Education::Program.human_attribute_name('short_name') %> + </h3> + <p><%= @program.short_name %></p> + <h3 class="h5 mt-4"> + <%= Education::Program.human_attribute_name('capacity') %> + </h3> + <p><%= @program.capacity %></p> + <h3 class="h5 mt-4"> + <%= Education::Program.human_attribute_name('continuing') %> + </h3> + <p><%= t @program.continuing %></p> + <% if @program.schools.any? %> + <h3 class="h5 mt-4"> + <%= Education::Program.human_attribute_name('schools') %> + </h3> + <ul class="list-unstyled"> + <% @program.schools.ordered.each do |school| %> + <li><%= link_to_if can?(:read, school), school, [:admin, school] %></li> + <% end %> + </ul> + <% end %> + </div> </div> - <div class="card-body"> - <% [ - :main_information, - :presentation, - :objectives, - :opportunities, - :results, - :accessibility, - :duration, - :pricing, - :content, - :pedagogy, - :evaluation, - :prerequisites, - :registration, - :other - ].each_with_index do |property, index| %> - <%= render 'admin/application/property/text', object: @program, property: property %> - <% end %> + <% end %> + <%= render 'admin/education/programs/forms/part', + part: :presentation, + collapsed: true do %> + <div class="row"> + <div class="col-xxl-6"> + <h3 class="h5"> + <%= Education::Program.human_attribute_name('presentation') %> + </h3> + <p><%= @program.presentation %></p> + </div> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :objectives %> + </div> </div> - </div> - + <% end %> <%= render 'admin/communication/blocks/list', about: @program %> - - <div class="card flex-fill w-100"> - <div class="card-header"> - <h5 class="card-title mb-0"><%= Education::Program.human_attribute_name('team') %></h5> + <%= render 'admin/education/programs/forms/part', + part: :pedagogy, + collapsed: true do %> + <div class="row"> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :content %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :pedagogy %> + <%= render 'admin/application/property/text', + object: @program, + property: :evaluation %> + </div> </div> - <div class="card-body"> - <%= render 'admin/education/programs/show/roles', roles: @roles %> + <%= render 'admin/education/programs/show/teachers', + involvements: @teacher_involvements %> + <% end %> + <%= render 'admin/education/programs/forms/part', + part: :results, + collapsed: true do %> + <div class="row"> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :opportunities %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :results %> + </div> </div> - <div class="card-body"> - <%= render 'admin/education/programs/show/teachers', involvements: @teacher_involvements %> + <% end %> + <%= render 'admin/education/programs/forms/part', + part: :admission, + collapsed: true do %> + <div class="row"> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :prerequisites %> + <%= render 'admin/application/property/text', + object: @program, + property: :accessibility %> + <%= render 'admin/application/property/text', + object: @program, + property: :other %> + </div> + <div class="col-xxl-6"> + <%= render 'admin/application/property/text', + object: @program, + property: :pricing %> + <%= render 'admin/application/property/text', + object: @program, + property: :registration %> + <%= render 'admin/application/property/text', + object: @program, + property: :contacts %> + </div> </div> - </div> + <%= render 'admin/education/programs/show/roles', roles: @roles %> + <% end %> <% if @program.children.any? %> <div class="card flex-fill w-100"> @@ -97,7 +177,6 @@ <% content_for :preview do %> <% [ - :main_information, :presentation, :objectives, :opportunities, diff --git a/app/views/admin/education/programs/static.html.erb b/app/views/admin/education/programs/static.html.erb index 80c1f3dde98a0ed852867eab4624d0951eccdcdd..26a7b57c2ee63a549fbef539631ca3fe1e8f70ff 100644 --- a/app/views/admin/education/programs/static.html.erb +++ b/app/views/admin/education/programs/static.html.erb @@ -45,20 +45,20 @@ level: <%= @about.level %> ects: <%= @about.ects %> <% [ - :main_information, :accessibility, :contacts, + :content, :duration, :evaluation, :objectives, :opportunities, :other, + :pedagogy, :prerequisites, :presentation, :pricing, :registration, - :results, - :content + :results ].each do |property| %> <%= property.to_s %>: > <%= prepare_html_for_static @about.send("best_#{property}"), @about.university %> diff --git a/app/views/admin/education/program/teachers/_form.html.erb b/app/views/admin/education/programs/teachers/_form.html.erb similarity index 100% rename from app/views/admin/education/program/teachers/_form.html.erb rename to app/views/admin/education/programs/teachers/_form.html.erb diff --git a/app/views/admin/education/program/teachers/_list.html.erb b/app/views/admin/education/programs/teachers/_list.html.erb similarity index 100% rename from app/views/admin/education/program/teachers/_list.html.erb rename to app/views/admin/education/programs/teachers/_list.html.erb diff --git a/app/views/admin/education/program/teachers/edit.html.erb b/app/views/admin/education/programs/teachers/edit.html.erb similarity index 100% rename from app/views/admin/education/program/teachers/edit.html.erb rename to app/views/admin/education/programs/teachers/edit.html.erb diff --git a/app/views/admin/education/program/teachers/index.html.erb b/app/views/admin/education/programs/teachers/index.html.erb similarity index 76% rename from app/views/admin/education/program/teachers/index.html.erb rename to app/views/admin/education/programs/teachers/index.html.erb index 2c4ebc71137a21df10684b9591117206134b2da1..9d76fa58e806d5f4be528c48872bdc516e3d7b23 100644 --- a/app/views/admin/education/program/teachers/index.html.erb +++ b/app/views/admin/education/programs/teachers/index.html.erb @@ -1,5 +1,5 @@ <% content_for :title, Education::Program.human_attribute_name("teachers") %> -<%= render 'admin/education/program/teachers/list', involvements: @involvements %> +<%= render 'admin/education/programs/teachers/list', involvements: @involvements %> <% content_for :action_bar_right do %> <%= link_to t('create'), diff --git a/app/views/admin/education/program/teachers/new.html.erb b/app/views/admin/education/programs/teachers/new.html.erb similarity index 100% rename from app/views/admin/education/program/teachers/new.html.erb rename to app/views/admin/education/programs/teachers/new.html.erb diff --git a/app/views/admin/education/programs/tree.html.erb b/app/views/admin/education/programs/tree.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..9a012771107eeb658fcbd0041001ab1e9947ac43 --- /dev/null +++ b/app/views/admin/education/programs/tree.html.erb @@ -0,0 +1,15 @@ +<% content_for :title, t('.title') %> + +<ul class="list-unstyled treeview js-treeview <%= 'treeview--sortable js-treeview-sortable js-treeview-sortable-container' if can?(:reorder, @programs.first) %>" data-id="" data-sort-url="<%= reorder_admin_education_programs_path %>"> + <%= render 'treebranch', programs: @programs %> +</ul> + +<% content_for :action_bar_left do %> + <%= link_to t('admin.education.programs.view_as_list'), + admin_education_programs_path, + class: button_classes %> +<% end %> + +<% content_for :action_bar_right do %> + <%= create_link Education::Program %> +<% end %> diff --git a/app/views/admin/education/school/roles/_form.html.erb b/app/views/admin/education/schools/roles/_form.html.erb similarity index 93% rename from app/views/admin/education/school/roles/_form.html.erb rename to app/views/admin/education/schools/roles/_form.html.erb index 5fe08980a344e6e703e9e43518ad5f7ecb4c4177..b03b38d179a400b6a670a59d6121987a284f8447 100644 --- a/app/views/admin/education/school/roles/_form.html.erb +++ b/app/views/admin/education/schools/roles/_form.html.erb @@ -28,7 +28,7 @@ <div class="mb-3" id="involvements" data-sortable="inputs"> <%= f.simple_fields_for :involvements, role.involvements.sort_by(&:position), include_id: false do |involvement_f| %> - <%= render 'admin/education/school/roles/involvement_fields', f: involvement_f, include_id: true %> + <%= render 'admin/education/schools/roles/involvement_fields', f: involvement_f, include_id: true %> <% end %> </div> </div> diff --git a/app/views/admin/education/school/roles/_involvement_fields.html.erb b/app/views/admin/education/schools/roles/_involvement_fields.html.erb similarity index 100% rename from app/views/admin/education/school/roles/_involvement_fields.html.erb rename to app/views/admin/education/schools/roles/_involvement_fields.html.erb diff --git a/app/views/admin/education/school/roles/_list.html.erb b/app/views/admin/education/schools/roles/_list.html.erb similarity index 100% rename from app/views/admin/education/school/roles/_list.html.erb rename to app/views/admin/education/schools/roles/_list.html.erb diff --git a/app/views/admin/education/school/roles/edit.html.erb b/app/views/admin/education/schools/roles/edit.html.erb similarity index 100% rename from app/views/admin/education/school/roles/edit.html.erb rename to app/views/admin/education/schools/roles/edit.html.erb diff --git a/app/views/admin/education/school/roles/index.html.erb b/app/views/admin/education/schools/roles/index.html.erb similarity index 80% rename from app/views/admin/education/school/roles/index.html.erb rename to app/views/admin/education/schools/roles/index.html.erb index 169795ed215ab55d5484cbc72e0affb3662fd532..95f31e6242eee66f8c3e36f1978785dafb6ec23c 100644 --- a/app/views/admin/education/school/roles/index.html.erb +++ b/app/views/admin/education/schools/roles/index.html.erb @@ -1,5 +1,5 @@ <% content_for :title, Education::School.human_attribute_name('roles') %> -<%= render 'admin/education/school/roles/list', roles: @roles %> +<%= render 'admin/education/schools/roles/list', roles: @roles %> <% content_for :action_bar_right do %> <%= link_to t('add'), new_admin_education_school_role_path(school_id: @school.id), class: button_classes if can? :create, University::Role %> diff --git a/app/views/admin/education/school/roles/new.html.erb b/app/views/admin/education/schools/roles/new.html.erb similarity index 100% rename from app/views/admin/education/school/roles/new.html.erb rename to app/views/admin/education/schools/roles/new.html.erb diff --git a/app/views/admin/education/school/roles/show.html.erb b/app/views/admin/education/schools/roles/show.html.erb similarity index 100% rename from app/views/admin/education/school/roles/show.html.erb rename to app/views/admin/education/schools/roles/show.html.erb diff --git a/app/views/admin/research/journal/articles/_form.html.erb b/app/views/admin/research/journals/articles/_form.html.erb similarity index 97% rename from app/views/admin/research/journal/articles/_form.html.erb rename to app/views/admin/research/journals/articles/_form.html.erb index 4c93bbfe3a40c264f15155f529a2d5a2732e0b8d..198a9b5adbeaf25b38ab301459da5e5f19a8fe2b 100644 --- a/app/views/admin/research/journal/articles/_form.html.erb +++ b/app/views/admin/research/journals/articles/_form.html.erb @@ -36,7 +36,7 @@ <%= f.association :people, collection: current_university.people.researchers.ordered, as: :check_boxes %> </div> </div> - <div class="card flex-fill w-100"> + <div class="card"> <div class="card-header"> <h5 class="card-title mb-0"><%= t('seo') %></h5> </div> diff --git a/app/views/admin/research/journal/articles/_list.html.erb b/app/views/admin/research/journals/articles/_list.html.erb similarity index 100% rename from app/views/admin/research/journal/articles/_list.html.erb rename to app/views/admin/research/journals/articles/_list.html.erb diff --git a/app/views/admin/research/journal/articles/edit.html.erb b/app/views/admin/research/journals/articles/edit.html.erb similarity index 100% rename from app/views/admin/research/journal/articles/edit.html.erb rename to app/views/admin/research/journals/articles/edit.html.erb diff --git a/app/views/admin/research/journal/articles/index.html.erb b/app/views/admin/research/journals/articles/index.html.erb similarity index 70% rename from app/views/admin/research/journal/articles/index.html.erb rename to app/views/admin/research/journals/articles/index.html.erb index 00a03fe0682e74b3c311b46a16fb9fe0b8b15ba4..482b92c24acabe62a91b96fc21ae2d040be2a330 100644 --- a/app/views/admin/research/journal/articles/index.html.erb +++ b/app/views/admin/research/journals/articles/index.html.erb @@ -1,6 +1,6 @@ <% content_for :title, Research::Journal::Article.model_name.human(count: 2) %> -<%= render 'admin/research/journal/articles/list', articles: @articles %> +<%= render 'admin/research/journals/articles/list', articles: @articles %> <% content_for :action_bar_right do %> <%= create_link Research::Journal::Article %> diff --git a/app/views/admin/research/journal/articles/new.html.erb b/app/views/admin/research/journals/articles/new.html.erb similarity index 100% rename from app/views/admin/research/journal/articles/new.html.erb rename to app/views/admin/research/journals/articles/new.html.erb diff --git a/app/views/admin/research/journal/articles/show.html.erb b/app/views/admin/research/journals/articles/show.html.erb similarity index 100% rename from app/views/admin/research/journal/articles/show.html.erb rename to app/views/admin/research/journals/articles/show.html.erb diff --git a/app/views/admin/research/journal/articles/static.html.erb b/app/views/admin/research/journals/articles/static.html.erb similarity index 100% rename from app/views/admin/research/journal/articles/static.html.erb rename to app/views/admin/research/journals/articles/static.html.erb diff --git a/app/views/admin/research/journals/show.html.erb b/app/views/admin/research/journals/show.html.erb index 3243b7306446b04e956cd2440acfd7fa4cc47544..9a6d6f41ed25c56a7a2aa5d02695b2da0c567301 100644 --- a/app/views/admin/research/journals/show.html.erb +++ b/app/views/admin/research/journals/show.html.erb @@ -52,7 +52,7 @@ <%= link_to Research::Journal::Article.model_name.human(count: 2), admin_research_journal_articles_path(journal_id: @journal) %></h2> </div> - <%= render 'admin/research/journal/articles/list', articles: @articles %> + <%= render 'admin/research/journals/articles/list', articles: @articles %> </div> <% content_for :action_bar_left do %> diff --git a/app/views/admin/research/journal/volumes/_form.html.erb b/app/views/admin/research/journals/volumes/_form.html.erb similarity index 100% rename from app/views/admin/research/journal/volumes/_form.html.erb rename to app/views/admin/research/journals/volumes/_form.html.erb diff --git a/app/views/admin/research/journal/volumes/edit.html.erb b/app/views/admin/research/journals/volumes/edit.html.erb similarity index 100% rename from app/views/admin/research/journal/volumes/edit.html.erb rename to app/views/admin/research/journals/volumes/edit.html.erb diff --git a/app/views/admin/research/journal/volumes/index.html.erb b/app/views/admin/research/journals/volumes/index.html.erb similarity index 100% rename from app/views/admin/research/journal/volumes/index.html.erb rename to app/views/admin/research/journals/volumes/index.html.erb diff --git a/app/views/admin/research/journal/volumes/new.html.erb b/app/views/admin/research/journals/volumes/new.html.erb similarity index 100% rename from app/views/admin/research/journal/volumes/new.html.erb rename to app/views/admin/research/journals/volumes/new.html.erb diff --git a/app/views/admin/research/journal/volumes/show.html.erb b/app/views/admin/research/journals/volumes/show.html.erb similarity index 100% rename from app/views/admin/research/journal/volumes/show.html.erb rename to app/views/admin/research/journals/volumes/show.html.erb diff --git a/app/views/admin/research/journal/volumes/static.html.erb b/app/views/admin/research/journals/volumes/static.html.erb similarity index 100% rename from app/views/admin/research/journal/volumes/static.html.erb rename to app/views/admin/research/journals/volumes/static.html.erb diff --git a/app/views/admin/research/laboratory/axes/_form.html.erb b/app/views/admin/research/laboratories/axes/_form.html.erb similarity index 100% rename from app/views/admin/research/laboratory/axes/_form.html.erb rename to app/views/admin/research/laboratories/axes/_form.html.erb diff --git a/app/views/admin/research/laboratory/axes/_list.html.erb b/app/views/admin/research/laboratories/axes/_list.html.erb similarity index 100% rename from app/views/admin/research/laboratory/axes/_list.html.erb rename to app/views/admin/research/laboratories/axes/_list.html.erb diff --git a/app/views/admin/research/laboratory/axes/edit.html.erb b/app/views/admin/research/laboratories/axes/edit.html.erb similarity index 100% rename from app/views/admin/research/laboratory/axes/edit.html.erb rename to app/views/admin/research/laboratories/axes/edit.html.erb diff --git a/app/views/admin/research/laboratory/axes/index.html.erb b/app/views/admin/research/laboratories/axes/index.html.erb similarity index 72% rename from app/views/admin/research/laboratory/axes/index.html.erb rename to app/views/admin/research/laboratories/axes/index.html.erb index dfe60dc90513a75553c2ee3b201d0eabbfe65b02..a18ee558643a11bb8ea0647a31b9c04174f67345 100644 --- a/app/views/admin/research/laboratory/axes/index.html.erb +++ b/app/views/admin/research/laboratories/axes/index.html.erb @@ -1,6 +1,6 @@ <% content_for :title, Research::Laboratory::Axis.model_name.human(count: 2) %> -<%= render 'admin/research/laboratory/axes/list', axes: @axes %> +<%= render 'admin/research/laboratories/axes/list', axes: @axes %> <% content_for :action_bar_right do %> <%= create_link Research::Laboratory::Axis %> diff --git a/app/views/admin/research/laboratory/axes/new.html.erb b/app/views/admin/research/laboratories/axes/new.html.erb similarity index 100% rename from app/views/admin/research/laboratory/axes/new.html.erb rename to app/views/admin/research/laboratories/axes/new.html.erb diff --git a/app/views/admin/research/laboratory/axes/show.html.erb b/app/views/admin/research/laboratories/axes/show.html.erb similarity index 100% rename from app/views/admin/research/laboratory/axes/show.html.erb rename to app/views/admin/research/laboratories/axes/show.html.erb diff --git a/app/views/admin/research/laboratories/show.html.erb b/app/views/admin/research/laboratories/show.html.erb index 38b6adcc77b32a3b00f22f3ffa72c71dd03d0e96..e9f522a018cd2b13b2c5a74691d91f2278cec996 100644 --- a/app/views/admin/research/laboratories/show.html.erb +++ b/app/views/admin/research/laboratories/show.html.erb @@ -11,7 +11,7 @@ <%= link_to Research::Laboratory::Axis.model_name.human(count: 2), admin_research_laboratory_axes_path(laboratory_id: @laboratory) %></h2> </div> - <%= render 'admin/research/laboratory/axes/list', axes: @axes %> + <%= render 'admin/research/laboratories/axes/list', axes: @axes %> </div> <% content_for :action_bar_left do %> diff --git a/app/views/admin/research/researchers/show.html.erb b/app/views/admin/research/researchers/show.html.erb index b80329a3cb053d38a15ec7de48b35df54c16a9c3..6b521d61fdfba8b71ffb21016e960ddfad32cb11 100644 --- a/app/views/admin/research/researchers/show.html.erb +++ b/app/views/admin/research/researchers/show.html.erb @@ -7,7 +7,7 @@ <div class="card-header"> <h2 class="card-title mb-0 h5"><%= "#{Research::Journal::Article.model_name.human(count: 2)} (#{@articles.total_count})" %></h2> </div> - <%= render 'admin/research/journal/articles/list', articles: @articles %> + <%= render 'admin/research/journals/articles/list', articles: @articles %> <% if @articles.total_pages > 1 %> <div class="card-footer"> <%= paginate @articles, theme: 'bootstrap-5' %> diff --git a/app/views/admin/university/organization/imports/index.html.erb b/app/views/admin/university/organizations/imports/index.html.erb similarity index 63% rename from app/views/admin/university/organization/imports/index.html.erb rename to app/views/admin/university/organizations/imports/index.html.erb index f06991e44d360ce2c18927d7cb4c75eda6ded0a5..898580ffa6ec4fbb2374f0eea399c40daf4b7396 100644 --- a/app/views/admin/university/organization/imports/index.html.erb +++ b/app/views/admin/university/organizations/imports/index.html.erb @@ -10,7 +10,7 @@ <tbody> <% @imports.each do |import| %> <tr> - <td><%= link_to import, [:admin, import] %></td> + <td><%= link_to import, admin_university_organizations_import_path(import) %></td> <td><%= import.lines %></td> </tr> <% end %> @@ -18,5 +18,8 @@ </table> <% content_for :action_bar_right do %> - <%= create_link University::Organization::Import %> + <%= link_to_if can?(:create, University::Organization::Import), + t('create'), + new_admin_university_organizations_import_path, + class: button_classes %> <% end %> diff --git a/app/views/admin/university/organization/imports/new.html.erb b/app/views/admin/university/organizations/imports/new.html.erb similarity index 94% rename from app/views/admin/university/organization/imports/new.html.erb rename to app/views/admin/university/organizations/imports/new.html.erb index 18e5d067fd7682fdfaaaf5b1821f1b25388b740f..579fe470d478f87273a66d8369ebfd61d0f0adb4 100644 --- a/app/views/admin/university/organization/imports/new.html.erb +++ b/app/views/admin/university/organizations/imports/new.html.erb @@ -10,7 +10,8 @@ Les caractères doivent être encodés en UTF-8.<br> Les valeurs possibles pour kind sont : company, non_profit, government. </p> - <%= simple_form_for [:admin, @import] do |f| %> + <%= simple_form_for @import, + url: admin_university_organizations_imports_path do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> diff --git a/app/views/admin/university/organization/imports/show.html.erb b/app/views/admin/university/organizations/imports/show.html.erb similarity index 100% rename from app/views/admin/university/organization/imports/show.html.erb rename to app/views/admin/university/organizations/imports/show.html.erb diff --git a/app/views/admin/university/organizations/index.html.erb b/app/views/admin/university/organizations/index.html.erb index 6fc56c6f77804a3c133f498e254c1d3ffcb7c89e..ad22a22de0356ca972066dfc89ababd6373f8b3e 100644 --- a/app/views/admin/university/organizations/index.html.erb +++ b/app/views/admin/university/organizations/index.html.erb @@ -7,7 +7,7 @@ <% content_for :action_bar_left do %> <%= link_to t('import'), - new_admin_university_organization_import_path, + new_admin_university_organizations_import_path, class: button_classes if can? :manage, University::Organization::Import %> <% end %> diff --git a/app/views/admin/university/organizations/show.html.erb b/app/views/admin/university/organizations/show.html.erb index 7b3fbe4179fcea5e2ecb77f7632081b7a7e8c406..4cc66d50f0999dcdb5c36316f72e614a8bc16189 100644 --- a/app/views/admin/university/organizations/show.html.erb +++ b/app/views/admin/university/organizations/show.html.erb @@ -24,16 +24,30 @@ <div class="row"> <div class="col-md-6"> <% [:address, :zipcode, :city, :country].each do |property| %> - <h3 class="h5"><%= University::Organization.human_attribute_name(property) %></h3> - <p><%= @organization.send property %></p> + <% value = @organization.send property %> + <% next if value.blank? %> + <h3 class="h5"> + <%= University::Organization.human_attribute_name(property) %> + </h3> + <p><%= value %></p> <% end %> </div> <div class="col-md-6"> - <h3 class="h5"><%= University::Organization.human_attribute_name(:url) %></h3> - <p><%= link_to @organization.url, @organization.url, target: :_blank %></p> + <% unless @organization.url.blank? %> + <h3 class="h5"> + <%= University::Organization.human_attribute_name(:url) %> + </h3> + <p><%= link_to @organization.url, + @organization.url, + target: :_blank %></p> + <% end %> <% [:phone, :email].each do |property| %> - <h3 class="h5"><%= University::Organization.human_attribute_name(property) %></h3> - <p><%= @organization.send property %></p> + <% value = @organization.send property %> + <% next if value.blank? %> + <h3 class="h5"> + <%= University::Organization.human_attribute_name(property) %> + </h3> + <p><%= value %></p> <% end %> </div> </div> diff --git a/app/views/admin/university/person/administrators/static.html.erb b/app/views/admin/university/people/administrators/static.html.erb similarity index 100% rename from app/views/admin/university/person/administrators/static.html.erb rename to app/views/admin/university/people/administrators/static.html.erb diff --git a/app/views/admin/university/person/alumni/_cohort_fields.html.erb b/app/views/admin/university/people/alumni/_cohort_fields.html.erb similarity index 100% rename from app/views/admin/university/person/alumni/_cohort_fields.html.erb rename to app/views/admin/university/people/alumni/_cohort_fields.html.erb diff --git a/app/views/admin/university/person/alumni/_list.html.erb b/app/views/admin/university/people/alumni/_list.html.erb similarity index 87% rename from app/views/admin/university/person/alumni/_list.html.erb rename to app/views/admin/university/people/alumni/_list.html.erb index 6844f54b87a4dacefcb7349a513b087e8b289d61..00f837195a83c7a68cbd084a275fdb91b6cc116f 100644 --- a/app/views/admin/university/person/alumni/_list.html.erb +++ b/app/views/admin/university/people/alumni/_list.html.erb @@ -7,7 +7,7 @@ </thead> <tbody> <% alumni.each do |alumnus| %> - <% path = admin_university_person_alumnus_path(alumnus) %> + <% path = admin_university_people_alumnus_path(alumnus) %> <tr> <td><%= link_to alumnus.last_name, path %></td> <td><%= link_to alumnus.first_name, path %></td> diff --git a/app/views/admin/university/person/alumni/edit_cohorts.html.erb b/app/views/admin/university/people/alumni/edit_cohorts.html.erb similarity index 100% rename from app/views/admin/university/person/alumni/edit_cohorts.html.erb rename to app/views/admin/university/people/alumni/edit_cohorts.html.erb diff --git a/app/views/admin/university/person/alumnus/imports/index.html.erb b/app/views/admin/university/people/alumni/imports/index.html.erb similarity index 57% rename from app/views/admin/university/person/alumnus/imports/index.html.erb rename to app/views/admin/university/people/alumni/imports/index.html.erb index 952d52da4e7b99f4c473186ebcbd5f28f6287a7c..a376df884a90ed95082a50df1e2f79464414da1d 100644 --- a/app/views/admin/university/person/alumnus/imports/index.html.erb +++ b/app/views/admin/university/people/alumni/imports/index.html.erb @@ -9,12 +9,15 @@ <tbody> <% @imports.each do |import| %> <tr> - <td><%= link_to import, [:admin, import] %></td> + <td><%= link_to import, admin_university_people_alumni_import_path(import) %></td> </tr> <% end %> </tbody> </table> <% content_for :action_bar_right do %> - <%= create_link University::Person::Alumnus::Import %> + <%= link_to_if can?(:create, University::Person::Alumnus::Import), + t('create'), + new_admin_university_people_alumni_import_path, + class: button_classes %> <% end %> diff --git a/app/views/admin/university/person/alumnus/imports/new.html.erb b/app/views/admin/university/people/alumni/imports/new.html.erb similarity index 96% rename from app/views/admin/university/person/alumnus/imports/new.html.erb rename to app/views/admin/university/people/alumni/imports/new.html.erb index dfdf89c5e8763b4e6cbe38af6cf55cfb8a883f2f..0749b75c5c3696a0b5d5dcf89b0d934cde8826b9 100644 --- a/app/views/admin/university/person/alumnus/imports/new.html.erb +++ b/app/views/admin/university/people/alumni/imports/new.html.erb @@ -10,7 +10,8 @@ Les caractères doivent être encodés en UTF-8.<br> Les valeurs pour gender peuvent être m (masculin), f (féminin) et n (non binaire). </p> - <%= simple_form_for [:admin, @import] do |f| %> + <%= simple_form_for @import, + url: admin_university_people_alumni_imports_path do |f| %> <%= f.error_notification %> <%= f.error_notification message: f.object.errors[:base].to_sentence if f.object.errors[:base].present? %> diff --git a/app/views/admin/university/person/alumnus/imports/show.html.erb b/app/views/admin/university/people/alumni/imports/show.html.erb similarity index 100% rename from app/views/admin/university/person/alumnus/imports/show.html.erb rename to app/views/admin/university/people/alumni/imports/show.html.erb diff --git a/app/views/admin/university/person/alumni/index.html.erb b/app/views/admin/university/people/alumni/index.html.erb similarity index 74% rename from app/views/admin/university/person/alumni/index.html.erb rename to app/views/admin/university/people/alumni/index.html.erb index 6fe0494bd3dd719d42790d9909d18b2af79d995e..dc53377d88626440dd47ff45d7e1de84e81eb234 100644 --- a/app/views/admin/university/person/alumni/index.html.erb +++ b/app/views/admin/university/people/alumni/index.html.erb @@ -1,14 +1,14 @@ <% content_for :title, "#{University::Person::Alumnus.model_name.human(count: 2)} (#{@alumni.total_count})" %> -<%= render 'filters', current_path: admin_university_person_alumni_path, filters: @filters if @filters.any? %> +<%= render 'filters', current_path: admin_university_people_alumni_path, filters: @filters if @filters.any? %> -<%= render 'admin/university/person/alumni/list', alumni: @alumni %> +<%= render 'admin/university/people/alumni/list', alumni: @alumni %> <%= paginate @alumni, theme: 'bootstrap-5' %> <% content_for :action_bar_left do %> <%= link_to t('import'), - new_admin_university_person_alumnus_import_path, + new_admin_university_people_alumni_import_path, class: button_classes if can? :manage, University::Person::Alumnus::Import %> <% end %> diff --git a/app/views/admin/university/person/alumni/new.html.erb b/app/views/admin/university/people/alumni/new.html.erb similarity index 100% rename from app/views/admin/university/person/alumni/new.html.erb rename to app/views/admin/university/people/alumni/new.html.erb diff --git a/app/views/admin/university/person/alumni/show.html.erb b/app/views/admin/university/people/alumni/show.html.erb similarity index 100% rename from app/views/admin/university/person/alumni/show.html.erb rename to app/views/admin/university/people/alumni/show.html.erb diff --git a/app/views/admin/university/person/alumni/show/_cohorts.html.erb b/app/views/admin/university/people/alumni/show/_cohorts.html.erb similarity index 100% rename from app/views/admin/university/person/alumni/show/_cohorts.html.erb rename to app/views/admin/university/people/alumni/show/_cohorts.html.erb diff --git a/app/views/admin/university/person/authors/static.html.erb b/app/views/admin/university/people/authors/static.html.erb similarity index 100% rename from app/views/admin/university/person/authors/static.html.erb rename to app/views/admin/university/people/authors/static.html.erb diff --git a/app/views/admin/university/person/researchers/static.html.erb b/app/views/admin/university/people/researchers/static.html.erb similarity index 100% rename from app/views/admin/university/person/researchers/static.html.erb rename to app/views/admin/university/people/researchers/static.html.erb diff --git a/app/views/admin/university/person/teachers/static.html.erb b/app/views/admin/university/people/teachers/static.html.erb similarity index 100% rename from app/views/admin/university/person/teachers/static.html.erb rename to app/views/admin/university/people/teachers/static.html.erb diff --git a/app/views/admin/users/show.html.erb b/app/views/admin/users/show.html.erb index 462cb95476da9120e8e2809aac27756f30ddde6e..2c4d3d8adaa800f77970cc4757246e525ed20890 100644 --- a/app/views/admin/users/show.html.erb +++ b/app/views/admin/users/show.html.erb @@ -50,8 +50,10 @@ <% end %> </div> +<% content_for :action_bar_left do %> + <%= destroy_link @user %> +<% end %> <% content_for :action_bar_right do %> <%= edit_link @user %> - <%= destroy_link @user %> <% end %> diff --git a/app/views/server/blocks/index.html.erb b/app/views/server/blocks/index.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..c19fa8b04903938eeef8dc33fb7e048f186a3564 --- /dev/null +++ b/app/views/server/blocks/index.html.erb @@ -0,0 +1,18 @@ +<% content_for :title, Communication::Block.model_name.human(count: 2) %> + +<table class="<%= table_classes %>"> + <thead> + <tr> + <th><%= Communication::Block.human_attribute_name('name') %></th> + <th><%= Communication::Block.human_attribute_name('quantity') %></th> + </tr> + </thead> + <tbody> + <% @templates.each do |template| %> + <tr> + <td><%= link_to t("enums.communication.block.template_kind.#{template}"), server_block_path(template) %></td> + <td><%= Communication::Block.send(template).count %></td> + </tr> + <% end %> + </tbody> +</table> diff --git a/app/views/server/blocks/show.html.erb b/app/views/server/blocks/show.html.erb new file mode 100644 index 0000000000000000000000000000000000000000..250e89ff2142339cbb0b94aaa2a991528275ac84 --- /dev/null +++ b/app/views/server/blocks/show.html.erb @@ -0,0 +1,37 @@ +<% content_for :title, t("enums.communication.block.template_kind.#{@template}") %> + +<table class="<%= table_classes %>"> + <thead> + <tr> + <th><%= Communication::Block.human_attribute_name('name') %></th> + <th><%= Communication::Block.human_attribute_name('about') %></th> + <th><%= Communication::Block.human_attribute_name('university') %></th> + <th><%= Communication::Block.human_attribute_name('url') %></th> + </tr> + </thead> + <tbody> + <% @blocks.each do |block| %> + <% url = "#{block.about.university.url }#{edit_admin_communication_block_path(block)}" %> + <tr> + <td><%= truncate "#{block}" %></td> + <td> + <%= truncate "#{block.about}" %> + <span class="badge bg-dark"> + <%= block.about.class.model_name.human %> + </span> + </td> + <td><%= block.about.university %></td> + <td><%= link_to 'Open', + url, + target: :_blank %></td> + </tr> + <% end %> + </tbody> +</table> + +<% content_for :action_bar_right do %> + <%= link_to t('resave'), + server_resave_block_path(@template), + method: :post, + class: button_classes %> +<% end %> diff --git a/config/admin_navigation.rb b/config/admin_navigation.rb index 4fccef35596f4b3505cad976350d55b20d6c6fdd..f0f93fb026a2c084af78360b79efb881c601975a 100644 --- a/config/admin_navigation.rb +++ b/config/admin_navigation.rb @@ -10,14 +10,15 @@ SimpleNavigation::Configuration.run do |navigation| primary.item :university, University.model_name.human, nil, { kind: :header } primary.item :university, University::Person.model_name.human(count: 2), admin_university_people_path, { icon: 'users-cog' } primary.item :university, University::Organization.model_name.human(count: 2), admin_university_organizations_path, { icon: 'building' } - primary.item :communication_alumni, University::Person::Alumnus.model_name.human(count: 2), admin_university_person_alumni_path, { icon: 'users' } + primary.item :communication_alumni, University::Person::Alumnus.model_name.human(count: 2), admin_university_people_alumni_path, { icon: 'users' } end if can?(:read, Education::Program) primary.item :education, Education.model_name.human, nil, { kind: :header } - primary.item :education, t('education.teachers', count: 2), admin_education_teachers_path, { icon: 'user-graduate' } if can?(:read, University::Person) - primary.item :education, Education::School.model_name.human(count: 2), admin_education_schools_path, { icon: 'university' } if can?(:read, Education::School) - primary.item :education_programs, Education::Program.model_name.human(count: 2), admin_education_programs_path, { icon: 'graduation-cap' } if can?(:read, Education::Program) + primary.item :education_teachers, t('education.teachers', count: 2), admin_education_teachers_path, { icon: 'user-graduate' } if can?(:read, University::Person) + primary.item :education_schools, Education::School.model_name.human(count: 2), admin_education_schools_path, { icon: 'university' } if can?(:read, Education::School) + primary.item :education_diplomas, Education::Diploma.model_name.human(count: 2), admin_education_diplomas_path, { icon: 'graduation-cap' } if can?(:read, Education::Diploma) + primary.item :education_programs, Education::Program.model_name.human(count: 2), admin_education_programs_path, { icon: 'chalkboard-teacher' } if can?(:read, Education::Program) primary.item :education, 'Ressources éducatives', nil, { icon: 'laptop' } primary.item :education, 'Feedbacks', nil, { icon: 'comments' } end diff --git a/config/locales/communication/en.yml b/config/locales/communication/en.yml index 8c7e55dd054111c2369e58cfb05888e27b468411..d7c097cf924abdfe39b50ee4ce172f8cc20b9a10 100644 --- a/config/locales/communication/en.yml +++ b/config/locales/communication/en.yml @@ -123,6 +123,20 @@ en: admin: communication: blocks: + components: + text: + label: Text + placeholder: Enter text + image: + input: + label: Image (.png, .jpg, .svg) + remove: Remove image + alt: + label: Alternative text + placeholder: Enter alternative text + credit: + label: Credit + placeholder: Enter credit template_kinds: chapter: edit: @@ -130,12 +144,32 @@ en: notes_placeholder: Enter notes text_label: Text text_placeholder: Enter text + call_to_action: + edit: + button_1: Primary button + button_2: Secondary button + button_label: Text + button_placeholder: Enter the button text here + buttons: Action buttons + image_alt_label: Alternative text + image_alt_placeholder: Enter image's alternative text here + image_credit_label: Credit + image_credit_placeholder: Enter image's credit here + image_label: File + image_title: Image + remove_image: Delete image + text_label: Text + text_placeholder: Enter text here + url_label: Link + url_placeholder: Enter the URL with "https://..." gallery: edit: add_image: Add image image_label: Image (.png, .jpg) alt_label: Alternative text alt_placeholder: Enter text description + credit_label: Credit + credit_placeholder: Enter image's credit here text_label: Text text_placeholder: Enter text remove_image: Remove image @@ -148,6 +182,9 @@ en: role_placeholder: Enter person's role drag_title: Drag and drop to organize persons delete_title: Remove person + pages: + edit: + add_page: Select a page partners: edit: add_partner: Add partner @@ -155,7 +192,7 @@ en: partner_name_placeholder: Enter partner's name partner_url_label: Website partner_url_placeholder: https:// - partner_image_label: Logo + partner_logo_label: Logo remove_logo: Remove logo remove_partner: Remove partner testimonials: @@ -186,22 +223,6 @@ en: title_placeholder: Enter title here text_label: Text text_placeholder: Enter text here - call_to_action: - edit: - text_label: Text - text_placeholder: Enter text here - url_label: Lien - url_placeholder: Enter the URL with "https://..." - buttons: Action buttons - button_1: Primary button - button_2: Secondary button - button_label: Text - button_placeholder: Enter the button text here - image_title: Image - image_label: Fichier - remove_image: Supprimer l'image - image_alt_label: Texte alternatif - image_alt_placeholder: Entrer le texte alternatif de l'image ici website: pages: delete_special_page_notice: Can't delete this page @@ -317,14 +338,19 @@ en: template: call_to_action: Call to action chapter: Chapter + datatable: Table definitions: Definitions + embed: HTML embed + files: Files gallery: Gallery + image: Image organization_chart: Organization chart pages: Pages partners: Partners posts: Posts testimonials: Testimonials timeline: Timeline + video: Video website: menu: item: diff --git a/config/locales/communication/fr.yml b/config/locales/communication/fr.yml index d4784d66599ad50eb9fb350869b0a958b3c7183d..821e146528e359c391bd076db42019f3cc37d669 100644 --- a/config/locales/communication/fr.yml +++ b/config/locales/communication/fr.yml @@ -123,6 +123,20 @@ fr: admin: communication: blocks: + components: + text: + label: Texte + placeholder: Entrer le texte + image: + input: + label: Image (.png, .jpg, .svg) + remove: Enlever l'image + alt: + label: Texte alternatif + placeholder: Entrer la description textuelle + credit: + label: Crédit + placeholder: Entrer le crédit templates: chapter: edit: @@ -136,6 +150,8 @@ fr: image_label: Image (.png, .jpg) alt_label: Texte alternatif alt_placeholder: Entrer la description textuelle + credit_label: Crédit + credit_placeholder: Entrer le crédit de l'image ici text_label: Texte text_placeholder: Entrer le texte remove_image: Enlever l'image @@ -148,6 +164,9 @@ fr: role_placeholder: Indiquer le rôle de la personne drag_title: Glisser-déposer pour organiser les personnes delete_title: Enlever la personne + pages: + edit: + add_page: Sélectionner une page partners: edit: add_partner: Ajouter un partenaire @@ -155,7 +174,7 @@ fr: partner_name_placeholder: Entrer le nom du partenaire partner_url_label: Site Web partner_url_placeholder: https:// - partner_image_label: Logo + partner_logo_label: Logo remove_logo: Enlever le logo remove_partner: Enlever le partenaire testimonials: @@ -190,20 +209,22 @@ fr: text_placeholder: Entrer la description de la définition call_to_action: edit: - text_label: Texte - text_placeholder: Entrer le texte ici - url_label: Lien - url_placeholder: Entrer le lien ici avec "https://..." - buttons: Boutons d'action button_1: Bouton principal button_2: Bouton secondaire button_label: Texte button_placeholder: Entrer le texte du bouton ici - image_title: Image + buttons: Boutons d'action + image_alt_label: Texte alternatif + image_alt_placeholder: Entrer la description textuelle + image_credit_label: Crédit + image_credit_placeholder: Entrer le crédit de l'image ici image_label: Fichier + image_title: Image remove_image: Supprimer l'image - image_alt_label: Texte alternatif - image_alt_placeholder: Entrer le texte alternatif de l'image ici + text_label: Texte + text_placeholder: Entrer le texte ici + url_label: Lien + url_placeholder: Entrer le lien ici avec "https://..." website: pages: delete_special_page_notice: Impossible de supprimer cette page @@ -319,14 +340,19 @@ fr: template_kind: call_to_action: Appel à actions chapter: Chapitre + datatable: Tableau definitions: Définitions + embed: Intégration HTML + files: Fichiers gallery: Galerie + image: Image organization_chart: Organigramme pages: Liste de pages partners: Partenaires posts: Liste d'actualités testimonials: Témoignages timeline: Frise chronologique + video: Vidéo website: menu: item: diff --git a/config/locales/education/en.yml b/config/locales/education/en.yml index 1767dbce544f55209b78740385e9024d6a07581c..4cd54e4b70e671944ab70327cd8a6dd1bd42c5ec 100644 --- a/config/locales/education/en.yml +++ b/config/locales/education/en.yml @@ -10,6 +10,9 @@ en: education/cohort: one: Cohort other: Cohorts + education/diploma: + one: Diploma + other: Diplomas education/program: one: Program other: Programs @@ -20,6 +23,11 @@ en: education/cohort: year: Year alumni: Alumni + education/diploma: + name: Name + short_name: Short name + level: Level + programs: Programs education/program: accessibility: Accessibilité capacity: Capacity @@ -27,6 +35,7 @@ en: continuing: Formation continue description: Meta Description duration: Durée + diploma: Diploma ects: Crédits ECTS evaluation: Modalités d’évaluation featured_image: Featured image @@ -45,6 +54,7 @@ en: registration: Modalités et délais d’accès roles: Roles schools: Schools with this formation + short_name: Short name teachers: Teachers team: Team content: Program's content @@ -60,6 +70,13 @@ en: roles: Team Members websites: Linked websites zipcode: Zipcode + admin: + education: + programs: + view_as_list: Listview + view_as_tree: Treeview + tree: + title: Programs treeview education: manage_programs: Manage programs manage_roles: Manage roles @@ -79,6 +96,18 @@ en: other: Teachers enums: education: + diploma: + level: + not_applicable: Not applicable + primary: Primary school + secondary: Secondary school + high: High School + first_year: 1 year + second_year: 2 years + third_year: Licence (3 years) + fourth_year: 4 years + master: Master (5 years) + doctor: Doctorate (8 years) program: level: bachelor: Licence / bachelor diff --git a/config/locales/education/fr.yml b/config/locales/education/fr.yml index 263d93218ce6d4eec895215963e8215190a1abc1..ecd5a58b3d1b8754fa7852b1542d63407a602a4d 100644 --- a/config/locales/education/fr.yml +++ b/config/locales/education/fr.yml @@ -10,6 +10,9 @@ fr: education/cohort: one: Promotion other: Promotions + education/diploma: + one: Diplôme + other: Diplômes education/program: one: Formation other: Formations @@ -20,6 +23,11 @@ fr: education/cohort: year: Année alumni: Alumni + education/diploma: + name: Nom + short_name: Nom abrégé + level: Niveau + programs: Formations education/program: accessibility: Accessibilité capacity: Capacité @@ -27,6 +35,7 @@ fr: continuing: Formation continue description: Meta Description duration: Durée + diploma: Diplôme ects: Crédits ECTS evaluation: Modalités d’évaluation featured_image: Image à la une @@ -45,6 +54,7 @@ fr: registration: Modalités et délais d’accès roles: Rôles schools: Écoles proposant cette formation + short_name: Nom abrégé teachers: Enseignants·es team: Équipe content: Contenus de la formation @@ -60,15 +70,40 @@ fr: roles: Membres de l'équipe websites: Sites Web associés zipcode: Code postal + admin: + education: + programs: + view_as_list: Vue en liste + view_as_tree: Vue en arbre + tree: + title: Arborescence des formations education: manage_programs: Gérer les formations manage_roles: Gérer les rôles manage_teachers: Gérer les enseignants·es number_of_programs: Nombre de formations program: - educational_informations: Informations pédagogiques - main_informations: Informations essentielles - useful_informations: Informations pratiques + parts: + technical: + label: Technique + hint: État de publication et URLs dans les sites Web concernés. + essential: + label: Essentiel + hint: Haut de page, résumé de la formation. + presentation: + label: Présentation + hint: Complétées par les blocs, afin de permettre une présentation libre et riche de la formation. + pedagogy: + label: Pédagogie + hint: Mode d'enseignement et d'évaluation, et présentation de l'équipe pédagogique. + results: + label: Résultats + hint: Débouchés et résultats obtenus par les anciens élèves. + admission: + label: Admission + hint: Modalités administratives d'accès à la formation. + hints: + essential: Ces informations apparaissent en haut de page roles: one: Rôle other: Rôles @@ -79,6 +114,18 @@ fr: other: Enseignants·es enums: education: + diploma: + level: + not_applicable: Non applicable + primary: École primaire + secondary: Collège + high: Lycée + first_year: Bac + 1 + second_year: Bac + 2 + third_year: Licence (Bac + 3) + fourth_year: Bac + 4 + master: Master (Bac + 5) + doctor: Doctorat (Bac + 8) program: level: bachelor: Licence / bachelor diff --git a/config/locales/en.yml b/config/locales/en.yml index 013fe4bf78609dc146ad49d5be36e18ddb01edb5..bc9a6fa7cb07d0a75ab9e4adcf6ed0907b4d780d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -47,7 +47,9 @@ en: sentence_without_link: Value inherited sentence_html: Value inherited from %{link} status: Inherited value - number_of_enqueued_tasks: "Number of enqueued tasks: %{tasks}" + pending_tasks: + label: Background tasks pending + hint: Those tasks precompute your data in order to minimize its carbon footprint. It creates a delay before your changes are online. password_hint: Leave blank if you do not wish to change the password. successfully_created_html: "<i>%{model}</i> was successfully created." successfully_destroyed_html: "<i>%{model}</i> was successfully destroyed." @@ -99,6 +101,15 @@ en: download: Download edit: Edit false: No + featured_image: + title: Image + alt: + label: Alternative text + hint: This text is important for accessibility + credit: + label: Credit + hint: The credit must be present according to copyright or copyleft licenses. + remove: Remove image filters: attributes: date: Filter by Date @@ -175,6 +186,14 @@ en: date_with_explicit_month: "%B %d, %Y" date_with_hour: "%B %d, %Y %H:%M" true: Yes + unsplash: + next: Next image + nothing: No results for this search + open: Search an image + placeholder: Type your search here + previous: Previous images + search: Search + title: Images on Unsplash validate: Validate views: pagination: diff --git a/config/locales/fr.yml b/config/locales/fr.yml index ad8733416ad22d7556982fa880d8af79d0c5b4a4..99b80a8739f2f4942c61a2f0c138dd5230ebc9df 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -47,7 +47,9 @@ fr: sentence_without_link: Valeur héritée sentence_html: Valeur héritée de %{link} status: Valeur héritée - number_of_enqueued_tasks: "Nombre de tâches à traiter : %{tasks}" + pending_tasks: + label: Tâches en cours de traitement + hint: L'exécution de ces tâches contribue à diminuer l'empreinte carbone du numérique, en précalculant ce qui peut l'être. Cela peut générer un délai avant que vos modifications ne soient visibles. password_hint: Laissez vide si vous ne souhaitez pas modifier le mot de passe. successfully_created_html: "<i>%{model}</i> a bien été créé(e)." successfully_destroyed_html: "<i>%{model}</i> a bien été détruit(e)." @@ -99,6 +101,15 @@ fr: download: Télécharger edit: Modifier false: Non + featured_image: + title: Image + alt: + label: Texte alternatif + hint: Ce texte est essentiel pour l'accessibilité + credit: + label: Crédit + hint: Le crédit photo doit être indiqué, dans le respect du droit d'auteur + remove: Supprimer l'image filters: attributes: date: Filtrer par Date @@ -175,6 +186,14 @@ fr: date_with_explicit_month: "%d %B %Y" date_with_hour: "%d %B %Y %H:%M" true: Oui + unsplash: + next: Images suivantes + nothing: Aucun résultat pour cette recherche + open: Chercher une image + placeholder: Tapez votre recherche + previous: Images précédentes + search: Chercher + title: Recherche d'image sur Unsplash validate: Valider views: pagination: diff --git a/config/routes.rb b/config/routes.rb index 5e9f0af119a7ec261e2d338a89ae71c11d8b3d96..2e983de6e2545700ecf2711812e285f5b4c5995c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,15 +28,11 @@ Rails.application.routes.draw do root to: 'dashboard#index' end - namespace :server do - resources :universities - resources :languages - root to: 'dashboard#index' - end get '/media/:signed_id/:filename_with_transformations' => 'media#show', as: :medium draw 'api' draw 'extranet' + draw 'server' # Root is in extranet end diff --git a/config/routes/admin/communication.rb b/config/routes/admin/communication.rb index c6716a4fe9cfc57e0a62e2d51c3fe126525317af..3b5347433d8fa803dbd0137e5bf313e3a93660c3 100644 --- a/config/routes/admin/communication.rb +++ b/config/routes/admin/communication.rb @@ -1,13 +1,11 @@ namespace :communication do get 'unsplash' => 'unsplash#index' resources :websites do - get 'home' => 'website/home#edit' - patch 'home' => 'website/home#update' member do get :import post :import end - resources :pages, controller: 'website/pages' do + resources :pages, controller: 'websites/pages' do collection do post :reorder end @@ -16,7 +14,7 @@ namespace :communication do get :static end end - resources :categories, controller: 'website/categories' do + resources :categories, controller: 'websites/categories' do collection do post :reorder end @@ -25,8 +23,8 @@ namespace :communication do get :static end end - resources :authors, controller: 'website/authors', only: [:index, :show] - resources :posts, controller: 'website/posts' do + resources :authors, controller: 'websites/authors', only: [:index, :show] + resources :posts, controller: 'websites/posts' do post :publish, on: :collection member do get :static @@ -35,10 +33,10 @@ namespace :communication do resources :curations, path: 'posts/curations', as: :post_curations, - controller: 'website/posts/curations', + controller: 'websites/posts/curations', only: [:new, :create] - resources :menus, controller: 'website/menus' do - resources :items, controller: 'website/menu/items', except: :index do + resources :menus, controller: 'websites/menus' do + resources :items, controller: 'websites/menus/items', except: :index do collection do get :kind_switch post :reorder @@ -48,11 +46,8 @@ namespace :communication do end end end - get 'structure' => 'website/structure#edit' - patch 'structure' => 'website/structure#update' - end - resources :blocks, controller: 'blocks', except: :index do + resources :blocks, controller: 'blocks', except: [:index, :show] do collection do post :reorder end diff --git a/config/routes/admin/education.rb b/config/routes/admin/education.rb index f4ae939d306a4de9b3b1eb6a8d3577fc10e9ec41..68586440f685abdd06ceba852aefa0f85aa24ab9 100644 --- a/config/routes/admin/education.rb +++ b/config/routes/admin/education.rb @@ -1,8 +1,8 @@ namespace :education do resources :teachers, only: [:index, :show, :edit, :update] resources :schools do - resources :roles, controller: 'school/roles' do - resources :people, controller: 'school/role/people', only: [:destroy] do + resources :roles, controller: 'schools/roles' do + resources :people, controller: 'schools/roles/people', only: [:destroy] do post :reorder, on: :collection end collection do @@ -11,20 +11,21 @@ namespace :education do end end resources :programs do - resources :roles, controller: 'program/roles' do - resources :people, controller: 'program/role/people', only: [:destroy] do + resources :roles, controller: 'programs/roles' do + resources :people, controller: 'programs/role/people', only: [:destroy] do post :reorder, on: :collection end collection do post :reorder end end - resources :teachers, controller: 'program/teachers', except: :show do + resources :teachers, controller: 'programs/teachers', except: :show do collection do post :reorder end end collection do + get :tree post :reorder end member do @@ -33,4 +34,5 @@ namespace :education do end resources :academic_years resources :cohorts + resources :diplomas end diff --git a/config/routes/admin/research.rb b/config/routes/admin/research.rb index 3557586e7b881e7472eedcdbf1ba1ecd461bc3fc..d4ec9725ca5ab7f5d396d564f5b7fd26a473e076 100644 --- a/config/routes/admin/research.rb +++ b/config/routes/admin/research.rb @@ -1,15 +1,15 @@ namespace :research do resources :researchers, only: [:index, :show] resources :journals do - resources :volumes, controller: 'journal/volumes' - resources :articles, controller: 'journal/articles' do + resources :volumes, controller: 'journals/volumes' + resources :articles, controller: 'journals/articles' do collection do post :reorder end end end resources :laboratories do - resources :axes, controller: 'laboratory/axes' do + resources :axes, controller: 'laboratories/axes' do collection do post :reorder end diff --git a/config/routes/admin/university.rb b/config/routes/admin/university.rb index 9ea5fdfa193049855aa245f1582c127d09579dcf..5106085dc6cb64aa953317c748c99e827750b6a1 100644 --- a/config/routes/admin/university.rb +++ b/config/routes/admin/university.rb @@ -1,9 +1,12 @@ namespace :university do - resources :people, :organizations - namespace :organization do + # Resources must come after namespaces, otherwise there is a confusion with ids + namespace :organizations do resources :imports, only: [:index, :show, :new, :create] end - namespace :person do + namespace :people do + namespace :alumni do + resources :imports, only: [:index, :show, :new, :create] + end resources :alumni, only: [:index, :show] do member do get 'edit_cohorts' => 'alumni#edit_cohorts' @@ -12,8 +15,6 @@ namespace :university do patch 'edit_experiences' => 'alumni#update_experiences' end end - namespace :alumnus do - resources :imports, only: [:index, :show, :new, :create] - end end + resources :people, :organizations end diff --git a/config/routes/server.rb b/config/routes/server.rb new file mode 100644 index 0000000000000000000000000000000000000000..c76985a7568405bf60616262ae137c88794599a4 --- /dev/null +++ b/config/routes/server.rb @@ -0,0 +1,7 @@ +namespace :server do + resources :universities, :languages + get 'blocks' => 'blocks#index', as: :blocks + get 'blocks/:id' => 'blocks#show', as: :block + post 'blocks/:id' => 'blocks#resave', as: :resave_block + root to: 'dashboard#index' +end diff --git a/config/server_navigation.rb b/config/server_navigation.rb index 4881a4db1b6b8f287c52d8ece930ed2d8fb7abc2..06113b460e72c3a4dde82d910699efd74c738de9 100644 --- a/config/server_navigation.rb +++ b/config/server_navigation.rb @@ -4,8 +4,20 @@ SimpleNavigation::Configuration.run do |navigation| navigation.highlight_on_subpath = true navigation.selected_class = 'active' navigation.items do |primary| - primary.item :dashboard, t('dashboard'), server_root_path, { icon: 'tachometer-alt', highlights_on: %r{server$} } - primary.item :universities, University.model_name.human(count: 2), server_universities_path, { icon: 'university' } if can?(:read, University) - primary.item :languages, Language.model_name.human(count: 2), server_languages_path, { icon: 'flag' } if can?(:read, Language) + primary.item :dashboard, + t('dashboard'), + server_root_path, + { icon: 'tachometer-alt', highlights_on: %r{server$} } + primary.item :universities, + University.model_name.human(count: 2), + server_universities_path, { icon: 'university' } if can?(:read, University) + primary.item :languages, + Language.model_name.human(count: 2), + server_languages_path, + { icon: 'flag' } if can?(:read, Language) + primary.item :blocks, + Communication::Block.model_name.human(count: 2), + server_blocks_path, + { icon: 'puzzle-piece' } if can?(:read, Communication::Block) end end diff --git a/db/migrate/20220515052429_create_education_diplomas.rb b/db/migrate/20220515052429_create_education_diplomas.rb new file mode 100644 index 0000000000000000000000000000000000000000..4fa9a997ab42733e16ef207811d2cdd7129e2a6d --- /dev/null +++ b/db/migrate/20220515052429_create_education_diplomas.rb @@ -0,0 +1,14 @@ +class CreateEducationDiplomas < ActiveRecord::Migration[6.1] + def change + create_table :education_diplomas, id: :uuid do |t| + t.string :name + t.string :short_name + t.integer :level, default: 0 + t.string :slug + t.references :university, null: false, foreign_key: true, type: :uuid + + t.timestamps + end + add_reference :education_programs, :diploma, type: :uuid + end +end diff --git a/db/migrate/20220515060948_add_short_name_to_education_programs.rb b/db/migrate/20220515060948_add_short_name_to_education_programs.rb new file mode 100644 index 0000000000000000000000000000000000000000..433620850012facf6d741a2af761b003ac53d87d --- /dev/null +++ b/db/migrate/20220515060948_add_short_name_to_education_programs.rb @@ -0,0 +1,5 @@ +class AddShortNameToEducationPrograms < ActiveRecord::Migration[6.1] + def change + add_column :education_programs, :short_name, :string + end +end diff --git a/db/migrate/20220515082819_remove_main_information_from_education_programs.rb b/db/migrate/20220515082819_remove_main_information_from_education_programs.rb new file mode 100644 index 0000000000000000000000000000000000000000..22003082c72630fdd5e40f0168ea6a6e88f4b171 --- /dev/null +++ b/db/migrate/20220515082819_remove_main_information_from_education_programs.rb @@ -0,0 +1,5 @@ +class RemoveMainInformationFromEducationPrograms < ActiveRecord::Migration[6.1] + def change + remove_column :education_programs, :main_information + end +end diff --git a/db/schema.rb b/db/schema.rb index 7b136e975811cbc6607a421b13c6ffdd891011f2..0968b7525eed32611fabd1a576e5dc7fa4e0a72c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2022_05_05_131539) do +ActiveRecord::Schema.define(version: 2022_05_15_082819) do # These are extensions that must be enabled in order to support this database enable_extension "pgcrypto" @@ -419,6 +419,17 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.index ["university_person_id", "education_cohort_id"], name: "index_person_cohort" end + create_table "education_diplomas", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "name" + t.string "short_name" + t.integer "level", default: 0 + t.string "slug" + t.uuid "university_id", null: false + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + t.index ["university_id"], name: "index_education_diplomas_on_university_id" + end + create_table "education_programs", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.uuid "university_id", null: false t.string "name" @@ -449,8 +460,10 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.text "content" t.text "results" t.text "presentation" - t.text "main_information" t.text "featured_image_credit" + t.uuid "diploma_id" + t.string "short_name" + t.index ["diploma_id"], name: "index_education_programs_on_diploma_id" t.index ["parent_id"], name: "index_education_programs_on_parent_id" t.index ["university_id"], name: "index_education_programs_on_university_id" end @@ -490,6 +503,23 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.index ["university_id"], name: "index_education_schools_on_university_id" end + create_table "external_organizations", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| + t.string "title" + t.text "description" + t.string "address" + t.string "zipcode" + t.string "city" + t.string "country" + t.string "website" + t.string "phone" + t.string "mail" + t.boolean "active" + t.string "sirene" + t.integer "kind" + t.datetime "created_at", precision: 6, null: false + t.datetime "updated_at", precision: 6, null: false + end + create_table "languages", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t| t.string "name" t.string "iso_code" @@ -680,8 +710,8 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do t.string "linkedin" t.boolean "is_alumnus", default: false t.text "description_short" - t.boolean "is_author" t.string "name" + t.boolean "is_author" t.index ["university_id"], name: "index_university_people_on_university_id" t.index ["user_id"], name: "index_university_people_on_user_id" end @@ -826,6 +856,7 @@ ActiveRecord::Schema.define(version: 2022_05_05_131539) do add_foreign_key "education_cohorts", "education_academic_years", column: "academic_year_id" add_foreign_key "education_cohorts", "education_programs", column: "program_id" add_foreign_key "education_cohorts", "universities" + add_foreign_key "education_diplomas", "universities" add_foreign_key "education_programs", "education_programs", column: "parent_id" add_foreign_key "education_programs", "universities" add_foreign_key "education_schools", "universities" diff --git a/test/fixtures/education/diplomas.yml b/test/fixtures/education/diplomas.yml new file mode 100644 index 0000000000000000000000000000000000000000..6b5998c346801ef18c013f347cd6b1b88eca75d5 --- /dev/null +++ b/test/fixtures/education/diplomas.yml @@ -0,0 +1,33 @@ +# == Schema Information +# +# Table name: education_diplomas +# +# id :uuid not null, primary key +# level :integer default("not_applicable") +# name :string +# short_name :string +# slug :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_education_diplomas_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_6cb2e9fa90 (university_id => universities.id) +# + +one: + name: MyString + short_name: MyString + level: 1 + slug: MyString + +two: + name: MyString + short_name: MyString + level: 1 + slug: MyString diff --git a/test/models/education/diploma_test.rb b/test/models/education/diploma_test.rb new file mode 100644 index 0000000000000000000000000000000000000000..54396281497a71f21144c7b926b41be2ffcb793c --- /dev/null +++ b/test/models/education/diploma_test.rb @@ -0,0 +1,28 @@ +# == Schema Information +# +# Table name: education_diplomas +# +# id :uuid not null, primary key +# level :integer default("not_applicable") +# name :string +# short_name :string +# slug :string +# created_at :datetime not null +# updated_at :datetime not null +# university_id :uuid not null, indexed +# +# Indexes +# +# index_education_diplomas_on_university_id (university_id) +# +# Foreign Keys +# +# fk_rails_6cb2e9fa90 (university_id => universities.id) +# +require "test_helper" + +class Education::DiplomaTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end