infopark_cloud_connector 6.9.1.3.22208381 → 6.9.2.1.125136549
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/rails_connector/blobs_controller.rb +1 -1
- data/app/controllers/rails_connector/objs_controller.rb +29 -9
- data/app/controllers/rails_connector/tasks_controller.rb +1 -1
- data/app/controllers/rails_connector/widget_renderer.rb +66 -0
- data/app/controllers/rails_connector/workspaces_controller.rb +9 -5
- data/app/helpers/rails_connector/cms_tag_helper.rb +40 -12
- data/app/views/rails_connector/objs/create_widget.html.erb +1 -1
- data/app/views/rails_connector/objs/show.html.erb +1 -0
- data/config/routes.rb +1 -1
- data/lib/assets/javascripts/infopark_editing.js +5598 -3254
- data/lib/assets/stylesheets/infopark_editing.css +366 -311
- data/lib/generators/cms/migration/templates/migration.rb +7 -9
- data/lib/rails_connector/backend_not_available.rb +1 -1
- data/lib/rails_connector/basic_obj.rb +10 -21
- data/lib/rails_connector/cache.rb +1 -1
- data/lib/rails_connector/cms_cache_storage.rb +10 -1
- data/lib/rails_connector/cms_rest_api.rb +80 -40
- data/lib/rails_connector/content_service.rb +1 -1
- data/lib/rails_connector/date_attribute.rb +1 -1
- data/lib/rails_connector/link.rb +0 -4
- data/lib/rails_connector/migrations/migration_dsl.rb +116 -12
- data/lib/rails_connector/migrations/migrator.rb +0 -1
- data/lib/rails_connector/workspace.rb +1 -1
- metadata +5 -7
- data/lib/rails_connector/cms_api_search_request.rb +0 -50
- data/lib/rails_connector/default_search_request.rb +0 -6
- data/lib/rails_connector/elasticsearch_request.rb +0 -78
- data/lib/rails_connector/widget_renderer.rb +0 -41
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infopark_cloud_connector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.9.1.
|
4
|
+
version: 6.9.2.1.125136549
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- app/controllers/rails_connector/objs_controller.rb
|
74
74
|
- app/controllers/rails_connector/tasks_controller.rb
|
75
75
|
- app/controllers/rails_connector/webservice_controller.rb
|
76
|
+
- app/controllers/rails_connector/widget_renderer.rb
|
76
77
|
- app/controllers/rails_connector/workspaces_controller.rb
|
77
78
|
- app/helpers/rails_connector/cms_asset_helper.rb
|
78
79
|
- app/helpers/rails_connector/cms_tag_helper.rb
|
@@ -81,6 +82,7 @@ files:
|
|
81
82
|
- app/helpers/rails_connector/widget_helper.rb
|
82
83
|
- app/views/rails_connector/_editing_javascript.html.erb
|
83
84
|
- app/views/rails_connector/objs/create_widget.html.erb
|
85
|
+
- app/views/rails_connector/objs/show.html.erb
|
84
86
|
- config/locales/de.rails_connector.models.yml
|
85
87
|
- config/locales/en.rails_connector.models.yml
|
86
88
|
- config/routes.rb
|
@@ -106,7 +108,6 @@ files:
|
|
106
108
|
- lib/rails_connector/cache_middleware.rb
|
107
109
|
- lib/rails_connector/client_error.rb
|
108
110
|
- lib/rails_connector/cloud_engine.rb
|
109
|
-
- lib/rails_connector/cms_api_search_request.rb
|
110
111
|
- lib/rails_connector/cms_backend.rb
|
111
112
|
- lib/rails_connector/cms_cache_storage.rb
|
112
113
|
- lib/rails_connector/cms_rest_api.rb
|
@@ -117,8 +118,6 @@ files:
|
|
117
118
|
- lib/rails_connector/content_state_visitor.rb
|
118
119
|
- lib/rails_connector/controller_runtime.rb
|
119
120
|
- lib/rails_connector/date_attribute.rb
|
120
|
-
- lib/rails_connector/default_search_request.rb
|
121
|
-
- lib/rails_connector/elasticsearch_request.rb
|
122
121
|
- lib/rails_connector/errors.rb
|
123
122
|
- lib/rails_connector/link.rb
|
124
123
|
- lib/rails_connector/log_subscriber.rb
|
@@ -137,7 +136,6 @@ files:
|
|
137
136
|
- lib/rails_connector/obj_data_from_service.rb
|
138
137
|
- lib/rails_connector/obj_search_enumerator.rb
|
139
138
|
- lib/rails_connector/rack_middlewares.rb
|
140
|
-
- lib/rails_connector/widget_renderer.rb
|
141
139
|
- lib/rails_connector/workspace.rb
|
142
140
|
- lib/rails_connector/workspace_data_from_service.rb
|
143
141
|
- lib/rails_connector/workspace_selection_middleware.rb
|
@@ -156,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
156
154
|
version: '0'
|
157
155
|
segments:
|
158
156
|
- 0
|
159
|
-
hash:
|
157
|
+
hash: 117017377
|
160
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
159
|
none: false
|
162
160
|
requirements:
|
@@ -1,50 +0,0 @@
|
|
1
|
-
module RailsConnector
|
2
|
-
|
3
|
-
# This class provides a basic implementation for accessing the search using the cms api.
|
4
|
-
# It can be activated by making it the superclass of SearchRequest.
|
5
|
-
# It should be customized by subclassing.
|
6
|
-
class CmsApiSearchRequest
|
7
|
-
|
8
|
-
# Takes +query_string+ and +options+ for accessing Cms Api Search.
|
9
|
-
#
|
10
|
-
# +options+ is a hash and may include:
|
11
|
-
#
|
12
|
-
# <tt>:limit</tt>:: The maximum number of hits
|
13
|
-
# <tt>:offset</tt>:: The search offset
|
14
|
-
def initialize(query_string, options = {})
|
15
|
-
@query_string = query_string
|
16
|
-
@options = options
|
17
|
-
end
|
18
|
-
|
19
|
-
# Accesses Cms Api Search using #query and fetches search hits.
|
20
|
-
def fetch_hits
|
21
|
-
search_enum = search_results
|
22
|
-
|
23
|
-
result = SES::SearchResult.new(search_enum.size)
|
24
|
-
search_enum.take(@options[:limit] || 10).each do |obj|
|
25
|
-
hard_coded_score = 1
|
26
|
-
result << SES::Hit.new(obj.id, hard_coded_score, {}, obj)
|
27
|
-
end
|
28
|
-
|
29
|
-
result
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def search_results
|
35
|
-
now = Time.now
|
36
|
-
search_enum = Obj.where(:_valid_from, :is_less_than, now.to_iso
|
37
|
-
).and_not(:_valid_until, :is_less_than, now.to_iso
|
38
|
-
).and_not(:_obj_class, :equals, 'Image'
|
39
|
-
).offset(@options[:offset] || 0
|
40
|
-
).batch_size(@options[:limit] || 10)
|
41
|
-
|
42
|
-
@query_string.strip.split(/[\s]+/).each do |word|
|
43
|
-
search_enum.and(:*, :contains_prefix, word)
|
44
|
-
end
|
45
|
-
|
46
|
-
search_enum
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'restclient'
|
3
|
-
|
4
|
-
module RailsConnector
|
5
|
-
|
6
|
-
# This class provides a basic implementation for accessing a elasticsearch server.
|
7
|
-
# It can be activated by making it the superclass of SearchRequest.
|
8
|
-
# It should be customized by subclassing.
|
9
|
-
class ElasticsearchRequest
|
10
|
-
# Takes +query_string+ and +options+ for accessing Elasticsearch.
|
11
|
-
#
|
12
|
-
# +options+ is a hash and may include:
|
13
|
-
#
|
14
|
-
# <tt>:limit</tt>:: The maximum number of hits
|
15
|
-
# <tt>:offset</tt>:: The search offset
|
16
|
-
# <tt>:url</tt>:: A non-default Elasticsearch index URL
|
17
|
-
def initialize(query_string, options = {})
|
18
|
-
@query_string = query_string
|
19
|
-
@options = Configuration.search_options.merge(options)
|
20
|
-
end
|
21
|
-
|
22
|
-
# Accesses Elasticsearch using #query and fetches search hits.
|
23
|
-
def fetch_hits
|
24
|
-
the_request = request_body
|
25
|
-
(the_request[:fields] ||= []) << :obj_id
|
26
|
-
the_request[:fields].uniq!
|
27
|
-
the_request[:from] = @options[:offset] if @options[:offset]
|
28
|
-
the_request[:size] = @options[:limit] if @options[:limit]
|
29
|
-
|
30
|
-
hits = JSON.parse(
|
31
|
-
RestClient::Request.execute(:method => :get, :url => url, :payload => the_request.to_json)
|
32
|
-
)['hits']
|
33
|
-
|
34
|
-
result = SES::SearchResult.new(hits['total'])
|
35
|
-
hits['hits'].each do |hit|
|
36
|
-
result << SES::Hit.new(hit['fields']['obj_id'], hit['_score'] / hits['max_score'], hit)
|
37
|
-
end
|
38
|
-
result
|
39
|
-
end
|
40
|
-
|
41
|
-
def request_body
|
42
|
-
{
|
43
|
-
:query => query,
|
44
|
-
:filter => filter
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
def query
|
49
|
-
{
|
50
|
-
:query_string => {
|
51
|
-
:query => @query_string.
|
52
|
-
gsub(/[^\w\*]/, ' ').
|
53
|
-
gsub(/\b(and|or|not)\b/i, '').
|
54
|
-
gsub(/\s+/, ' ').strip
|
55
|
-
}
|
56
|
-
}
|
57
|
-
end
|
58
|
-
|
59
|
-
def filter
|
60
|
-
now = Time.now
|
61
|
-
{
|
62
|
-
:and => [
|
63
|
-
{:not => {:term => {:obj_type => :image}}},
|
64
|
-
{:not => {:term => {:suppress_export => true}}},
|
65
|
-
{:not => {:range => {:valid_from => {:from => (now + 1.second).to_iso, :to => '*'}}}},
|
66
|
-
{:not => {:range => {:valid_until => {:from => '*', :to => now.to_iso}}}}
|
67
|
-
]
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
private
|
72
|
-
|
73
|
-
def url
|
74
|
-
"#{@options[:url]}/_search"
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module RailsConnector
|
2
|
-
|
3
|
-
class WidgetRenderer < AbstractController::Base
|
4
|
-
include AbstractController::Rendering
|
5
|
-
include AbstractController::Helpers
|
6
|
-
|
7
|
-
helper :cms, "rails_connector/widget"
|
8
|
-
|
9
|
-
self.view_paths = [File.join('app', 'widgets')]
|
10
|
-
|
11
|
-
def initialize(request)
|
12
|
-
@_request = request
|
13
|
-
end
|
14
|
-
|
15
|
-
def show(widget, obj, widget_field_name, container)
|
16
|
-
@widget = widget
|
17
|
-
@obj = obj
|
18
|
-
@widget_field_name = widget_field_name
|
19
|
-
@container = container
|
20
|
-
|
21
|
-
render_to_string "#{widget.obj_class.underscore}/views/show"
|
22
|
-
end
|
23
|
-
|
24
|
-
def thumbnail(widget_dir)
|
25
|
-
begin
|
26
|
-
render_to_string "#{widget_dir}/views/thumbnail"
|
27
|
-
rescue ActionView::MissingTemplate => e
|
28
|
-
view_context.widget_thumbnail(
|
29
|
-
widget_dir.titleize,
|
30
|
-
'thumbnail.html.erb does not existing. Please provide one.',
|
31
|
-
view_context.image_tag('180x120.gif')
|
32
|
-
)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def request
|
37
|
-
@_request
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end # module RailsConnector
|