Commit 321dbb7bac5b2859cd5f30fdee7a1a2f39e122ae
1 parent
cff95191
Exists in
master
and in
4 other branches
removed project filter
Showing
5 changed files
with
26 additions
and
64 deletions
Show diff stats
app/assets/javascripts/projects.js
| ... | ... | @@ -7,19 +7,6 @@ var ProjectsList = { |
| 7 | 7 | this.limit=limit; |
| 8 | 8 | this.offset=limit; |
| 9 | 9 | this.initLoadMore(); |
| 10 | - | |
| 11 | - $('.project_search').keyup(function() { | |
| 12 | - var terms = $(this).val(); | |
| 13 | - if (terms.length >= 2 || terms.length == 0) { | |
| 14 | - url = $('.project_search').parent().attr('action'); | |
| 15 | - $.ajax({ | |
| 16 | - type: "GET", | |
| 17 | - url: location.href, | |
| 18 | - data: { 'terms': terms, 'replace': true }, | |
| 19 | - dataType: "script" | |
| 20 | - }); | |
| 21 | - } | |
| 22 | - }); | |
| 23 | 10 | }, |
| 24 | 11 | |
| 25 | 12 | getOld: |
| ... | ... | @@ -33,17 +20,6 @@ var ProjectsList = { |
| 33 | 20 | dataType: "script"}); |
| 34 | 21 | }, |
| 35 | 22 | |
| 36 | - replace: | |
| 37 | - function(count, html) { | |
| 38 | - $(".tile").html(html); | |
| 39 | - if(count == ProjectsList.limit) { | |
| 40 | - this.offset = count; | |
| 41 | - this.initLoadMore(); | |
| 42 | - } else { | |
| 43 | - this.offset = 0; | |
| 44 | - } | |
| 45 | - }, | |
| 46 | - | |
| 47 | 23 | append: |
| 48 | 24 | function(count, html) { |
| 49 | 25 | $(".tile").append(html); | ... | ... |
app/assets/stylesheets/projects.css.scss
app/controllers/projects_controller.rb
| ... | ... | @@ -12,9 +12,7 @@ class ProjectsController < ApplicationController |
| 12 | 12 | |
| 13 | 13 | def index |
| 14 | 14 | @limit, @offset = (params[:limit] || 16), (params[:offset] || 0) |
| 15 | - @projects = current_user.projects | |
| 16 | - @projects = @projects.where("name LIKE ?", "%#{params[:terms]}%") unless params[:terms].blank? | |
| 17 | - @projects = @projects.limit(@limit).offset(@offset) | |
| 15 | + @projects = current_user.projects.limit(@limit).offset(@offset) | |
| 18 | 16 | end |
| 19 | 17 | |
| 20 | 18 | def new | ... | ... |
app/views/projects/index.html.haml
| 1 | 1 | - content_for(:body_class, "projects-page") |
| 2 | -- content_for(:page_title) do | |
| 3 | - .container_4 | |
| 4 | - .grid_4 | |
| 5 | - - if current_user.can_create_project? | |
| 6 | - %a.grey-button.right{:href => new_project_path} Create new project | |
| 7 | - %h2.icon | |
| 8 | - %span | |
| 9 | - Projects | |
| 10 | - %center | |
| 11 | - = form_tag projects_path, :method => :get, :remote => true, :id => "projects_search_form" do | |
| 12 | - = search_field_tag :project_search, nil, { :placeholder => 'Filter projects by name', :class => 'project_search text' } | |
| 2 | +.container_4 | |
| 3 | + .grid_4 | |
| 4 | + - if current_user.can_create_project? | |
| 5 | + %a.grey-button.right{:href => new_project_path} Create new project | |
| 6 | + %h2.icon | |
| 7 | + %span | |
| 8 | + Projects | |
| 13 | 9 | |
| 14 | - %div.clear | |
| 15 | - - unless @projects.empty? | |
| 16 | - %div{:class => "tile"} | |
| 17 | - = render "tile" | |
| 10 | + %div.clear | |
| 11 | + - unless @projects.empty? | |
| 12 | + %div{:class => "tile"} | |
| 13 | + = render "tile" | |
| 14 | + | |
| 15 | + -# If projects requris paging | |
| 16 | + -# We add ajax loader & init script | |
| 17 | + - if @projects.count == @limit | |
| 18 | 18 | .clear |
| 19 | 19 | .loading{ :style => "display:none;"} |
| 20 | 20 | %center= image_tag "ajax-loader.gif" |
| 21 | 21 | |
| 22 | - - if @projects.count == @limit | |
| 23 | - :javascript | |
| 24 | - $(function(){ | |
| 25 | - ProjectsList.init(16); | |
| 26 | - }); | |
| 27 | - - else | |
| 28 | - %center.prepend-top | |
| 29 | - %h2 | |
| 30 | - %cite Nothing here | |
| 22 | + :javascript | |
| 23 | + $(function(){ | |
| 24 | + ProjectsList.init(16); | |
| 25 | + }); | |
| 26 | + - else | |
| 27 | + %center.prepend-top | |
| 28 | + %h2 | |
| 29 | + %cite Nothing here | ... | ... |
app/views/projects/index.js.haml
| 1 | -- if params[:replace] | |
| 2 | - :plain | |
| 3 | - ProjectsList.replace(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}"); | |
| 4 | -- else | |
| 5 | - :plain | |
| 6 | - ProjectsList.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}"); | |
| 7 | - | |
| 1 | +:plain | |
| 2 | + ProjectsList.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}"); | ... | ... |