removed project filter
This commit is contained in:
parent
cff9519127
commit
321dbb7bac
5 changed files with 26 additions and 64 deletions
|
@ -7,19 +7,6 @@ var ProjectsList = {
|
||||||
this.limit=limit;
|
this.limit=limit;
|
||||||
this.offset=limit;
|
this.offset=limit;
|
||||||
this.initLoadMore();
|
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:
|
getOld:
|
||||||
|
@ -33,17 +20,6 @@ var ProjectsList = {
|
||||||
dataType: "script"});
|
dataType: "script"});
|
||||||
},
|
},
|
||||||
|
|
||||||
replace:
|
|
||||||
function(count, html) {
|
|
||||||
$(".tile").html(html);
|
|
||||||
if(count == ProjectsList.limit) {
|
|
||||||
this.offset = count;
|
|
||||||
this.initLoadMore();
|
|
||||||
} else {
|
|
||||||
this.offset = 0;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
append:
|
append:
|
||||||
function(count, html) {
|
function(count, html) {
|
||||||
$(".tile").append(html);
|
$(".tile").append(html);
|
||||||
|
|
|
@ -647,9 +647,3 @@ h4.middle-panel {
|
||||||
border-radius:3px;
|
border-radius:3px;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.project_search {
|
|
||||||
margin: 1.5em 0;
|
|
||||||
padding: 8px !important;
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
|
@ -12,9 +12,7 @@ class ProjectsController < ApplicationController
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@limit, @offset = (params[:limit] || 16), (params[:offset] || 0)
|
@limit, @offset = (params[:limit] || 16), (params[:offset] || 0)
|
||||||
@projects = current_user.projects
|
@projects = current_user.projects.limit(@limit).offset(@offset)
|
||||||
@projects = @projects.where("name LIKE ?", "%#{params[:terms]}%") unless params[:terms].blank?
|
|
||||||
@projects = @projects.limit(@limit).offset(@offset)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
|
|
@ -1,30 +1,29 @@
|
||||||
- content_for(:body_class, "projects-page")
|
- content_for(:body_class, "projects-page")
|
||||||
- content_for(:page_title) do
|
.container_4
|
||||||
.container_4
|
.grid_4
|
||||||
.grid_4
|
- if current_user.can_create_project?
|
||||||
- if current_user.can_create_project?
|
%a.grey-button.right{:href => new_project_path} Create new project
|
||||||
%a.grey-button.right{:href => new_project_path} Create new project
|
%h2.icon
|
||||||
%h2.icon
|
%span
|
||||||
%span
|
Projects
|
||||||
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' }
|
|
||||||
|
|
||||||
%div.clear
|
%div.clear
|
||||||
- unless @projects.empty?
|
- unless @projects.empty?
|
||||||
%div{:class => "tile"}
|
%div{:class => "tile"}
|
||||||
= render "tile"
|
= render "tile"
|
||||||
|
|
||||||
|
-# If projects requris paging
|
||||||
|
-# We add ajax loader & init script
|
||||||
|
- if @projects.count == @limit
|
||||||
.clear
|
.clear
|
||||||
.loading{ :style => "display:none;"}
|
.loading{ :style => "display:none;"}
|
||||||
%center= image_tag "ajax-loader.gif"
|
%center= image_tag "ajax-loader.gif"
|
||||||
|
|
||||||
- if @projects.count == @limit
|
:javascript
|
||||||
:javascript
|
$(function(){
|
||||||
$(function(){
|
ProjectsList.init(16);
|
||||||
ProjectsList.init(16);
|
});
|
||||||
});
|
- else
|
||||||
- else
|
%center.prepend-top
|
||||||
%center.prepend-top
|
%h2
|
||||||
%h2
|
%cite Nothing here
|
||||||
%cite Nothing here
|
|
||||||
|
|
|
@ -1,7 +1,2 @@
|
||||||
- if params[:replace]
|
:plain
|
||||||
:plain
|
ProjectsList.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}");
|
||||||
ProjectsList.replace(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}");
|
|
||||||
- else
|
|
||||||
:plain
|
|
||||||
ProjectsList.append(#{@projects.count}, "#{escape_javascript(render(:partial => 'projects/tile'))}");
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue