rademade_admin 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/rademade_admin.coffee +1 -0
- data/app/assets/javascripts/rademade_admin/app/common/cropper.coffee +0 -4
- data/app/assets/javascripts/rademade_admin/app/common/image-preview.coffee +33 -0
- data/app/assets/javascripts/rademade_admin/app/templates/image-preview-popup.jst.ejs +3 -0
- data/app/assets/javascripts/rademade_admin/app/templates/related-item.jst.ejs +2 -2
- data/app/assets/javascripts/rademade_admin/library/ckeditor/config.js +1 -0
- data/app/assets/stylesheets/edit.css +15 -0
- data/app/assets/stylesheets/rademade_admin/base/main.sass +45 -39
- data/app/assets/stylesheets/rademade_admin/blocks/buttons/main.sass +6 -1
- data/app/assets/stylesheets/rademade_admin/blocks/form/select2.sass +85 -60
- data/app/controllers/rademade_admin/model_controller.rb +3 -0
- data/app/helpers/rademade_admin/field_helper.rb +25 -13
- data/app/helpers/rademade_admin/form_helper.rb +4 -6
- data/app/helpers/rademade_admin/uri_helper.rb +3 -3
- data/app/services/csv_service.rb +38 -0
- data/app/services/linker.rb +3 -1
- data/app/services/model_controller/instance_options.rb +7 -2
- data/app/services/model_controller/notifier.rb +15 -19
- data/app/services/model_controller/templates.rb +1 -0
- data/app/services/saver.rb +6 -1
- data/app/services/template_service.rb +38 -19
- data/app/services/upload/preview_service.rb +2 -1
- data/app/views/rademade_admin/_blocks/_form.html.erb +6 -5
- data/app/views/rademade_admin/_blocks/button/_hide.html.erb +2 -2
- data/app/views/rademade_admin/_layouts/main.html.erb +3 -6
- data/app/views/rademade_admin/abstract/index.html.erb +4 -2
- data/config/locales/rademade_admin.en.yml +2 -1
- data/config/locales/rademade_admin.ru.yml +2 -1
- data/lib/rademade_admin/{hrml_buffer.rb → html_buffer.rb} +0 -0
- data/lib/rademade_admin/input/related_select_input/related_list.rb +8 -5
- data/lib/rademade_admin/model/adapter/data/mongoid.rb +1 -1
- data/lib/rademade_admin/model/adapter/query/active_record.rb +1 -1
- data/lib/rademade_admin/model/configuration.rb +17 -1
- data/lib/rademade_admin/model/configuration/csv_fields.rb +12 -0
- data/lib/rademade_admin/model/configuration/list_field.rb +5 -1
- data/lib/rademade_admin/model/info.rb +10 -1
- data/lib/rademade_admin/model/info/data_item.rb +31 -13
- data/lib/rademade_admin/model/info/data_item/initializer.rb +37 -0
- data/lib/rademade_admin/model/info/data_items.rb +11 -1
- data/lib/rademade_admin/model/info/fields.rb +39 -26
- data/lib/rademade_admin/version.rb +1 -1
- metadata +22 -4
- data/app/assets/javascripts/rademade_admin/library/jquery/jquery.tablednd.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cbf2b035073b7ecd22583c679174032a17198b6f
|
4
|
+
data.tar.gz: 680b96e301ee4c35cb8b056c9a2dad63525267b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eeb141cfbcbda28277a22f2381190fc23b6567486b5492abff1888bda148b47876a56beb2edaaaa87121b216b8008d757497a5183a8c042e5a9c342939ca00a
|
7
|
+
data.tar.gz: 9cdac46cb24a8f0bca639994b135ec5380d8db904e8881bc1a046d55205fa32eb5c2abbe19a4867a28d902bc8e3d921bb73be989b70a22942f03076daf08d2f1
|
@@ -6,7 +6,6 @@ class @Cropper extends Backbone.View
|
|
6
6
|
className : 'add_new_popup'
|
7
7
|
|
8
8
|
events :
|
9
|
-
'click' : 'check'
|
10
9
|
'click [data-crop]' : 'crop'
|
11
10
|
'click [data-close]' : 'close'
|
12
11
|
|
@@ -31,9 +30,6 @@ class @Cropper extends Backbone.View
|
|
31
30
|
$image.Jcrop
|
32
31
|
onSelect : @_updateCropAttributes
|
33
32
|
|
34
|
-
check : (e) ->
|
35
|
-
@closePopup() if $(e.target).closest('.crop').length is 0
|
36
|
-
|
37
33
|
crop : (e) ->
|
38
34
|
e.preventDefault()
|
39
35
|
@closePopup()
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class @ImagePreview extends Backbone.View
|
2
|
+
|
3
|
+
className : 'add_new_popup hide'
|
4
|
+
|
5
|
+
events :
|
6
|
+
'click' : 'close'
|
7
|
+
|
8
|
+
show : (imagePath) ->
|
9
|
+
@render(imagePath)
|
10
|
+
@$el.removeClass 'hide'
|
11
|
+
|
12
|
+
close : (e) ->
|
13
|
+
e.preventDefault()
|
14
|
+
@closePopup()
|
15
|
+
|
16
|
+
closePopup : () ->
|
17
|
+
@$el.addClass 'hide'
|
18
|
+
|
19
|
+
render : (imagePath) ->
|
20
|
+
@$el.html @_getHTML(imagePath : imagePath)
|
21
|
+
|
22
|
+
_getHTML : (data) ->
|
23
|
+
JST['rademade_admin/app/templates/image-preview-popup'](data)
|
24
|
+
|
25
|
+
@init : () ->
|
26
|
+
imagePreview = new ImagePreview
|
27
|
+
$('#pad-wrapper').append imagePreview.$el
|
28
|
+
$('tr .image-preview').click (e) ->
|
29
|
+
fullUrl = $(e.currentTarget).attr('full-url')
|
30
|
+
imagePreview.show(fullUrl) if fullUrl
|
31
|
+
|
32
|
+
$ ->
|
33
|
+
$(document).on 'page:load ready init-plugins', ImagePreview.init
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<span><%= text %></span><%
|
2
2
|
if (editurl) {
|
3
|
-
%><button data-edit="<%= editurl %>"><%= I18n.t('rademade_admin.edit_related_item') %></button><%
|
3
|
+
%><button class="select2-item-edit" data-edit="<%= editurl %>"><%= I18n.t('rademade_admin.edit_related_item') %></button><%
|
4
4
|
}
|
5
|
-
%><button data-remove><%= I18n.t('rademade_admin.destroy') %></button>
|
5
|
+
%><button class="select2-item-remove" data-remove><%= I18n.t('rademade_admin.destroy') %></button>
|
@@ -1,5 +1,6 @@
|
|
1
1
|
if (CKEDITOR && CKEDITOR.config) {
|
2
2
|
CKEDITOR.config.language = 'en';
|
3
|
+
CKEDITOR.config.forcePasteAsPlainText = true;
|
3
4
|
CKEDITOR.config.toolbar = [
|
4
5
|
{ name: 'document', groups: [ 'mode' ], items: [ 'Source' ] },
|
5
6
|
{ name: 'editing', groups: [ 'find' ], items: [ 'Find', 'Replace' ] },
|
@@ -1,71 +1,77 @@
|
|
1
1
|
html,
|
2
2
|
body
|
3
|
-
|
4
|
-
|
3
|
+
height: 100%
|
4
|
+
min-height: 100%
|
5
|
+
|
5
6
|
body
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
font-size: 12px
|
8
|
+
color: #2c4042
|
9
|
+
background: #34495e
|
10
|
+
+arial
|
10
11
|
|
11
12
|
a
|
12
|
-
|
13
|
-
|
13
|
+
text-decoration: none
|
14
|
+
outline: none
|
14
15
|
|
15
16
|
b,
|
16
17
|
strong
|
17
|
-
|
18
|
+
font-weight: 700
|
18
19
|
|
19
20
|
.clear
|
20
|
-
|
21
|
-
|
21
|
+
clear: both
|
22
|
+
float: none !important
|
22
23
|
|
23
24
|
.wrapper
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
min-width: 900px
|
26
|
+
height: 100%
|
27
|
+
overflow-x: hidden
|
28
|
+
background: #34495e
|
28
29
|
|
29
30
|
.fix
|
30
|
-
|
31
|
-
|
32
|
-
|
31
|
+
min-width: 900px
|
32
|
+
padding: 0 0 0 15px
|
33
|
+
margin: 0 auto
|
33
34
|
|
34
35
|
.fl-l
|
35
|
-
|
36
|
+
float: left
|
36
37
|
|
37
38
|
.fl-r
|
38
|
-
|
39
|
+
float: right
|
39
40
|
|
40
41
|
.hide
|
41
|
-
|
42
|
+
display: none !important
|
42
43
|
|
43
44
|
.ico
|
44
|
-
|
45
|
-
|
45
|
+
display: inline-block
|
46
|
+
position: absolute
|
46
47
|
|
47
48
|
#overlay
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
49
|
+
display: none
|
50
|
+
position: fixed
|
51
|
+
top: 0
|
52
|
+
left: 0
|
53
|
+
width: 100%
|
54
|
+
height: 100%
|
55
|
+
background-color: rgba(0, 0, 0, 0.7)
|
56
|
+
z-index: 998
|
56
57
|
|
57
58
|
input[type="text"],
|
58
59
|
input[type="password"],
|
59
60
|
input[type="email"]
|
60
|
-
|
61
|
-
|
61
|
+
margin: 0
|
62
|
+
outline: 0
|
62
63
|
|
63
64
|
input[type="checkbox"]
|
64
|
-
|
65
|
-
|
65
|
+
margin: 0
|
66
|
+
padding: 0
|
66
67
|
|
67
68
|
textarea
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
69
|
+
margin: 0
|
70
|
+
padding: 0
|
71
|
+
outline: 0
|
72
|
+
resize: none
|
73
|
+
|
74
|
+
textarea,
|
75
|
+
input
|
76
|
+
&:disabled
|
77
|
+
+opacity(0.3)
|
@@ -57,7 +57,10 @@ button
|
|
57
57
|
border-color: #ac2925
|
58
58
|
|
59
59
|
.r-margin
|
60
|
-
margin-right:
|
60
|
+
margin-right: 10px
|
61
|
+
|
62
|
+
.l-margin
|
63
|
+
margin-left: 10px
|
61
64
|
|
62
65
|
.btn-sep
|
63
66
|
margin: 0 10px
|
@@ -83,6 +86,8 @@ button
|
|
83
86
|
.login-btn
|
84
87
|
padding: 9px 12px
|
85
88
|
width: 100%
|
89
|
+
height: auto
|
90
|
+
line-height: initial
|
86
91
|
font-size: 18px
|
87
92
|
|
88
93
|
.select-btn
|
@@ -1,67 +1,92 @@
|
|
1
1
|
.form-box
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
.select2-search-choice
|
25
|
-
display: none
|
2
|
+
.input-holder
|
3
|
+
.select2-container
|
4
|
+
width: 100%
|
5
|
+
height: 34px
|
6
|
+
margin-bottom: 10px
|
7
|
+
.select2-choices
|
8
|
+
padding: 0
|
9
|
+
display: block
|
10
|
+
width: 100%
|
11
|
+
font-size: 14px
|
12
|
+
color: #555
|
13
|
+
background-color: #fff
|
14
|
+
background-image: none
|
15
|
+
border: 1px solid #ccc
|
16
|
+
+box-sizing(border-box)
|
17
|
+
+border-radius(4px)
|
18
|
+
+box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075))
|
19
|
+
+transition(border-color ease-in-out .15s, box-shadow ease-in-out .15s)
|
20
|
+
&:focus
|
21
|
+
border-color: #66afe9
|
22
|
+
+box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6))
|
26
23
|
|
27
|
-
|
28
|
-
|
24
|
+
.select2-search-choice
|
25
|
+
display: none
|
29
26
|
|
30
|
-
|
31
|
-
|
32
|
-
padding: 4px 12px
|
33
|
-
&:focus
|
34
|
-
outline: 0
|
35
|
-
+box-shadow(none)
|
27
|
+
.select2-search-field
|
28
|
+
height: 34px
|
36
29
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
height: 34px
|
44
|
-
line-height: 34px
|
45
|
-
font-size: 14px
|
46
|
-
.select2-arrow
|
47
|
-
b
|
48
|
-
background-position: 0 4px
|
30
|
+
input[type="text"]
|
31
|
+
border: 0
|
32
|
+
padding: 4px 12px
|
33
|
+
&:focus
|
34
|
+
outline: 0
|
35
|
+
+box-shadow(none)
|
49
36
|
|
37
|
+
.select2-choice
|
38
|
+
height: 34px
|
39
|
+
background-color: #fff
|
40
|
+
background-image: none
|
41
|
+
border: 1px solid #ccc
|
42
|
+
.select2-chosen
|
43
|
+
height: 34px
|
44
|
+
line-height: 34px
|
45
|
+
font-size: 14px
|
46
|
+
.select2-arrow
|
47
|
+
b
|
48
|
+
background-position: 0 4px
|
50
49
|
|
51
|
-
|
50
|
+
.select2-items-list
|
51
|
+
float: left
|
52
|
+
margin-top: 15px
|
53
|
+
width: 100%
|
54
|
+
border-top: 1px solid #bdc3c7
|
55
|
+
li
|
56
|
+
padding: 10px 0
|
57
|
+
font-size: 14px
|
58
|
+
line-height: 24px
|
59
|
+
border-bottom: 1px solid #bdc3c7
|
60
|
+
+clear
|
61
|
+
span
|
52
62
|
float: left
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
width: 63%
|
64
|
+
+to
|
65
|
+
button
|
66
|
+
float: right
|
67
|
+
|
68
|
+
.select2-item-edit,
|
69
|
+
.select2-item-remove
|
70
|
+
position: relative
|
71
|
+
width: 25px
|
72
|
+
height: 25px
|
73
|
+
background: none
|
74
|
+
overflow: hidden
|
75
|
+
text-indent: 100%
|
76
|
+
cursor: pointer
|
77
|
+
&:before
|
78
|
+
position: absolute
|
79
|
+
top: 0
|
80
|
+
left: 0
|
81
|
+
height: 100%
|
82
|
+
width: 100%
|
83
|
+
font-size: 14px
|
84
|
+
color: #000
|
85
|
+
text-indent: 0
|
86
|
+
@extend .glyphicon
|
87
|
+
|
88
|
+
.select2-item-edit
|
89
|
+
@extend .glyphicon-edit
|
90
|
+
|
91
|
+
.select2-item-remove
|
92
|
+
@extend .glyphicon-trash
|
@@ -61,6 +61,7 @@ module RademadeAdmin
|
|
61
61
|
respond_to do |format|
|
62
62
|
format.html { render_template }
|
63
63
|
format.json { render :json => @items }
|
64
|
+
format.csv { send_data RademadeAdmin::CsvService.new(model_info, @items).to_csv }
|
64
65
|
end
|
65
66
|
end
|
66
67
|
|
@@ -80,6 +81,7 @@ module RademadeAdmin
|
|
80
81
|
render_template
|
81
82
|
end
|
82
83
|
|
84
|
+
# TODO move related to other controller or remove
|
83
85
|
def related
|
84
86
|
authorize! :read, model_class
|
85
87
|
@related_model_info = RademadeAdmin::RelationService.new.related_model_info(model_info, params[:relation])
|
@@ -131,6 +133,7 @@ module RademadeAdmin
|
|
131
133
|
end
|
132
134
|
|
133
135
|
protected
|
136
|
+
# TODO move to search module
|
134
137
|
|
135
138
|
def index_items
|
136
139
|
conditions = Search::Conditions::List.new(params, model_info.data_items)
|
@@ -9,21 +9,23 @@ module RademadeAdmin::FieldHelper
|
|
9
9
|
# @return [String]
|
10
10
|
#
|
11
11
|
def display_item_value(item, data_item)
|
12
|
-
value = item
|
13
|
-
if
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
elsif data_item.has_uploader?
|
21
|
-
RademadeAdmin::Upload::PreviewService.new(value).uploaded_file_html
|
12
|
+
value = raw_item_value(item, data_item)
|
13
|
+
return (value ? '✔' : '×') if value.is_a?(::Boolean)
|
14
|
+
value
|
15
|
+
end
|
16
|
+
|
17
|
+
def display_related_item(data_item, value)
|
18
|
+
if data_item.relation.has_many?
|
19
|
+
link_to(data_item.label, admin_related_item(item, data_item.getter))
|
22
20
|
else
|
23
|
-
value.to_s.
|
21
|
+
link_to(value.to_s, admin_edit_uri(value)) unless value.nil?
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
25
|
+
def display_upload_item(_, value)
|
26
|
+
RademadeAdmin::Upload::PreviewService.new(value).uploaded_file_html
|
27
|
+
end
|
28
|
+
|
27
29
|
def pagination_option(number, name = 'paginate')
|
28
30
|
hash_params = request.query_parameters.clone
|
29
31
|
hash_params.delete(:page)
|
@@ -35,8 +37,18 @@ module RademadeAdmin::FieldHelper
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def input_attr(attrs = {})
|
38
|
-
attrs.deep_merge
|
39
|
-
|
40
|
+
attrs.deep_merge(
|
41
|
+
wrapper_html: { class: 'form-group' },
|
42
|
+
input_html: { class: 'form-input' }
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def raw_item_value(item, data_item)
|
47
|
+
return data_item.list_preview_handler.call(item) unless data_item.list_preview_handler.nil?
|
48
|
+
value = item.send(data_item.list_preview_accessor)
|
49
|
+
return display_upload_item(data_item, value) if data_item.has_uploader?
|
50
|
+
return display_related_item(data_item, value) if data_item.has_relation?
|
51
|
+
value.to_s.html_safe
|
40
52
|
end
|
41
53
|
|
42
54
|
end
|