Skip to content

Commit 63e05f4

Browse files
authored
Merge pull request #128 from publify/remove-inline-styles
Remove inline styles assigned in ERB templates
2 parents f39643d + e5382f7 commit 63e05f4

File tree

13 files changed

+68
-22
lines changed

13 files changed

+68
-22
lines changed

app/assets/javascripts/optional_field_toggle.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
$(document).ready(function() {
2+
$('.optional_field').hide();
23
$('.optional-field-toggle').on("click", function(e){
34
$('.optional_field').fadeToggle();
45
e.preventDefault();
Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
// Show and hide spinners on Ajax requests.
22
$(document).ready(function(){
3-
$('form.spinnable').on('ajax:before', function(evt, xhr, status){ $('#spinner').show();})
4-
$('form.spinnable').on('ajax:complete', function(evt, xhr, status){ $('#spinner').hide();})
3+
$('#spinner').hide().removeClass("hidden");
4+
$('form.spinnable').on('ajax:before', function(evt, xhr, status){
5+
$('#spinner').show();
6+
});
7+
$('form.spinnable').on('ajax:complete', function(evt, xhr, status){
8+
$('#spinner').hide();
9+
});
510
});

app/assets/stylesheets/administration_structure.css.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* General */
22

33
body {
4-
padding-top: 40px;
4+
padding-top: 60px;
55
}
66

77
footer {

app/assets/stylesheets/publify.css.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,25 @@
2828
.admin-tools-reveal:hover .admintools {
2929
display: block;
3030
}
31+
32+
.tag-sidebar-tag-cloud {
33+
overflow: hidden;
34+
}
35+
36+
.tag-sidebar-tag-67 { font-size: 0.67em; }
37+
.tag-sidebar-tag-75 { font-size: 0.75em; }
38+
.tag-sidebar-tag-83 { font-size: 0.83em; }
39+
.tag-sidebar-tag-91 { font-size: 0.91em; }
40+
.tag-sidebar-tag-100 { font-size: 1em; }
41+
.tag-sidebar-tag-112 { font-size: 1.12em; }
42+
.tag-sidebar-tag-125 { font-size: 1.25em; }
43+
.tag-sidebar-tag-137 { font-size: 1.37em; }
44+
.tag-sidebar-tag-150 { font-size: 1.50em; }
45+
.tag-sidebar-tag-162 { font-size: 1.62em; }
46+
.tag-sidebar-tag-175 { font-size: 1.75em; }
47+
.tag-sidebar-tag-187 { font-size: 1.87em; }
48+
.tag-sidebar-tag-200 { font-size: 2em; }
49+
50+
.hidden {
51+
display: none;
52+
}

app/models/tag_sidebar.rb

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,34 @@ def sizes
1818
average = total.to_f / @tags.size
1919
@sizes = tags.reduce({}) do |h, tag|
2020
size = tag.content_counter.to_f / average
21-
h.merge tag => size.clamp(2.0 / 3.0, 2) * 100
21+
h.merge tag => bucket(size)
2222
end
2323
end
2424

25-
def font_multiplier
26-
80
25+
BUCKETS = [
26+
67,
27+
75,
28+
83,
29+
91,
30+
100,
31+
112,
32+
125,
33+
137,
34+
150,
35+
162,
36+
175,
37+
187,
38+
200
39+
].freeze
40+
41+
private
42+
43+
def bucket(size)
44+
base_size = size.clamp(2.0 / 3.0, 2) * 100
45+
BUCKETS.each do |sz|
46+
return sz if sz >= base_size
47+
end
48+
BUCKETS.last
2749
end
2850
end
2951

app/views/admin/articles/index.html.erb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</p>
2121

2222
<div class="panel panel-default">
23-
<div class="panel-heading">
23+
<div class="panel-heading clearfix">
2424
<div class="pull-right">
2525
<div class="form-group">
2626
<%= 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 @@
3333
</div>
3434
<div class="form-group">
3535
<%= submit_tag(t('.search'), class: 'btn btn-success') %>
36-
<span id="spinner" style="display:none;"><%= image_tag('spinner.gif') %></span>
36+
<span id="spinner" class="hidden"><%= image_tag('spinner.gif') %></span>
3737
</div>
3838
</div>
39-
<br style="clear: both">
4039
</div>
4140
</div>
4241
<table class="table table-hover">

app/views/articles/_comment_form.html.erb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<%= form_tag @article.comment_url, id: 'comment_form', remote: true do %>
22
<div class="comment-box">
3-
<div id="errors" style="display: none"></div>
4-
<div id="preview" style="display: none"></div>
3+
<div id="errors" class="hidden"></div>
4+
<div id="preview" class="hidden"></div>
55

66
<a name="respond"></a>
77
<table cellpadding="4" cellspacing="0" class="frm-tbl">
@@ -16,11 +16,11 @@
1616
</small>
1717
</td>
1818
</tr>
19-
<tr class="optional_field" style="display: none">
19+
<tr class="optional_field">
2020
<td><p><label for="comment_url"><%= t('.your_blog') %></label></p></td>
2121
<td> <%= text_field 'comment', 'url' %></td>
2222
</tr>
23-
<tr class="optional_field" style="display: none">
23+
<tr class="optional_field">
2424
<td><p><label for="comment_email"><%= t('.your_email') %></label></p></td>
2525
<td> <%= text_field 'comment', 'email' %></td>
2626
</tr>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
var message = "<%= j render 'articles/comment_errors', comment: @comment %>";
22
$('#preview').hide();
3-
$('#errors').hide().html(message).fadeIn();
3+
$('#errors').hide().removeClass("hidden").html(message).fadeIn();

app/views/comments/preview.js.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
var preview = "<%= j render 'articles/comment_preview', comment: @comment %>";
22
$('#errors').hide();
3-
$('#preview').hide().html(preview).fadeIn();
3+
$('#preview').hide().removeClass("hidden").html(preview).fadeIn();

app/views/layouts/administration.html.erb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
<body>
1313
<%= render 'admin/shared/menu' %>
1414
<div class='container-fluid'>
15-
<div style='margin-top:20px'>
16-
<%= render 'shared/flash', flash: flash %>
17-
</div>
15+
<%= render 'shared/flash', flash: flash %>
1816
<% if content_for?(:page_heading) %>
1917
<div class='page-header'>
2018
<%= yield :page_heading %>

0 commit comments

Comments
 (0)