cmor_files 0.0.54.pre → 0.0.59.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: a95d17cb60910105b23d478f6c5f6da7ffcb02761a353485b7c8ea4452ac915d
4
- data.tar.gz: 8fc8b16b6dba1504ae0498056543855810a47c7127c6bab36f602b247b10917b
3
+ metadata.gz: acee5a135cac1afacc3116fe809c1da48ee1a63c2ddb3486789368a7d91ac1ed
4
+ data.tar.gz: e80877f393ad8fe48ca230641d7f8b28e3a20548367f1dff9cf9b48fee4ef109
5
5
  SHA512:
6
- metadata.gz: b6073f504c35588b87722fd8900ed388628ad4a36c9c7253ce1c9a5af96aaa8bb72712cbd003f5fa3f18a9cc56efed035891f4e235b997692bf7d81d76f8b033
7
- data.tar.gz: 99118a3eb349d61aef8a9ee024e5457ff4a4c013781fda6b5dc8d664dd72edbc66e773039711b74927637642c3d9344eeedb2d0ea660b4a6a1b9921cb7ff694e
6
+ metadata.gz: 173df29e329d9d0188cec32a07b8a1c88573340d5385c06fe79fca414bc43e73c664b0fec0fab2da5f31416754529561903f224129a720413c17aa842d92f828
7
+ data.tar.gz: c39555e64ad3757424fda55e9ed915f94f26ce77da20e511495afe7a23ea273ab20b48dca23c2f5d73da09a54fbac15ca290e2a643126479e185982f1868af7c
@@ -16,5 +16,9 @@ module Cmor::Files
16
16
  friendly_id :title, use: :slugged
17
17
 
18
18
  validates :identifier, uniqueness: { scope: [ :folder_id ] }, allow_blank: true, allow_nil: true
19
+
20
+ def label
21
+ title.presence || asset&.blob&.filename&.to_s&.truncate(64).presence
22
+ end
19
23
  end
20
24
  end
@@ -11,7 +11,7 @@ module Cmor
11
11
  # Example:
12
12
  #
13
13
  # # app/views/layouts/application.html.haml
14
- # = files_helper(self).render_download(identifier: 'Quick reference manual')
14
+ # = files_helper(self).render_file(identifier: 'Quick reference manual')
15
15
  #
16
16
  def render_file(identifier:)
17
17
  resource = Cmor::Files::FileDetail.published.where(identifier: identifier).first
@@ -21,6 +21,24 @@ module Cmor
21
21
  render resource: resource
22
22
  end
23
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)})"
41
+ end
24
42
  end
25
43
  end
26
44
  end
@@ -0,0 +1,14 @@
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 :label
10
+ = table.column :actions, html: "text-right" do |resource|
11
+ - capture_haml do
12
+ .text-right
13
+ = link_to(main_app.url_for(resource.asset), class: 'btn btn-primary') do
14
+ = 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,19 @@
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 :label
10
+ = table.column :blob_byte_size do |resource|
11
+ - number_to_human_size(resource.asset.blob.byte_size)
12
+ = table.column :actions do |resource|
13
+ - capture_haml do
14
+ .text-right
15
+ = link_to(main_app.url_for(resource.asset), class: 'btn btn-primary') do
16
+ = files_helper(self).asset_download_button_label(resource.asset)
13
17
 
14
18
 
15
19
  .row.mt-4
@@ -18,8 +18,11 @@ 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
23
26
  blob_created_at: Datei erstellt am
24
27
  blob_filename: Dateiname
25
28
  description: Beschreibung
@@ -27,6 +30,7 @@ de:
27
30
  folder: Ordner
28
31
  folder_id: Ordner
29
32
  identifier: Bezeichner
33
+ label: Label
30
34
  position: Position
31
35
  published: Veröffentlicht
32
36
  published_at: Veröffentlicht am
@@ -36,12 +40,14 @@ de:
36
40
  updated_at: Aktualisiert am
37
41
  cmor/files/folder:
38
42
  id: ID
43
+ append_assets: Dateien hinzufügen
39
44
  assets: Dateien
40
45
  assets_count: Dateien
41
46
  description: Beschreibung
42
47
  identifier: Bezeichner
43
48
  locale: Sprache
44
49
  name: Name
50
+ overwrite_assets: Dateien ersetzen
45
51
  position: Position
46
52
  published: Veröffentlicht
47
53
  published_at: Veröffentlicht am
@@ -18,8 +18,11 @@ 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
23
26
  blob_created_at: File created at
24
27
  blob_filename: Filename
25
28
  description: Description
@@ -27,6 +30,7 @@ en:
27
30
  folder: Folder
28
31
  folder_id: Folder
29
32
  identifier: Identifier
33
+ label: Label
30
34
  position: Position
31
35
  published: Published
32
36
  published_at: Published at
@@ -36,12 +40,14 @@ en:
36
40
  updated_at: Updated at
37
41
  cmor/files/folder:
38
42
  id: ID
43
+ append_assets: Append files
39
44
  assets: Files
40
45
  assets_count: Files
41
46
  description: Description
42
47
  identifier: Identifier
43
48
  locale: Locale
44
49
  name: Name
50
+ overwrite_assets: Overwrite files
45
51
  position: Position
46
52
  published: Published
47
53
  published_at: Published at
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.54.pre
4
+ version: 0.0.59.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-05-20 00:00:00.000000000 Z
11
+ date: 2020-08-18 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.54.pre
33
+ version: 0.0.59.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.54.pre
40
+ version: 0.0.59.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.54.pre
47
+ version: 0.0.59.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.54.pre
54
+ version: 0.0.59.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
@@ -451,7 +452,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
451
452
  - !ruby/object:Gem::Version
452
453
  version: 1.3.1
453
454
  requirements: []
454
- rubygems_version: 3.1.3
455
+ rubygems_version: 3.1.4
455
456
  signing_key:
456
457
  specification_version: 4
457
458
  summary: Cmor Files Module.