ecm_pictures2_backend 2.0.6 → 2.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3743c249e5407cbc63a01d94af0d8ee160be989
4
- data.tar.gz: 47a4bb3d5469f17a221f77765fe380d8ad39efcb
3
+ metadata.gz: 4c2b57e9b5e09dc3955d5435ace0b1d820a2f1e2
4
+ data.tar.gz: 90206866c808f45d1e2a752c9d0531d720a1ff48
5
5
  SHA512:
6
- metadata.gz: 1dc7eeda66ea36d8d7bf594a23d33d93529f4130b64d967c7608b3b84d85a3f6f221dbc513422495f06e17a5c7a6d1f9f6d1cee4cd2bbdc10f56062a0e828d0f
7
- data.tar.gz: 795370db33a9775d06a33267fe3f8dc0c5a7822b8421474841dec4c802135ae5d0a7bb31a87b245e43f73ff0610890538c376aa6542a516d47588f7c9132ce50
6
+ metadata.gz: 2151fc118550c3ccd4cea03172c8cd2a053a283d57b051135ba49ad469ae3b7d9df2a5c375eb821bf8f8f5917f138feb758072d19c4a6ac68252f2de78ff9b4a
7
+ data.tar.gz: 400b51db2a4382c0147c72acf39dacaa123cb8668693d2d4eda297398d25ca5aed10347db5c1adb6c2de1db529e3b7109815fdaf39321957541746c1f5de657c
@@ -1,49 +1,39 @@
1
- take_snapshot = (attribute_name) ->
1
+ remove_overlays = (elements) ->
2
+ $(elements).removeClass('selected')
3
+
4
+ add_overlay = (element) ->
5
+ element.parent().toggleClass('selected')
6
+
7
+ take_snapshot = ->
2
8
  Webcam.snap (data_uri) ->
3
- console.log attribute_name
4
- snapshot_container = $("[name='snapshots-for-#{attribute_name}']").first()
5
- img_name = "webcam-snapshot-for-#{attribute_name}"
6
- img_taken_at = Date.now()
7
- snapshot_container.append('<div class="col-xs-12 col-sm-6 col-md-4 col-lg-2 thumbnail-with-overlay"><img data-taken-at="'+img_taken_at+'" data-attribute-name="'+attribute_name+'" name="'+img_name+'" class="img-responsive thumbnail webcam-snapshot" src="'+data_uri+'"/><span class="text-success glyphicon glyphicon-ok-circle overlay" style="display: none;" /></div>')
9
+ $('#snapshots').append('<div class="col-xs-12 col-sm-6 col-md-4 col-lg-2"><img class="img-responsive thumbnail" data-onclick-copy-data-to="#ecm_pictures_picture_image_base64" src="'+data_uri+'"/><span class="glyphicon glyphicon-ok overlay" /></div>')
8
10
 
9
11
  $ ->
10
- $('[data-webcam-toggle=true]').each (index) ->
12
+ $('[data-camera-toggle=true]').each (index) ->
11
13
  button = $(@)
12
14
  button.on 'click', ->
13
- camera_container_name = $(@).data('attribute-name')
14
- camera_container = $("[name='webcam-for-#{camera_container_name}']").first()
15
- console.log camera_container
16
- camera_container.css('width', '640px')
17
- camera_container.css('height', '480px')
18
- Webcam.attach(camera_container.attr('id'))
15
+ camera_container = $(@).data('camera-target')
16
+ $(camera_container).css('width', '640px')
17
+ $(camera_container).css('height', '480px')
18
+ Webcam.attach(camera_container)
19
19
  false
20
20
 
21
21
  $ ->
22
- $('[data-webcam-trigger=true]').each (index) ->
22
+ $('[data-capture-picture=true]').each (index) ->
23
23
  button = $(@)
24
24
  button.on 'click', ->
25
- attribute_name = $(@).data('attribute-name')
26
- take_snapshot(attribute_name)
25
+ take_snapshot()
27
26
  false
28
27
 
29
28
  $ ->
30
- $('.webcam-snapshots').on 'click', 'img.webcam-snapshot', (e) ->
31
- multiple = $(@).parent().data('multiple')
32
- console.log multiple
33
- attribute_name = $(@).data('attribute-name')
34
- taken_at = $(@).data('taken-at')
35
- raw_image_data = $(@).attr('src')
36
- hidden_tag = '<input type="hidden" name="'+attribute_name+'[]" data-taken-at="'+taken_at+'" class="webcam optional" value="'+raw_image_data+'">'
37
- console.log $("input[name='#{attribute_name}[]']")
38
- if multiple && (existent = $("input[name='#{attribute_name}[]']")).length
39
- console.log('Removing already existent tags')
40
- existent.remove()
41
- $(@).parent().parent().find('span').hide()
42
- if (existent = $("input[name='#{attribute_name}[]'][data-taken-at='#{taken_at}']")).length
43
- console.log('Removing already existent tag')
44
- existent.remove()
45
- $(@).parent().find('span').hide()
46
- else
47
- console.log('Adding hidden tag')
48
- $(@).after(hidden_tag)
49
- $(@).parent().find('span').show()
29
+ $('#snapshots').on 'click', '[data-onclick-copy-data-to]', (e) ->
30
+ source = $(@)
31
+ source.on 'click', ->
32
+ target_id = $(@).attr('data-onclick-copy-data-to')
33
+ target = $(target_id)
34
+ # raw_image_data = source.attr('src').replace(/^data\:image\/\w+\;base64\,/, '')
35
+ raw_image_data = source.attr('src')
36
+ target.val(raw_image_data)
37
+ remove_overlays($(@).parent().parent().find('.selected'))
38
+ add_overlay($(@))
39
+ e.preventDefault
@@ -1,18 +1,16 @@
1
- .thumbnail-with-overlay .glyphicon.overlay {
1
+ #snapshots div.selected {
2
+ display: relative;
3
+ }
4
+
5
+ #snapshots .glyphicon.overlay {
6
+ position: absolute;
2
7
  top: 15px;
3
8
  left: 30px;
4
9
  font-size: 20px;
5
- color: light-green;
10
+ color: green;
11
+ display: none;
6
12
  }
7
13
 
8
14
  #snapshots div.selected > .glyphicon.overlay {
9
15
  display: inline-block;
10
- }
11
-
12
- .thumbnail-with-overlay {
13
- display: relative;
14
- }
15
-
16
- .thumbnail-with-overlay .overlay {
17
- position: absolute;
18
16
  }
@@ -6,20 +6,8 @@ class Ecm::Pictures::Backend::PictureGalleriesController < Itsf::Backend::Resour
6
6
  private
7
7
 
8
8
  def permitted_params
9
- # raise params.inspect
10
- picture_images_base_64 = params[:ecm_pictures_picture_gallery].delete(:picture_images_base_64)
11
- picture_images = picture_images_base_64.collect do |data|
12
- Tempfile.new(['image', '.jpg']).tap do |t|
13
- t.write(Base64.decode64(data.gsub(/^data\:image\/\w+\;base64\,/, '')).force_encoding('UTF-8'))
14
- t.rewind
15
- end
16
- end
17
- # raise picture_images.inspect
18
- p = params.require(:ecm_pictures_picture_gallery).permit(:name, :markup_language, :description, :link_images, :tag_list, picture_images: [])
19
- if picture_images.any?
20
- p.merge(picture_images: picture_images)
21
- else
22
- p
23
- end
9
+ params
10
+ .require(:ecm_pictures_picture_gallery)
11
+ .permit(:name, :markup_language, :description, :link_images, :tag_list, picture_images: [])
24
12
  end
25
13
  end
@@ -3,7 +3,7 @@
3
3
 
4
4
  .well
5
5
  = form.input :markup_language, collection: Ecm::Pictures::markup_languages
6
- = form.input :description, input_html: { 'data-add-editor': true, 'data-editor-syntax': :textile }
6
+ = form.input :description, input_html: { 'data-add-editor': Itsf::Backend.features?(:'ace-rails-ap'), 'data-editor-syntax': :textile }
7
7
 
8
8
  .well
9
9
  = form.input :link_images
@@ -11,10 +11,6 @@
11
11
  .well
12
12
  = form.input :picture_images, as: :file, input_html: { multiple: 'multiple' }
13
13
 
14
- - if Ecm::Pictures::Backend::Configuration.enable_html5_camera_support
15
- .well
16
- = form.input :picture_images, as: :webcam, multiple: true
17
-
18
14
  - if form.object.respond_to?(:tag_list)
19
15
  .well
20
16
  = form.input :tag_list, input_html: { value: form.object.tag_list.to_s }
@@ -5,7 +5,8 @@
5
5
  = table.row :position
6
6
  = table.row :markup_language
7
7
  = table.row :markup_language
8
- = table.row :created_at
9
- = table.row :updated_at
10
8
  = table.row(:tenant, as: :association) if table.resource.respond_to?(:tenant)
11
- = table.row(:tag_list) if table.resource.respond_to?(:tag_list)
9
+ = table.row(:tag_list) if table.resource.respond_to?(:tag_list)
10
+ = table.row :display_code_for_erb
11
+ = table.row :created_at
12
+ = table.row :updated_at
@@ -6,15 +6,20 @@
6
6
 
7
7
  .well
8
8
  = form.input :markup_language, collection: Ecm::Pictures::markup_languages
9
- = form.input :description, input_html: { 'data-add-editor': true, 'data-editor-syntax': :textile }
9
+ = form.input :description, input_html: { 'data-add-editor': Itsf::Backend.features?(:'ace-rails-ap'), 'data-editor-syntax': :textile }
10
10
 
11
11
  .well
12
12
  = form.input :image
13
13
  = image_tag(form.object.image.url(:default_thumb)) if form.object.image.present?
14
14
 
15
15
  - if Ecm::Pictures::Backend::Configuration.enable_html5_camera_support
16
+ %input{ name: 'ecm_pictures_picture[image_base64]', type: 'hidden', id: 'ecm_pictures_picture_image_base64', value: '' }
16
17
  .well
17
- = form.input :picture_images, as: :webcam
18
+ .bottom-margin-1
19
+ = link_to(t('.enable_camera'), '#', class: 'btn btn-primary', data: { 'camera-toggle': true, 'camera-target': '#camera' })
20
+ = link_to(t('.capture_picture'), '#', class: 'btn btn-primary', data: { 'capture-picture': true, 'camera-target': '#camera' })
21
+ #camera.bottom-margin-1
22
+ #snapshots.row
18
23
 
19
24
  - if form.object.respond_to?(:tag_list)
20
25
  .well
@@ -10,5 +10,7 @@
10
10
  = table.row :image_fingerprint
11
11
  - if table.resource.respond_to?(:tag_list)
12
12
  = table.row :tag_list
13
+ = table.row :display_code_for_textile
14
+ = table.row :display_code_for_erb
13
15
  = table.row :created_at
14
16
  = table.row :updated_at
@@ -1,13 +1,6 @@
1
1
  de:
2
2
  classes:
3
3
  ecm/pictures/backend/engine: 'Bilder'
4
- inputs:
5
- webcam:
6
- capture_picture: Auslösen
7
- enable_camera: Kamera aktivieren
8
- webcam_multiple:
9
- capture_picture: Auslösen
10
- enable_camera: Kamera aktivieren
11
4
  routes:
12
5
  mount:
13
6
  ecm_pictures_backend: '/backend/bilder'
@@ -8,8 +8,6 @@ module Ecm
8
8
  app.config.assets.precompile << 'ecm_pictures_backend.js'
9
9
  app.config.assets.precompile << 'ecm_pictures_backend.css'
10
10
  end
11
-
12
- config.autoload_paths << root.join(*%w(app inputs))
13
11
  end
14
12
  end
15
13
  end
@@ -1,7 +1,7 @@
1
1
  module Ecm
2
2
  module Pictures
3
3
  module Backend
4
- VERSION = '2.0.6'.freeze
4
+ VERSION = '2.0.7'.freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecm_pictures2_backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
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: 2016-03-08 00:00:00.000000000 Z
11
+ date: 2016-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -228,7 +228,6 @@ files:
228
228
  - app/controllers/ecm/pictures/backend/picture_galleries_controller.rb
229
229
  - app/controllers/ecm/pictures/backend/pictures_controller.rb
230
230
  - app/helpers/ecm/pictures/backend/application_helper.rb
231
- - app/inputs/webcam_input.rb
232
231
  - app/policies/ecm/pictures/backend/engine_policy.rb
233
232
  - app/policies/ecm/pictures/picture_gallery_policy.rb
234
233
  - app/policies/ecm/pictures/picture_policy.rb
@@ -239,11 +238,8 @@ files:
239
238
  - app/views/ecm/pictures/backend/pictures/_form.html.haml
240
239
  - app/views/ecm/pictures/backend/pictures/_show.html.haml
241
240
  - app/views/ecm/pictures/backend/pictures/_table.html.haml
242
- - app/views/inputs/_webcam.haml
243
- - app/views/inputs/_webcam_multiple.haml
244
241
  - app/views/layouts/ecm/pictures/backend/application.html.erb
245
242
  - config/locales/de.yml
246
- - config/locales/en.yml
247
243
  - config/rbac.yml
248
244
  - config/routes.rb
249
245
  - lib/ecm/pictures/backend.rb
@@ -1,10 +0,0 @@
1
- class WebcamInput < SimpleForm::Inputs::Base
2
- def input
3
- multiple = input_options.delete(:multiple)
4
- if multiple
5
- template.render partial: 'inputs/webcam_multiple', locals: { f: @builder, attribute_name: attribute_name, input_options: input_options, input_html_options: input_html_options }
6
- else
7
- template.render partial: 'inputs/webcam', locals: { f: @builder, attribute_name: attribute_name, input_options: input_options, input_html_options: input_html_options }
8
- end
9
- end
10
- end
@@ -1,7 +0,0 @@
1
- .webcam-controls.bottom-margin-1
2
- = link_to(t('.enable_camera'), '#', class: 'btn btn-primary', data: { 'webcam-toggle': true, 'attribute-name': "#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" })
3
- = link_to(t('.capture_picture'), '#', class: 'btn btn-primary', data: { 'webcam-trigger': true, 'attribute-name': "#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" })
4
-
5
- .webcam.bottom-margin-1{ id: "webcam-for-#{f.object.class.name.underscore.gsub('/', '_')}_#{attribute_name}_base_64", name: "webcam-for-#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" }
6
-
7
- .webcam-snapshots.row{ 'data-multiple': "false", id: "snapshots-for-#{f.object.class.name.underscore.gsub('/', '_')}_#{attribute_name}_base_64", name: "snapshots-for-#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" }
@@ -1,7 +0,0 @@
1
- .webcam-controls.bottom-margin-1
2
- = link_to(t('.enable_camera'), '#', class: 'btn btn-primary', data: { 'webcam-toggle': true, 'attribute-name': "#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" })
3
- = link_to(t('.capture_picture'), '#', class: 'btn btn-primary', data: { 'webcam-trigger': true, 'attribute-name': "#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" })
4
-
5
- .webcam.bottom-margin-1{ id: "webcam-for-#{f.object.class.name.underscore.gsub('/', '_')}_#{attribute_name}_base_64", name: "webcam-for-#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" }
6
-
7
- .webcam-snapshots.multiple.row{ 'data-multiple': "true", id: "snapshots-for-#{f.object.class.name.underscore.gsub('/', '_')}_#{attribute_name}_base_64", name: "snapshots-for-#{f.object.class.name.underscore.gsub('/', '_')}[#{attribute_name}_base_64]" }
@@ -1,13 +0,0 @@
1
- en:
2
- classes:
3
- ecm/pictures/backend/engine: 'Pictures'
4
- inputs:
5
- webcam:
6
- capture_picture: Capture picture
7
- enable_camera: Enable camera
8
- webcam_multiple:
9
- capture_picture: Capture picture
10
- enable_camera: Enable camera
11
- routes:
12
- mount:
13
- ecm_pictures_backend: '/backend/pictures'