diff --git a/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb b/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb
index a87b1fc..89f1090 100644
--- a/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb
+++ b/plugins/comment_paragraph/controllers/profile/comment_paragraph_plugin_profile_controller.rb
@@ -4,7 +4,7 @@ class CommentParagraphPluginProfileController < ProfileController
def view_comments
@article_id = params[:article_id]
@paragraph_id = params[:paragraph_id]
-
+
article = profile.articles.find(@article_id)
@paragraph_comment_page = (params[:paragraph_comment_page] || 1).to_i
diff --git a/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb b/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb
index bb2993a..692c2be 100644
--- a/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb
+++ b/plugins/comment_paragraph/lib/comment_paragraph_plugin.rb
@@ -16,14 +16,14 @@ class CommentParagraphPlugin < Noosfero::Plugin
comment = args[:comment]
paragraph_id = comment.paragraph_id || args[:paragraph_id]
proc {
- arr = []
+ arr = []
arr << hidden_field_tag('comment[id]', comment.id)
arr << hidden_field_tag('comment[paragraph_id]', paragraph_id) if paragraph_id
- arr << hidden_field_tag('comment[comment_paragraph_selected_area]', comment.comment_paragraph_selected_area) if comment.comment_paragraph_selected_area
+ arr << hidden_field_tag('comment[comment_paragraph_selected_area]', comment.comment_paragraph_selected_area) if comment.comment_paragraph_selected_area
arr
}
end
-
+
def comment_extra_contents(args)
comment = args[:comment]
proc {
diff --git a/plugins/comment_paragraph/lib/ext/article.rb b/plugins/comment_paragraph/lib/ext/article.rb
index d8fa24a..978a72d 100644
--- a/plugins/comment_paragraph/lib/ext/article.rb
+++ b/plugins/comment_paragraph/lib/ext/article.rb
@@ -12,6 +12,6 @@ class Article
errors[:base] << (N_('You are unable to change the body of the article when paragraphs are commented')) unless (paragraphs_with_comments).empty?
end
end
-
+
end
diff --git a/plugins/comment_paragraph/lib/ext/comment.rb b/plugins/comment_paragraph/lib/ext/comment.rb
index b91ac57..225137b 100644
--- a/plugins/comment_paragraph/lib/ext/comment.rb
+++ b/plugins/comment_paragraph/lib/ext/comment.rb
@@ -3,9 +3,9 @@ require_dependency 'comment'
class Comment
scope :without_paragraph, :conditions => {:paragraph_id => nil }
-
+
settings_items :comment_paragraph_selected_area, :type => :string
-
+
scope :in_paragraph, proc { |paragraph_id| {
:conditions => ['paragraph_id = ?', paragraph_id]
}
diff --git a/plugins/comment_paragraph/public/comment_paragraph.js b/plugins/comment_paragraph/public/comment_paragraph.js
index e8063a9..7481bf6 100644
--- a/plugins/comment_paragraph/public/comment_paragraph.js
+++ b/plugins/comment_paragraph/public/comment_paragraph.js
@@ -11,7 +11,7 @@ function makeCommentable() {
tinyMCE.activeEditor.setContent(paragraphsTxt)
return;
}
-
+
jQuery('#article_body_ifr').contents().find('body').children('p').each(function( index ) {
paragraphsTxt+='
' + jQuery(this).html() + '
'
});
diff --git a/plugins/comment_paragraph/public/comment_paragraph_macro.js b/plugins/comment_paragraph/public/comment_paragraph_macro.js
index 14d32e8..9201ea3 100644
--- a/plugins/comment_paragraph/public/comment_paragraph_macro.js
+++ b/plugins/comment_paragraph/public/comment_paragraph_macro.js
@@ -20,25 +20,17 @@ jQuery(document).ready(function($) {
if(lastParagraph[paragraphId]){
rootElement.innerHTML = lastParagraph[paragraphId];
}
- });
-
+ });
+
//highlight area from the paragraph
$('.comment_paragraph').mouseup(function(){
var paragraphId = getIdCommentParagraph($(this)[0].id);
var rootElement = $(this).get(0);
-
lastParagraph[paragraphId] = rootElement.innerHTML;
-
- console.log(rootElement);
-
var selObj = rangy.getSelection();
- var selected_area = rangy.serializeSelection(selObj, true,rootElement);
-
+ var selected_area = rangy.serializeSelection(selObj, true,rootElement);
cssApplier.toggleSelection();
-
- lastSelectedArea[paragraphId] = selected_area;
- //cssApplier.toggleSelection();
-
+ lastSelectedArea[paragraphId] = selected_area;
form = jQuery(this).parent().find('form');
if (form.find('input.selected_area').length === 0){
jQuery('').attr({
@@ -49,20 +41,9 @@ jQuery(document).ready(function($) {
}).appendTo(form)
}else{
form.find('input.selected_area').val(selected_area)
- }
+ }
rootElement.focus();
- });
-
-
-// em colocar um data-paragraph e data-selected-area
-// //highlight area from the paragraph
-// $('.article-comment').mouseover(function(){
-// rootElement = $('#comment_paragraph_' + this).get(0);
-// var selObj = rangy.getSelection();
-// var se = $('#result').val();
-// rangy.deserializeSelection(se, rootElement);
-// cssApplier.toggleSelection();
-// });
+ });
function processAnchor(){
var anchor = window.location.hash;
@@ -84,41 +65,30 @@ jQuery(document).ready(function($) {
}
});
}
-
+
processAnchor();
-
+
$(document).on('mouseover', 'li.article-comment', function(){
var selected_area = $(this).find('input.paragraph_comment_area').val();
var paragraph_id = $(this).find('input.paragraph_id').val();
var rootElement = $('#comment_paragraph_'+ paragraph_id).get(0);
-
+
if(lastParagraph[paragraph_id] == null || lastParagraph[paragraph_id] == 'undefined'){
- console.log(rootElement.innerHTML);
lastParagraph[paragraph_id] = rootElement.innerHTML;
}
else {
rootElement.innerHTML = lastParagraph[paragraph_id] ;
}
-
- //console.log(rootElement.innerHTML);
- console.log("selected_area = '" + selected_area + "'");
if(selected_area != ""){
rangy.deserializeSelection(selected_area, rootElement);
cssApplier.toggleSelection();
}
});
-
+
$(document).on('mouseout', 'li.article-comment', function(){
var paragraph_id = $(this).find('input.paragraph_id').val();
- console.log("mouseout paragraph_id = " + paragraph_id);
var rootElement = $('#comment_paragraph_'+ paragraph_id).get(0);
- console.log(lastParagraph[paragraph_id]);
-
-// cssApplier.undoToSelection();
-//
-// cssApplier.toggleSelection();
-
-
+
if(lastSelectedArea[paragraph_id] != null && lastSelectedArea[paragraph_id] != 'undefined' ){
rootElement = $('#comment_paragraph_'+ paragraph_id).get(0);
rootElement.innerHTML = lastParagraph[paragraph_id];
@@ -129,30 +99,9 @@ jQuery(document).ready(function($) {
var sel = rangy.getSelection();
sel.removeAllRanges();
}
-
-//var selected_area = $(this).find('input.paragraph_comment_area').val();
- //var paragraph_id = $(this).find('input.paragraph_id').val();
- //var rootElement = $('#comment_paragraph_'+ paragraph_id).get(0);
- //console.log(rootElement.innerHTML);
- //console.log(selected_area);
- //rangy.deserializeSelection(selected_area, rootElement);
- //cssApplier.toggleSelection();
- //window.last_paragraph
- //if(last_selected_area)
});
-
});
-function selectAreaForComment(paragraph){
-// console.log(this)
-// alert("Paragrafo " + paragraph)
-// cssApplier.toggleSelection();
-// saveSelection();
-// var selObj = rangy.getSelection();
-// var se = rangy.serializeSelection(selObj, true,rootElement);
-}
-
-
function toggleParagraph(paragraph) {
var div = jQuery('div.comments_list_toggle_paragraph_'+paragraph);
var visible = div.is(':visible');
@@ -170,20 +119,3 @@ function loadCompleted(paragraph) {
comment_paragraph_anchor = null;
}
}
-
-
-
-//Return a string with the beggining and the end of the selection of a text area separated by colon
-function getSelectionBounderies(textareaId){
-
-// var textarea = document.getElementById(textareaId);
-// if ('selectionStart' in textarea) {
-// // check whether some text is selected in the textarea
-// if (textarea.selectionStart != textarea.selectionEnd) {
-// alert(textarea.selectionStart + ":" + textarea.selectionEnd)
-// return textarea.selectionStart + ":" + textarea.selectionEnd;
-// }
-// }
-
- return false
-}
diff --git a/plugins/comment_paragraph/public/style.css b/plugins/comment_paragraph/public/style.css
index d816c09..7c3099f 100644
--- a/plugins/comment_paragraph/public/style.css
+++ b/plugins/comment_paragraph/public/style.css
@@ -21,12 +21,12 @@ div.article-comments-list-more{
}
.commented-area {
- background-color: #a8d1ff;
+ background-color: #FFFF66;
}
::selection {
- background: #a8d1ff; /* WebKit/Blink Browsers */
+ background: #FFFF66; /* WebKit/Blink Browsers */
}
::-moz-selection {
- background: #a8d1ff; /* Gecko Browsers */
+ background: #FFFF66; /* Gecko Browsers */
}
\ No newline at end of file
diff --git a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
index 994c2d3..ad6cc22 100644
--- a/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
+++ b/plugins/comment_paragraph/test/functional/content_viewer_controller_test.rb
@@ -2,9 +2,9 @@ require File.dirname(__FILE__) + '/../test_helper'
class ContentViewerController
append_view_path File.join(File.dirname(__FILE__) + '/../../views')
- def rescue_action(e)
- raise e
- end
+ def rescue_action(e)
+ raise e
+ end
end
class ContentViewerControllerTest < ActionController::TestCase
--
libgit2 0.21.2