From 0cf396ad302c52fdccc6ebebdc691e36a51821ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saray=20Cabrera=20Padr=C3=B3n?= Date: Tue, 18 Dec 2018 15:17:23 +0100 Subject: [PATCH 1/2] Migrate project new page to bootstrap Following the re-design, the creation of a project will be in a modal as it is in subprojects. Co-authored-by: David Kang --- src/api/app/views/webui2/webui/project/_form.html.haml | 2 +- .../webui2/webui/project/_new_project_modal.html.haml | 8 ++++++++ src/api/app/views/webui2/webui/project/list.html.haml | 4 +++- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/api/app/views/webui2/webui/project/_new_project_modal.html.haml diff --git a/src/api/app/views/webui2/webui/project/_form.html.haml b/src/api/app/views/webui2/webui/project/_form.html.haml index cc37938332e..5b70d5f4e1c 100644 --- a/src/api/app/views/webui2/webui/project/_form.html.haml +++ b/src/api/app/views/webui2/webui/project/_form.html.haml @@ -9,7 +9,7 @@ #{namespace}: = form.text_field(:name, required: true, class: 'form-control') - else - = form.label(:name, 'Project Name:', class: 'form-control') + = form.label(:name, 'Project Name:') = form.text_field(:name, required: true, class: 'form-control') .form-group = form.label(:title, 'Title:') diff --git a/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml b/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml new file mode 100644 index 00000000000..f717e9015c0 --- /dev/null +++ b/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml @@ -0,0 +1,8 @@ +.modal.fade#new-project-modal{ tabindex: '-1', role: 'dialog', aria: { labelledby: 'new-project-modal-label', hidden: true } } + .modal-dialog.modal-lg{ role: 'document' } + .modal-content + .modal-header + %h5.modal-title#new-project-modal-label + Create New Project + .modal-body + = render partial: 'form', locals: { project: Project.new, configuration: configuration } diff --git a/src/api/app/views/webui2/webui/project/list.html.haml b/src/api/app/views/webui2/webui/project/list.html.haml index 7a3e4e83fac..0b413247b9f 100644 --- a/src/api/app/views/webui2/webui/project/list.html.haml +++ b/src/api/app/views/webui2/webui/project/list.html.haml @@ -32,9 +32,11 @@ Include #{::Configuration.unlisted_projects_filter_description} - unless User.current.is_nobody? %li.list-inline-item - = link_to(new_project_path) do + = link_to('#', data: { toggle: 'modal', target: '#new-project-modal' }) do %i.fas.fa-plus-circle.text-primary Add New Project + = render partial: 'new_project_modal', locals: { configuration: @configuration } + - cachekey = Digest::MD5.hexdigest(@projects.join) - projecturl = project_show_path('REPLACEIT') #project-list From ef9e8122e949ad7d0f3ae48eab5b9d47ce598e5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Saray=20Cabrera=20Padr=C3=B3n?= Date: Tue, 18 Dec 2018 16:19:07 +0100 Subject: [PATCH 2/2] Unify creation modal for both projects and subprojects They are almost the same, it is not worth having two different views. Co-authored-by: David Kang --- .../webui/project/_add_new_subproject_modal.html.haml | 8 -------- .../webui2/webui/project/_new_project_modal.html.haml | 6 ++++-- .../app/views/webui2/webui/project/subprojects.html.haml | 4 ++-- 3 files changed, 6 insertions(+), 12 deletions(-) delete mode 100644 src/api/app/views/webui2/webui/project/_add_new_subproject_modal.html.haml diff --git a/src/api/app/views/webui2/webui/project/_add_new_subproject_modal.html.haml b/src/api/app/views/webui2/webui/project/_add_new_subproject_modal.html.haml deleted file mode 100644 index a81cb731115..00000000000 --- a/src/api/app/views/webui2/webui/project/_add_new_subproject_modal.html.haml +++ /dev/null @@ -1,8 +0,0 @@ -.modal.fade#add-new-subproject-modal{ tabindex: -1, role: 'dialog', aria: { labelledby: 'add-new-subproject-modal-label', hidden: true } } - .modal-dialog.modal-lg{ role: 'document' } - .modal-content - .modal-header - %h5.modal-title#add-new-subproject-modal-label - Create Subproject - .modal-body - = render partial: 'form', locals: { project: Project.new, namespace: project.name, configuration: configuration } diff --git a/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml b/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml index f717e9015c0..9a1ba89148e 100644 --- a/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml +++ b/src/api/app/views/webui2/webui/project/_new_project_modal.html.haml @@ -3,6 +3,8 @@ .modal-content .modal-header %h5.modal-title#new-project-modal-label - Create New Project + = local_assigns.key?(:project) ? 'Create Subproject' : 'Create Project' .modal-body - = render partial: 'form', locals: { project: Project.new, configuration: configuration } + - options = { project: Project.new, configuration: configuration } + - options[:namespace] = project.name if local_assigns.key?(:project) + = render partial: 'form', locals: options diff --git a/src/api/app/views/webui2/webui/project/subprojects.html.haml b/src/api/app/views/webui2/webui/project/subprojects.html.haml index 058cc41686e..8b346648e4b 100644 --- a/src/api/app/views/webui2/webui/project/subprojects.html.haml +++ b/src/api/app/views/webui2/webui/project/subprojects.html.haml @@ -16,7 +16,7 @@ %p %i This project has no subprojects - if User.current.can_modify?(@project) - = link_to('#', data: { toggle: 'modal', target: '#add-new-subproject-modal' }, title: 'Add New Subproject', class: 'nav-link') do + = link_to('#', data: { toggle: 'modal', target: '#new-project-modal' }, class: 'nav-link') do %i.fas.fa-plus-circle.text-primary Add New Subproject .row.mt-3 @@ -24,7 +24,7 @@ - if @siblings.present? = render partial: 'projects_table', locals: { table_title: 'Sibling Project', project: @project, projects: @siblings } -= render partial: 'add_new_subproject_modal', locals: { project: @project, configuration: @configuration } += render partial: 'new_project_modal', locals: { project: @project, configuration: @configuration } :javascript initializeDataTable('.projects-table');