Commits

agend committed 54696b0

po uzyciu jshint

Comments (0)

Files changed (4)

 Django
 psycopg2
-wsgiref
+
     var show_content = function(){
         // show or hide content textarea etc according to values of select inputs
 
-        if( type_select.val()=='custom' && creator_select.val()!='' &&
-                target_select.val()!='') {
+        if( type_select.val()==='custom' && creator_select.val()!=='' &&
+                target_select.val()!=='') {
             
             content.show();
             content_label.show();
             content_label.hide();
             help.hide();
         }
-    }
+    };
 
     show_content();
     type_select.attr('disabled', true);  
     $('#id_creator, #id_target').change(function() {
         // disable type of action select if creator and target not choosen yet
 
-        var not_ready = creator_select.val()=='' || target_select.val()=='';
+        var not_ready = creator_select.val()==='' || target_select.val()==='';
         type_select.attr('disabled', not_ready);
         show_content();
         if(!not_ready) fill_options();
-    })
+    });
 
 
     type_select.change(function() {
-        show_content()
-        if(type_select.val()=='custom')
+        show_content();
+        if(type_select.val()==='custom')
             content.val('$CREATOR did something to $TARGET');
     });
 
             type_select.html(data);
 
             // if there is only one option select it otherwise select first
-            if($("#id_type option").length==1)
+            if($("#id_type option").length===1)
                 $("#id_type option[value='custom']").attr('selected', 'selected');
             else
                 $("#id_type option[value='1']").attr('selected', 'selected');
 
             show_content();
-        })
-    }
+        });
+    };
 
 
     $('form#add_form').submit(function() {
         // send new action data to server on submit
 
         var content;
-        if(type_select.val()=='custom'){
+        if(type_select.val()==='custom'){
             // if custom action - check for '$CREATOR' and '$TARGET' 
             content = $('#id_content').val();
             if(content.indexOf('$CREATOR')<0 || content.indexOf('$TARGET')<0) {
             // get 10 latest activities
             $('#activities').load('get_latest', {limit: 30}); })
         .error(function() {
-            alert('Could not save new activity!');
-        })
+            alert('Could not save new activity!'); });
         
         return false;
-    })
+    });
 
 
     $(window).scroll(function() {
         // infinite scroll - if user scroll to bottom - refresh activities
         // this time fetch 10 more 
 
-        if ($(window).scrollTop() == $(document).height() - $(window).height()){
-            var so_far = $('#activities div.activity').length
+        if ($(window).scrollTop() === $(document).height() - $(window).height()){
+            var so_far = $('#activities div.activity').length;
             $('#activities').load('get_latest', {limit: so_far + 10});
         }
     });
 
-})
+});

static/js/search.js

             targets[i] = $(selected).val(); 
         });
 
-        if(creators.length==0 || targets.length==0) return false;
+        if(creators.length===0 || targets.length===0) return false;
 
         $.get('search_ajax', {
             creators: creators,
             targets: targets })
         .success(function(data) {
             $('#activities').load('get_search_results', {limit: 30});
-        })
+        });
 
         return false;
-    })
+    });
 
     $(window).scroll(function() {
         // infinite scroll - if user scroll to bottom - refresh activities
         // this time fetch 10 more 
         
-        if ($(window).scrollTop() == $(document).height() - $(window).height()){
-            var so_far = $('#activities div.activity').length
+        if ($(window).scrollTop() === $(document).height() - $(window).height()){
+            var so_far = $('#activities div.activity').length;
             $('#activities').load('get_search_results', {limit: so_far + 10});
         }
     });
 
-})
+});
 
 Uruchomienie:
 
-    ja używam django1.4 i postgresql 9.1, na innych też powinno działać
-    
+    ja używam: python2.7, django1.4, postgresql 9.1 na innych też powinno działać
+
     po skonfigurowaniu bazy danych w settings.py:
 
     pip install -r requirements.txt