-
-
Notifications
You must be signed in to change notification settings - Fork 730
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4074 from HugsDaniel/defacepocalypse
[Defacepocalypse] De-deface product properties index
- Loading branch information
Showing
9 changed files
with
107 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
...roduct_properties/_product_property_fields/replace_free_text_with_select.html.haml.deface
This file was deleted.
Oops, something went wrong.
26 changes: 0 additions & 26 deletions
26
...admin/product_properties/index/add_producer_properties_warning_and_table.html.haml.deface
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
app/overrides/spree/admin/product_properties/index/rename_form_headings.html.haml.deface
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
app/views/spree/admin/product_properties/_product_property_fields.html.haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
%tr.product_property.fields{"data-hook" => "product_property", id: "spree_#{dom_id(f.object)}"} | ||
%td.no-border | ||
%span.handle | ||
= f.hidden_field :id | ||
%td.property_name | ||
- if spree_current_user.admin? | ||
= f.text_field :property_name, class: 'autocomplete' | ||
- else | ||
= f.select :property_name, @properties, { include_blank: true }, { class: 'select2 fullwidth' } | ||
%td.value | ||
= f.text_field :value, class: 'autocomplete' | ||
%td.actions | ||
- if f.object.persisted? | ||
= link_to_delete f.object, no_text: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
= render partial: 'spree/admin/shared/product_sub_menu' | ||
|
||
= render partial: 'spree/admin/shared/product_tabs', locals: { current: 'Product Properties' } | ||
|
||
= render partial: 'spree/shared/error_messages', locals: { target: @product } | ||
|
||
- content_for :page_actions do | ||
%ul.tollbar.inline-menu | ||
%li | ||
= link_to_add_fields Spree.t(:add_product_properties), 'tbody#product_properties', class: 'icon-plus button' | ||
%li | ||
%span#new_ptype_link | ||
= link_to Spree.t(:select_from_prototype), available_admin_prototypes_url, remote: true, 'data-update' => 'prototypes', class: 'button icon-copy' | ||
|
||
= form_for @product, url: admin_product_url(@product), method: :put do |f| | ||
%fieldset.no-border-top | ||
.add_product_properties | ||
#prototypes | ||
= image_tag 'select2-spinner.gif', plugin: 'spree', style: 'display:none;', id: 'busy_indicator' | ||
|
||
%table.index.sortable{"data-sortable-link" => update_positions_admin_product_product_properties_url} | ||
%thead | ||
%tr | ||
%th.no-border | ||
%th= t('admin.products.properties.property_name') | ||
%th= t('admin.description') | ||
%th.actions | ||
%tbody#product_properties | ||
= f.fields_for :product_properties do |pp_form| | ||
= render partial: 'product_property_fields', locals: { f: pp_form } | ||
= f.check_box :inherits_properties | ||
= f.label :inherits_properties, t(".inherits_properties_checkbox_hint", supplier: @product.supplier.name) | ||
%br | ||
%br | ||
#inherited_properties | ||
%table.index | ||
%thead | ||
%tr | ||
%th= t('admin.products.properties.inherited_property') | ||
%th= t('admin.description') | ||
%th.actions | ||
%tbody#producer_properties | ||
- @product.supplier.producer_properties.each do |producer_property| | ||
%tr | ||
%td= producer_property.property.presentation | ||
%td= producer_property.value | ||
%td.actions | ||
= render partial: 'spree/admin/shared/edit_resource_links' | ||
= hidden_field_tag 'clear_product_properties', 'true' | ||
:coffee | ||
$(document).ready -> | ||
$("#inherited_properties").toggle $("input#product_inherits_properties").is(':checked') | ||
$("input#product_inherits_properties").change -> | ||
$("#inherited_properties").toggle $(this).is(':checked') | ||
|
||
:javascript | ||
var properties = #{raw(@properties.to_json)}; | ||
$("#product_properties input.autocomplete").live("keydown", function(){ | ||
already_auto_completed = $(this).is('ac_input'); | ||
if (!already_auto_completed) { | ||
$(this).autocomplete({source: properties}); | ||
$(this).focus(); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.form-buttons.filter-actions.actions | ||
= button Spree.t('actions.update'), 'icon-refresh' | ||
%span.or= Spree.t(:or) | ||
= button_link_to Spree.t('actions.cancel'), collection_url, icon: 'icon-remove' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- content_for :sub_menu do | ||
%ul#sub_nav.inline-menu | ||
= tab :products, match_path: '/products' | ||
= tab :option_types, match_path: '/option_types' | ||
= tab :properties | ||
= tab :prototypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- if target && target.errors.any? | ||
#errorExplanation.errorExplanation | ||
%h2 | ||
= Spree.t(:errors_prohibited_this_record_from_being_saved, count: target.errors.count) | ||
\: | ||
%p | ||
= Spree.t(:there_were_problems_with_the_following_fields) | ||
\: | ||
%ul | ||
- target.errors.full_messages.each do |msg| | ||
%li= msg |