cmor_files 0.0.52.pre → 0.0.57.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01b4749c426409136f626da21f0524c3252cb263e885c6295bfdb596d4d475d2
4
- data.tar.gz: a35736f55efe085f2f9c8cc2ff6178290aa40452c44e480258ffc54b02bcadae
3
+ metadata.gz: de313087b0cb2538b0ebf14a13fbce25eb0d63c986fd5007e5fffc02914604f3
4
+ data.tar.gz: '09cc0eb9d71adc3d2b2684b4dd0cbe41d0d88b3d33a799cab78e12a16e5e0f84'
5
5
  SHA512:
6
- metadata.gz: 10e9f950d420ed6926a07637d5d8669b112a597766995dd5987542a359c5ff0c2880c5a22c8c45d5995a95d37c6236cb5dc1b68c41e270a8b2f0251a30f6d041
7
- data.tar.gz: a372935fc8b53e269447d8b1e8209f9a1f8d8b05fb798a0dadecb853528244aa7aed6d6dc161e59870d8078ebea1bf62dac0e584265633f03d438c43766f57b0
6
+ metadata.gz: d8f648884103e211e6c1c46995d5555d639c15b2857a367302b716a8344ddf2f2976b7596faca21e66bf5cb76a89a0778c136ab8e66527ffefd12077bde4a3b2
7
+ data.tar.gz: c9816a0590814535cef8591215c6e7efd0f17977eb1bfd94a496fa0ae953eaa9a84ba75c2ad65ae5294a8726563a409138a5895672f6e0367bf1bbd1124a28a1
@@ -11,11 +11,33 @@ module Cmor
11
11
  # Example:
12
12
  #
13
13
  # # app/views/layouts/application.html.haml
14
- # = files_helper(self).render_download(name: 'Quick reference manual')
14
+ # = files_helper(self).render_file(identifier: 'Quick reference manual')
15
15
  #
16
16
  def render_file(identifier:)
17
- resource = Cmor::Files::FileDetail.where(identifier: identifier).first
18
- render resource: resource
17
+ resource = Cmor::Files::FileDetail.published.where(identifier: identifier).first
18
+ if resource.nil?
19
+ "Could not find published file detail with identifier: '#{identifier}'."
20
+ else
21
+ render resource: resource
22
+ end
23
+ end
24
+
25
+ # Example:
26
+ #
27
+ # # app/views/layouts/application.html.haml
28
+ # = files_helper(self).render_folder(identifier: 'Manuals')
29
+ #
30
+ def render_folder(identifier:)
31
+ resource = Cmor::Files::Folder.published.where(identifier: identifier).first
32
+ if resource.nil?
33
+ "Could not find published folder with identifier: '#{identifier}'."
34
+ else
35
+ render resource: resource
36
+ end
37
+ end
38
+
39
+ def asset_download_button_label(asset)
40
+ "#{c.t(".download")} (#{asset.blob.content_type.split('/').last}, #{c.number_to_human_size(asset.blob.byte_size)})"
19
41
  end
20
42
  end
21
43
  end
@@ -0,0 +1,15 @@
1
+ .row
2
+ .col-12
3
+ %h4= resource.name
4
+
5
+ .row
6
+ .col-12
7
+ .table-responsive
8
+ = collection_table(collection: resource.file_details, resource_class: Cmor::Files::FileDetail, header: false) do |table|
9
+ = table.column :filename do |resource|
10
+ - resource.asset.blob.filename.to_s.truncate(64)
11
+ = table.column :actions, html: "text-right" do |resource|
12
+ - capture_haml do
13
+ .text-right
14
+ = link_to(main_app.url_for(resource.asset), class: 'btn btn-primary') do
15
+ = files_helper(self).asset_download_button_label(resource.asset)
@@ -5,5 +5,5 @@
5
5
  = collection_table(collection: @collection, resource_class: resource_class) do |t|
6
6
  = t.column :name
7
7
  = t.column :assets_count
8
- = t.column :actions do |resource|
8
+ = t.column :actions, title: false do |resource|
9
9
  - link_to(t('.show'), [resource], class: 'btn btn-primary')
@@ -1,15 +1,20 @@
1
- %h1= @resource.name
1
+ .row
2
+ .col-12
3
+ %h1= @resource.name
2
4
 
3
5
  .row
4
6
  .col-12
5
- = collection_table(collection: @resource.file_details, resource_class: Cmor::Files::FileDetail, header: false) do |table|
6
- = table.column :filename do |resource|
7
- - resource.asset.blob.filename
8
- = table.column :blob_byte_size do |resource|
9
- - number_to_human_size(resource.asset.blob.byte_size)
10
- = table.column :actions do |resource|
11
- - capture_haml do
12
- = link_to(t('.download'), main_app.url_for(resource.asset), class: 'btn btn-primary')
7
+ .table-responsive
8
+ = collection_table(collection: @resource.file_details, resource_class: Cmor::Files::FileDetail, header: false) do |table|
9
+ = table.column :filename do |resource|
10
+ - resource.asset.blob.filename.to_s.truncate(64)
11
+ = table.column :blob_byte_size do |resource|
12
+ - number_to_human_size(resource.asset.blob.byte_size)
13
+ = table.column :actions do |resource|
14
+ - capture_haml do
15
+ .text-right
16
+ = link_to(main_app.url_for(resource.asset), class: 'btn btn-primary') do
17
+ = files_helper(self).asset_download_button_label(resource.asset)
13
18
 
14
19
 
15
20
  .row.mt-4
@@ -18,10 +18,15 @@ de:
18
18
  id: ID
19
19
  asset: Datei
20
20
  asset_id: Datei
21
+ asset_permanent_path: Permanenter Datei-Pfad
22
+ asset_permanent_url: Permanente Datei-URL
21
23
  blob_byte_size: Dateigröße
22
24
  blob_checksum: Checksumme
25
+ blob_content_type: Dateityp
26
+ blob_created_at: Datei erstellt am
23
27
  blob_filename: Dateiname
24
28
  description: Beschreibung
29
+ filename: Dateiname
25
30
  folder: Ordner
26
31
  folder_id: Ordner
27
32
  identifier: Bezeichner
@@ -34,12 +39,14 @@ de:
34
39
  updated_at: Aktualisiert am
35
40
  cmor/files/folder:
36
41
  id: ID
42
+ append_assets: Dateien hinzufügen
37
43
  assets: Dateien
38
44
  assets_count: Dateien
39
45
  description: Beschreibung
40
46
  identifier: Bezeichner
41
47
  locale: Sprache
42
48
  name: Name
49
+ overwrite_assets: Dateien ersetzen
43
50
  position: Position
44
51
  published: Veröffentlicht
45
52
  published_at: Veröffentlicht am
@@ -18,10 +18,15 @@ en:
18
18
  id: ID
19
19
  asset: Asset
20
20
  asset_id: Asset
21
+ asset_permanent_path: Permanent asset path
22
+ asset_permanent_url: Permanent asset ur
21
23
  blob_byte_size: Filesize
22
24
  blob_checksum: Checksum
25
+ blob_content_type: Content-Type
26
+ blob_created_at: File created at
23
27
  blob_filename: Filename
24
28
  description: Description
29
+ filename: Filename
25
30
  folder: Folder
26
31
  folder_id: Folder
27
32
  identifier: Identifier
@@ -34,12 +39,14 @@ en:
34
39
  updated_at: Updated at
35
40
  cmor/files/folder:
36
41
  id: ID
42
+ append_assets: Append files
37
43
  assets: Files
38
44
  assets_count: Files
39
45
  description: Description
40
46
  identifier: Identifier
41
47
  locale: Locale
42
48
  name: Name
49
+ overwrite_assets: Overwrite files
43
50
  position: Position
44
51
  published: Published
45
52
  published_at: Published at
@@ -0,0 +1,17 @@
1
+ FactoryBot.define do
2
+ factory :cmor_files_file_detail, class: 'Cmor::Files::FileDetail' do
3
+ association :folder, factory: :cmor_files_folder
4
+ after(:build) { |resource|
5
+ assets = resource.folder.assets.attach(
6
+ io: File.open(File.join(Cmor::Files::Engine.root.join(*%w( spec files cmor files file_details example.png)))),
7
+ filename: 'example.png',
8
+ content_type: 'image/png'
9
+ )
10
+ if Rails.version < "6.0.0"
11
+ resource.asset = assets.first
12
+ else
13
+ resource.asset = resource.folder.assets.first
14
+ end
15
+ }
16
+ end
17
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :cmor_files_folder, class: 'Cmor::Files::Folder' do
3
+ sequence(:name) { |i| "Folder ##{i}" }
4
+ sequence(:identifier) { |i| "folder-#{i}" }
5
+ end
6
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cmor_files
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.52.pre
4
+ version: 0.0.57.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Vasquez Angel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-26 00:00:00.000000000 Z
11
+ date: 2020-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.0.52.pre
33
+ version: 0.0.57.pre
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.0.52.pre
40
+ version: 0.0.57.pre
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: cmor_core_frontend
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 0.0.52.pre
47
+ version: 0.0.57.pre
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: 0.0.52.pre
54
+ version: 0.0.57.pre
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sqlite3
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -401,6 +401,7 @@ files:
401
401
  - app/models/cmor/files/folder.rb
402
402
  - app/view_helpers/cmor/files/application_view_helper.rb
403
403
  - app/views/cmor/files/application_view_helper/_render_file.html.haml
404
+ - app/views/cmor/files/application_view_helper/_render_folder.html.haml
404
405
  - app/views/cmor/files/file_details/index.html.haml
405
406
  - app/views/cmor/files/file_details/show.html.haml
406
407
  - app/views/cmor/files/folders/index.html.haml
@@ -429,6 +430,8 @@ files:
429
430
  - lib/generators/cmor/files/install/templates/initializer.rb
430
431
  - lib/generators/cmor/files/install/templates/routes.source
431
432
  - lib/tasks/cmor_files_tasks.rake
433
+ - spec/factories/cmor_files_file_details.rb
434
+ - spec/factories/cmor_files_folders.rb
432
435
  - spec/files/cmor/files/file_details/example.png
433
436
  homepage: https://github.com/content-management-on-rails
434
437
  licenses:
@@ -449,7 +452,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
449
452
  - !ruby/object:Gem::Version
450
453
  version: 1.3.1
451
454
  requirements: []
452
- rubygems_version: 3.1.2
455
+ rubygems_version: 3.1.4
453
456
  signing_key:
454
457
  specification_version: 4
455
458
  summary: Cmor Files Module.