rostra 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -29,9 +29,33 @@ var custom_validation_callbacks = {
|
|
29
29
|
field.find('.error').text("can't be blank");
|
30
30
|
}
|
31
31
|
}
|
32
|
+
},
|
33
|
+
|
34
|
+
// Custom valiation form Tiny MCE wysiwyg.
|
35
|
+
//
|
36
|
+
wysiwyg: function(element, event_data) {
|
37
|
+
var wysiwyg_textarea = element.hasClass('wysiwyg');
|
38
|
+
if (wysiwyg_textarea) {
|
39
|
+
var textarea_field = element.closest('.field');
|
40
|
+
var editor = tinyMCE.get(element.attr('id'))
|
41
|
+
textarea_field.append('<span class="error"></span>'); // Cuase sometimes it doesn't have a error span. Why?
|
42
|
+
|
43
|
+
var wysiwyg_has_content = function() {
|
44
|
+
return $.trim( editor.getContent().replace(/<[^>]+>/g, '') ) ? true : false;
|
45
|
+
}
|
46
|
+
|
47
|
+
element.data('valid', wysiwyg_has_content());
|
48
|
+
|
49
|
+
editor.onKeyUp.add(function(ed, e) {
|
50
|
+
var error_message = wysiwyg_has_content() ? '' : "can't be blank";
|
51
|
+
textarea_field.find('.error').text(error_message);
|
52
|
+
});
|
53
|
+
}
|
32
54
|
}
|
55
|
+
|
33
56
|
};
|
34
57
|
|
35
58
|
clientSideValidations.callbacks.element.after = function(element, event_data) {
|
36
59
|
custom_validation_callbacks.taglist(element, event_data);
|
60
|
+
custom_validation_callbacks.wysiwyg(element, event_data);
|
37
61
|
}
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
<div id="page_content">
|
4
4
|
<div id="questions">
|
5
|
-
<% if
|
6
|
-
<h3>No questions have been asked.</h3>
|
7
|
-
|
5
|
+
<% if Rostra::Question.count.zero? %>
|
6
|
+
<h3>Sorry! No questions have been asked.</h3>
|
7
|
+
<% elsif @questions.empty? %>
|
8
|
+
<h3>Sorry! No questions found.</h3>
|
8
9
|
<% else %>
|
9
|
-
|
10
10
|
<% @questions.each do |question| %>
|
11
11
|
<div class="question">
|
12
12
|
|
data/lib/rostra/version.rb
CHANGED