redde 0.3.12 → 0.3.13
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a94e4daeabb901bbc2eaa51d473e66615ec65e59
|
4
|
+
data.tar.gz: 45421c128878de33b368925a50c22e6271c0a79c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 614708064fe53ac70ebab9c188a614868e2c64986977100ea371ee1c98a140d9932ae319d6b75fa09e9bbc760a7160889d342aa2adc74139a03a66b8d4c7aaa6
|
7
|
+
data.tar.gz: 904add8d59889760fc3bc06ad9630d0a724e0013f6faf8b55603631341f6048d303536620d18c2a18a932d65bc66fcc7a372cc927456dcbe6d2bc8c9b757e072
|
@@ -1,5 +1,5 @@
|
|
1
1
|
class ReddeFormBuilder < ActionView::Helpers::FormBuilder
|
2
|
-
delegate :render, :content_tag, :tag, :link_to, :concat, :capture, to: :@template
|
2
|
+
delegate :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)
|
@@ -10,7 +10,11 @@ class ReddeFormBuilder < ActionView::Helpers::FormBuilder
|
|
10
10
|
when :time then redde_date_time(name, *args)
|
11
11
|
when :datetime then redde_date_time(name, *args)
|
12
12
|
else
|
13
|
-
|
13
|
+
if object.send(name).class.superclass.name == 'CarrierWave::Uploader::Base'
|
14
|
+
redde_image_field(name, *args)
|
15
|
+
else
|
16
|
+
redde_text_field(name, *args)
|
17
|
+
end
|
14
18
|
end
|
15
19
|
end
|
16
20
|
|
@@ -39,6 +43,17 @@ class ReddeFormBuilder < ActionView::Helpers::FormBuilder
|
|
39
43
|
wrap(name, text_field(name, options), options)
|
40
44
|
end
|
41
45
|
|
46
|
+
def redde_image_field(name, *args)
|
47
|
+
concat empty_wrap(image_tag(object.send(name), class: 'redde-form__img-preview') + check_box(:remove_preview) + label(:remove_preview)) if object.send(name).present?
|
48
|
+
redde_file_field(name, *args)
|
49
|
+
end
|
50
|
+
|
51
|
+
def redde_file_field(name, *args)
|
52
|
+
options = args.extract_options!
|
53
|
+
# options[:class] = assign_class(['inp', 'redde-form__inp'], options[:class])
|
54
|
+
wrap(name, file_field(name, options), options)
|
55
|
+
end
|
56
|
+
|
42
57
|
def redde_text_area(name, *args)
|
43
58
|
options = args.extract_options!
|
44
59
|
options[:class] = assign_class(['txtr', 'redde-form__txtr'], options[:class])
|
@@ -66,6 +81,12 @@ class ReddeFormBuilder < ActionView::Helpers::FormBuilder
|
|
66
81
|
end
|
67
82
|
end
|
68
83
|
|
84
|
+
def empty_wrap(*args, &block)
|
85
|
+
options = args.extract_options!
|
86
|
+
content = block_given? ? capture(&block) : args[0]
|
87
|
+
content_tag( :tr, tag( :td, class: ['redde-form__cell', options[:cell]].flatten.compact ) + content_tag( :td, content, class: ['redde-form__cell', options[:cell]] ), class: ['redde-form__row', options[:wrap]].flatten.compact )
|
88
|
+
end
|
89
|
+
|
69
90
|
def wrap(name = nil, *args, &block)
|
70
91
|
options = args.extract_options!
|
71
92
|
content = block_given? ? capture(&block) : args[0]
|
@@ -135,10 +135,13 @@ module Redde::IndexHelper
|
|
135
135
|
end
|
136
136
|
|
137
137
|
def render_item_column(item, column)
|
138
|
-
|
139
|
-
|
138
|
+
value = item.send(column)
|
139
|
+
return 'Не задано' unless value.present?
|
140
|
+
case value.class.name
|
141
|
+
when 'Time' then l(item.send(column), format: '%d %b %Y, %H:%M')
|
142
|
+
when 'Date' then l(item.send(column), format: '%d %b %Y')
|
140
143
|
else
|
141
|
-
|
144
|
+
value
|
142
145
|
end
|
143
146
|
end
|
144
147
|
end
|
data/lib/redde/version.rb
CHANGED
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.
|
4
|
+
version: 0.3.13
|
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-
|
12
|
+
date: 2016-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jquery-rails
|
@@ -583,7 +583,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
583
583
|
version: '0'
|
584
584
|
requirements: []
|
585
585
|
rubyforge_project:
|
586
|
-
rubygems_version: 2.5.1
|
586
|
+
rubygems_version: 2.4.5.1
|
587
587
|
signing_key:
|
588
588
|
specification_version: 4
|
589
589
|
summary: Admin scaffold generator for redde projects
|