rademade_admin 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/rademade_admin.sass.erb +2 -0
- data/app/assets/stylesheets/rademade_admin/blocks/buttons/main.sass +110 -100
- data/app/assets/stylesheets/rademade_admin/blocks/filter/_main.sass +10 -0
- data/app/assets/stylesheets/rademade_admin/blocks/gallery/_main.sass +46 -4
- data/app/controllers/rademade_admin/abstract_controller.rb +1 -1
- data/app/controllers/rademade_admin/file_controller.rb +5 -1
- data/app/helpers/rademade_admin/field_helper.rb +1 -1
- data/app/helpers/rademade_admin/uri_helper.rb +9 -4
- data/app/inputs/rademade_admin/file_input.rb +4 -4
- data/app/inputs/rademade_admin/gallery_input.rb +2 -2
- data/app/services/upload/gallery_preview_service.rb +5 -4
- data/app/views/rademade_admin/_blocks/_sort_reset.html.erb +1 -1
- data/app/views/rademade_admin/_blocks/button/_hide.html.erb +7 -1
- data/app/views/rademade_admin/abstract/index.html.erb +1 -1
- data/config/routes.rb +2 -0
- data/lib/rademade_admin/model/configuration.rb +1 -1
- data/lib/rademade_admin/model/graph.rb +3 -3
- data/lib/rademade_admin/model/info.rb +4 -0
- data/lib/rademade_admin/model/reflection.rb +6 -6
- data/lib/rademade_admin/routing/mapper.rb +1 -1
- data/lib/rademade_admin/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 506cc86834c33f984bbdf61e71dec4fa7a50e1e2
|
4
|
+
data.tar.gz: ea1cc018f8994d3757f7647ee0897c75aec5cb5f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0802b51d1350071bebd1c4ae8cde902a18627f13a14aef041575e32ed52c3be0a2d903a5f6c729d46512cf2357337b3d866a41105ce1aa6c2ab40cef5166080
|
7
|
+
data.tar.gz: 23254105027ffe82e06ecd9b0a61d61c1f0c96b520d43acb951fe62df286a38af1a8232989131bf1738c108e6e5aa1f4bfa14bda80d2971ad738537f5a72e784
|
@@ -1,129 +1,139 @@
|
|
1
|
+
button
|
2
|
+
margin: 0
|
3
|
+
padding: 0
|
4
|
+
outline: none
|
5
|
+
border: 0
|
6
|
+
+box-sizing(content-box)
|
7
|
+
|
1
8
|
.btn
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
display: inline-block
|
10
|
+
margin: 0
|
11
|
+
padding: 0 12px
|
12
|
+
height: 32px
|
13
|
+
line-height: 30px
|
14
|
+
font-size: 14px
|
15
|
+
font-weight: 400
|
16
|
+
color: #fff
|
17
|
+
text-align: center
|
18
|
+
cursor: pointer
|
19
|
+
border: 1px solid transparent
|
20
|
+
+border-radius(4px)
|
21
|
+
+box-sizing(border-box)
|
22
|
+
+user-select
|
13
23
|
|
14
24
|
.blue-btn
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
25
|
+
background-color: #428bca
|
26
|
+
border-color: #357ebd
|
27
|
+
&:hover
|
28
|
+
background-color: #3071a9
|
29
|
+
border-color: #285e8e
|
20
30
|
|
21
31
|
.green-btn
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
32
|
+
background-color: #5cb85c
|
33
|
+
border-color: #4cae4c
|
34
|
+
&:hover
|
35
|
+
background-color: #449d44
|
36
|
+
border-color: #398439
|
27
37
|
|
28
38
|
.l-blue-btn
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
background-color: #5bc0de
|
40
|
+
border-color: #46b8da
|
41
|
+
&:hover
|
42
|
+
background-color: #31b0d5
|
43
|
+
border-color: #269abc
|
34
44
|
|
35
45
|
.yellow-btn
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
46
|
+
background-color: #f0ad4e
|
47
|
+
border-color: #eea236
|
48
|
+
&:hover
|
49
|
+
background-color: #ec971f
|
50
|
+
border-color: #d58512
|
41
51
|
|
42
52
|
.red-btn
|
53
|
+
background-color: #c9302c
|
54
|
+
border-color: #ac2925
|
55
|
+
&:hover
|
43
56
|
background-color: #c9302c
|
44
57
|
border-color: #ac2925
|
45
|
-
&:hover
|
46
|
-
background-color: #c9302c
|
47
|
-
border-color: #ac2925
|
48
58
|
|
49
59
|
.r-margin
|
50
|
-
|
60
|
+
margin-right: 20px
|
51
61
|
|
52
62
|
.btn-sep
|
53
|
-
|
54
|
-
|
55
|
-
|
63
|
+
margin: 0 10px
|
64
|
+
font-size: 12px
|
65
|
+
line-height: 34px
|
56
66
|
|
57
67
|
.cancel-btn
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
68
|
+
line-height: 34px
|
69
|
+
font-size: 14px
|
70
|
+
color: #46b8da
|
71
|
+
border-bottom: 1px solid transparentize(#46b8da, 0.6)
|
72
|
+
&:hover
|
73
|
+
border-bottom: 1px solid transparent
|
64
74
|
|
65
75
|
.related-link
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
76
|
+
line-height: 30px
|
77
|
+
font-size: 14px
|
78
|
+
color: #46b8da
|
79
|
+
border-bottom: 1px solid transparentize(#46b8da, 0.6)
|
80
|
+
&:hover
|
81
|
+
border-bottom: 1px solid transparent
|
72
82
|
|
73
83
|
.login-btn
|
74
|
-
|
75
|
-
|
76
|
-
|
84
|
+
padding: 9px 12px
|
85
|
+
width: 100%
|
86
|
+
font-size: 18px
|
77
87
|
|
78
88
|
.select-btn
|
79
|
-
|
89
|
+
padding: 4px 12px
|
80
90
|
|
81
91
|
.lang-btn
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
92
|
+
position: relative
|
93
|
+
display: inline-block
|
94
|
+
margin: 0
|
95
|
+
padding: 6px 12px
|
96
|
+
font-size: 13px
|
97
|
+
font-weight: 400
|
98
|
+
color: #fff
|
99
|
+
text-align: center
|
100
|
+
cursor: pointer
|
101
|
+
border: 1px solid #397bc1
|
102
|
+
background-color: #428bca
|
103
|
+
+border-radius(5px)
|
104
|
+
+user-select
|
105
|
+
|
106
|
+
a
|
107
|
+
width: auto !important
|
108
|
+
padding: 0 10px
|
109
|
+
|
110
|
+
&:hover
|
111
|
+
background-color: #3071a9
|
112
|
+
border-color: #285e8e
|
95
113
|
|
114
|
+
&.ui-state-active
|
115
|
+
border: 1px solid #abc993
|
116
|
+
background-color: #eaf7de
|
96
117
|
a
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
pointer-events: none
|
120
|
-
&:after
|
121
|
-
border-color: rgba(234, 247, 222, 0)
|
122
|
-
border-top-color: #eaf7de
|
123
|
-
border-width: 4px
|
124
|
-
margin-left: -4px
|
125
|
-
&:before
|
126
|
-
border-color: rgba(171, 201, 147, 0)
|
127
|
-
border-top-color: #abc993
|
128
|
-
border-width: 5px
|
129
|
-
margin-left: -5px
|
118
|
+
position: relative
|
119
|
+
color: #70ab3c !important
|
120
|
+
&:after,
|
121
|
+
&:before
|
122
|
+
top: 100%
|
123
|
+
left: 50%
|
124
|
+
border: solid transparent
|
125
|
+
content: " "
|
126
|
+
height: 0
|
127
|
+
width: 0
|
128
|
+
position: absolute
|
129
|
+
pointer-events: none
|
130
|
+
&:after
|
131
|
+
border-color: rgba(234, 247, 222, 0)
|
132
|
+
border-top-color: #eaf7de
|
133
|
+
border-width: 4px
|
134
|
+
margin-left: -4px
|
135
|
+
&:before
|
136
|
+
border-color: rgba(171, 201, 147, 0)
|
137
|
+
border-top-color: #abc993
|
138
|
+
border-width: 5px
|
139
|
+
margin-left: -5px
|
@@ -41,16 +41,58 @@
|
|
41
41
|
position: absolute
|
42
42
|
top: 2px
|
43
43
|
right: 5px
|
44
|
-
|
44
|
+
width: 16px
|
45
|
+
height: 16px
|
46
|
+
padding: 1px
|
45
47
|
cursor: pointer
|
46
|
-
padding: 1px 5px
|
47
48
|
border-radius: 3px
|
48
|
-
|
49
|
+
color: #333
|
49
50
|
font-weight: bold
|
51
|
+
overflow: hidden
|
52
|
+
font-size: 16px
|
53
|
+
text-indent: 100%
|
54
|
+
background-color: #fff
|
55
|
+
&:before
|
56
|
+
position: absolute
|
57
|
+
top: 2px
|
58
|
+
left: 1px
|
59
|
+
width: 16px
|
60
|
+
height: 16px
|
61
|
+
text-indent: 0
|
62
|
+
@extend .glyphicon
|
63
|
+
@extend .glyphicon-remove
|
64
|
+
&:hover
|
65
|
+
+opacity(0.9)
|
50
66
|
|
51
67
|
.crop-btn
|
52
68
|
position: absolute
|
53
|
-
|
69
|
+
top: 2px
|
70
|
+
right: 26px
|
71
|
+
width: 16px
|
72
|
+
height: 16px
|
73
|
+
padding: 1px
|
74
|
+
cursor: pointer
|
75
|
+
border-radius: 3px
|
76
|
+
color: #333
|
77
|
+
font-weight: bold
|
78
|
+
overflow: hidden
|
79
|
+
font-size: 14px
|
80
|
+
text-indent: 100%
|
81
|
+
background-color: #fff
|
82
|
+
border: 0
|
83
|
+
+box-sizing(content-box)
|
84
|
+
&:before
|
85
|
+
position: absolute
|
86
|
+
top: 2px
|
87
|
+
left: 1px
|
88
|
+
width: 16px
|
89
|
+
height: 16px
|
90
|
+
text-indent: 0
|
91
|
+
@extend .glyphicon
|
92
|
+
@extend .glyphicon-fullscreen
|
93
|
+
&:hover
|
94
|
+
+opacity(0.9)
|
95
|
+
|
54
96
|
|
55
97
|
.gallery-images-container
|
56
98
|
float: left
|
@@ -41,7 +41,11 @@ class RademadeAdmin::FileController < RademadeAdmin::AbstractController
|
|
41
41
|
|
42
42
|
def model
|
43
43
|
model_class = RademadeAdmin::LoaderService.const_get(params[:model])
|
44
|
-
|
44
|
+
model_object = nil
|
45
|
+
if params[:id].present?
|
46
|
+
model_object = model_class.find(params[:id]) rescue nil
|
47
|
+
end
|
48
|
+
model_object || model_class.new
|
45
49
|
end
|
46
50
|
|
47
51
|
end
|
@@ -31,7 +31,7 @@ module RademadeAdmin::FieldHelper
|
|
31
31
|
|
32
32
|
selected = number == request.query_parameters[name.to_sym].to_i
|
33
33
|
url_params = request.path_parameters.merge(hash_params)
|
34
|
-
content_tag(:option, number.to_s, :selected => selected, :value => admin_url_for(url_params
|
34
|
+
content_tag(:option, number.to_s, :selected => selected, :value => admin_url_for(url_params))
|
35
35
|
end
|
36
36
|
|
37
37
|
def input_attr(attrs = {})
|
@@ -2,7 +2,12 @@
|
|
2
2
|
module RademadeAdmin::UriHelper
|
3
3
|
|
4
4
|
def root_uri
|
5
|
-
|
5
|
+
rademade_admin_route(:root_url)
|
6
|
+
end
|
7
|
+
|
8
|
+
def rademade_admin_route(route_url, opts = {})
|
9
|
+
opts[:only_path] = true
|
10
|
+
RademadeAdmin::Engine.routes.url_helpers.send(route_url, opts)
|
6
11
|
end
|
7
12
|
|
8
13
|
def admin_list_uri(model)
|
@@ -74,14 +79,14 @@ module RademadeAdmin::UriHelper
|
|
74
79
|
end
|
75
80
|
|
76
81
|
def admin_model_url_for(model, opts = {})
|
82
|
+
model_info = _real_model_info(model)
|
77
83
|
admin_url_for(opts.merge({
|
78
|
-
:controller =>
|
84
|
+
:controller => "#{model_info.module_name}/#{model_info.controller}"
|
79
85
|
}))
|
80
86
|
end
|
81
87
|
|
82
|
-
def admin_url_for(opts
|
88
|
+
def admin_url_for(opts)
|
83
89
|
opts[:only_path] = true
|
84
|
-
opts[:controller] = "rademade_admin/#{opts[:controller]}" unless is_admin_controller
|
85
90
|
Rails.application.routes.url_helpers.url_for(opts)
|
86
91
|
rescue
|
87
92
|
RademadeAdmin::Engine.routes.url_helpers.url_for(opts) rescue nil
|
@@ -36,7 +36,7 @@ module RademadeAdmin
|
|
36
36
|
:name => uploader.mounted_as,
|
37
37
|
:data => {
|
38
38
|
:saved => object.new_record? ? 0 : 1,
|
39
|
-
:url =>
|
39
|
+
:url => rademade_admin_route(:file_upload_url)
|
40
40
|
}.merge(uploader_params)
|
41
41
|
})
|
42
42
|
end
|
@@ -68,9 +68,9 @@ module RademadeAdmin
|
|
68
68
|
template.content_tag(:a, I18n.t('rademade_admin.download_file'), {
|
69
69
|
:class => 'btn blue-btn download-btn',
|
70
70
|
:href => admin_url_for({
|
71
|
-
:controller => 'file',
|
71
|
+
:controller => 'rademade_admin/file',
|
72
72
|
:action => 'download'
|
73
|
-
}.merge(uploader_params))
|
73
|
+
}.merge(uploader_params)) #todo use route name and resources
|
74
74
|
}) unless uploader.file.nil?
|
75
75
|
end
|
76
76
|
|
@@ -79,7 +79,7 @@ module RademadeAdmin
|
|
79
79
|
:class => 'btn red-btn upload-btn',
|
80
80
|
:data => {
|
81
81
|
:crop => true,
|
82
|
-
:url =>
|
82
|
+
:url => rademade_admin_route(:file_crop_url)
|
83
83
|
}
|
84
84
|
})
|
85
85
|
end
|
@@ -20,7 +20,7 @@ module RademadeAdmin
|
|
20
20
|
:type => 'file',
|
21
21
|
:multiple => true,
|
22
22
|
:data => {
|
23
|
-
:url =>
|
23
|
+
:url => rademade_admin_route(:gallery_upload_url),
|
24
24
|
:class_name => gallery_class.to_s
|
25
25
|
}
|
26
26
|
})
|
@@ -31,7 +31,7 @@ module RademadeAdmin
|
|
31
31
|
template.content_tag(:div, HtmlBuffer.new([images_html]), {
|
32
32
|
:class => 'gallery-images-container',
|
33
33
|
:data => {
|
34
|
-
:sortable_url => is_sortable ?
|
34
|
+
:sortable_url => is_sortable ? rademade_admin_route(:gallery_sort_url) : ''
|
35
35
|
}
|
36
36
|
})
|
37
37
|
end
|
@@ -25,7 +25,7 @@ module RademadeAdmin
|
|
25
25
|
:class => 'btn red-btn crop-btn',
|
26
26
|
:data => {
|
27
27
|
:crop => true,
|
28
|
-
:url =>
|
28
|
+
:url => rademade_admin_route(:gallery_crop_url),
|
29
29
|
:full_url => uploader.url,
|
30
30
|
:original_dimensions => uploader.original_dimensions.join(',')
|
31
31
|
}
|
@@ -50,11 +50,12 @@ module RademadeAdmin
|
|
50
50
|
content_tag(:span, 'x', {
|
51
51
|
:class => 'remove-ico',
|
52
52
|
:data => {
|
53
|
-
|
54
|
-
|
53
|
+
#todo use route name and resources
|
54
|
+
:url => admin_url_for({
|
55
|
+
:controller => 'rademade_admin/gallery',
|
55
56
|
:action => 'remove',
|
56
57
|
:id => uploader.model.id.to_s
|
57
|
-
)
|
58
|
+
})
|
58
59
|
}
|
59
60
|
})
|
60
61
|
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
<%
|
2
2
|
if @model_info.hideable? && can?(:edit, @model)
|
3
3
|
element_id = "hide_#{item.id}"
|
4
|
-
toggle_url = admin_url_for(
|
4
|
+
toggle_url = admin_url_for(
|
5
|
+
:controller => :status,
|
6
|
+
:action => :toggle,
|
7
|
+
:model => @model,
|
8
|
+
:id => item.id
|
9
|
+
) #todo via native method. Add route resourse
|
10
|
+
|
5
11
|
%><div class="view-option">
|
6
12
|
<input id="<%=element_id%>" data-toggle-url="<%= toggle_url %>" type="checkbox"<%
|
7
13
|
if item.shown?
|
@@ -10,8 +10,8 @@
|
|
10
10
|
end %>
|
11
11
|
|
12
12
|
<% content_for :content do %><%
|
13
|
-
concat render @template_service.on_page_select_block
|
14
13
|
concat render @template_service.search_block
|
14
|
+
concat render @template_service.on_page_select_block
|
15
15
|
concat render @template_service.sort_reset_block
|
16
16
|
%><table class="table-box"><%
|
17
17
|
concat render @template_service.table_head_block, {
|
data/config/routes.rb
CHANGED
@@ -5,10 +5,12 @@ RademadeAdmin::Engine.routes.draw do
|
|
5
5
|
|
6
6
|
root 'dashboard#index'
|
7
7
|
|
8
|
+
#todo via resources :file
|
8
9
|
match 'file-upload' => 'file#upload', :via => [:post, :patch]
|
9
10
|
match 'file-download/:model/:id/:uploader/:column' => 'file#download', :via => [:get]
|
10
11
|
match 'file-crop' => 'file#crop', :via => [:post, :patch]
|
11
12
|
|
13
|
+
#todo via resources :gallery
|
12
14
|
match 'gallery-upload' => 'gallery#upload', :via => [:post, :patch]
|
13
15
|
match 'gallery-crop' => 'gallery#crop', :via => [:post, :patch]
|
14
16
|
match 'gallery-sort' => 'gallery#sort', :via => [:post, :patch]
|
@@ -4,15 +4,15 @@ module RademadeAdmin
|
|
4
4
|
class Graph
|
5
5
|
include Singleton
|
6
6
|
|
7
|
-
def add_pair(controller_name, inner)
|
7
|
+
def add_pair(module_name, controller_name, inner)
|
8
8
|
# Controller includes configuration for mapping model
|
9
|
-
controller = LoaderService.const_get("
|
9
|
+
controller = LoaderService.const_get("#{module_name}/#{controller_name}_controller")
|
10
10
|
controller.configuration.model(controller_name.classify) unless controller.model_name
|
11
11
|
|
12
12
|
model = controller.model_class
|
13
13
|
|
14
14
|
unless @model_infos[model.to_s]
|
15
|
-
model_reflection = RademadeAdmin::Model::Reflection.new(model, controller_name)
|
15
|
+
model_reflection = RademadeAdmin::Model::Reflection.new(model, controller_name, module_name)
|
16
16
|
model_info = RademadeAdmin::Model::Info.new(model_reflection, controller.configuration, inner)
|
17
17
|
@model_infos[model.to_s] = model_info
|
18
18
|
end
|
@@ -3,15 +3,15 @@ module RademadeAdmin
|
|
3
3
|
module Model
|
4
4
|
class Reflection
|
5
5
|
|
6
|
-
attr_reader :model, :controller
|
7
|
-
|
8
|
-
def initialize(model, controller)
|
9
|
-
@model, @controller = model, controller
|
10
|
-
end
|
11
|
-
|
12
6
|
ORM_TYPE_ACTIVERECORD = 'ActiveRecord'
|
13
7
|
ORM_TYPE_MONGOID = 'Mongoid'
|
14
8
|
|
9
|
+
attr_reader :model, :controller, :module_name
|
10
|
+
|
11
|
+
def initialize(model, controller, module_name)
|
12
|
+
@model, @controller, @module_name = model, controller, module_name
|
13
|
+
end
|
14
|
+
|
15
15
|
# Load data adapter for current model
|
16
16
|
#
|
17
17
|
# @return [RademadeAdmin::Model::Adapter::Data]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rademade_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vladislav Melanitskiy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-02-
|
13
|
+
date: 2015-02-27 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -447,6 +447,7 @@ files:
|
|
447
447
|
- app/assets/stylesheets/rademade_admin.sass.erb
|
448
448
|
- app/assets/stylesheets/rademade_admin/base/main.sass
|
449
449
|
- app/assets/stylesheets/rademade_admin/blocks/buttons/main.sass
|
450
|
+
- app/assets/stylesheets/rademade_admin/blocks/filter/_main.sass
|
450
451
|
- app/assets/stylesheets/rademade_admin/blocks/form/checkbox.sass
|
451
452
|
- app/assets/stylesheets/rademade_admin/blocks/form/input.sass
|
452
453
|
- app/assets/stylesheets/rademade_admin/blocks/form/label.sass
|