redde 0.3.24 → 0.3.25

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: c4a929d175b37bbd530e0430504cf643ab11a4e8
4
- data.tar.gz: 5c9c478d9a0879200ab9f8a953ca0af002fa246a
3
+ metadata.gz: ff2fe1b2884412ac533182f5b63c7556ac4af1c6
4
+ data.tar.gz: 11dcb20a7a740e4ceec4b799b33411031d76a63a
5
5
  SHA512:
6
- metadata.gz: 34dd432d80560a684109474d084db0a5378a8ec19702d6a269ddab2eb15fda49f14fa00e3ddfa535d353697da1399d4a584bb5a01f364fed0dd7433ef8b5822e
7
- data.tar.gz: b3e6908d2bff02e27078485ecb0bbddbd411b95a4c56c916f14ad0e670f46a5c4f75d374f8802c058fb2635730b797d859e02b1adfd4c1ba0188f42e6e9c542c
6
+ metadata.gz: a8cf1ef26c646307e65eaf870cda93203f200c0e4c1c7e7faa9705642645724dc7c4a779edb790d7d018d529bf22a9a5b4325153e2647920420884732f597312
7
+ data.tar.gz: ceaf7717245a380b938f707627cc57566c2da6f8b20db9449598f6d7826d4ec371a416070f080ab7652759f94a10f360e32b8bd959b47b99008a5b20b75b1109
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17"><path fill="#186f9a" d="M14.9 0H2.1C1 0 0 1 0 2.1v12.8C0 16 1 17 2.1 17h12.8c1.2 0 2.1-1 2.1-2.1V2.1C17 1 16 0 14.9 0zm0 13.8c0 .6-.5 1.1-1.1 1.1H3.2c-.6 0-1.1-.5-1.1-1.1V3.2c0-.6.5-1.1 1.1-1.1h10.6c.6 0 1.1.5 1.1 1.1v10.6zM5.8 7.4c.9 0 1.6-.7 1.6-1.6 0-.9-.7-1.6-1.6-1.6S4.2 5 4.2 5.8c0 .9.8 1.6 1.6 1.6zm1.6 4.3l-1-2.1-2.1 3.2h8.5l-2.1-6.4-3.3 5.3z"/></svg>
@@ -0,0 +1,27 @@
1
+ class Rfile
2
+ constructor: (@$box, condition)->
3
+ @$box.off('click.rfile touch.rfile', '.jsr-file--del')
4
+ if condition
5
+ @$box.find('.jsr-file--del').removeAttr('hidden')
6
+ @$box.on 'click.rfile touch.rfile', '.jsr-file--del', $.proxy(@, 'delete')
7
+ else
8
+ @$box.find('.jsr-file--del').attr('hidden', "")
9
+
10
+ delete: ->
11
+ $wrap = @$box.find('.jsr-file--wrap')
12
+ $wrap.html $wrap.html()
13
+ @$box.find('.jsr-file--name').empty()
14
+ @$box.find('.jsr-file--del').attr('hidden', '')
15
+ delete(this)
16
+
17
+ $ ->
18
+ $(document).on 'change', '.jsr-file input:file', (e)->
19
+ files = e.currentTarget.files
20
+ $box = $(this).closest('.jsr-file')
21
+ $box.find('.jsr-file--name').map ->
22
+ if files.length > 0
23
+ throw new Error('Не работает для multiple') if files.length > 1
24
+ $(this).text(files[0].name)
25
+ else
26
+ $(this).empty()
27
+ new Rfile($box, !!files.length)
@@ -6,6 +6,7 @@
6
6
  #= require ./sortTree
7
7
  #= require ./fileapi
8
8
  #= require ./redactor
9
+ #= require ./file
9
10
 
10
11
  $ ->
11
12
  $(document).on 'click', '[data-href]', (e)->
@@ -35,6 +35,8 @@
35
35
 
36
36
  &._img
37
37
  padding-left: 20px
38
+ &._photo
39
+ padding-right: 0
38
40
 
39
41
  .list__head_del
40
42
  padding-right: 0
@@ -78,6 +80,14 @@
78
80
  padding-right: 7px
79
81
  width: 0.01%
80
82
 
83
+ &._photo
84
+ width: 0.01%
85
+ padding-right: 10px
86
+ img
87
+ display: block
88
+ width: 17px
89
+ height: 17px
90
+
81
91
  .list__cell_del
82
92
  padding-right: 0
83
93
  width: 1px
@@ -0,0 +1,32 @@
1
+ .rfile
2
+ position: relative
3
+
4
+ .rfile__btn
5
+ position: relative
6
+ &:before
7
+ margin-left: 0
8
+ margin-right: 0.6em
9
+
10
+ .rfile__wrap
11
+ position: absolute
12
+ top: 0
13
+ right: 0
14
+ bottom: 0
15
+ left: 0
16
+ overflow: hidden
17
+
18
+ .rfile__name
19
+ margin-left: 0.25em
20
+
21
+ .rfile__inp
22
+ position: absolute
23
+ top: -10px
24
+ right: -40px
25
+ font-size: 50px
26
+ opacity: 0
27
+ cursor: pointer
28
+
29
+ .rfile__del
30
+ margin-left: 0.25em
31
+ cursor: pointer
32
+ user-select: none
@@ -1,5 +1,5 @@
1
1
  class ReddeFormBuilder < ActionView::Helpers::FormBuilder
2
- delegate :render, :content_tag, :tag, :link_to, :image_tag, :concat, :capture, to: :@template
2
+ delegate :raw, :render, :content_tag, :tag, :link_to, :image_tag, :concat, :capture, to: :@template
3
3
  # delegate :debug, :render, :content_tag, :tag, :link_to, :concat, :capture, to: :@template
4
4
 
5
5
  def redde_field(name, *args)
@@ -53,8 +53,13 @@ class ReddeFormBuilder < ActionView::Helpers::FormBuilder
53
53
 
54
54
  def redde_file_field(name, *args)
55
55
  options = args.extract_options!
56
- options[:class] = assign_class(['redde-form__file'], options[:class])
57
- wrap(name, file_field(name, options), options)
56
+ wrap(name, options) do
57
+ content_tag(:span, class: ['redde-form__file rfile jsr-file', options[:class]]) do
58
+ concat content_tag :span, raw('Загрузить') + content_tag(:span, file_field(name, options.merge(class: 'rfile__inp')), class: 'rfile__wrap jsr-file--wrap'), class: 'rfile__btn btn icon-upload'
59
+ concat content_tag(:span, '', class: 'rfile__name jsr-file--name')
60
+ concat content_tag(:span, 'удал.', class: 'rfile__del jsr-file--del', hidden: "")
61
+ end
62
+ end
58
63
  end
59
64
 
60
65
  def redde_text_area(name, *args)
@@ -47,7 +47,13 @@ module Redde::IndexHelper
47
47
  end
48
48
 
49
49
  def cell field = nil, options = {}, &block
50
- content_tag :th, list.human_attribute_name(field), class: ['list__head', options[:class]]
50
+ if field.is_a?(Symbol) || field.is_a?(String)
51
+ content_tag :th, list.human_attribute_name(field), class: ['list__head', options[:class]]
52
+ elsif field.is_a?(Hash)
53
+ content_tag :th, "", class: ['list__head', field[:class]]
54
+ elsif field.nil?
55
+ content_tag :th, "", class: 'list__head'
56
+ end
51
57
  end
52
58
  end
53
59
 
@@ -77,7 +83,11 @@ module Redde::IndexHelper
77
83
 
78
84
  def cell(field, options = {}, &block)
79
85
  # через content_tag ... do не работает
80
- content_tag :td, if block_given? then capture(&block) else IndexCellBuilder.content(item.send(field)) end, class: ['list__cell', options[:class]]
86
+ if field.is_a?(Hash)
87
+ content_tag :td, capture(&block), class: ['list__cell', field[:class]]
88
+ else
89
+ content_tag :td, if block_given? then capture(&block) else IndexCellBuilder.content(item.send(field)) end, class: ['list__cell', options[:class]]
90
+ end
81
91
  end
82
92
 
83
93
  def empty(options = {})
data/lib/redde/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Redde
2
- VERSION = '0.3.24'.freeze
2
+ VERSION = '0.3.25'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redde
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.24
4
+ version: 0.3.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Bovykin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-03-19 00:00:00.000000000 Z
12
+ date: 2016-03-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: jquery-rails
@@ -438,6 +438,7 @@ files:
438
438
  - app/assets/images/redde/main-menu/list.svg
439
439
  - app/assets/images/redde/main-menu/list_active.svg
440
440
  - app/assets/images/redde/move-handler.png
441
+ - app/assets/images/redde/photo.svg
441
442
  - app/assets/images/redde/plus.svg
442
443
  - app/assets/images/redde/prev.svg
443
444
  - app/assets/images/redde/redactor/icons.png
@@ -449,6 +450,7 @@ files:
449
450
  - app/assets/images/redde/redactor/plugins/video.html
450
451
  - app/assets/images/redde/sel.svg
451
452
  - app/assets/images/redde/user.svg
453
+ - app/assets/javascripts/redde/file.js.coffee
452
454
  - app/assets/javascripts/redde/fileapi.js.coffee
453
455
  - app/assets/javascripts/redde/index.js.coffee
454
456
  - app/assets/javascripts/redde/redactor/index.coffee
@@ -478,6 +480,7 @@ files:
478
480
  - app/assets/stylesheets/redde/blocks/ra-layout.sass
479
481
  - app/assets/stylesheets/redde/blocks/ra-login.sass
480
482
  - app/assets/stylesheets/redde/blocks/redde-form.sass
483
+ - app/assets/stylesheets/redde/blocks/rfile.sass
481
484
  - app/assets/stylesheets/redde/blocks/sidebar.sass
482
485
  - app/assets/stylesheets/redde/blocks/sort-tree.sass
483
486
  - app/assets/stylesheets/redde/defaults/index.sass