diff --git a/app/controllers/my/project_repo_mappings_controller.rb b/app/controllers/my/project_repo_mappings_controller.rb
index 7dd430e..7e411e4 100644
--- a/app/controllers/my/project_repo_mappings_controller.rb
+++ b/app/controllers/my/project_repo_mappings_controller.rb
@@ -19,7 +19,7 @@ class My::ProjectRepoMappingsController < ApplicationController
end
if @project_repo_mapping.update(project_repo_mapping_params)
- redirect_to my_project_repo_mapping_path, notice: "Repository mapping updated successfully."
+ redirect_to my_projects_path, notice: "Repository mapping updated successfully."
else
flash.now[:alert] = @project_repo_mapping.errors.full_messages.join(", ")
render :edit, status: :unprocessable_entity
diff --git a/app/views/my/project_repo_mappings/_edit_modal.html.erb b/app/views/my/project_repo_mappings/_edit_modal.html.erb
new file mode 100644
index 0000000..14f0050
--- /dev/null
+++ b/app/views/my/project_repo_mappings/_edit_modal.html.erb
@@ -0,0 +1,51 @@
+<%
+ modal_id = "edit-project-modal-#{project[:project]&.parameterize || 'unknown'}"
+ form_id = "edit-project-form-#{project[:project]&.parameterize || 'unknown'}"
+ project_name = project[:project]
+ repo_url = project[:repo_url] || ""
+ form_content = capture do
+%>
+ <%= form_with model: ProjectRepoMapping.new,
+ url: my_project_repo_mapping_path(CGI.escape(project_name)),
+ method: :patch,
+ local: true,
+ id: form_id,
+ class: "w-full space-y-4" do |f| %>
+
+ <%= f.label :project_name, "Project Name", class: "block text-sm font-semibold text-white" %>
+ <%= f.text_field :project_name,
+ value: project_name,
+ disabled: true,
+ class: "w-full px-4 py-3 bg-darkless text-secondary border border-darkless rounded-lg cursor-not-allowed" %>
+
Project name cannot be changed.
+
+
+
+ <%= f.label :repo_url, "Repository URL", class: "block text-sm font-semibold text-white" %>
+ <%= f.url_field :repo_url,
+ value: repo_url,
+ placeholder: "https://github.com/username/repo",
+ class: "w-full px-4 py-3 bg-darkless text-white border border-darkless rounded-lg focus:border-primary focus:outline-none transition-colors" %>
+
+ <% end %>
+<% end %>
+
+<%= render "shared/modal",
+ modal_id: modal_id,
+ title: "Edit Project Mapping",
+ description: "We try to autodetect your Git repository, but you can manually specify it if needed.",
+ max_width: "max-w-lg",
+ custom: form_content,
+ buttons: [
+ {
+ text: "Cancel",
+ class: "border border-gray-600 text-gray-300 hover:bg-darkless",
+ action: "click->modal#close"
+ },
+ {
+ text: "Update Project",
+ class: "bg-primary text-white hover:bg-red font-medium",
+ form: true,
+ form_id: form_id
+ }
+ ] %>
diff --git a/app/views/my/project_repo_mappings/edit.html.erb b/app/views/my/project_repo_mappings/edit.html.erb
deleted file mode 100644
index b132a2e..0000000
--- a/app/views/my/project_repo_mappings/edit.html.erb
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
Edit Repository Mapping
-
Connect your project to its GitHub repository
-
-
-
- <%= form_with(model: @project_repo_mapping, url: my_project_repo_mapping_path(@project_repo_mapping.project_name), method: :patch, local: true, class: "space-y-6") do |f| %>
-
- <%= f.label :project_name, "Project Name", class: "block text-sm font-semibold text-white" %>
- <%= f.text_field :project_name, value: @project_repo_mapping.project_name, disabled: true,
- class: "w-full px-4 py-3 bg-darkless text-secondary border border-darkless rounded-lg cursor-not-allowed" %>
-
Project name cannot be changed
-
-
-
- <%= f.label :repo_url, "Repository URL", class: "block text-sm font-semibold text-white" %>
- <%= f.url_field :repo_url, placeholder: "https://github.com/username/repo",
- class: "w-full px-4 py-3 bg-darkless text-white border border-darkless rounded-lg focus:border-primary focus:outline-none transition-colors" %>
-
Enter the full GitHub repository URL
-
-
-
- <%= f.submit "Update Mapping", class: "bg-primary hover:bg-red text-white px-6 py-3 rounded-lg font-semibold transition-colors cursor-pointer" %>
- <%= link_to "Cancel", root_path, class: "bg-secondary hover:bg-darkless text-white px-6 py-3 rounded-lg font-semibold transition-colors cursor-pointer" %>
-
- <% end %>
-
-
-
diff --git a/app/views/shared/_modal.html.erb b/app/views/shared/_modal.html.erb
index 1e9bdf2..f9e2488 100644
--- a/app/views/shared/_modal.html.erb
+++ b/app/views/shared/_modal.html.erb
@@ -38,16 +38,24 @@
<% buttons.each do |button| %>
<% if button[:form] %>
-
+ <% else %>
+
+ <% end %>
<% else %>