Skip to content

Commit

Permalink
Refactor views
Browse files Browse the repository at this point in the history
  • Loading branch information
w-masahiro-ct committed Jan 1, 2025
1 parent 1072807 commit cc45a1f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 55 deletions.
16 changes: 8 additions & 8 deletions app/views/passwords/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<% @title = t('.title') %>
<% @title = t(".title") %>

<%= form_for(:password_reset, url: password_path, html: { method: :put }) do |form| %>
<%= error_messages_for @user %>
<div class="password_field">
<%= form.label :password, t("activerecord.attributes.user.password"), :class => 'form__label' %>
<%= form.password_field :password, autocomplete: 'new-password', class: 'form__input' %>
<%= form.label :password, t("activerecord.attributes.user.password"), :class => "form__label" %>
<%= form.password_field :password, autocomplete: "new-password", class: "form__input" %>
</div>
<div class="form__checkbox">
<%= form.check_box :reset_api_key, { :class => 'form__checkbox__input' } , 'true', 'false' %>
<%= form.label :reset_api_key, t('settings.edit.api_access.reset'), :class => 'form__checkbox__label' %>
<%= form.check_box :reset_api_key, { :class => "form__checkbox__input" } , "true", "false" %>
<%= form.label :reset_api_key, t("settings.edit.api_access.reset"), :class => "form__checkbox__label" %>
</div>
<div class="form__checkbox">
<%= form.check_box :reset_api_keys, { :class => 'form__checkbox__input' } , 'true', 'false' %>
<%= form.label :reset_api_keys, t('settings.edit.api_access.reset_all'), :class => 'form__checkbox__label' %>
<%= form.check_box :reset_api_keys, { :class => "form__checkbox__input" } , "true", "false" %>
<%= form.label :reset_api_keys, t("settings.edit.api_access.reset_all"), :class => "form__checkbox__label" %>
</div>

<div class="form_bottom">
<%= form.submit t('.submit'), :data => {:disable_with => t('form_disable_with')}, :class => 'form__submit' %>
<%= form.submit t(".submit"), :data => { :disable_with => t("form_disable_with") }, :class => "form__submit" %>
</div>
<% end %>
18 changes: 9 additions & 9 deletions app/views/profiles/delete.html.erb
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<% @title = t('.title') %>
<% @title = t(".title") %>

<% if @only_owner_gems.any? %>
<div class="t-body">
<p class="page__subheading"><%= (t '.list_only_owner_html', command_link: link_to('gem owner', 'https://guides.rubygems.org/command-reference/#gem-owner')) %></p>
<p class="page__subheading"><%= (t(".list_only_owner_html", command_link: link_to("gem owner", "https://guides.rubygems.org/command-reference/#gem-owner"))) %></p>
</div>
<div id="profile">
<div class="profile-list">
<ul>
<%= render partial: 'rubygem', collection: @only_owner_gems, locals: {owners: true} %>
<%= render partial: "rubygem", collection: @only_owner_gems, locals: {owners: true} %>
</ul>
</div>
</div>
<% end %>

<% if @multi_owner_gems.any? %>
<div class="t-body">
<p class="page__subheading push--s"><%= t '.list_multi_owner' %></p>
<p class="page__subheading push--s"><%= t(".list_multi_owner") %></p>
</div>
<div id="profile">
<div class="profile-list">
<ul>
<%= render partial: 'rubygem', collection: @multi_owner_gems, locals: {owners: true} %>
<%= render partial: "rubygem", collection: @multi_owner_gems, locals: {owners: true} %>
</ul>
</div>
</div>
<% end %>

<div class="t-body push--s">
<p><%= t '.instructions' %></p>
<p><%= t(".instructions") %></p>
<%= form_for current_user, url: destroy_profile_path, method: :delete do |form| %>
<div class="password_field">
<%= form.label :password, t("activerecord.attributes.user.password"), class: 'form__label' %>
<%= form.password_field :password, placeholder: t("activerecord.attributes.user.password"), autocomplete: 'current-password', class: 'form__input' %>
<%= form.label :password, t("activerecord.attributes.user.password"), class: "form__label" %>
<%= form.password_field :password, autocomplete: "current-password", class: "form__input" %>
</div>
<%= form.submit t('.confirm'), data: { confirm: "This action can't be UNDONE! Are you sure?" }, class: 'form__submit' %>
<%= form.submit t(".confirm"), data: { confirm: "This action can't be UNDONE! Are you sure?" }, class: "form__submit" %>
<% end %>
</div>
65 changes: 32 additions & 33 deletions app/views/profiles/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,87 +1,86 @@
<% @title = t('.title') %>
<% @title = t(".title") %>

<%= form_for @user, :url => {:controller => 'profiles', :action => 'update'} do |form| %>
<%= form_for @user, :url => { :controller => "profiles", :action => "update" } do |form| %>
<%= error_messages_for(@user) %>

<div class="avatar_field">
<%= form.label :avatar, :class => 'form__label' %>
<%= form.label :avatar, :class => "form__label" %>
<div class="l-overflow">
<%= avatar(160) %>
<% if @user.public_email? %>
<%= link_to t('.change_avatar'), 'https://www.gravatar.com', :class => 't-text t-link' %>
<%= link_to t(".change_avatar"), "https://www.gravatar.com", :class => "t-text t-link" %>
<% else %>
<%= content_tag 'i', t('.disabled_avatar_html'), :class => 't-text' %>
<%= content_tag "i", t(".disabled_avatar_html"), :class => "t-text" %>
<% end %>
</div>
</div>

<div class="text_field">
<%= form.label :handle, :class => 'form__label' %>
<%= form.text_field :handle, :class => 'form__input' %>
<%= form.label :handle, :class => "form__label" %>
<%= form.text_field :handle, :class => "form__input" %>
</div>

<div class="text_field">
<%= form.label :twitter_username, class: 'form__label form__label__icon-container' do %>
<%= form.label :twitter_username, class: "form__label form__label__icon-container" do %>
<%=
image_tag("/images/x_icon.png", alt: 'X icon', class: 'form__label__icon')
image_tag("/images/x_icon.png", alt: "X icon", class: "form__label__icon")
%>

<span class='form__label__text'><%= t('.twitter_username') %></span>
<span class="form__label__text"><%= t(".twitter_username") %></span>
<% end %>

<p class='form__field__instructions'>
<%= t('.optional_twitter_username') %>
<p class="form__field__instructions">
<%= t(".optional_twitter_username") %>
</p>

<div class="form__input__addon-container form__input__addon-left">
<span class="form__input__addon">@</span>
<%= form.text_field(:twitter_username, class: 'form__input') %>
<%= form.text_field(:twitter_username, class: "form__input") %>
</div>
</div>

<% if current_user.unconfirmed_email %>
<div class="push--bottom-s">
<p class='form__field__instructions'>
<%= t('.email_awaiting_confirmation', unconfirmed_email: current_user.unconfirmed_email) %>
<p class="form__field__instructions">
<%= t(".email_awaiting_confirmation", unconfirmed_email: current_user.unconfirmed_email) %>
</p>
<%= link_to "Resend confirmation", unconfirmed_email_confirmations_path, method: :patch, class: 'form__field__instructions t-link' %>
<%= link_to "Resend confirmation", unconfirmed_email_confirmations_path, method: :patch, class: "form__field__instructions t-link" %>
</div>
<% end %>

<div class="text_field">
<%= form.label :email, :class => 'form__label' %>
<%= form.email_field :email, name: 'user[unconfirmed_email]', class: 'form__input' %>
<%= form.label :email, :class => "form__label" %>
<%= form.email_field :email, name: "user[unconfirmed_email]", class: "form__input" %>
</div>

<div class="text_field">
<%= form.label :full_name, :class => 'form__label' %>
<p class='form__field__instructions'>
<%= t('.optional_full_name') %>
<%= form.label :full_name, :class => "form__label" %>
<p class="form__field__instructions">
<%= t(".optional_full_name") %>
</p>
<%= form.text_field :full_name, :class => 'form__input' %>
<%= form.text_field :full_name, :class => "form__input" %>
</div>

<div class="password_field">
<%= form.label :password, t("activerecord.attributes.user.password"), :class => 'form__label' %>
<p class='form__field__instructions'>
<%= t('.enter_password') %>
<%= form.label :password, t("activerecord.attributes.user.password"), :class => "form__label" %>
<p class="form__field__instructions">
<%= t(".enter_password") %>
</p>
<%= form.password_field :password, autocomplete: 'current-password', class: 'form__input', required: true %>
<%= form.password_field :password, autocomplete: "current-password", class: "form__input", required: true %>
</div>


<div class="profile-checkbox form__checkbox">
<%= form.check_box :public_email, :class => 'form__checkbox__input' %>
<%= form.label :public_email, t('profiles.public_email'), :class => 'form__checkbox__label' %>
<%= form.check_box :public_email, :class => "form__checkbox__input" %>
<%= form.label :public_email, t("profiles.public_email"), :class => "form__checkbox__label" %>
</div>

<div class="submit_field">
<%= form.submit t("update"), :data => {:disable_with => t('form_disable_with')}, :class => 'form__submit' %>
<%= form.submit t("update"), :data => { :disable_with => t("form_disable_with") }, :class => "form__submit" %>
</div>
<% end %>

<div class="t-body">
<h2><%= t '.delete.delete_profile' %></h2>
<p><%= t '.delete.warning' %></p>
<%= button_to t('.delete.delete'), delete_profile_path, method: 'get', class: 'form__submit' %>
<h2><%= t(".delete.delete_profile") %></h2>
<p><%= t(".delete.warning") %></p>
<%= button_to t(".delete.delete"), delete_profile_path, method: "get", class: "form__submit" %>
</div>
10 changes: 5 additions & 5 deletions app/views/settings/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% @title = t(".title") %>

<div class="t-body">
<h2 class="page__subheading"><%= t ".mfa.multifactor_auth" %></h2>
<h2 class="page__subheading"><%= t(".mfa.multifactor_auth") %></h2>
<% if @user.mfa_enabled? %>
<div class="mfa__header-wrapper">
<h2 class="mfa__header mfa__header--compact"><%= t(".mfa.level.title")%></h2>
Expand Down Expand Up @@ -62,21 +62,21 @@
</div>

<div class="t-body">
<h2><%= link_to t('.reset_password.title'), new_password_path %></h2>
<h2><%= link_to t(".reset_password.title"), new_password_path %></h2>
</div>

<div class="t-body">
<h2><%= link_to t('api_keys.index.api_keys'), profile_api_keys_path %></h2>
<h2><%= link_to t("api_keys.index.api_keys"), profile_api_keys_path %></h2>
</div>

<div class="t-body">
<h2><%= link_to t('oidc.pending_trusted_publishers.index.title'), profile_oidc_pending_trusted_publishers_path %></h2>
<h2><%= link_to t("oidc.pending_trusted_publishers.index.title"), profile_oidc_pending_trusted_publishers_path %></h2>
<span><%= t("oidc.pending_trusted_publishers.index.description_html") %></span>
</div>

<% if @user.oidc_api_key_roles.any? %>
<div class="t-body">
<h2><%= link_to t('oidc.api_key_roles.index.api_key_roles'), profile_oidc_api_key_roles_path %></h2>
<h2><%= link_to t("oidc.api_key_roles.index.api_key_roles"), profile_oidc_api_key_roles_path %></h2>
</div>
<% end %>

Expand Down

0 comments on commit cc45a1f

Please sign in to comment.