Commit 4babb0b1df16b8f152ac137740773cccfda3005b
1 parent
e8f8ec18
Exists in
staging
and in
4 other branches
comment_paragraph: improve layout and usability
Conflicts: plugins/comment_paragraph/public/comment_paragraph_macro.js plugins/comment_paragraph/public/style.css plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
Showing
3 changed files
with
28 additions
and
18 deletions
Show diff stats
plugins/comment_paragraph/public/comment_paragraph_macro.js
@@ -58,6 +58,7 @@ jQuery(document).ready(function($) { | @@ -58,6 +58,7 @@ jQuery(document).ready(function($) { | ||
58 | function hideCommentBox() { | 58 | function hideCommentBox() { |
59 | $("div.side-comment").hide(); | 59 | $("div.side-comment").hide(); |
60 | $('.article-body').removeClass('comment-paragraph-slide-left'); | 60 | $('.article-body').removeClass('comment-paragraph-slide-left'); |
61 | + $('.comments').removeClass('selected'); | ||
61 | } | 62 | } |
62 | 63 | ||
63 | function showBox(div){ | 64 | function showBox(div){ |
@@ -75,20 +76,12 @@ jQuery(document).ready(function($) { | @@ -75,20 +76,12 @@ jQuery(document).ready(function($) { | ||
75 | <div align="center" class="triangle-right" >Comentar</div>\ | 76 | <div align="center" class="triangle-right" >Comentar</div>\ |
76 | </a>'); | 77 | </a>'); |
77 | 78 | ||
78 | - function resizeArticle(paragraphId){ | ||
79 | - var commentHeigh = $('#side_comment_' + paragraphId).height(); | ||
80 | - if(commentHeigh > 0){ | ||
81 | - $('.article-body').height(originalArticleHeight + commentHeigh + 50); | ||
82 | - }else{ | ||
83 | - $('.article-body').height(originalArticleHeight); | ||
84 | - } | ||
85 | - } | ||
86 | - | ||
87 | $('.side-comments-counter').click(function(){ | 79 | $('.side-comments-counter').click(function(){ |
88 | var paragraphId = $(this).data('paragraph'); | 80 | var paragraphId = $(this).data('paragraph'); |
89 | hideAllCommentsExcept(paragraphId); | 81 | hideAllCommentsExcept(paragraphId); |
90 | hideAllSelectedAreasExcept(paragraphId); | 82 | hideAllSelectedAreasExcept(paragraphId); |
91 | hideCommentBox(); | 83 | hideCommentBox(); |
84 | + $(this).closest('.comments').addClass('selected'); | ||
92 | $('.article-body').addClass('comment-paragraph-slide-left'); | 85 | $('.article-body').addClass('comment-paragraph-slide-left'); |
93 | $('#side_comment_' + paragraphId).show(); | 86 | $('#side_comment_' + paragraphId).show(); |
94 | $('#comment-bubble').removeClass('visible'); | 87 | $('#comment-bubble').removeClass('visible'); |
@@ -100,7 +93,6 @@ jQuery(document).ready(function($) { | @@ -100,7 +93,6 @@ jQuery(document).ready(function($) { | ||
100 | }).done(function() { | 93 | }).done(function() { |
101 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); | 94 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); |
102 | button.click(); | 95 | button.click(); |
103 | - resizeArticle(paragraphId); | ||
104 | }); | 96 | }); |
105 | }); | 97 | }); |
106 | 98 | ||
@@ -120,7 +112,6 @@ jQuery(document).ready(function($) { | @@ -120,7 +112,6 @@ jQuery(document).ready(function($) { | ||
120 | }).done(function() { | 112 | }).done(function() { |
121 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); | 113 | var button = $('#page-comment-form-' + paragraphId + ' a').get(0); |
122 | button.click(); | 114 | button.click(); |
123 | - resizeArticle(paragraphId); | ||
124 | }); | 115 | }); |
125 | }); | 116 | }); |
126 | 117 |
plugins/comment_paragraph/public/style.css
@@ -134,7 +134,7 @@ div[class^='comment-paragraph-loading-'] { | @@ -134,7 +134,7 @@ div[class^='comment-paragraph-loading-'] { | ||
134 | width: 20px; | 134 | width: 20px; |
135 | height: 19px; | 135 | height: 19px; |
136 | padding: 0px; | 136 | padding: 0px; |
137 | - background: #b8b8b8; | 137 | + background: #b5b5b5; |
138 | -webkit-border-radius: 2px; | 138 | -webkit-border-radius: 2px; |
139 | -moz-border-radius: 2px; | 139 | -moz-border-radius: 2px; |
140 | border-radius: 2px; | 140 | border-radius: 2px; |
@@ -144,15 +144,25 @@ div[class^='comment-paragraph-loading-'] { | @@ -144,15 +144,25 @@ div[class^='comment-paragraph-loading-'] { | ||
144 | font-weight: bold; | 144 | font-weight: bold; |
145 | color: white; | 145 | color: white; |
146 | text-align: center; | 146 | text-align: center; |
147 | + opacity: 0.7; | ||
147 | } | 148 | } |
148 | 149 | ||
149 | -.side-comments-counter:hover{ | 150 | +.comment-paragraph-plugin .loading { |
151 | + height: 40px; | ||
152 | + background-position: center 0; | ||
153 | +} | ||
154 | + | ||
155 | +.side-comments-counter:hover { | ||
150 | background-color: rgb(117, 192, 117); | 156 | background-color: rgb(117, 192, 117); |
151 | } | 157 | } |
152 | -.side-comments-counter:hover:after{ | 158 | +.side-comments-counter:hover:after { |
153 | border-color: rgb(117, 192, 117) transparent; | 159 | border-color: rgb(117, 192, 117) transparent; |
154 | } | 160 | } |
155 | 161 | ||
162 | +.comments.selected .side-comments-counter, .comments.selected .side-comments-counter:after { | ||
163 | + opacity: 1; | ||
164 | +} | ||
165 | + | ||
156 | .side-comments-counter:after { | 166 | .side-comments-counter:after { |
157 | content: ""; | 167 | content: ""; |
158 | position: absolute; | 168 | position: absolute; |
@@ -182,6 +192,9 @@ div[class^='comment-paragraph-loading-'] { | @@ -182,6 +192,9 @@ div[class^='comment-paragraph-loading-'] { | ||
182 | 192 | ||
183 | #article .side-comment .article-comments-list { | 193 | #article .side-comment .article-comments-list { |
184 | margin: 0; | 194 | margin: 0; |
195 | + overflow-y: auto; | ||
196 | + overflow-x: hidden; | ||
197 | + max-height: 400px; | ||
185 | } | 198 | } |
186 | #article .side-comment .article-comments-list .article-comment { | 199 | #article .side-comment .article-comments-list .article-comment { |
187 | margin: 0; | 200 | margin: 0; |
@@ -269,12 +282,16 @@ div[class^='comment-paragraph-loading-'] { | @@ -269,12 +282,16 @@ div[class^='comment-paragraph-loading-'] { | ||
269 | display: table; | 282 | display: table; |
270 | } | 283 | } |
271 | 284 | ||
285 | +.comments .comment_paragraph:hover, .comments.selected .comment_paragraph { | ||
286 | + background-color: rgb(236, 236, 236); | ||
287 | +} | ||
288 | + | ||
272 | .comment-paragraph-group-comments{ | 289 | .comment-paragraph-group-comments{ |
273 | position: absolute; | 290 | position: absolute; |
274 | right: -296px; | 291 | right: -296px; |
275 | - top: 12px; | 292 | + top: 0px; |
276 | background-color: white; | 293 | background-color: white; |
277 | - z-index: 9999; | 294 | + z-index: 199; |
278 | } | 295 | } |
279 | 296 | ||
280 | .article-body.comment-paragraph-slide-left { | 297 | .article-body.comment-paragraph-slide-left { |
plugins/comment_paragraph/views/comment_paragraph_plugin_profile/_comment_paragraph.html.erb
1 | -<div class="comments"> | 1 | +<div class="comment-paragraph-plugin comments"> |
2 | <div class="comment_paragraph" id="comment_paragraph_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>"> | 2 | <div class="comment_paragraph" id="comment_paragraph_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>"> |
3 | <%= inner_html %> | 3 | <%= inner_html %> |
4 | </div> | 4 | </div> |
@@ -29,7 +29,9 @@ | @@ -29,7 +29,9 @@ | ||
29 | <div class="side-comment" id="side_comment_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>" style="display:none"> | 29 | <div class="side-comment" id="side_comment_<%= paragraph_id %>" data-paragraph="<%= paragraph_id %>" style="display:none"> |
30 | <div class="comment-paragraph-loading-<%= paragraph_id %>"> | 30 | <div class="comment-paragraph-loading-<%= paragraph_id %>"> |
31 | <div class="comments_list_toggle_paragraph_<%= paragraph_id %>" > | 31 | <div class="comments_list_toggle_paragraph_<%= paragraph_id %>" > |
32 | - <div class="article-comments-list" id="comments_list_paragraph_<%= paragraph_id %>"></div> | 32 | + <div class="article-comments-list" id="comments_list_paragraph_<%= paragraph_id %>"> |
33 | + <div class="loading"></div> | ||
34 | + </div> | ||
33 | <div class ="article-comments-list-more" id="comments_list_paragraph_<%= paragraph_id %>_more"></div> | 35 | <div class ="article-comments-list-more" id="comments_list_paragraph_<%= paragraph_id %>_more"></div> |
34 | <div id="page-comment-form-<%= paragraph_id %>" class='post_comment_box closed'> | 36 | <div id="page-comment-form-<%= paragraph_id %>" class='post_comment_box closed'> |
35 | <%= render :partial => 'comment/comment_form', :locals => {:comment => Comment.new, :display_link => true, :cancel_triggers_hide => true, :paragraph_id => paragraph_id}%> | 37 | <%= render :partial => 'comment/comment_form', :locals => {:comment => Comment.new, :display_link => true, :cancel_triggers_hide => true, :paragraph_id => paragraph_id}%> |