diff --git a/app/assets/javascripts/projects.js b/app/assets/javascripts/projects.js index a80e593f..90de73a1 100644 --- a/app/assets/javascripts/projects.js +++ b/app/assets/javascripts/projects.js @@ -7,19 +7,6 @@ var ProjectsList = { this.limit=limit; this.offset=limit; this.initLoadMore(); - - $('.project_search').keyup(function() { - var terms = $(this).val(); - if (terms.length >= 2 || terms.length == 0) { - url = $('.project_search').parent().attr('action'); - $.ajax({ - type: "GET", - url: location.href, - data: { 'terms': terms, 'replace': true }, - dataType: "script" - }); - } - }); }, getOld: @@ -33,17 +20,6 @@ var ProjectsList = { dataType: "script"}); }, - replace: - function(count, html) { - $(".tile").html(html); - if(count == ProjectsList.limit) { - this.offset = count; - this.initLoadMore(); - } else { - this.offset = 0; - } - }, - append: function(count, html) { $(".tile").append(html); diff --git a/app/assets/stylesheets/projects.css.scss b/app/assets/stylesheets/projects.css.scss index f1b7ac09..366a0d84 100644 --- a/app/assets/stylesheets/projects.css.scss +++ b/app/assets/stylesheets/projects.css.scss @@ -647,9 +647,3 @@ h4.middle-panel { border-radius:3px; float:left; } - -.project_search { - margin: 1.5em 0; - padding: 8px !important; - width: 300px; -} diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index f0eafeeb..4b4f748f 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -12,9 +12,7 @@ class ProjectsController < ApplicationController def index @limit, @offset = (params[:limit] || 16), (params[:offset] || 0) - @projects = current_user.projects - @projects = @projects.where("name LIKE ?", "%#{params[:terms]}%") unless params[:terms].blank? - @projects = @projects.limit(@limit).offset(@offset) + @projects = current_user.projects.limit(@limit).offset(@offset) end def new diff --git a/app/views/projects/index.html.haml b/app/views/projects/index.html.haml index 9cbfd950..8a4343b0 100644 --- a/app/views/projects/index.html.haml +++ b/app/views/projects/index.html.haml @@ -1,30 +1,29 @@ - content_for(:body_class, "projects-page") -- content_for(:page_title) do - .container_4 - .grid_4 - - if current_user.can_create_project? - %a.grey-button.right{:href => new_project_path} Create new project - %h2.icon - %span - Projects - %center - = form_tag projects_path, :method => :get, :remote => true, :id => "projects_search_form" do - = search_field_tag :project_search, nil, { :placeholder => 'Filter projects by name', :class => 'project_search text' } +.container_4 + .grid_4 + - if current_user.can_create_project? + %a.grey-button.right{:href => new_project_path} Create new project + %h2.icon + %span + Projects - %div.clear - - unless @projects.empty? - %div{:class => "tile"} - = render "tile" + %div.clear + - unless @projects.empty? + %div{:class => "tile"} + = render "tile" + + -# If projects requris paging + -# We add ajax loader & init script + - if @projects.count == @limit .clear .loading{ :style => "display:none;"} %center= image_tag "ajax-loader.gif" - - if @projects.count == @limit - :javascript - $(function(){ - ProjectsList.init(16); - }); - - else - %center.prepend-top - %h2 - %cite Nothing here + :javascript + $(function(){ + ProjectsList.init(16); + }); + - else + %center.prepend-top + %h2 + %cite Nothing here diff --git a/app/views/projects/index.js.haml b/app/views/projects/index.js.haml index 9b990734..25da7cb4 100644 --- a/app/views/projects/index.js.haml +++ b/app/views/projects/index.js.haml @@ -1,7 +1,2 @@ -- if params[:replace] - :plain - ProjectsList.replace(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}"); -- else - :plain - ProjectsList.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}"); - +:plain + ProjectsList.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}");