Convert spree/admin/image_settings/edit.html from erb to haml

This commit is contained in:
luisramos0
2019-07-16 14:43:20 +01:00
parent 22c9f33f4c
commit 9db4edcd0d
2 changed files with 78 additions and 126 deletions

View File

@@ -1,126 +0,0 @@
<%= render :partial => 'spree/admin/shared/configuration_menu' %>
<% content_for :page_title do %>
<%= Spree.t(:image_settings) %>
<% end %>
<%= form_tag admin_image_settings_path, :method => :put do %>
<% destroy = Spree.t(:destroy) %>
<fieldset class="no-border-top">
<fieldset class="no-border-bottom">
<legend align="center"><%= Spree.t(:general_settings)%></legend>
<div class="field">
<div class="warning note"><%= Spree.t(:image_settings_warning) %></div>
</div>
<div data-hook="attachment_path" class="field">
<%= label_tag 'preferences[attachment_path]', Spree.t(:attachment_path) %>
<%= preference_field_tag 'preferences[attachment_path]', Spree::Config[:attachment_path], :type => :string %>
</div>
<div class="alpha eight columns">
<div data-hook="attachment_default_url" class="field">
<%= label_tag 'preferences[attachment_default_url]', Spree.t(:attachment_default_url) %>
<%= preference_field_tag 'preferences[attachment_default_url]', Spree::Config[:attachment_default_url], :type => :string %>
</div>
</div>
<div class="alpha eight columns">
<div data-hook="attachment_url" class="field">
<%= label_tag 'preferences[attachment_url]', Spree.t(:attachment_url) %>
<%= preference_field_tag 'preferences[attachment_url]', Spree::Config[:attachment_url], :type => :string %>
</div>
</div>
<div class="omega four columns">
<div data-hook="attachment_default_style" class="field">
<%= label_tag 'preferences[attachment_default_style]', Spree.t(:attachment_default_style) %>
<%= collection_select 'preferences', 'attachment_default_style', @styles, :first, :first, {:selected => Spree::Config[:attachment_default_style] }, :class => 'select2 fullwidth' %>
</div>
</div>
<div class="clear"></div>
<div data-hook="use_s3" class="field">
<%= preference_field_tag 'preferences[use_s3]', Spree::Config[:use_s3], :type => :boolean %>
<%= label_tag 'preferences[use_s3]', Spree.t(:use_s3) %>
</div>
</fieldset>
<fieldset class="no-border-bottom" id="attachment_styles" data-hook="attachment_styles">
<legend align="center"><%= Spree.t(:attachment_styles) %></legend>
<div id="styles_list" class="row frameless">
<% @styles.each_with_index do |(style_name, style_value), index| %>
<div class="field three columns">
<%= label_tag "attachment_styles[#{style_name}]", style_name %>
<a href='#' alt="<%= destroy %>" title="<%= destroy %>" class='destroy_style with-tip'><i class='icon-trash'></i></a>
<%= text_field_tag "attachment_styles[#{style_name}]", style_value, :class => 'fullwidth' %>
</div>
<% end %>
</div>
<div id="new-styles" class="row frameless"></div>
<div class="field">
<%= link_to_with_icon 'icon-plus', Spree.t(:add_new_style), '#', :class => 'add_new_style button' %>
</div>
</fieldset>
<div class="row">
<div class="alpha six columns" id="s3_settings" data-hook="s3_settings" style="display: none">
<fieldset class="no-border-bottom">
<legend align="center"><%= Spree.t(:configure_s3) %></legend>
<div data-hook="s3_access_key" class="field">
<%= label_tag 'preferences[s3_access_key]', Spree.t(:s3_access_key) %>
<%= preference_field_tag 'preferences[s3_access_key]', Spree::Config[:s3_access_key], :type => :string %>
</div>
<div data-hook="s3_secret" class="field">
<%= label_tag 'preferences[s3_secret]', Spree.t(:s3_secret) %>
<%= preference_field_tag 'preferences[s3_secret]', Spree::Config[:s3_secret], :type => :string %>
</div>
<div data-hook="s3_bucket" class="field">
<%= label_tag 'preferences[s3_bucket]', Spree.t(:s3_bucket) %>
<%= preference_field_tag 'preferences[s3_bucket]', Spree::Config[:s3_bucket], :type => :string %>
</div>
<div data-hook="s3_protocol" class="field">
<%= label_tag 'preferences[s3_protocol]', Spree.t(:s3_protocol) %>
<%= preference_field_tag 'preferences[s3_protocol]', Spree::Config[:s3_protocol], :type => :string %>
</div>
</fieldset>
</div>
<div class="omega six columns" id="s3_headers" data-hook="s3_headers" style="display: none">
<fieldset class="no-border-bottom">
<legend align="center"><%= Spree.t(:s3_headers) %></legend>
<div id="headers_list">
<% @headers.each do |header_name, header_value| %>
<div class="field">
<%= label_tag "s3_headers[#{header_name}]", header_name %>
<a href="#" alt="<%= destroy %>" title="<%= destroy %>" class="destroy_header with-tip"><i class="icon-trash"></i></a>
<%= text_field_tag "s3_headers[#{header_name}]", header_value, :class => 'fullwidth' %>
</div>
<% end %>
</div>
<%= link_to_with_icon 'icon-plus', Spree.t(:add_new_header), '#', :class => 'add_header button' %>
</fiedlset>
</div>
</div>
<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,78 @@
= render :partial => 'spree/admin/shared/configuration_menu'
- content_for :page_title do
= Spree.t(:image_settings)
= form_tag admin_image_settings_path, :method => :put do
- destroy = Spree.t(:destroy)
%fieldset.no-border-top
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:general_settings)
.field
.warning.note= Spree.t(:image_settings_warning)
.field{"data-hook" => "attachment_path"}
= label_tag 'preferences[attachment_path]', Spree.t(:attachment_path)
= preference_field_tag 'preferences[attachment_path]', Spree::Config[:attachment_path], :type => :string
.alpha.eight.columns
.field{"data-hook" => "attachment_default_url"}
= label_tag 'preferences[attachment_default_url]', Spree.t(:attachment_default_url)
= preference_field_tag 'preferences[attachment_default_url]', Spree::Config[:attachment_default_url], :type => :string
.alpha.eight.columns
.field{"data-hook" => "attachment_url"}
= label_tag 'preferences[attachment_url]', Spree.t(:attachment_url)
= preference_field_tag 'preferences[attachment_url]', Spree::Config[:attachment_url], :type => :string
.omega.four.columns
.field{"data-hook" => "attachment_default_style"}
= label_tag 'preferences[attachment_default_style]', Spree.t(:attachment_default_style)
= collection_select 'preferences', 'attachment_default_style', @styles, :first, :first, {:selected => Spree::Config[:attachment_default_style] }, :class => 'select2 fullwidth'
.clear
.field{"data-hook" => "use_s3"}
= preference_field_tag 'preferences[use_s3]', Spree::Config[:use_s3], :type => :boolean
= label_tag 'preferences[use_s3]', Spree.t(:use_s3)
%fieldset#attachment_styles.no-border-bottom{"data-hook" => "attachment_styles"}
%legend{:align => "center"}= Spree.t(:attachment_styles)
#styles_list.row.frameless
- @styles.each_with_index do |(style_name, style_value), index|
.field.three.columns
= label_tag "attachment_styles[#{style_name}]", style_name
%a.destroy_style.with-tip{:alt => destroy, :href => "#", :title => destroy}
%i.icon-trash
= text_field_tag "attachment_styles[#{style_name}]", style_value, :class => 'fullwidth'
#new-styles.row.frameless
.field
= link_to_with_icon 'icon-plus', Spree.t(:add_new_style), '#', :class => 'add_new_style button'
.row
#s3_settings.alpha.six.columns{"data-hook" => "s3_settings", :style => "display: none"}
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:configure_s3)
.field{"data-hook" => "s3_access_key"}
= label_tag 'preferences[s3_access_key]', Spree.t(:s3_access_key)
= preference_field_tag 'preferences[s3_access_key]', Spree::Config[:s3_access_key], :type => :string
.field{"data-hook" => "s3_secret"}
= label_tag 'preferences[s3_secret]', Spree.t(:s3_secret)
= preference_field_tag 'preferences[s3_secret]', Spree::Config[:s3_secret], :type => :string
.field{"data-hook" => "s3_bucket"}
= label_tag 'preferences[s3_bucket]', Spree.t(:s3_bucket)
= preference_field_tag 'preferences[s3_bucket]', Spree::Config[:s3_bucket], :type => :string
.field{"data-hook" => "s3_protocol"}
= label_tag 'preferences[s3_protocol]', Spree.t(:s3_protocol)
= preference_field_tag 'preferences[s3_protocol]', Spree::Config[:s3_protocol], :type => :string
#s3_headers.omega.six.columns{"data-hook" => "s3_headers", :style => "display: none"}
%fieldset.no-border-bottom
%legend{:align => "center"}= Spree.t(:s3_headers)
#headers_list
- @headers.each do |header_name, header_value|
.field
= label_tag "s3_headers[#{header_name}]", header_name
%a.destroy_header.with-tip{:alt => destroy, :href => "#", :title => destroy}
%i.icon-trash
= text_field_tag "s3_headers[#{header_name}]", header_value, :class => 'fullwidth'
= link_to_with_icon 'icon-plus', Spree.t(:add_new_header), '#', :class => 'add_header button'
.form-buttons.filter-actions.actions{"data-hook" => "buttons"}
= button Spree.t('actions.update'), 'icon-refresh'