tawork 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/app/assets/javascripts/backbone/tawork.js.coffee +7 -1
- data/app/assets/stylesheets/bootstrap_and_overrides.sass +1 -0
- data/app/models/attachment.rb +36 -0
- data/app/views/layouts/_nav_header.html.haml +24 -14
- data/lib/tawork/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjhmMzgxMzNlYjA5OGY4NzJhZmI4NDU2YTVmYmVkMTljZDczM2I0ZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2U1MjczODA5OTM0YjZiNTdmYzkwN2E2MWVhOTlhNTFlNmNiNzMzMA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjQyMjhiODJmOGZmNTY3YTdlZGFjMDc0OTI3NTM0MDY0ZmRiZTM0Yjk2NDI3
|
10
|
+
YzhhYmE2ZjhkMDdiMzIwYzlhODQ2ZGQ0OTc0YzUxZDBkY2QxOGIyM2ZmYWM5
|
11
|
+
MWEyYzJmMTU0NWRiOGY3N2E0NTYyMWM1ZmQyZWM1M2NjYmUyZmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YjE5M2IzMDJmZTRjMzE5ODFkY2RkYzNmYzBmYTRlMjVhNWE2MmQwOTc4NTM5
|
14
|
+
NmQxOTllODY2ZWNmYzNmYmM1YzI0ZDk3YTU2ZTBiY2RhYzU2YTEzYmViYTNi
|
15
|
+
YTQwNWNjNDRiMDIyMGU5Mjg1MWRlYmY5YjdkZjViMGUwYThhMTE=
|
data/Gemfile
CHANGED
@@ -9,6 +9,7 @@ gem 'rails', "4.1.0.rc1"
|
|
9
9
|
gem 'mysql2'
|
10
10
|
gem 'bootstrap-sass'
|
11
11
|
|
12
|
+
gem 'docsplit'
|
12
13
|
gem 'kaminari'
|
13
14
|
gem 'elasticsearch', git: 'git://github.com/elasticsearch/elasticsearch-ruby.git'
|
14
15
|
gem 'elasticsearch-model', git: 'git://github.com/elasticsearch/elasticsearch-rails.git'
|
data/Gemfile.lock
CHANGED
@@ -120,6 +120,7 @@ GEM
|
|
120
120
|
warden (~> 1.2.3)
|
121
121
|
diff-lcs (1.2.5)
|
122
122
|
diffy (3.0.2)
|
123
|
+
docsplit (0.7.4)
|
123
124
|
dotenv (0.10.0)
|
124
125
|
erubis (2.7.0)
|
125
126
|
eventmachine (1.0.3)
|
@@ -337,6 +338,7 @@ DEPENDENCIES
|
|
337
338
|
coffee-rails (~> 4.0.0)
|
338
339
|
devise
|
339
340
|
diffy
|
341
|
+
docsplit
|
340
342
|
elasticsearch!
|
341
343
|
elasticsearch-model!
|
342
344
|
elasticsearch-rails!
|
@@ -8,4 +8,10 @@ window.Tawork =
|
|
8
8
|
Models: {}
|
9
9
|
Collections: {}
|
10
10
|
Routers: {}
|
11
|
-
Views: {}
|
11
|
+
Views: {}
|
12
|
+
|
13
|
+
# global window closer
|
14
|
+
|
15
|
+
$(document).click (event) ->
|
16
|
+
if( $(event.target).closest('.close-outside-click').length == 0 )
|
17
|
+
$('.close-outside-click').addClass("hide")
|
data/app/models/attachment.rb
CHANGED
@@ -12,6 +12,7 @@ class Attachment < ActiveRecord::Base
|
|
12
12
|
indexes :type, :as => :type, :boost => 100
|
13
13
|
indexes :filename, :analyzer => 'snowball', :boost => 100
|
14
14
|
indexes :content_type, :analyzer => 'snowball'
|
15
|
+
indexes :body, :analyzer => 'snowball'
|
15
16
|
indexes :created_at, :type => 'date', :include_in_all => false
|
16
17
|
indexes :updated_at, :type => 'date', :include_in_all => false
|
17
18
|
end
|
@@ -30,6 +31,7 @@ class Attachment < ActiveRecord::Base
|
|
30
31
|
file, user,
|
31
32
|
"uploading file: #{filename}"
|
32
33
|
)
|
34
|
+
attachment.__elasticsearch__.index_document
|
33
35
|
end
|
34
36
|
|
35
37
|
attachment
|
@@ -83,10 +85,43 @@ class Attachment < ActiveRecord::Base
|
|
83
85
|
def as_indexed_json(options = {})
|
84
86
|
json = self.as_json
|
85
87
|
json[:type] = self.class.to_s.underscore
|
88
|
+
json[:body] = self.extracted_text
|
86
89
|
|
87
90
|
json
|
88
91
|
end
|
89
92
|
|
93
|
+
def extracted_text
|
94
|
+
tmp_dir = File.join Rails.root, "tmp", "#{id}_#{Time.now.to_i}"
|
95
|
+
text_dir = File.join tmp_dir, "text_dump"
|
96
|
+
tmp_filename = File.join tmp_dir, filename
|
97
|
+
|
98
|
+
FileUtils.mkdir_p tmp_dir
|
99
|
+
|
100
|
+
File.open tmp_filename, "wb" do |file|
|
101
|
+
file.write self.file_data
|
102
|
+
end
|
103
|
+
|
104
|
+
docs = Dir[File.join(tmp_dir, "*")]
|
105
|
+
Docsplit.extract_text(docs, output: text_dir)
|
106
|
+
|
107
|
+
texts = []
|
108
|
+
Dir[File.join(text_dir, "*")].each do |file|
|
109
|
+
texts << File.read(file)
|
110
|
+
end
|
111
|
+
|
112
|
+
text = texts.join("\n")
|
113
|
+
|
114
|
+
encoding_options = {
|
115
|
+
:invalid => :replace, # Replace invalid byte sequences
|
116
|
+
:undef => :replace, # Replace anything not defined in ASCII
|
117
|
+
:replace => '', # Use a blank for those replacements
|
118
|
+
:universal_newline => true # Always break lines with \n
|
119
|
+
}
|
120
|
+
text.encode(Encoding.find('ASCII'), encoding_options)
|
121
|
+
rescue
|
122
|
+
Rails.logger.info "document not extractable."
|
123
|
+
end
|
124
|
+
|
90
125
|
protected
|
91
126
|
|
92
127
|
def wiki_attachment_data
|
@@ -96,4 +131,5 @@ class Attachment < ActiveRecord::Base
|
|
96
131
|
def wiki_dir
|
97
132
|
"/attachments/#{id}"
|
98
133
|
end
|
134
|
+
|
99
135
|
end
|
@@ -11,20 +11,30 @@
|
|
11
11
|
|
12
12
|
.collapse.navbar-collapse
|
13
13
|
%ul.nav.navbar-nav
|
14
|
-
|
15
|
-
%
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
%
|
20
|
-
= link_to "Spaces Listing", wiki_pages_path, class: "space-link"
|
21
|
-
%li.divider
|
22
|
-
- Page.roots.each do |page|
|
14
|
+
- if current_user.present?
|
15
|
+
%li.dropdown
|
16
|
+
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
|
17
|
+
Spaces
|
18
|
+
%b.caret
|
19
|
+
%ul.dropdown-menu
|
23
20
|
%li
|
24
|
-
= link_to
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
= link_to "Spaces Listing", wiki_pages_path, class: "space-link"
|
22
|
+
%li.divider
|
23
|
+
- Page.roots.each do |page|
|
24
|
+
%li
|
25
|
+
= link_to page.title, wiki_page_path(page)
|
26
|
+
%li.divider
|
27
|
+
%li
|
28
|
+
= link_to "Create New Space", new_wiki_space_path
|
29
|
+
|
30
|
+
%li.dropdown
|
31
|
+
%a.dropdown-toggle{"data-toggle" => "dropdown", :href => "#"}
|
32
|
+
Favourites
|
33
|
+
%b.caret
|
34
|
+
%ul.dropdown-menu
|
35
|
+
- Starred.where(user: current_user, starrable_type: 'Page').each do |starred|
|
36
|
+
%li
|
37
|
+
= link_to starred.starrable.title, wiki_page_path(starred.starrable)
|
28
38
|
-# %li
|
29
39
|
-# = link_to "wiki", wiki_path
|
30
40
|
%ul.nav.navbar-nav.navbar-right
|
@@ -32,7 +42,7 @@
|
|
32
42
|
#global-search-container
|
33
43
|
%form.navbar-form
|
34
44
|
%input#global-search.form-control{type: "text", placeholder: "Search...", style: "width: 400px;", autocomplete: "off"}
|
35
|
-
#global-search-results.hide
|
45
|
+
#global-search-results.hide.close-outside-click
|
36
46
|
:coffeescript
|
37
47
|
view = new GlobalSearch(el: $("#global-search-container"))
|
38
48
|
- if user_signed_in?
|
data/lib/tawork/version.rb
CHANGED