Convert spree/admin/mail_methods from erb to haml

This commit is contained in:
luisramos0
2019-09-17 16:42:54 +01:00
parent 96737da128
commit 42e3f2f2f4
4 changed files with 75 additions and 97 deletions

View File

@@ -1,76 +0,0 @@
<div data-hook="admin_mail_method_form_fields">
<div class="row">
<div class="alpha six columns" data-hook="general">
<fieldset class="no-border-bottom">
<legend align="center"><%= Spree.t(:general) %></legend>
<div class="field">
<%= preference_field_tag("enable_mail_delivery", Spree::Config[:enable_mail_delivery], :type => :boolean) %>
<%= label_tag :enable_mail_delivery, Spree.t(:enable_mail_delivery) %>
</div>
<div class="field">
<%= label_tag :mails_from, Spree.t(:send_mails_as) %><br />
<%= text_field_tag :mails_from, Spree::Config[:mails_from], :maxlength => 256, :class => 'fullwidth' %>
<br />
<span class="info">
<%= Spree.t(:smtp_send_all_emails_as_from_following_address) %>
</span>
</div>
<div class="field">
<%= label_tag :mail_bcc, Spree.t(:send_copy_of_all_mails_to) %><br />
<%= text_field_tag :mail_bcc, Spree::Config[:mail_bcc], :maxlength => 256, :class => 'fullwidth' %>
<br />
<span class="info">
<%= Spree.t(:smtp_send_copy_to_this_addresses) %>
</span>
</div>
<div class="field">
<%= label_tag :intercept_email, Spree.t(:intercept_email_address) %><br />
<%= text_field_tag :intercept_email, Spree::Config[:intercept_email], :maxlength => 256, :class => 'fullwidth' %>
<br />
<span class="info">
<%= Spree.t(:intercept_email_instructions) %>
</span>
</div>
</fieldset>
</div>
<div class="six columns omega" data-hook="smtp">
<fieldset class="no-border-bottom">
<legend align="center"><%= Spree.t(:smtp) %></legend>
<div class="field">
<%= label_tag :mail_domain, Spree.t(:smtp_domain) %><br />
<%= text_field_tag :mail_domain, Spree::Config[:mail_domain], :class => 'fullwidth' %>
</div>
<div class="field">
<%= label_tag :mail_host, Spree.t(:smtp_mail_host) %><br />
<%= text_field_tag :mail_host, Spree::Config[:mail_host], :class => 'fullwidth' %>
</div>
<div class="field">
<%= label_tag :mail_port, Spree.t(:smtp_port) %><br />
<%= text_field_tag :mail_port, Spree::Config[:mail_port], :class => 'fullwidth' %>
</div>
<div class="field">
<%= label_tag :secure_connection_type, Spree.t(:secure_connection_type) %><br />
<%= select_tag(:secure_connection_type, options_from_collection_for_select(Spree::Core::MailSettings::SECURE_CONNECTION_TYPES.map{|w| Spree.t(w.downcase.to_sym, :default => w)}, :to_s, :to_s, Spree::Config[:secure_connection_type]), :class => 'select2 fullwidth') %>
</div>
<div class="field">
<%= label_tag :mail_auth_type, Spree.t(:smtp_authentication_type) %><br />
<%= select_tag(:mail_auth_type, options_from_collection_for_select(Spree::Core::MailSettings::MAIL_AUTH.map{|w| Spree.t(w.downcase.to_sym, :default => w)}, :to_s, :to_s, Spree::Config[:mail_auth_type]), :class => 'select2 fullwidth') %>
</div>
<div class="field">
<%= label_tag :smtp_username, Spree.t(:smtp_username) %><br />
<%= text_field_tag :smtp_username, Spree::Config[:smtp_username], :class => 'fullwidth' %>
</div>
<div class="field">
<%= label_tag :preferred_smtp_password, Spree.t(:smtp_password) %><br />
<%= password_field_tag :smtp_password, Spree::Config[:smtp_password], :class => 'fullwidth' %>
</div>
</fieldset>
</div>
</div>
</div>

View File

@@ -0,0 +1,60 @@
%div
.row
.alpha.six.columns
%fieldset.no-border-bottom
%legend{align: "center"}= t("spree.general")
.field
= preference_field_tag("enable_mail_delivery", Spree::Config[:enable_mail_delivery], type: :boolean)
= label_tag :enable_mail_delivery, t("spree.enable_mail_delivery")
.field
= label_tag :mails_from, t("spree.send_mails_as")
%br/
= text_field_tag :mails_from, Spree::Config[:mails_from], maxlength: 256, class: 'fullwidth'
%br/
%span.info
= t("spree.smtp_send_all_emails_as_from_following_address")
.field
= label_tag :mail_bcc, t("spree.send_copy_of_all_mails_to")
%br/
= text_field_tag :mail_bcc, Spree::Config[:mail_bcc], maxlength: 256, class: 'fullwidth'
%br/
%span.info
= t("spree.smtp_send_copy_to_this_addresses")
.field
= label_tag :intercept_email, t("spree.intercept_email_address")
%br/
= text_field_tag :intercept_email, Spree::Config[:intercept_email], maxlength: 256, class: 'fullwidth'
%br/
%span.info
= t("spree.intercept_email_instructions")
.six.columns.omega
%fieldset.no-border-bottom
%legend{align: "center"}= t("spree.smtp")
.field
= label_tag :mail_domain, t("spree.smtp_domain")
%br/
= text_field_tag :mail_domain, Spree::Config[:mail_domain], class: 'fullwidth'
.field
= label_tag :mail_host, t("spree.smtp_mail_host")
%br/
= text_field_tag :mail_host, Spree::Config[:mail_host], class: 'fullwidth'
.field
= label_tag :mail_port, t("spree.smtp_port")
%br/
= text_field_tag :mail_port, Spree::Config[:mail_port], class: 'fullwidth'
.field
= label_tag :secure_connection_type, t("spree.secure_connection_type")
%br/
= select_tag(:secure_connection_type, options_from_collection_for_select(Spree::Core::MailSettings::SECURE_CONNECTION_TYPES.map{|w| Spree.t(w.downcase.to_sym, default: w)}, :to_s, :to_s, Spree::Config[:secure_connection_type]), class: 'select2 fullwidth')
.field
= label_tag :mail_auth_type, t("spree.smtp_authentication_type")
%br/
= select_tag(:mail_auth_type, options_from_collection_for_select(Spree::Core::MailSettings::MAIL_AUTH.map{|w| Spree.t(w.downcase.to_sym, default: w)}, :to_s, :to_s, Spree::Config[:mail_auth_type]), class: 'select2 fullwidth')
.field
= label_tag :smtp_username, t("spree.smtp_username")
%br/
= text_field_tag :smtp_username, Spree::Config[:smtp_username], class: 'fullwidth'
.field
= label_tag :preferred_smtp_password, t("spree.smtp_password")
%br/
= password_field_tag :smtp_password, Spree::Config[:smtp_password], class: 'fullwidth'

View File

@@ -1,21 +0,0 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:mail_method_settings) %>
<% end %>
<% content_for :page_actions do %>
<li>
<%= link_to_with_icon 'icon-envelope-alt', Spree.t('admin.mail_methods.send_testmail'), testmail_admin_mail_method_path,
:method => :post, :title => Spree.t('admin.mail_methods.send_testmail'), :class => 'send_mail button no-text' %>
</li>
<% end %>
<%= render :partial => 'spree/shared/error_messages', :locals => { :target => @mail_method } %>
<%= form_tag admin_mail_method_path, :method => :put do |f| %>
<fieldset class="no-border-top">
<%= render :partial => 'form', :locals => { :f => f } %>
<div class="form-buttons filter-actions actions" data-hook="buttons"><%= button Spree.t('actions.update'), 'icon-refresh' %></div>
</fieldset>
<% end %>

View File

@@ -0,0 +1,15 @@
= render partial: 'spree/admin/shared/configuration_menu'
- content_for :page_title do
= t("spree.mail_method_settings")
- content_for :page_actions do
%li
= link_to_with_icon 'icon-envelope-alt', t("spree.admin.mail_methods.send_testmail"), testmail_admin_mail_method_path, method: :post, title: t("spree.admin.mail_methods.send_testmail"), class: 'send_mail button no-text'
= render partial: 'spree/shared/error_messages', locals: { target: @mail_method }
= form_tag admin_mail_method_path, method: :put do |f|
%fieldset.no-border-top
= render partial: 'form', locals: { f: f }
.form-buttons.filter-actions.actions= button t("spree.actions.update"), 'icon-refresh'