Skip to content

Commit

Permalink
chore: upgrade phoenix to 1.7.10
Browse files Browse the repository at this point in the history
  • Loading branch information
nwittstruck committed Jan 25, 2024
1 parent 5de5b4f commit 9705fd4
Show file tree
Hide file tree
Showing 16 changed files with 311 additions and 148 deletions.
12 changes: 4 additions & 8 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[
import_deps: [:ecto, :phoenix],
inputs: [
"*.{ex,exs}",
"priv/repo/data_migrations/*.{ex,exs}",
"priv/*/seeds.exs",
"{config,lib,test}/**/*.{ex,exs}"
],
subdirectories: ["priv/*/migrations"]
import_deps: [:ecto, :ecto_sql, :phoenix],
subdirectories: ["priv/*/migrations"],
plugins: [Phoenix.LiveView.HTMLFormatter],
inputs: ["*.{heex,ex,exs}", "{config,lib,test}/**/*.{heex,ex,exs}", "priv/*/seeds.exs"]
]
122 changes: 90 additions & 32 deletions lib/mindwendel_web/live/admin/brainstorming_live/edit.html.heex
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div class="card mb-3">
<div class="card-header">
<h4><%= gettext("Administration for brainstorming: %{name}", name: @brainstorming.name) %></h4>
<h4>
<%= gettext("Administration for brainstorming: %{name}", name: @brainstorming.name) %>
</h4>
</div>
<div class="card-body">
<p><%= gettext("Save this link to update / delete your brainstorming later on:") %></p>
Expand All @@ -12,7 +14,7 @@
id="brainstorming-link-input-readonly"
readonly="true"
type="text"
value={ URI.to_string(@uri) }
value={URI.to_string(@uri)}
/>
<button
class="btn btn-outline-secondary"
Expand All @@ -26,9 +28,9 @@
<button
aria-label="Share brainstorming"
class="btn btn-outline-secondary"
data-native-sharing-button-share-data-text={ gettext("Join my brainstorming") }
data-native-sharing-button-share-data-title={ gettext("Mindwendel Brainstorming") }
data-native-sharing-button-share-data-url={ URI.to_string(@uri) }
data-native-sharing-button-share-data-text={gettext("Join my brainstorming")}
data-native-sharing-button-share-data-title={gettext("Mindwendel Brainstorming")}
data-native-sharing-button-share-data-url={URI.to_string(@uri)}
id="brainstorming-link-share-button"
phx-hook="NativeSharingButton"
>
Expand All @@ -37,9 +39,18 @@
</div>
<br />
<i class="far fa-arrow-alt-circle-right"></i>
<%= link gettext("Proceed to your brainstorming"), to: Routes.brainstorming_show_path(@socket, :show, @brainstorming), class: "fw-bold" %>
<%= link(gettext("Proceed to your brainstorming"),
to: Routes.brainstorming_show_path(@socket, :show, @brainstorming),
class: "fw-bold"
) %>
<br />
<p>(<%= gettext("Brainstorming will be deleted ") %> <%= Timex.format!(brainstorming_available_until(@brainstorming), "{relative}", :relative) %>)</p>
<p>
(<%= gettext("Brainstorming will be deleted ") %> <%= Timex.format!(
brainstorming_available_until(@brainstorming),
"{relative}",
:relative
) %>)
</p>
</div>
</div>

Expand All @@ -50,9 +61,14 @@
<div class="card-body">
<%= form_for @changeset, "#", [phx_submit: :save, phx_change: :save, id: "form-edit-brainstorming"], fn f -> %>
<div class="mb-3 position-relative">
<%= label f, :name, class: "form-label" %>
<%= text_input f, :name, class: "form-control #{if f.errors[:name], do: "is-invalid"} #{if f.source.changes[:name], do: "is-valid"}", phx_debounce: 500, phx_feedback_for: input_id(f, :name) %>
<%= error_tag_tooltip f, :name %>
<%= label(f, :name, class: "form-label") %>
<%= text_input(f, :name,
class:
"form-control #{if f.errors[:name], do: "is-invalid"} #{if f.source.changes[:name], do: "is-valid"}",
phx_debounce: 500,
phx_feedback_for: input_id(f, :name)
) %>
<%= error_tag_tooltip(f, :name) %>
<%= content_tag(:div,
class: "valid-tooltip",
phx_feedback_for: input_id(f, :name)
Expand All @@ -62,15 +78,23 @@
</div>

<div class="form-check mb-3 position-relative">
<%= checkbox f, :option_show_link_to_settings, id: "checkbox-option-show-link-to-settings", class: "form-check-input #{if f.source.changes[:option_show_link_to_settings] != nil, do: "is-valid"}" %>
<%= label f, :option_show_link_to_settings,
gettext("Show brainstorming settings link for all users"),
for: "checkbox-option-show-link-to-settings",
class: "form-check-label"
%>
<%= checkbox(f, :option_show_link_to_settings,
id: "checkbox-option-show-link-to-settings",
class:
"form-check-input #{if f.source.changes[:option_show_link_to_settings] != nil, do: "is-valid"}"
) %>
<%= label(
f,
:option_show_link_to_settings,
gettext("Show brainstorming settings link for all users"),
for: "checkbox-option-show-link-to-settings",
class: "form-check-label"
) %>
<br />
<small class="form-text text-muted">
<%= gettext("Warning: Please make sure you save the admin link at the top, before hiding the settings link!") %>
<%= gettext(
"Warning: Please make sure you save the admin link at the top, before hiding the settings link!"
) %>
</small>
<%= content_tag(:div,
class: "valid-tooltip",
Expand All @@ -93,30 +117,53 @@
<div class="col">
<%= inputs_for f, :labels, fn p -> %>
<div class="input-group has-validation mb-3 ">
<%= color_input p, :color, class: "form-control form-control-color #{if p.errors[:color], do: "is-invalid"} #{if p.source.changes[:name] || p.source.changes[:color], do: "border-success"}", style: "max-width: 50px", title: gettext("Choose the label color") %>
<%= text_input p, :name, class: "form-control #{if p.errors[:name] || p.errors[:idea_idea_labels] || f.errors[:labels], do: "is-invalid"} #{if p.source.changes[:name] || p.source.changes[:color], do: "is-valid"}", placeholder: gettext("Type the label name"), phx_debounce: 500 %>
<button class="btn btn-outline-secondary" type="button" phx-click="remove_idea_label" value={ input_value(p, :id) }><%= gettext("Remove idea label") %></button>
<%= error_tag_tooltip p, :color %>
<%= error_tag_tooltip p, :name %>
<%= color_input(p, :color,
class:
"form-control form-control-color #{if p.errors[:color], do: "is-invalid"} #{if p.source.changes[:name] || p.source.changes[:color], do: "border-success"}",
style: "max-width: 50px",
title: gettext("Choose the label color")
) %>
<%= text_input(p, :name,
class:
"form-control #{if p.errors[:name] || p.errors[:idea_idea_labels] || f.errors[:labels], do: "is-invalid"} #{if p.source.changes[:name] || p.source.changes[:color], do: "is-valid"}",
placeholder: gettext("Type the label name"),
phx_debounce: 500
) %>
<button
class="btn btn-outline-secondary"
type="button"
phx-click="remove_idea_label"
value={input_value(p, :id)}
>
<%= gettext("Remove idea label") %>
</button>
<%= error_tag_tooltip(p, :color) %>
<%= error_tag_tooltip(p, :name) %>
<%= if message = p.errors[:idea_idea_labels] do %>
<span class="is-invalid"></span>
<span class="invalid-tooltip" phx_feedback_for={ input_id(p, :name)}><%= translate_error(message) %></span>
<span class="is-invalid"></span>
<span class="invalid-tooltip" phx_feedback_for={input_id(p, :name)}>
<%= translate_error(message) %>
</span>
<% end %>
<%= if message = f.errors[:labels] do %>
<span class="invalid-tooltip" phx_feedback_for={ input_id(f, :labels)}><%= translate_error(message) %></span>
<span class="invalid-tooltip" phx_feedback_for={input_id(f, :labels)}>
<%= translate_error(message) %>
</span>
<% end %>
<%= content_tag(:span, class: "valid-tooltip", phx_feedback_for: input_id(f, :labels)) do %>
<%= gettext("Saved") %>
<% end %>
</div>
<% end %>
<%= error_tag_tooltip f, :labels %>
<%= error_tag_tooltip(f, :labels) %>
</div>
</div>

<div class="row mb-3">
<div class="col-12 d-grid">
<button type="button" class="btn btn-secondary" phx-click="add_idea_label"><%= gettext("Add idea label") %></button>
<button type="button" class="btn btn-secondary" phx-click="add_idea_label">
<%= gettext("Add idea label") %>
</button>
</div>
</div>
<% end %>
Expand All @@ -128,8 +175,17 @@
<h4><%= gettext("Export") %></h4>
</div>
<div class="card-body">
<%= link gettext("Export to CSV"), to: Routes.admin_brainstorming_path(@socket, :export, @brainstorming.admin_url_id, _format: "csv"), class: "fw-bold"%><br />
<%= link gettext("Export to HTML"), to: Routes.admin_brainstorming_path(@socket, :export, @brainstorming.admin_url_id), class: "fw-bold" %>
<%= link(gettext("Export to CSV"),
to:
Routes.admin_brainstorming_path(@socket, :export, @brainstorming.admin_url_id,
_format: "csv"
),
class: "fw-bold"
) %><br />
<%= link(gettext("Export to HTML"),
to: Routes.admin_brainstorming_path(@socket, :export, @brainstorming.admin_url_id),
class: "fw-bold"
) %>
</div>
</div>

Expand All @@ -141,14 +197,16 @@
<div class="row mb-3">
<div class="col">
<p>
<%= gettext("Attention: This will delete the brainstorming with all belonging ideas and other associated records to it. This cant be undone") %>
<%= gettext(
"Attention: This will delete the brainstorming with all belonging ideas and other associated records to it. This cant be undone"
) %>
</p>
<%= button gettext("Delete"),
<%= button(gettext("Delete"),
"data-confirm": gettext("Brainstorming delete are you sure"),
class: "btn btn-danger",
method: :delete,
to: Routes.admin_brainstorming_path(@socket, :delete, @brainstorming.admin_url_id)
%>
) %>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<div>
<div class="row mb-3">
<div class="input-group">
Expand Down Expand Up @@ -33,15 +32,11 @@
</div>
</div>

<hr/>
<hr />

<div class="row mb-3">
<div class="d-flex justify-content-center">
<div
data-qr-code-url={@uri}
id="brainstorming-link-qr-code-canvas"
phx-hook="QrCodeCanvas"
>
<div data-qr-code-url={@uri} id="brainstorming-link-qr-code-canvas" phx-hook="QrCodeCanvas">
</div>
</div>
</div>
Expand All @@ -59,7 +54,6 @@
<i class="bi-download"></i> <%= gettext("Download as svg") %>
</a>
&nbsp;

<a
class="btn btn-primary"
data-qr-code-file-extension="png"
Expand All @@ -70,7 +64,6 @@
>
<i class="bi-download"></i> <%= gettext("Download as png") %>
</a>

</div>
</div>
</div>
42 changes: 30 additions & 12 deletions lib/mindwendel_web/live/brainstorming_live/show.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<%= if @inspiration do %>
<a data-bs-toggle="collapse" href="#inspiration" role="button" aria-expanded="false">
<i class="bi-question-circle"></i> <%= gettext("Got stuck? Try inspirational teasers!") %>
</a><br /><br />
</a>
<br /><br />
<div class="alert alert-info collapse" id="inspiration">
<p>
<%= @inspiration.title %>
Expand All @@ -21,7 +22,11 @@
</div>
<div class="col-sm-12 col-md-12 col-xl-6">
<div class="d-grid d-md-flex justify-content-md-end">
<%= live_patch gettext("New Idea"), to: Routes.brainstorming_show_path(@socket, :new_idea, @brainstorming), class: "btn btn-primary m-1", title: gettext("New idea page (Hotkey: i)") %>
<%= live_patch(gettext("New Idea"),
to: Routes.brainstorming_show_path(@socket, :new_idea, @brainstorming),
class: "btn btn-primary m-1",
title: gettext("New idea page (Hotkey: i)")
) %>
<%= link to: "#", class: "btn btn-primary m-1", phx_click: "sort_by_likes", phx_value_id: @brainstorming.id, title: gettext("Sort by likes") do %>
<i class="bi-sort-numeric-up-alt"></i> <%= gettext("Sort by likes") %>
<% end %>
Expand All @@ -44,53 +49,66 @@
</div>

<%= if @live_action in [:edit] do %>
<%= live_modal MindwendelWeb.BrainstormingLive.FormComponent,
<%= live_modal(MindwendelWeb.BrainstormingLive.FormComponent,
id: @brainstorming.id,
title: @page_title,
action: @live_action,
brainstorming: @brainstorming,
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming) %>
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming)
) %>
<% end %>

<%= if @live_action in [:new_idea] do %>
<%= live_modal MindwendelWeb.IdeaLive.FormComponent,
<%= live_modal(MindwendelWeb.IdeaLive.FormComponent,
id: :new,
title: gettext("New idea"),
action: :new,
brainstorming: @brainstorming,
current_user: @current_user,
idea: @idea,
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming) %>
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming)
) %>
<% end %>

<%= if @live_action in [:edit_idea] do %>
<%= live_modal MindwendelWeb.IdeaLive.FormComponent,
<%= live_modal(MindwendelWeb.IdeaLive.FormComponent,
id: :update,
title: gettext("Update idea"),
action: :update,
brainstorming: @brainstorming,
current_user: @current_user,
idea: @idea,
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming) %>
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming)
) %>
<% end %>

<%= if @live_action in [:share] do %>
<%= live_modal MindwendelWeb.BrainstormingLive.ShareComponent,
<%= live_modal(MindwendelWeb.BrainstormingLive.ShareComponent,
id: :share,
title: gettext("Share brainstorming"),
action: :share,
brainstorming: @brainstorming,
current_user: @current_user,
uri: Routes.brainstorming_show_url(@socket, :show, @brainstorming),
modal_size: "modal-lg",
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming) %>
return_to: Routes.brainstorming_show_path(@socket, :show, @brainstorming)
) %>
<% end %>

<%= live_component MindwendelWeb.IdeaLive.IndexComponent, ideas: @ideas, brainstorming: @brainstorming, id: @brainstorming.id, current_user: @current_user %>
<%= live_component(MindwendelWeb.IdeaLive.IndexComponent,
ideas: @ideas,
brainstorming: @brainstorming,
id: @brainstorming.id,
current_user: @current_user
) %>

<footer class="footer fixed-bottom d-lg-none bg-light">
<div class="d-grid gap-2">
<%= live_patch gettext("New Idea"), to: Routes.brainstorming_show_path(@socket, :new_idea, @brainstorming), class: "btn btn-primary", title: gettext("Open new idea page (Hotkey: i)") %>
<%= live_patch(gettext("New Idea"),
to: Routes.brainstorming_show_path(@socket, :new_idea, @brainstorming),
class: "btn btn-primary",
title: gettext("Open new idea page (Hotkey: i)")
) %>
</div>
</footer>
</div>
Expand Down
Loading

0 comments on commit 9705fd4

Please sign in to comment.