diff --git a/app/assets/javascripts/optional_field_toggle.js b/app/assets/javascripts/optional_field_toggle.js index f6b85516..7a43a5f1 100644 --- a/app/assets/javascripts/optional_field_toggle.js +++ b/app/assets/javascripts/optional_field_toggle.js @@ -1,4 +1,5 @@ $(document).ready(function() { + $('.optional_field').hide(); $('.optional-field-toggle').on("click", function(e){ $('.optional_field').fadeToggle(); e.preventDefault(); diff --git a/app/assets/javascripts/spinnable.js b/app/assets/javascripts/spinnable.js index b0d026a0..98527bb3 100644 --- a/app/assets/javascripts/spinnable.js +++ b/app/assets/javascripts/spinnable.js @@ -1,5 +1,10 @@ // Show and hide spinners on Ajax requests. $(document).ready(function(){ - $('form.spinnable').on('ajax:before', function(evt, xhr, status){ $('#spinner').show();}) - $('form.spinnable').on('ajax:complete', function(evt, xhr, status){ $('#spinner').hide();}) + $('#spinner').hide().removeClass("hidden"); + $('form.spinnable').on('ajax:before', function(evt, xhr, status){ + $('#spinner').show(); + }); + $('form.spinnable').on('ajax:complete', function(evt, xhr, status){ + $('#spinner').hide(); + }); }); diff --git a/app/assets/stylesheets/administration_structure.css.scss b/app/assets/stylesheets/administration_structure.css.scss index c766e657..4ed9325f 100644 --- a/app/assets/stylesheets/administration_structure.css.scss +++ b/app/assets/stylesheets/administration_structure.css.scss @@ -1,7 +1,7 @@ /* General */ body { - padding-top: 40px; + padding-top: 60px; } footer { diff --git a/app/assets/stylesheets/publify.css.scss b/app/assets/stylesheets/publify.css.scss index b7270ecd..f9007ae5 100644 --- a/app/assets/stylesheets/publify.css.scss +++ b/app/assets/stylesheets/publify.css.scss @@ -28,3 +28,25 @@ .admin-tools-reveal:hover .admintools { display: block; } + +.tag-sidebar-tag-cloud { + overflow: hidden; +} + +.tag-sidebar-tag-67 { font-size: 0.67em; } +.tag-sidebar-tag-75 { font-size: 0.75em; } +.tag-sidebar-tag-83 { font-size: 0.83em; } +.tag-sidebar-tag-91 { font-size: 0.91em; } +.tag-sidebar-tag-100 { font-size: 1em; } +.tag-sidebar-tag-112 { font-size: 1.12em; } +.tag-sidebar-tag-125 { font-size: 1.25em; } +.tag-sidebar-tag-137 { font-size: 1.37em; } +.tag-sidebar-tag-150 { font-size: 1.50em; } +.tag-sidebar-tag-162 { font-size: 1.62em; } +.tag-sidebar-tag-175 { font-size: 1.75em; } +.tag-sidebar-tag-187 { font-size: 1.87em; } +.tag-sidebar-tag-200 { font-size: 2em; } + +.hidden { + display: none; +} diff --git a/app/models/tag_sidebar.rb b/app/models/tag_sidebar.rb index 9810211b..9c1c69f5 100644 --- a/app/models/tag_sidebar.rb +++ b/app/models/tag_sidebar.rb @@ -18,12 +18,34 @@ def sizes average = total.to_f / @tags.size @sizes = tags.reduce({}) do |h, tag| size = tag.content_counter.to_f / average - h.merge tag => size.clamp(2.0 / 3.0, 2) * 100 + h.merge tag => bucket(size) end end - def font_multiplier - 80 + BUCKETS = [ + 67, + 75, + 83, + 91, + 100, + 112, + 125, + 137, + 150, + 162, + 175, + 187, + 200 + ].freeze + + private + + def bucket(size) + base_size = size.clamp(2.0 / 3.0, 2) * 100 + BUCKETS.each do |sz| + return sz if sz >= base_size + end + BUCKETS.last end end diff --git a/app/views/admin/articles/index.html.erb b/app/views/admin/articles/index.html.erb index 088fb322..b841c2f7 100644 --- a/app/views/admin/articles/index.html.erb +++ b/app/views/admin/articles/index.html.erb @@ -20,7 +20,7 @@

-
+
<%= select_tag('search[user_id]', options_from_collection_for_select(User.all, 'id', 'name'), prompt: t('.select_an_author'), class: 'form-control') %> @@ -33,10 +33,9 @@
<%= submit_tag(t('.search'), class: 'btn btn-success') %> - +
-
diff --git a/app/views/articles/_comment_form.html.erb b/app/views/articles/_comment_form.html.erb index 25ad844d..ba8c7365 100644 --- a/app/views/articles/_comment_form.html.erb +++ b/app/views/articles/_comment_form.html.erb @@ -1,7 +1,7 @@ <%= form_tag @article.comment_url, id: 'comment_form', remote: true do %>
- - + +
@@ -16,11 +16,11 @@ - + - + diff --git a/app/views/articles/comment_failed.js.erb b/app/views/articles/comment_failed.js.erb index 4705fa3a..136b9fe3 100644 --- a/app/views/articles/comment_failed.js.erb +++ b/app/views/articles/comment_failed.js.erb @@ -1,3 +1,3 @@ var message = "<%= j render 'articles/comment_errors', comment: @comment %>"; $('#preview').hide(); -$('#errors').hide().html(message).fadeIn(); +$('#errors').hide().removeClass("hidden").html(message).fadeIn(); diff --git a/app/views/comments/preview.js.erb b/app/views/comments/preview.js.erb index 3cfe95c6..41ab2ca3 100644 --- a/app/views/comments/preview.js.erb +++ b/app/views/comments/preview.js.erb @@ -1,3 +1,3 @@ var preview = "<%= j render 'articles/comment_preview', comment: @comment %>"; $('#errors').hide(); -$('#preview').hide().html(preview).fadeIn(); +$('#preview').hide().removeClass("hidden").html(preview).fadeIn(); diff --git a/app/views/layouts/administration.html.erb b/app/views/layouts/administration.html.erb index c81847e2..554082f9 100644 --- a/app/views/layouts/administration.html.erb +++ b/app/views/layouts/administration.html.erb @@ -12,9 +12,7 @@ <%= render 'admin/shared/menu' %>
-
- <%= render 'shared/flash', flash: flash %> -
+ <%= render 'shared/flash', flash: flash %> <% if content_for?(:page_heading) %> -
diff --git a/app/views/tag_sidebar/_content.html.erb b/app/views/tag_sidebar/_content.html.erb index 987cab51..a10010c1 100644 --- a/app/views/tag_sidebar/_content.html.erb +++ b/app/views/tag_sidebar/_content.html.erb @@ -1,9 +1,9 @@ <% unless sidebar.tags.blank? %> diff --git a/spec/models/tag_sidebar_spec.rb b/spec/models/tag_sidebar_spec.rb index 2eae0740..8016178b 100644 --- a/spec/models/tag_sidebar_spec.rb +++ b/spec/models/tag_sidebar_spec.rb @@ -43,7 +43,7 @@ create(:article, keywords: "foo, quuz") result = sidebar.sizes - expect(result.values.uniq).to contain_exactly (2.0 / 3.0 * 100), 200 + expect(result.values.uniq).to contain_exactly 67, 200 end end end

<%= text_field 'comment', 'url' %>

<%= text_field 'comment', 'email' %>