Skip to content

Commit

Permalink
Removed edits from form and added a todo task in import.html
Browse files Browse the repository at this point in the history
  • Loading branch information
harshit-soora committed Feb 25, 2025
1 parent 78f0103 commit f8d5357
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 26 deletions.
43 changes: 18 additions & 25 deletions apps/dashboard/app/views/projects/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%
edit_project_action = action_name != "new" && action_name != "create" && action_name != "import"
import_project_action = action_name == "import"
edit_project_action = action_name != "new" && action_name != "create"

path_selector_id = "project_directory_path_selector"

path_selector_locals = {
Expand All @@ -27,13 +27,10 @@
<div class='card'>
<div class='card-body'>
<div class="col">

<% if !import_project_action %>
<div class="field">
<%= form.text_field :name, placeholder: I18n.t('dashboard.jobs_project_name_placeholder'),
help: I18n.t('dashboard.jobs_project_name_validation') %>
</div>
<% end %>

<div class="field">
<%= form.text_field(:directory, placeholder: I18n.t('dashboard.jobs_project_directory_placeholder'),
Expand All @@ -49,35 +46,31 @@
<%= render(partial: 'shared/path_selector_table', locals: path_selector_locals ) %>
</div>

<% if !import_project_action %>
<div class="field">
<%= form.text_area :description, placeholder: I18n.t('dashboard.jobs_project_description_placeholder') %>
</div>
<% end %>
</div>
</div>
</div>
<div class="card">
<div class='card-body'>
<div class="col">
<% if !import_project_action %>
<div class="field">
<%= javascript_include_tag('icon_picker', nonce: true, type: 'module') %>
<%= form.text_field :icon, placeholder: "cog", id: "product_icon_select", value: @project.icon_class %>
<% if @project.icon =~ /(fa[bsrl]?):\/\/(.*)/ %>
<% icon = $2; style = $1 %>
<p class="text-center">
<%= fa_icon(icon, fa_style: style, id: "product_icon") %>
</p>
<% else %>
<p class="text-center">
<%= fa_icon("cog", fa_style: "fas", id: "product_icon") %>
</p>
<% end %>
<ul id="icon_picker_list">
</ul>
</div>
<% end %>
<div class="field">
<%= javascript_include_tag('icon_picker', nonce: true, type: 'module') %>
<%= form.text_field :icon, placeholder: "cog", id: "product_icon_select", value: @project.icon_class %>
<% if @project.icon =~ /(fa[bsrl]?):\/\/(.*)/ %>
<% icon = $2; style = $1 %>
<p class="text-center">
<%= fa_icon(icon, fa_style: style, id: "product_icon") %>
</p>
<% else %>
<p class="text-center">
<%= fa_icon("cog", fa_style: "fas", id: "product_icon") %>
</p>
<% end %>
<ul id="icon_picker_list">
</ul>
</div>
</div>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/dashboard/app/views/projects/import.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Import a Shared Project
</h1>
</div>

# TODO: Add a new partial for this. May be similar to index with a list of cards or a simple search
# Right now it point to "Create new Project" form
<%= bootstrap_form_for(@project, url: project_import_save_path, method: :post) do |form| %>
<%= render partial: "form", locals: { form: form }%>
<% end %>

0 comments on commit f8d5357

Please sign in to comment.