Skip to content
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

Remove the text from sitemap loading spinner #4

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/assets/javascripts/alchemy/alchemy.sitemap.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Alchemy.Sitemap =
@search_field = $("#search_field")
@filter_field_clear = $('.js_filter_field_clear')
@display = $('#page_filter_result')
@sitemap_wrapper = $('#sitemap-wrapper .sitemap-load-notice')
@sitemap_wrapper = $('#sitemap-wrapper')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code replaces that target with the sitemap. There's some CSS attached to #sitemap-wrapper. This will break that. Instead, there should be a dummy element within the wrapper which can be safely replaced with the sitemap itself.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're using .replaceWith instead of .html that indeed replaces the element. Why?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's because the same code also replaces a part of the tree when folding. It's a lot less JS plumbing to just replace the entire unlinked list that's being folded. Now we don't need to disable the spinner, for example. Now folding is basically the same as rendering the whole tree. Just from a different root.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense. I will change that this evening.

@template = Handlebars.compile($('#sitemap-template').html())
list_template_regexp = new RegExp '\/' + options.page_root_id, 'g'
list_template_html = $('#sitemap-list').html().replace(list_template_regexp, '/{{id}}')
Expand All @@ -23,7 +23,8 @@ Alchemy.Sitemap =
# Fetches the sitemap from JSON
fetch: (foldingId) ->
self = Alchemy.Sitemap
spinner = Alchemy.Spinner.small()
spinner_size = @options.spinner_size
spinner = if spinner_size == 'small' then Alchemy.Spinner.small() else Alchemy.Spinner.medium()

if foldingId
spinTarget = $('#fold_button_' + foldingId)
Expand Down
15 changes: 4 additions & 11 deletions app/assets/stylesheets/alchemy/sitemap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,10 @@
position: relative;
min-height: 100%;

.sitemap-load-notice {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);

.spinner {
left: 0 !important;
top: -1px !important;
margin-right: 10px;
}
.spinner {
position: absolute !important;
top: 50% !important;
left: 50% !important;
}
}

Expand Down
7 changes: 3 additions & 4 deletions app/views/alchemy/admin/pages/_sitemap.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<div id="sitemap-wrapper">
<p class="center sitemap-load-notice"><%= _t(:loading_sitemap) %></p>
</div>
<div id="sitemap-wrapper"></div>

<script id="sitemap-template" type="text/x-handlebars-template">
<ul id="sitemap" class="list<%= @sorting ? ' sorting' : nil %>">
Expand All @@ -25,7 +23,8 @@
Alchemy.PageSorter.init();
}
<% elsif action_name == 'link' %>
,ready: function () {
,spinner_size: 'small',
ready: function () {
Alchemy.currentDialog().attachEvents();
}
<% end %>
Expand Down
1 change: 0 additions & 1 deletion config/locales/alchemy.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ de:
file: "Datei"
internal: "Intern"
link_title: "Linktitel"
loading_sitemap: "Seitenbaum wird geladen"
login: "anmelden"
logout: "abmelden"
mail_to: "Empfängeradresse"
Expand Down
1 change: 0 additions & 1 deletion config/locales/alchemy.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ en:
file: "File"
internal: "Internal"
link_title: "Link title"
loading_sitemap: "Loading sitemap"
login: "login"
logout: "logout"
mail_to: "Recipient"
Expand Down