scrivito_pdf_widget 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +4 -0
- data/Rakefile +21 -0
- data/app/assets/javascripts/pdf_widget/application.js +15 -0
- data/app/assets/javascripts/pdf_widget/editing.js +12 -0
- data/app/assets/javascripts/pdf_widget/jquery.viewer.js +154 -0
- data/app/assets/javascripts/pdf_widget/pdf.js +6511 -0
- data/app/assets/javascripts/pdf_widget/pdf.worker.js +44061 -0
- data/app/assets/javascripts/pdf_widget/widget.js.erb +11 -0
- data/app/assets/stylesheets/pdf_widget/application.css +4 -0
- data/app/assets/stylesheets/pdf_widget/widget.css +39 -0
- data/app/models/pdf.rb +26 -0
- data/app/models/pdf_widget.rb +3 -0
- data/app/views/pdf_widget/_inline_pdf.html.erb +24 -0
- data/app/views/pdf_widget/details.html.erb +2 -0
- data/app/views/pdf_widget/show.html.erb +9 -0
- data/app/views/pdf_widget/thumbnail.html.erb +13 -0
- data/lib/scrivito_pdf_widget/engine.rb +5 -0
- data/lib/scrivito_pdf_widget/version.rb +3 -0
- data/lib/scrivito_pdf_widget.rb +4 -0
- data/lib/tasks/scrivito_pdf_widget_tasks.rake +4 -0
- data/scrivito/migrate/0_create_pdf_widget.rb +24 -0
- metadata +121 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
.inline-pdf canvas {
|
2
|
+
width: 100%;
|
3
|
+
}
|
4
|
+
|
5
|
+
.inline-pdf .pdf-bar {
|
6
|
+
overflow: hidden;
|
7
|
+
}
|
8
|
+
|
9
|
+
.inline-pdf .button {
|
10
|
+
cursor: pointer;
|
11
|
+
float: left;
|
12
|
+
font-weight: bold;
|
13
|
+
padding: 0px 5px;
|
14
|
+
font-size: 20px;
|
15
|
+
line-height: 20px;
|
16
|
+
}
|
17
|
+
|
18
|
+
.inline-pdf .pdf-first {}
|
19
|
+
.inline-pdf .pdf-prev {
|
20
|
+
margin-right: 10px;
|
21
|
+
}
|
22
|
+
.inline-pdf .pdf-next {}
|
23
|
+
.inline-pdf .pdf-last {}
|
24
|
+
.inline-pdf .pdf-bar {}
|
25
|
+
.inline-pdf .page-num {margin: 0 0 0 5px;}
|
26
|
+
.inline-pdf .page-num:after {content: '/';}
|
27
|
+
.inline-pdf .page-count {}
|
28
|
+
.inline-pdf .pdf-fullscreen {
|
29
|
+
float: right;
|
30
|
+
font-size: 15px;
|
31
|
+
}
|
32
|
+
.inline-pdf .pdf-download {
|
33
|
+
float: right;
|
34
|
+
font-size: 15px;
|
35
|
+
}
|
36
|
+
.pdf-page-numbers {
|
37
|
+
padding: 2px 0;
|
38
|
+
text-align: center;
|
39
|
+
}
|
data/app/models/pdf.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
class Pdf < Obj
|
2
|
+
def self.create(attributes)
|
3
|
+
attributes = attributes.with_indifferent_access
|
4
|
+
|
5
|
+
unless attributes.has_key?(:_obj_class)
|
6
|
+
attributes[:_obj_class] = 'Pdf'
|
7
|
+
end
|
8
|
+
|
9
|
+
if attributes.has_key?(:blob) && !attributes.has_key?(:_path)
|
10
|
+
filename = Pathname.new(attributes[:blob].path).basename
|
11
|
+
path = "_resources/#{SecureRandom.hex(8)}/#{filename}"
|
12
|
+
|
13
|
+
attributes[:_path] = path
|
14
|
+
end
|
15
|
+
|
16
|
+
super(attributes)
|
17
|
+
end
|
18
|
+
|
19
|
+
def url_to_pdf
|
20
|
+
self.try(:binary_url) || ''
|
21
|
+
end
|
22
|
+
|
23
|
+
def show_in_navigation?
|
24
|
+
false
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<div class="inline-pdf" data-url="<%= pdf.url_to_pdf %>">
|
2
|
+
<canvas></canvas>
|
3
|
+
<div class="pdf-bar">
|
4
|
+
<div class="button pdf-first">
|
5
|
+
<%= fa_icon 'angle-double-left', title: 'first Page' %>
|
6
|
+
</div>
|
7
|
+
<div class="button pdf-prev">
|
8
|
+
<%= fa_icon 'angle-left', title: 'prev Page' %>
|
9
|
+
</div>
|
10
|
+
<div class="button pdf-next">
|
11
|
+
<%= fa_icon 'angle-right', title: 'next Page' %>
|
12
|
+
</div>
|
13
|
+
<div class="button pdf-last">
|
14
|
+
<%= fa_icon 'angle-double-right', title: 'last Page' %>
|
15
|
+
</div>
|
16
|
+
<div class="button pdf-download">
|
17
|
+
<a class="link" href="<%= pdf.url_to_pdf %>" title="Download Pdf">
|
18
|
+
download
|
19
|
+
</a>
|
20
|
+
</div>
|
21
|
+
<div class="pdf-page-numbers">
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class CreatePdfWidget < ::Scrivito::Migration
|
2
|
+
def up
|
3
|
+
Scrivito::ObjClass.create(
|
4
|
+
name: 'Pdf',
|
5
|
+
type: 'generic',
|
6
|
+
is_binary: true,
|
7
|
+
title: 'Pdf',
|
8
|
+
attributes: [
|
9
|
+
{:name=>"headline", :type=>"string"},
|
10
|
+
{:name=>"description", :type=>"html"}
|
11
|
+
]
|
12
|
+
)
|
13
|
+
|
14
|
+
Scrivito::ObjClass.create(
|
15
|
+
name: 'PdfWidget',
|
16
|
+
type: 'publication',
|
17
|
+
is_binary: false,
|
18
|
+
title: 'Pdf Widget',
|
19
|
+
attributes: [
|
20
|
+
{:name=>"pdf", :type=>"reference"}
|
21
|
+
]
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scrivito_pdf_widget
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Scrivito
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-11-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: scrivito_sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: font-awesome-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rails
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 4.1.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 4.1.4
|
69
|
+
description: Displays a PDF using PDF js to show it on your page.
|
70
|
+
email:
|
71
|
+
- support@scrivito.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- LICENSE
|
77
|
+
- Rakefile
|
78
|
+
- app/assets/javascripts/pdf_widget/application.js
|
79
|
+
- app/assets/javascripts/pdf_widget/editing.js
|
80
|
+
- app/assets/javascripts/pdf_widget/jquery.viewer.js
|
81
|
+
- app/assets/javascripts/pdf_widget/pdf.js
|
82
|
+
- app/assets/javascripts/pdf_widget/pdf.worker.js
|
83
|
+
- app/assets/javascripts/pdf_widget/widget.js.erb
|
84
|
+
- app/assets/stylesheets/pdf_widget/application.css
|
85
|
+
- app/assets/stylesheets/pdf_widget/widget.css
|
86
|
+
- app/models/pdf.rb
|
87
|
+
- app/models/pdf_widget.rb
|
88
|
+
- app/views/pdf_widget/_inline_pdf.html.erb
|
89
|
+
- app/views/pdf_widget/details.html.erb
|
90
|
+
- app/views/pdf_widget/show.html.erb
|
91
|
+
- app/views/pdf_widget/thumbnail.html.erb
|
92
|
+
- lib/scrivito_pdf_widget.rb
|
93
|
+
- lib/scrivito_pdf_widget/engine.rb
|
94
|
+
- lib/scrivito_pdf_widget/version.rb
|
95
|
+
- lib/tasks/scrivito_pdf_widget_tasks.rake
|
96
|
+
- scrivito/migrate/0_create_pdf_widget.rb
|
97
|
+
homepage: https://www.scrivito.com
|
98
|
+
licenses:
|
99
|
+
- LGPL-3
|
100
|
+
metadata: {}
|
101
|
+
post_install_message:
|
102
|
+
rdoc_options: []
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - ">="
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 2.3.0
|
118
|
+
signing_key:
|
119
|
+
specification_version: 4
|
120
|
+
summary: Display a PDF on your Page.
|
121
|
+
test_files: []
|