-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Localize each store #95
Localize each store #95
Conversation
9291b8d
to
674f538
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the change. I have some comments about the implementation. I think we can make use of handlebars templates here.
} | ||
}); | ||
|
||
$(function(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use jQuery DOM ready events. Use Spree.ready
, so it is Turbolinks compatible.
And maybe we should put this in the view where we actually have the DOM elements available. Initializing directly inside the backbone file makes changes to JS initializing very hard.
<table class="index locales-settings"> | ||
<thead> | ||
<tr> | ||
<th>Name</th> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
Spree::Store.human_attribute_name_for(:name)
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th>Url</th> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
<%= link_to '', '#', :class => 'fa fa-edit edit-available-locales icon_link icon-edit no-text with-tip', :data => {store_id: store.id, action: 'edit'}, :title => Spree.t('edit') %> | ||
</td> | ||
</tr> | ||
<% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a handlebars template would be much better here.
Very sad we can't make use of editable-table
introduced in solidusio/solidus/pull/1580 here, because of back wards compatibility, but maybe the same implementation can be used here?
674f538
to
351ad27
Compare
PR updated. Thanks for your review, with your suggestions the code is more simple and readable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some change requested, general direction is very good!
{{/each}} | ||
{{/if}} | ||
</td> | ||
<td class="actions"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we use {{#if editing}}
to conditionally display actions instead of hiding/showing with css?
<% end %> | ||
<script> | ||
$(function(){ | ||
if ($(".locales-settings").length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we move this in some JS file?
@@ -18,6 +18,12 @@ def all_locales_options | |||
SolidusI18n::Locale.all.map { |locale| locale_presentation(locale) }.push(['English (EN)', :en]) | |||
end | |||
|
|||
def available_locales_presentation(store) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this method used?
@DanielePalombo there seems to be an related issue on latest master of Solidus. Mind to take a look into it? |
'click [data-action=cancel]': 'onCancel' | ||
|
||
onEdit: (e) -> | ||
return if @$el.hasClass('editing') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use the editing
value for the conditional, that way we can stop adding and removing class to the element
a4b9ceb
to
6dfc5dc
Compare
Add handlebars templates and helpers to manage the inline editing of available languages
This Object toggles the editing mode for the rows and save the new value through the API.
This Object append the `tr` inside the tbody and run the EditInlineLocales on the new row.
auto width resolution was breaking table, this will make the select2 not change its size when opened
d386b1c
to
3803c36
Compare
Should we deprecate the old global setting or update the README? |
Modified the admin general settings page to select different available locales to each stores
rel #82