app/assets/javascripts/activities.js.erb in social_stream-base-0.9.0 vs app/assets/javascripts/activities.js.erb in social_stream-base-0.9.1
- old
+ new
@@ -7,10 +7,24 @@
$('#new_<%= SocialStream.activity_forms.first %>').show();
$('#select_<%= SocialStream.activity_forms.first %>').addClass('selected');
$('#security').chosen();
});
+
+$(document).ready(function() {
+ $('#new_post').submit(function() {
+ $("#input_activities").blur();
+ $("#masterSubmitButton").val("<%= I18n.t('activity.sending') %>...");
+ $('#new_post').attr("disabled", true);
+ $('#masterSubmitButton').attr("disabled", true);
+ $('#input_activities').attr('readonly', true);
+ return true;
+ });
+});
+
+
+
//clicks form selector
$('.activity_form_selector').live('click',function(){
$('.activity_form_selector').removeClass('selected');
$(this).addClass('selected');
$('#wrapper_activities_header form').hide();
@@ -32,30 +46,21 @@
$('#wrapper_activities_header form:visible').submit();
});
//javascript for main activities input
$(function() {
- activity_input = "<%= I18n.t('activity.input') %>";
$("#input_activities").click(function(){
- if(this.value == activity_input){
- this.value = "";
$("#masterSubmitButton").show();
- }
});
- event_input = "<%= I18n.t('event.input') %>";
- $("#event_name").click(function(){
- if(this.value == event_input){
- this.value = "";
- }
- });
});
//javascript for comments
$(function() {
//"write new comment..." text in every text field for comments
- $(".input_new_comments").val("<%= I18n.t('comment.input') %>");
+ $("#input_activities").Watermark("<%= I18n.t('activity.input') %>","#666");
+ $(".input_new_comments").Watermark("<%= I18n.t('comment.input') %>","#666");
//show only the text fields for new comment if there are any comment to the post
$(".activity_new_comment").each(function(){
if ($.trim($(this).siblings(".activity_comments").text()) != ""){
$(this).show();
@@ -82,44 +87,20 @@
$("#"+id).children(".hide_show_comments").hide();
};
//usa livequery para usar el javascript luego de una accion con AJAX
$(".input_new_comments").live("click",function(){
- if(this.value == "<%= I18n.t('comment.input') %>"){
- $(this).val("");
- }
$(".activities_comment_btn").hide();
$(this).parent(".new_comment").children(".activities_comment_btn").show();
});
-/* this function works but it finishes and no other event is done
- * I mean: when you click in other button the blur happens but the click is not done
-$(".input_new_comments").live("blur",function(){
- if(this.value == ""){
- $(".activities_comment_btn").hide();
- $(this).val("<%= I18n.t('comment.input') %>");
- }
- return true;
-});
-*/
-
//javascript for tocomment option
$(".to_comment").live("click", function(){
$(this).parents(".activity_content").find(".activity_new_comment").show();
- $(".input_new_comments").val("<%= I18n.t('comment.input') %>");
$(this).parents(".activity_content").find(".input_new_comments").click();
$(this).parents(".activity_content").find(".input_new_comments").focus();
return false;
});
-
-
-
-
-
-
-
-
-
//move he last list item before the first item. The purpose of this is if the user clicks to slide left he will be able to see the last item.
$('#carousel_ul li:first').before($('#carousel_ul li:last'));