looking_for 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +142 -0
- data/Rakefile +2 -0
- data/app/assets/javascripts/looking_for/index.js +10 -0
- data/app/assets/javascripts/looking_for/looking_for.js.coffee +29 -0
- data/app/assets/stylesheets/looking_for/index.css +13 -0
- data/app/assets/stylesheets/looking_for/looking_for-tableless.css +27 -0
- data/app/controllers/looking_for_controller.rb +51 -0
- data/app/views/looking_for/_looking_for.html.erb +38 -0
- data/app/views/looking_for/_pagination.html.erb +3 -0
- data/app/views/looking_for/_results.html.erb +26 -0
- data/app/views/looking_for/_toolbar.html.erb +5 -0
- data/app/views/looking_for/assign_and_close.js.erb +8 -0
- data/app/views/looking_for/assign_first.js.erb +6 -0
- data/app/views/looking_for/clear.js.erb +6 -0
- data/app/views/looking_for/looking_for.js.erb +55 -0
- data/config/routes.rb +4 -0
- data/lib/looking_for.rb +7 -0
- data/lib/looking_for/engine.rb +4 -0
- data/lib/looking_for/helpers/looking_for_helper.rb +51 -0
- data/lib/looking_for/version.rb +3 -0
- data/looking_for.gemspec +20 -0
- metadata +107 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Gianni Rossi
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,142 @@
|
|
1
|
+
# LookingFor
|
2
|
+
|
3
|
+
Simple ajax search form.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'looking_for'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install looking_for
|
18
|
+
|
19
|
+
## Assets
|
20
|
+
|
21
|
+
In application.js add
|
22
|
+
|
23
|
+
//= require looking_for
|
24
|
+
|
25
|
+
In application.css add
|
26
|
+
|
27
|
+
*= require looking_for
|
28
|
+
|
29
|
+
You can use the Themeroller (http://jqueryui.com/themeroller/) to define and download an appropriate css file and the pictures needed.
|
30
|
+
Add the downloaded Themeroller css file to the css assets and add the Themeroller images to the image assets.
|
31
|
+
|
32
|
+
#### Adding a touch of style to LookingFor element
|
33
|
+
|
34
|
+
Example, in your application css add:
|
35
|
+
|
36
|
+
#looking_for-toolbar {
|
37
|
+
margin-bottom: 0.5em;
|
38
|
+
}
|
39
|
+
|
40
|
+
#looking_for-header .cell {
|
41
|
+
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
42
|
+
font-size: 1.1em;
|
43
|
+
font-weight: bold;
|
44
|
+
text-align: center;
|
45
|
+
color: #ffffff;
|
46
|
+
background-color: #5c9ccc;
|
47
|
+
}
|
48
|
+
|
49
|
+
#looking_for-filter .cell {
|
50
|
+
padding: 0.1em;
|
51
|
+
}
|
52
|
+
|
53
|
+
#looking_for-results a {
|
54
|
+
font-family: Lucida Grande, Lucida Sans, Arial, sans-serif;
|
55
|
+
font-size: 1em;
|
56
|
+
color: inherit;
|
57
|
+
background-color: inherit;
|
58
|
+
display: block;
|
59
|
+
text-decoration: none;
|
60
|
+
}
|
61
|
+
|
62
|
+
#looking_for-results .row:hover {
|
63
|
+
color: #fff;
|
64
|
+
background-color: #ff8000;
|
65
|
+
}
|
66
|
+
|
67
|
+
#looking_for-results .even {
|
68
|
+
color: #5c9ccc;
|
69
|
+
background-color: #dff;
|
70
|
+
}
|
71
|
+
|
72
|
+
#looking_for-results .odd {
|
73
|
+
color: #5c9ccc;
|
74
|
+
background-color: #ffd;
|
75
|
+
}
|
76
|
+
|
77
|
+
#looking_for-pagination .page_info {
|
78
|
+
margin-top: 0.5em;
|
79
|
+
color: #5c9ccc;
|
80
|
+
text-align: left;
|
81
|
+
}
|
82
|
+
|
83
|
+
#looking_for-pagination .page_info b {
|
84
|
+
color: #6aa6ed;
|
85
|
+
}
|
86
|
+
|
87
|
+
## Usage
|
88
|
+
|
89
|
+
Looking For Helper
|
90
|
+
|
91
|
+
Creates a link tag to open LookingFor search form with the given options.
|
92
|
+
|
93
|
+
##### Signatures
|
94
|
+
|
95
|
+
looking_for(object_name, method_names, link_body, options = {}, html_options = {})
|
96
|
+
|
97
|
+
* object_name - A model name, for example 'Item' or a collection in a one-to-many association (for example 'user.items' if user has many items).
|
98
|
+
* method_names - An array of method names for build the results columns (for example [:id, :code, :description] if id, code, description are attributues of object_name)
|
99
|
+
* link_body - The link body
|
100
|
+
|
101
|
+
###### options
|
102
|
+
|
103
|
+
* :fill - Fill html input with value from database ( db_field => input_tag_id ) when a row is selected.
|
104
|
+
* :width - Width of dialog, optional, default 500px.
|
105
|
+
* :height - Height of dialog, optional, default 300px.
|
106
|
+
|
107
|
+
###### html_options
|
108
|
+
|
109
|
+
Like html_options in link_to helper but :remote will be always true.
|
110
|
+
|
111
|
+
##### Examples
|
112
|
+
|
113
|
+
In your application generate a scaffold for the Item resource :
|
114
|
+
|
115
|
+
rails generate scaffold Item code:string description:string
|
116
|
+
rake db:migrate
|
117
|
+
|
118
|
+
In a view put this code:
|
119
|
+
|
120
|
+
<%= text_field_tag :item_id , '', :name => "looking_for_filter[id]" , :class => :looking_for, :looking_for_id => 'looking_for_items' %>
|
121
|
+
<%= looking_for 'Item',
|
122
|
+
[:id,:code,:description],
|
123
|
+
'Search',
|
124
|
+
{ :fill => {:id => :item_id,
|
125
|
+
:code => :item_code,
|
126
|
+
:description => :item_description},
|
127
|
+
:width => 550,
|
128
|
+
:height => 360},
|
129
|
+
:id => 'looking_for_items' %>
|
130
|
+
<%= text_field_tag :item_code , "", :name => "looking_for_filter[code]" , :class => :looking_for, :looking_for_id => 'looking_for_items' %>
|
131
|
+
<%= text_field_tag :item_description, "", :name => "looking_for_filter[description]", :class => :looking_for, :looking_for_id => 'looking_for_items' %>
|
132
|
+
|
133
|
+
Start web server and try it!
|
134
|
+
|
135
|
+
## TODO:
|
136
|
+
|
137
|
+
* Add column sorting
|
138
|
+
* More options for each column, for example width, min_width, max_width.
|
139
|
+
* Drill-down rows
|
140
|
+
* Inline editing
|
141
|
+
* ....
|
142
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
+
// the compiled file.
|
6
|
+
//
|
7
|
+
//= require jquery
|
8
|
+
//= require jquery_ujs
|
9
|
+
//= require jquery-ui
|
10
|
+
//= require_tree .
|
@@ -0,0 +1,29 @@
|
|
1
|
+
$(document).on 'change', 'input.looking_for', ->
|
2
|
+
name = $(this).attr('name')
|
3
|
+
val = $(this).val()
|
4
|
+
if ( $(this).attr('looking_for_id')!= undefined )
|
5
|
+
looking_for_id = '#' + $(this).attr('looking_for_id')
|
6
|
+
href_old = $(looking_for_id).attr('href')
|
7
|
+
if (val!='')
|
8
|
+
href_new = href_old + '&' + name + '=' + encodeURI(val) + '&validate=true'
|
9
|
+
else
|
10
|
+
href_new = href_old + '&' + name + '=' + encodeURI(val) + '&clear=true'
|
11
|
+
$(looking_for_id).attr('href',href_new)
|
12
|
+
$(looking_for_id).click()
|
13
|
+
$(looking_for_id).attr('href',href_old)
|
14
|
+
|
15
|
+
t = null
|
16
|
+
last_id = null
|
17
|
+
last_value = null
|
18
|
+
|
19
|
+
$(document).on 'keyup', 'input.looking_for_filter', (e) ->
|
20
|
+
if (last_id == $(this).id && last_value == $(this).val())
|
21
|
+
return;
|
22
|
+
last_id = $(this).id
|
23
|
+
last_value = $(this).val()
|
24
|
+
if ( e.keyCode == 13 )
|
25
|
+
$('#looking_for_find').click()
|
26
|
+
else
|
27
|
+
if t!=null
|
28
|
+
clearTimeout(t)
|
29
|
+
t=setTimeout("$('#looking_for_find').click()",250)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,27 @@
|
|
1
|
+
.header {
|
2
|
+
display: table-row;
|
3
|
+
}
|
4
|
+
|
5
|
+
.header .cell {
|
6
|
+
display: table-cell;
|
7
|
+
}
|
8
|
+
|
9
|
+
.filter {
|
10
|
+
display: table-row;
|
11
|
+
}
|
12
|
+
|
13
|
+
.filter .cell {
|
14
|
+
display: table-cell;
|
15
|
+
}
|
16
|
+
|
17
|
+
.body {
|
18
|
+
display: table-row-group;
|
19
|
+
}
|
20
|
+
|
21
|
+
.row {
|
22
|
+
display: table-row;
|
23
|
+
}
|
24
|
+
|
25
|
+
.row .cell {
|
26
|
+
display: table-cell;
|
27
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
class LookingForController < ApplicationController
|
2
|
+
def search
|
3
|
+
object_eval = eval("#{params[:object_name]}")
|
4
|
+
if params[:looking_for_filter]
|
5
|
+
params[:looking_for_filter].each do |key, value|
|
6
|
+
if value!=""
|
7
|
+
table_alias_and_field = key
|
8
|
+
table_alias_and_field = "#{params[:object_name].underscore}.#{key}" if key.split('.').length == 1
|
9
|
+
ar = table_alias_and_field.split('.')
|
10
|
+
table_alias = ar[ar.length-2]
|
11
|
+
field = ar[ar.length-1]
|
12
|
+
table_alias = table_alias.pluralize
|
13
|
+
table_alias_and_field = "#{table_alias}.#{field}"
|
14
|
+
|
15
|
+
if params[:no_case] && params[:no_case].include?(key)
|
16
|
+
object_eval = object_eval.where("upper(#{table_alias_and_field}) like ? ",value.upcase+"%")
|
17
|
+
elsif params[:use_upper] && params[:use_upper].include?(key)
|
18
|
+
object_eval = object_eval.where("#{table_alias_and_field} like ? ",value.upcase+"%")
|
19
|
+
else
|
20
|
+
object_eval = object_eval.where("#{table_alias_and_field} like ? ",value+"%")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
if params[:conditions] && params[:conditions].class == Array
|
27
|
+
params[:conditions].collect! do |a|
|
28
|
+
if a=='true'
|
29
|
+
true
|
30
|
+
elsif a=='false'
|
31
|
+
false
|
32
|
+
else
|
33
|
+
a
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
object_eval = object_eval.where(params[:conditions])if params[:conditions]
|
39
|
+
object_eval = object_eval.includes(params[:include]) if params[:include]
|
40
|
+
|
41
|
+
@records = object_eval.paginate(:per_page => 10,:page => params[:page]).order(params[:order])
|
42
|
+
|
43
|
+
template = 'looking_for'
|
44
|
+
template = 'assign_first' if @records.length == 1 && params[:validate] == 'true'
|
45
|
+
template = 'clear' if params[:clear] == 'true'
|
46
|
+
|
47
|
+
respond_to do |format|
|
48
|
+
format.js { render template}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
<div class="looking_for">
|
2
|
+
<%= form_tag( {:controller => :looking_for,
|
3
|
+
:action => :search,
|
4
|
+
:object_name => params[:object_name],
|
5
|
+
:method_names => params[:method_names],
|
6
|
+
:fill => params[:fill],
|
7
|
+
:conditions => params[:conditions],
|
8
|
+
:no_case => params[:no_case],
|
9
|
+
:use_upper => params[:use_upper],
|
10
|
+
:include => params[:include]
|
11
|
+
},
|
12
|
+
{:method=>'get', :remote => true, :id=>'looking_for_form' } ) do %>
|
13
|
+
|
14
|
+
<div id="looking_for-toolbar" class="ui-corner-all">
|
15
|
+
</div>
|
16
|
+
|
17
|
+
<div id="looking_for-table" class="table">
|
18
|
+
<div id="looking_for-header" class="header">
|
19
|
+
<% params[:method_names].each do |method_name| %>
|
20
|
+
<div class="cell"><%= label(params[:object_name].downcase, method_name) %></div>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div id="looking_for-filter" class="filter">
|
25
|
+
<% params[:looking_for_filter] ||= {} %>
|
26
|
+
<% params[:method_names].each do |method_name| %>
|
27
|
+
<div class="cell"><%= text_field_tag "looking_for_filter[#{method_name}]" , params[:looking_for_filter][method_name]||'', :class => 'looking_for_filter' %></div>
|
28
|
+
<% end %>
|
29
|
+
</div>
|
30
|
+
|
31
|
+
<div id="looking_for-results" class="body">
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div id="looking_for-pagination">
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
</div>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<% @records.each do |record| %>
|
2
|
+
<% assignments = {} %>
|
3
|
+
<% if !params[:fill].nil? %>
|
4
|
+
<% params[:fill].each do |key, value| %>
|
5
|
+
<% assignments[value] = eval("record.#{key}") %>
|
6
|
+
<% end %>
|
7
|
+
<% end %>
|
8
|
+
<div class="row <%= cycle("even", "odd") %>">
|
9
|
+
<% if params[:method_names] %>
|
10
|
+
<% params[:method_names].each do |method_name| %>
|
11
|
+
<div class="cell">
|
12
|
+
<% field_class = eval("record.#{method_names}.class") rescue nil %>
|
13
|
+
<%= link_to( (field_class == TrueClass) | (field_class== FalseClass) ?
|
14
|
+
check_box_tag(method_name , eval("record."+method_name) , eval("record."+method_name) , :disabled=>true) :
|
15
|
+
eval("record."+method_name)||'',
|
16
|
+
{
|
17
|
+
:controller => :looking_for,
|
18
|
+
:action => :assign_and_close,
|
19
|
+
:assignments => assignments
|
20
|
+
},
|
21
|
+
:remote=> true) rescue '' %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
<% end %>
|
@@ -0,0 +1,5 @@
|
|
1
|
+
<%= content_tag :button, 'Previous', :id => "looking_for_prev", :disabled => !(@records.current_page > 1 && @records.current_page - 1) %>
|
2
|
+
<%= content_tag :button, 'Search' , :id => "looking_for_find" %>
|
3
|
+
<%= content_tag :button, 'Next' , :id => "looking_for_next", :disabled => !(@records.current_page < @records.total_pages && @records.current_page + 1) %>
|
4
|
+
|
5
|
+
<%= hidden_field_tag "page", @records.current_page %>
|
@@ -0,0 +1,55 @@
|
|
1
|
+
<% params[:name] ||= 'looking_for_window' %>
|
2
|
+
var window_id = "<%= params[:name] %>";
|
3
|
+
|
4
|
+
<% if params[:validate] == 'true' %>
|
5
|
+
<% if !params[:fill].nil? %>
|
6
|
+
<% params[:fill].each do |key, value| %>
|
7
|
+
$("#<%= value %>").val("");
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
if ($("#"+window_id).length == 0)
|
13
|
+
{
|
14
|
+
var p_width = <%= params[:width] || 500 %>;
|
15
|
+
var p_height = <%= params[:height] || 300 %>;
|
16
|
+
$("<div id='"+window_id+"'></div>").dialog({autoOpen: true,title: 'Looking for..',height: p_height,width: p_width,modal: true, close: function(ev, ui) {$(this).remove();}});
|
17
|
+
$("#"+window_id).html("<%= escape_javascript(render('looking_for')) %>");
|
18
|
+
$("#"+window_id).effect('slide');
|
19
|
+
}
|
20
|
+
|
21
|
+
$("#"+window_id).dialog('open');
|
22
|
+
$("#looking_for-toolbar").html("<%= escape_javascript(render('toolbar')) %>");
|
23
|
+
$("#looking_for-results").html("<%= escape_javascript(render('results')) %>");
|
24
|
+
$("#looking_for-pagination").html("<%= escape_javascript(render('pagination')) %>");
|
25
|
+
|
26
|
+
$("#looking_for_prev").button({text: false, icons: { primary: "ui-icon-seek-prev"}});
|
27
|
+
$("#looking_for_next").button({text: false, icons: { primary: "ui-icon-seek-next"}});
|
28
|
+
$("#looking_for_find").button({text: false, icons: { primary: "ui-icon-search"}});
|
29
|
+
|
30
|
+
$('#looking_for_prev').click
|
31
|
+
(
|
32
|
+
function()
|
33
|
+
{
|
34
|
+
$('#looking_for_form input[name=page]').val(parseInt($('#looking_for_form input[name=page]').val())-1);
|
35
|
+
$('#looking_for_form').submit();
|
36
|
+
}
|
37
|
+
);
|
38
|
+
|
39
|
+
$('#looking_for_find').click
|
40
|
+
(
|
41
|
+
function()
|
42
|
+
{
|
43
|
+
$('#looking_for_form input[name=page]').val(1);
|
44
|
+
$('#looking_for_form').submit();
|
45
|
+
}
|
46
|
+
);
|
47
|
+
|
48
|
+
$('#looking_for_next').click
|
49
|
+
(
|
50
|
+
function()
|
51
|
+
{
|
52
|
+
$('#looking_for_form input[name=page]').val(parseInt($('#looking_for_form input[name=page]').val())+1);
|
53
|
+
$('#looking_for_form').submit();
|
54
|
+
}
|
55
|
+
);
|
data/config/routes.rb
ADDED
data/lib/looking_for.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
module LookingForHelper
|
2
|
+
#
|
3
|
+
# = Looking For Helper
|
4
|
+
#
|
5
|
+
# Creates a link tag to open LookingFor search form with the given options.
|
6
|
+
#
|
7
|
+
# ==== Signatures
|
8
|
+
#
|
9
|
+
# looking_for(object_name, method_names, link_body, options = {}, html_options = {})
|
10
|
+
#
|
11
|
+
# * <tt>object_name</tt> - A model name, for example 'Item' or a collection in a one-to-many association (for example 'user.items' if user has many items).
|
12
|
+
# * <tt>method_names</tt> - An array of method names for build the results columns (for example [:id, :code, :description] if id, code, description are attributues of object_name)
|
13
|
+
# * <tt>link_body</tt> - The link body
|
14
|
+
#
|
15
|
+
# ==== options
|
16
|
+
#
|
17
|
+
# * <tt>:fill</tt> - Fill html input with value from database ( db_field => input_tag_id ) when a row is selected.
|
18
|
+
# * <tt>:width</tt> - Width of dialog, optional, default 500px.
|
19
|
+
# * <tt>:height</tt> - Height of dialog, optional, default 300px.
|
20
|
+
#
|
21
|
+
# ==== html_options
|
22
|
+
#
|
23
|
+
# Like html_options in link_to helper but :remote will be always true.
|
24
|
+
#
|
25
|
+
# ==== Examples
|
26
|
+
#
|
27
|
+
# <%= looking_for 'Item',
|
28
|
+
# [:id,:code,:description],
|
29
|
+
# 'search',
|
30
|
+
# { :fill => {:id => :item_id,
|
31
|
+
# :code => :item_code,
|
32
|
+
# :description => :item_description},
|
33
|
+
# :width => 550,
|
34
|
+
# :height => 360},
|
35
|
+
# :id => 'looking_for_items' %>
|
36
|
+
|
37
|
+
def looking_for(*args)
|
38
|
+
opt = args[3] || {}
|
39
|
+
opt[:controller] = :looking_for
|
40
|
+
opt[:action] = :search
|
41
|
+
opt[:width] ||= 500
|
42
|
+
opt[:height] ||= 300
|
43
|
+
opt[:object_name] = args.first
|
44
|
+
opt[:method_names] = args[1]
|
45
|
+
|
46
|
+
html_opt = args[4] || {}
|
47
|
+
html_opt[:remote] = true
|
48
|
+
|
49
|
+
link_to args[2], opt, html_opt
|
50
|
+
end
|
51
|
+
end
|
data/looking_for.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/looking_for/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Gianni Rossi"]
|
6
|
+
gem.email = ["giannirossi72@gmail.com"]
|
7
|
+
gem.summary = %q{Looking for}
|
8
|
+
gem.description = %q{Simple ajax search form }
|
9
|
+
gem.homepage = "https://github.com/giannirossi72/looking_for"
|
10
|
+
|
11
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
12
|
+
gem.files = `git ls-files`.split("\n")
|
13
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
|
+
gem.name = "looking_for"
|
15
|
+
gem.require_paths = ["lib"]
|
16
|
+
gem.version = LookingFor::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency "rails", ">= 3.1.0", "< 5.0"
|
19
|
+
gem.add_dependency 'will_paginate', '~> 3.0.0'
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: looking_for
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Gianni Rossi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-03-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.1.0
|
22
|
+
- - <
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: '5.0'
|
25
|
+
type: :runtime
|
26
|
+
prerelease: false
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.1.0
|
33
|
+
- - <
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '5.0'
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: will_paginate
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 3.0.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: !ruby/object:Gem::Requirement
|
47
|
+
none: false
|
48
|
+
requirements:
|
49
|
+
- - ~>
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 3.0.0
|
52
|
+
description: ! 'Simple ajax search form '
|
53
|
+
email:
|
54
|
+
- giannirossi72@gmail.com
|
55
|
+
executables: []
|
56
|
+
extensions: []
|
57
|
+
extra_rdoc_files: []
|
58
|
+
files:
|
59
|
+
- .gitignore
|
60
|
+
- Gemfile
|
61
|
+
- LICENSE
|
62
|
+
- README.md
|
63
|
+
- Rakefile
|
64
|
+
- app/assets/javascripts/looking_for/index.js
|
65
|
+
- app/assets/javascripts/looking_for/looking_for.js.coffee
|
66
|
+
- app/assets/stylesheets/looking_for/index.css
|
67
|
+
- app/assets/stylesheets/looking_for/looking_for-tableless.css
|
68
|
+
- app/controllers/looking_for_controller.rb
|
69
|
+
- app/views/looking_for/_looking_for.html.erb
|
70
|
+
- app/views/looking_for/_pagination.html.erb
|
71
|
+
- app/views/looking_for/_results.html.erb
|
72
|
+
- app/views/looking_for/_toolbar.html.erb
|
73
|
+
- app/views/looking_for/assign_and_close.js.erb
|
74
|
+
- app/views/looking_for/assign_first.js.erb
|
75
|
+
- app/views/looking_for/clear.js.erb
|
76
|
+
- app/views/looking_for/looking_for.js.erb
|
77
|
+
- config/routes.rb
|
78
|
+
- lib/looking_for.rb
|
79
|
+
- lib/looking_for/engine.rb
|
80
|
+
- lib/looking_for/helpers/looking_for_helper.rb
|
81
|
+
- lib/looking_for/version.rb
|
82
|
+
- looking_for.gemspec
|
83
|
+
homepage: https://github.com/giannirossi72/looking_for
|
84
|
+
licenses: []
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
88
|
+
- lib
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 1.8.21
|
104
|
+
signing_key:
|
105
|
+
specification_version: 3
|
106
|
+
summary: Looking for
|
107
|
+
test_files: []
|