unknown_admin 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,22 @@ module Admin
|
|
30
30
|
|
31
31
|
|
32
32
|
protected
|
33
|
-
|
33
|
+
# This method is responsable for building the object on :new and :create
|
34
|
+
# methods. If you overwrite it, don't forget to cache the result in an
|
35
|
+
# instance variable.
|
36
|
+
#
|
37
|
+
def build_resource
|
38
|
+
logger.debug "---------build info-----------"
|
39
|
+
logger.debug "Build Method: #{method_for_build}"
|
40
|
+
logger.debug "End of assoc: #{end_of_association_chain}"
|
41
|
+
logger.debug ""
|
42
|
+
get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_build, *resource_params))
|
43
|
+
end
|
44
|
+
def resource_params
|
45
|
+
return [] if request.get?
|
46
|
+
whitelist_method = :"#{ resource_request_name }_params"
|
47
|
+
[ self.send(whitelist_method) ]
|
48
|
+
end
|
34
49
|
def collection
|
35
50
|
if params[:rquery].nil?
|
36
51
|
if end_of_association_chain.column_names.include? "position"
|
@@ -15,7 +15,12 @@ module Admin
|
|
15
15
|
rel = resource.send(list_field_item.first.first)
|
16
16
|
resolved = rel.send(list_field_item.first.last)
|
17
17
|
end
|
18
|
-
resolved
|
18
|
+
if resolved.respond_to?("mime_type") && resolved.mime_type.start_with?("image/") && resolved.respond_to?("thumb")
|
19
|
+
image_tag(resolved.thumb("80x80#").url,alt:"")
|
20
|
+
else
|
21
|
+
resolved
|
22
|
+
end
|
23
|
+
|
19
24
|
end
|
20
25
|
def resolve_field_name(list_field_item)
|
21
26
|
case list_field_item
|
@@ -1,9 +1,5 @@
|
|
1
1
|
<p><span class="badge"><%= collection.total_entries %> Records found</span></p>
|
2
|
-
<% if resource_class.column_names.include?('position') %>
|
3
|
-
<table id="sortable_list" class="table table-striped table-bordered table-condensed" data-update-url="<%= list_sort_resources_path %>">
|
4
|
-
<% else %>
|
5
2
|
<table id="sortable_list" class="table table-striped table-bordered table-condensed">
|
6
|
-
<% end %>
|
7
3
|
<thead>
|
8
4
|
<%= render :partial=>"list_header" %>
|
9
5
|
</thead>
|
@@ -30,7 +30,22 @@ module Admin
|
|
30
30
|
|
31
31
|
|
32
32
|
protected
|
33
|
-
|
33
|
+
# This method is responsable for building the object on :new and :create
|
34
|
+
# methods. If you overwrite it, don't forget to cache the result in an
|
35
|
+
# instance variable.
|
36
|
+
#
|
37
|
+
def build_resource
|
38
|
+
logger.debug "---------build info-----------"
|
39
|
+
logger.debug "Build Method: #{method_for_build}"
|
40
|
+
logger.debug "End of assoc: #{end_of_association_chain}"
|
41
|
+
logger.debug ""
|
42
|
+
get_resource_ivar || set_resource_ivar(end_of_association_chain.send(method_for_build, *resource_params))
|
43
|
+
end
|
44
|
+
def resource_params
|
45
|
+
return [] if request.get?
|
46
|
+
whitelist_method = :"#{ resource_request_name }_params"
|
47
|
+
[ self.send(whitelist_method) ]
|
48
|
+
end
|
34
49
|
def collection
|
35
50
|
@search = end_of_association_chain.search(params[:q])
|
36
51
|
get_collection_ivar || set_collection_ivar(@search.result.paginate(:page => params[:page], :per_page => per_page))
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unknown_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: inherited_resources
|