Posts

Showing posts from October, 2017

RUN HTML TEMPLATE IN APACHE2 LOCALHOST

Image
When we want to run the html template or html page like :-

URL:-
     file:///home/rohit/Desktop/index.html

We can also run the application in the localhost:-

URL:-
      localhost/index.html

Install Apache:-

sudo apt-get install apache2then goto the /etc/apache2/sites-available/000-default.confDocumentRoot /home/rohit/Downloads/html_pagesinstead of :-#DocumentRoot /var/www/htmlThen go to the :- /etc/apache2/apache2.conf <Directory /> Options FollowSymLinks AllowOverride None Require all denied </Directory> <Directory /usr/share> AllowOverride None Require all granted </Directory> <Directory /home/rohit/Downloads/html_pages> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> then run:-In the URL :-localhost/We can also refer :-https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Set_up_a_basic_working_environment

SHOW LINE NUMBER OF TEXT AREA

WHEN WE ENTER , SHOW LINE NUMBER IN TEXT AREAHTML PAGE:-

<textarea class="line-numbers" cols="3" readonly="readonly" rows="5"></textarea>
<%= text_area_tag :query_editor, '' :name => "query_editor", :class => "add_query_editor" %>


<script type="text/javascript">
   $(".add_query_editor").keyup(function(event) {
     $(this).prev().height($(this).height());
     $(this).prev()[0].scrollTop = this.scrollTop;
   });

   $(".add_query_editor").keyup(function(event) {
     var elm = $(this);
     var lines = elm.val().split("\n");
     var numbers = "";
     for(var i=0; i<lines.length; i++)
     numbers += (i+1) + "\n";
     elm.prev().val(numbers);
     elm.prev()[0].scrollTop = this.scrollTop;
  });

</script>

<style type="text/css">
   .line-numbers {
      background-color: aqua
      text-align: right;
      position:relative;

INFINITE SCROLLING WITH WILL PAGINATE

Image
When we want to use the Infinite Scrolling then sometimes we are facing problem with Infinite Scrolling with Pagination. So I am giving some steps that will try to help for that : -Firstly we have to add the gem

gem 'will_paginate', '~> 2.3.16'
Then in our controllerdef show
     @users = User.all.paginate(:page => params[:page], :per_page => 1)
     respond_to do |format|
        format.js     
     end
end

After that in our view page show.html.erb   =render :partial => "user_list", :locals=>{:users=>@users}
_user_list.html.erb#product_specs
    %table
      %tbody
        %tr
          %td
our content.....#infinite-scrolling      
         = will_paginate @users



<script type="text/javascript">
       $(document).ready(function() {
             if ($('.pagination').length)

             {
                  $(window).scroll(function() 

                   {
                          var url = $(".pagination a[rel='next']&qu…