rademade_admin 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/app/assets/images/rademade_admin/ico/btn-attach.png +0 -0
- data/app/assets/images/rademade_admin/logos/logo.png +0 -0
- data/app/assets/javascripts/rademade_admin.coffee +8 -4
- data/app/assets/javascripts/rademade_admin/app/app.coffee +2 -1
- data/app/assets/javascripts/rademade_admin/app/common/datetime-picker.coffee +7 -0
- data/app/assets/javascripts/rademade_admin/app/common/dnd-sort.coffee +23 -32
- data/app/assets/javascripts/rademade_admin/app/common/droplist.coffee +8 -0
- data/app/assets/javascripts/rademade_admin/app/common/lang-panel.coffee +6 -0
- data/app/assets/javascripts/rademade_admin/app/common/related-index.coffee +6 -9
- data/app/assets/javascripts/rademade_admin/app/common/sort-list.coffee +10 -14
- data/app/assets/javascripts/rademade_admin/app/common/uploader.coffee +3 -3
- data/app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee +24 -37
- data/app/assets/javascripts/rademade_admin/app/form-popup/view.coffee +32 -18
- data/app/assets/javascripts/rademade_admin/app/forms/remove.coffee +4 -3
- data/app/assets/javascripts/rademade_admin/app/select2/model.coffee +7 -0
- data/app/assets/javascripts/rademade_admin/app/select2/related/collection-view.coffee +35 -0
- data/app/assets/javascripts/rademade_admin/app/select2/related/collection.coffee +28 -0
- data/app/assets/javascripts/rademade_admin/app/select2/related/model.coffee +15 -0
- data/app/assets/javascripts/rademade_admin/app/select2/related/view.coffee +40 -0
- data/app/assets/javascripts/rademade_admin/app/select2/view.coffee +78 -0
- data/app/assets/javascripts/rademade_admin/form/form-ajax.coffee +48 -0
- data/app/assets/javascripts/rademade_admin/form/form-initializater.coffee +45 -0
- data/app/assets/javascripts/rademade_admin/form/form-validation.coffee +42 -0
- data/app/assets/javascripts/rademade_admin/form/form.coffee +62 -0
- data/app/assets/javascripts/rademade_admin/library/ckeditor/config.js +14 -12
- data/app/assets/stylesheets/{rademade_admin/bootstrap → old/-bootstrap}/bootstrap-overrides.css.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/bootstrap → old/-bootstrap}/main.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/chart-showcase.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/datatables.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/elements.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/error.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/form-showcase.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/form-wizard.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/gallery.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/grids.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/icons.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/index.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/layout.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/new-user.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/personal-info.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/popup.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/signin.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/tables.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/ui-elements.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/user-list.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/user-profile.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/web-app-icons.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/lib → old/-lib}/bootstrap.datepicker.css.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin/lib → old/-lib}/morris.css.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin → old}/base.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin → old}/edit.css +0 -0
- data/app/assets/stylesheets/{rademade_admin → old}/file-upload.scss.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin → old}/notifier.custom.css.erb +0 -0
- data/app/assets/stylesheets/{rademade_admin → old}/scaffolds.scss.erb +0 -0
- data/app/assets/stylesheets/rademade_admin.sass.erb +96 -0
- data/app/assets/stylesheets/rademade_admin/base/main.sass +71 -0
- data/app/assets/stylesheets/rademade_admin/blocks/buttons/main.sass +81 -0
- data/app/assets/stylesheets/rademade_admin/blocks/form/input.sass +29 -0
- data/app/assets/stylesheets/rademade_admin/blocks/form/label.sass +31 -0
- data/app/assets/stylesheets/rademade_admin/blocks/form/select.sass +26 -0
- data/app/assets/stylesheets/rademade_admin/blocks/form/select2.sass +67 -0
- data/app/assets/stylesheets/rademade_admin/blocks/form/table.sass +42 -0
- data/app/assets/stylesheets/rademade_admin/blocks/form/texarea.sass +20 -0
- data/app/assets/stylesheets/rademade_admin/blocks/header/_logo.sass +7 -0
- data/app/assets/stylesheets/rademade_admin/blocks/header/_menu.sass +80 -0
- data/app/assets/stylesheets/rademade_admin/blocks/header/_search.sass +37 -0
- data/app/assets/stylesheets/rademade_admin/blocks/page/content/_main.sass +11 -0
- data/app/assets/stylesheets/rademade_admin/blocks/page/headline/main.sass +44 -0
- data/app/assets/stylesheets/rademade_admin/blocks/page/menu/_main.sass +31 -0
- data/app/assets/stylesheets/rademade_admin/lib/datepicker.sass +373 -0
- data/app/assets/stylesheets/rademade_admin/lib/glyphicon.sass.erb +618 -0
- data/app/assets/stylesheets/rademade_admin/lib/notifier.css.erb +661 -0
- data/app/assets/stylesheets/rademade_admin/lib/uploader.sass +66 -0
- data/app/assets/stylesheets/rademade_admin/mixins/clear.sass +5 -0
- data/app/assets/stylesheets/rademade_admin/mixins/fonts.sass +8 -0
- data/app/assets/stylesheets/rademade_admin/mixins/sprite.sass +7 -0
- data/app/assets/stylesheets/rademade_admin/mixins/text-overflow.sass +6 -0
- data/app/assets/stylesheets/rademade_admin/mixins/user-select.sass +5 -0
- data/app/assets/stylesheets/rademade_admin/modules/breadcrumbs/main.sass +30 -0
- data/app/assets/stylesheets/rademade_admin/modules/errors/error.sass.erb +19 -0
- data/app/assets/stylesheets/rademade_admin/modules/form/main.sass +15 -0
- data/app/assets/stylesheets/rademade_admin/modules/header/main.sass +6 -0
- data/app/assets/stylesheets/rademade_admin/modules/login/_main.sass +79 -0
- data/app/assets/stylesheets/rademade_admin/modules/main-menu/main.sass +0 -0
- data/app/assets/stylesheets/rademade_admin/modules/page/main.sass +16 -0
- data/app/assets/stylesheets/rademade_admin/modules/pagination/main.sass +51 -0
- data/app/assets/stylesheets/rademade_admin/modules/popup/new.sass +18 -0
- data/app/assets/stylesheets/rademade_admin/var/colors.sass +0 -0
- data/app/assets/stylesheets/rademade_admin/var/images.sass +2 -0
- data/app/assets/stylesheets/rademade_admin/var/width.sass +13 -0
- data/app/controllers/rademade_admin/abstract_controller.rb +18 -2
- data/app/controllers/rademade_admin/application_controller.rb +1 -1
- data/app/controllers/rademade_admin/dashboard_controller.rb +1 -1
- data/app/controllers/rademade_admin/file_controller.rb +25 -0
- data/app/controllers/rademade_admin/model_controller.rb +66 -47
- data/app/controllers/rademade_admin/sessions_controller.rb +3 -3
- data/app/helpers/rademade_admin/field_helper.rb +21 -32
- data/app/helpers/rademade_admin/form_helper.rb +57 -27
- data/app/helpers/rademade_admin/menu_helper.rb +12 -5
- data/app/helpers/rademade_admin/uri_helper.rb +50 -62
- data/app/inputs/rademade_admin/date_time_input.rb +13 -0
- data/app/inputs/rademade_admin/file_input.rb +72 -0
- data/app/inputs/rademade_admin/related_select_input.rb +78 -0
- data/app/serializers/autocomplete/link_serializer.rb +6 -4
- data/app/services/linker.rb +8 -14
- data/app/services/login.rb +5 -3
- data/app/services/model_controller/breadcrumbs.rb +36 -0
- data/app/services/model_controller/instance_options.rb +7 -5
- data/app/services/model_controller/model_options.rb +10 -7
- data/app/services/model_controller/notifier.rb +10 -6
- data/app/services/model_controller/templates.rb +4 -3
- data/app/services/relation_service.rb +11 -0
- data/app/services/saver.rb +59 -24
- data/app/services/search/conditions/abstract.rb +15 -14
- data/app/services/search/conditions/autocomplete.rb +11 -9
- data/app/services/search/conditions/list.rb +6 -5
- data/app/services/search/conditions/related_list.rb +17 -13
- data/app/services/search/{conditions/part/where.rb → part/abstract.rb} +7 -9
- data/app/services/search/part/order.rb +17 -0
- data/app/services/search/part/where.rb +19 -0
- data/app/services/sortable_service.rb +27 -27
- data/app/services/template_service.rb +68 -0
- data/app/services/upload/preview_service.rb +86 -0
- data/app/views/layouts/rademade_admin.html.erb +13 -4
- data/app/views/rademade_admin/_blocks/_header.html.erb +35 -28
- data/app/views/rademade_admin/_blocks/_menu.html.erb +20 -23
- data/app/views/rademade_admin/_blocks/_on_page_select.html.erb +15 -0
- data/app/views/rademade_admin/_blocks/_pagination.html.erb +1 -18
- data/app/views/rademade_admin/_blocks/_sub_menu.html.erb +3 -3
- data/app/views/rademade_admin/_blocks/form/_control.html.erb +3 -0
- data/app/views/rademade_admin/_blocks/form/_lang_panel.html.erb +19 -0
- data/app/views/rademade_admin/_blocks/sub_menu/_link.html.erb +6 -5
- data/app/views/rademade_admin/_blocks/table/_head.html.erb +13 -0
- data/app/views/rademade_admin/_layouts/inner.html.erb +21 -33
- data/app/views/rademade_admin/_layouts/inner/form.html.erb +6 -13
- data/app/views/rademade_admin/_layouts/inner/index_table.html.erb +31 -55
- data/app/views/rademade_admin/_layouts/inner/related_index_table.html.erb +26 -54
- data/app/views/rademade_admin/abstract/_form.html.erb +6 -9
- data/app/views/rademade_admin/abstract/edit.html.erb +3 -8
- data/app/views/rademade_admin/abstract/index.html.erb +38 -67
- data/app/views/rademade_admin/abstract/new.html.erb +3 -8
- data/app/views/rademade_admin/abstract/related.html.erb +48 -0
- data/app/views/rademade_admin/dashboard/index.html.erb +4 -5
- data/app/views/rademade_admin/dashboard/login.html.erb +19 -30
- data/config/initializers/carrier_wave/mongoid.rb +48 -0
- data/config/initializers/ckeditor.rb +3 -0
- data/config/initializers/kaminari_route_proxy.rb +16 -0
- data/config/initializers/simple_form.rb +147 -0
- data/config/initializers/simple_form/rademade_component.rb +9 -0
- data/config/initializers/simple_form/wrappers.rb +28 -0
- data/config/locales/rademade_admin.en.yml +28 -0
- data/config/locales/simple_form.en.yml +26 -0
- data/config/routes.rb +1 -2
- data/lib/rademade_admin.rb +7 -5
- data/lib/rademade_admin/bower/performer.rb +1 -1
- data/lib/rademade_admin/breadcrumbs/render/rademade.rb +31 -0
- data/lib/rademade_admin/engine.rb +2 -2
- data/lib/rademade_admin/input/related_select_input/model_data.rb +40 -0
- data/lib/rademade_admin/input/related_select_input/related_list.rb +60 -0
- data/lib/rademade_admin/model/adapter/data.rb +119 -0
- data/lib/rademade_admin/model/adapter/data/active_record.rb +109 -0
- data/lib/rademade_admin/model/adapter/data/mongoid.rb +77 -0
- data/{app/services/search/query_adapter/abstract.rb → lib/rademade_admin/model/adapter/query.rb} +15 -5
- data/lib/rademade_admin/model/adapter/query/active_record.rb +50 -0
- data/lib/rademade_admin/model/adapter/query/mongoid.rb +57 -0
- data/lib/rademade_admin/model/configuration.rb +43 -16
- data/lib/rademade_admin/model/configuration/field_label.rb +16 -0
- data/lib/rademade_admin/model/configuration/fields.rb +47 -21
- data/lib/rademade_admin/model/configuration/fields_labels.rb +31 -0
- data/lib/rademade_admin/model/configuration/form_field.rb +27 -0
- data/lib/rademade_admin/model/configuration/form_fields.rb +18 -0
- data/lib/rademade_admin/model/configuration/list_field.rb +21 -0
- data/lib/rademade_admin/model/configuration/list_fields.rb +18 -0
- data/lib/rademade_admin/model/graph.rb +9 -9
- data/lib/rademade_admin/model/info.rb +53 -68
- data/lib/rademade_admin/model/info/data_item.rb +130 -0
- data/lib/rademade_admin/model/info/data_items.rb +130 -0
- data/lib/rademade_admin/model/info/field.rb +39 -0
- data/lib/rademade_admin/model/info/fields.rb +87 -0
- data/lib/rademade_admin/model/info/relation.rb +49 -0
- data/lib/rademade_admin/model/info/relations.rb +40 -0
- data/lib/rademade_admin/model/info/uploader.rb +16 -0
- data/lib/rademade_admin/model/info/uploaders.rb +35 -0
- data/lib/rademade_admin/model/reflection.rb +38 -9
- data/lib/rademade_admin/routing/mapper.rb +9 -5
- data/lib/rademade_admin/search/searcher.rb +22 -0
- data/lib/rademade_admin/sortable.rb +1 -0
- data/lib/rademade_admin/uploader/photo.rb +1 -0
- data/lib/rademade_admin/user.rb +7 -6
- data/lib/rademade_admin/version.rb +1 -1
- data/lib/tasks/rademade_bower_install.rake +10 -2
- data/lib/templates/erb/scaffold/_form.html.erb +13 -0
- metadata +195 -109
- data/app/assets/javascripts/rademade_admin/app/common/relation-list.coffee +0 -109
- data/app/assets/javascripts/rademade_admin/app/form-popup/collection.coffee +0 -20
- data/app/assets/javascripts/rademade_admin/app/form-popup/model.coffee +0 -4
- data/app/assets/javascripts/rademade_admin/detail_admin/theme.js +0 -56
- data/app/assets/javascripts/rademade_admin/form/form-ajax-submit.coffee +0 -157
- data/app/assets/stylesheets/rademade_admin.scss.erb +0 -19
- data/app/helpers/rademade_admin/name_helper.rb +0 -18
- data/app/helpers/rademade_admin/upload_preview_helper.rb +0 -60
- data/app/inputs/rademade_admin/admin_file_input.rb +0 -71
- data/app/inputs/rademade_admin/admin_select_input.rb +0 -82
- data/app/inputs/rademade_admin/admin_textarea_input.rb +0 -6
- data/app/inputs/rademade_admin/boolean_input.rb +0 -14
- data/app/services/form_builder.rb +0 -4
- data/app/services/search/query_adapter/active_record.rb +0 -45
- data/app/services/search/query_adapter/mongoid.rb +0 -51
- data/app/services/search/searcher.rb +0 -20
- data/app/views/rademade_admin/_blocks/_form_control.html.erb +0 -5
- data/app/views/rademade_admin/abstract/related_index.html.erb +0 -85
- data/config/initializers/devise.rb +0 -251
- data/config/initializers/formtastic.rb +0 -13
- data/lib/rademade_admin/model/data_adapter.rb +0 -64
- data/lib/rademade_admin/model/data_adapter/active_record.rb +0 -59
- data/lib/rademade_admin/model/data_adapter/mongoid.rb +0 -54
- data/lib/rademade_admin/model/reflection/data.rb +0 -48
- data/lib/rademade_admin/model/reflection/uploader.rb +0 -18
@@ -1,71 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module RademadeAdmin
|
3
|
-
class AdminFileInput < Formtastic::Inputs::FileInput
|
4
|
-
|
5
|
-
include UploadPreviewHelper
|
6
|
-
include UriHelper
|
7
|
-
|
8
|
-
def to_html
|
9
|
-
input_wrapping do
|
10
|
-
template.content_tag(
|
11
|
-
:div,
|
12
|
-
HtmlBuffer.new([label_html, file_html]),
|
13
|
-
{:class => 'uploader-block'}
|
14
|
-
)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def file_html
|
19
|
-
template.content_tag(
|
20
|
-
:div,
|
21
|
-
HtmlBuffer.new([preview_html, input_file_html, upload_progress_html, input_hidden_html]),
|
22
|
-
{:class => 'uploader-wrapper'}
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
def preview_html
|
27
|
-
file_preview_html(object.send(method))
|
28
|
-
end
|
29
|
-
|
30
|
-
def input_file_html
|
31
|
-
builder.file_field(method, {
|
32
|
-
:id => nil,
|
33
|
-
:class => 'uploader-input-file',
|
34
|
-
:name => input_name,
|
35
|
-
:data => {
|
36
|
-
:column => input_name,
|
37
|
-
:id => object.id.to_s,
|
38
|
-
:saved => object.new_record? ? 0 : 1,
|
39
|
-
:model => model_name,
|
40
|
-
:uploader => uploader_classname,
|
41
|
-
:url => admin_url_for(:controller => 'file', :action => 'upload')
|
42
|
-
}
|
43
|
-
})
|
44
|
-
end
|
45
|
-
|
46
|
-
def input_hidden_html
|
47
|
-
builder.hidden_field(method, {
|
48
|
-
:class => 'uploader-input-hidden hidden'
|
49
|
-
})
|
50
|
-
end
|
51
|
-
|
52
|
-
def upload_progress_html
|
53
|
-
progress_slider = template.content_tag(:div, '', {:class => 'upload-progress'})
|
54
|
-
template.content_tag(:div, progress_slider, {
|
55
|
-
:class => 'upload-progress-wrapper',
|
56
|
-
:style => 'display:none'
|
57
|
-
})
|
58
|
-
end
|
59
|
-
|
60
|
-
protected
|
61
|
-
|
62
|
-
def current_file
|
63
|
-
object.send(input_name)
|
64
|
-
end
|
65
|
-
|
66
|
-
def uploader_classname
|
67
|
-
current_file.class.name
|
68
|
-
end
|
69
|
-
|
70
|
-
end
|
71
|
-
end
|
@@ -1,82 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module RademadeAdmin
|
3
|
-
class AdminSelectInput < Formtastic::Inputs::SelectInput
|
4
|
-
|
5
|
-
include ::RademadeAdmin::UriHelper
|
6
|
-
|
7
|
-
alias_method :parent_select_html, :select_html
|
8
|
-
|
9
|
-
def select_html
|
10
|
-
template.content_tag(
|
11
|
-
:div,
|
12
|
-
RademadeAdmin::HtmlBuffer.new([select_ui_html, add_new_button_html]),
|
13
|
-
html_attributes
|
14
|
-
)
|
15
|
-
end
|
16
|
-
|
17
|
-
private
|
18
|
-
|
19
|
-
def add_new_button_html
|
20
|
-
related_with_model? ? add_button_html : ''
|
21
|
-
end
|
22
|
-
|
23
|
-
def select_ui_html
|
24
|
-
template.text_field_tag(extra_input_html_options[:name], input_value, html_attributes)
|
25
|
-
end
|
26
|
-
|
27
|
-
def input_value
|
28
|
-
object_reflection = builder.object.send(reflection_name)
|
29
|
-
if multiple?
|
30
|
-
object_reflection.pluck(:id).map(&:to_s).join(',')
|
31
|
-
else
|
32
|
-
object_reflection.try(:id).to_s
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def html_attributes
|
37
|
-
{
|
38
|
-
:class => 'select-wrapper',
|
39
|
-
:data => reflection_data.merge('owner-class' => object.class.to_s),
|
40
|
-
:type => 'hidden'
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
def add_button_html
|
45
|
-
url = new_item_url
|
46
|
-
template.content_tag(:button, 'Add new', {
|
47
|
-
:class => 'relation-add-button',
|
48
|
-
'data-new' => url,
|
49
|
-
'data-class' => reflection_class
|
50
|
-
}) if url
|
51
|
-
end
|
52
|
-
|
53
|
-
def new_item_url
|
54
|
-
admin_new_form_uri(reflection_class.constantize)
|
55
|
-
end
|
56
|
-
|
57
|
-
def reflection_data
|
58
|
-
data = {}
|
59
|
-
if related_with_model?
|
60
|
-
data.merge!({
|
61
|
-
'rel-multiple' => multiple?.to_s,
|
62
|
-
'rel-class' => reflection_class,
|
63
|
-
'rel-list-url' => admin_autocomplete_uri(reflection_class, format: :json)
|
64
|
-
})
|
65
|
-
end
|
66
|
-
data
|
67
|
-
end
|
68
|
-
|
69
|
-
def reflection_class
|
70
|
-
related_with_model? ? reflection.class_name : nil
|
71
|
-
end
|
72
|
-
|
73
|
-
def related_with_model?
|
74
|
-
!association.nil?
|
75
|
-
end
|
76
|
-
|
77
|
-
def reflection_name
|
78
|
-
reflection.is_a?(Hash) ? reflection[:name] : reflection.name
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|
82
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'search/query_adapter/abstract'
|
3
|
-
|
4
|
-
module RademadeAdmin
|
5
|
-
module Search
|
6
|
-
module QueryAdapter
|
7
|
-
class ActiveRecord < Abstract
|
8
|
-
|
9
|
-
protected
|
10
|
-
|
11
|
-
def where(where_conditions)
|
12
|
-
@values = []
|
13
|
-
condition = collect_where_conditions(where_conditions)
|
14
|
-
@result.where([condition, *@values])
|
15
|
-
end
|
16
|
-
|
17
|
-
def order(order_conditions)
|
18
|
-
order_conditions.each do |order_condition|
|
19
|
-
@result = @result.order(order_condition)
|
20
|
-
end
|
21
|
-
@result
|
22
|
-
end
|
23
|
-
|
24
|
-
def collect_where_conditions(where_conditions)
|
25
|
-
condition = ''
|
26
|
-
where_conditions.parts.each do |part|
|
27
|
-
condition += " #{where_conditions.type.to_s.capitalize} " unless condition.empty?
|
28
|
-
if part.is_a? RademadeAdmin::Search::Conditions::Where
|
29
|
-
condition += "(#{collect_where_conditions(part)})"
|
30
|
-
else
|
31
|
-
if part[:value].is_a? Array
|
32
|
-
condition += "#{part[:field]} IN (?)"
|
33
|
-
else
|
34
|
-
condition += "#{part[:field]} = ?"
|
35
|
-
end
|
36
|
-
@values << part[:value]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
condition
|
40
|
-
end
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
require 'search/query_adapter/abstract'
|
3
|
-
|
4
|
-
module RademadeAdmin
|
5
|
-
module Search
|
6
|
-
module QueryAdapter
|
7
|
-
class Mongoid < Abstract
|
8
|
-
|
9
|
-
protected
|
10
|
-
|
11
|
-
WHERE_METHOD_MAP = { :or => :or, :and => :where }.freeze
|
12
|
-
|
13
|
-
def where(where_conditions)
|
14
|
-
if defined?(::Mongoid::Paranoia) and @model.ancestors.include? ::Mongoid::Paranoia
|
15
|
-
where_condition = RademadeAdmin::Search::Conditions::Where.new(:and)
|
16
|
-
where_condition.add(:deleted_at, nil)
|
17
|
-
where_condition.sub_add(where_conditions) if where_conditions
|
18
|
-
where_conditions = where_condition
|
19
|
-
end
|
20
|
-
collect_where_condition(where_conditions, @result)
|
21
|
-
end
|
22
|
-
|
23
|
-
def order(order_conditions)
|
24
|
-
order_conditions.each do |order_condition|
|
25
|
-
@result = @result.order_by(order_condition)
|
26
|
-
end
|
27
|
-
@result
|
28
|
-
end
|
29
|
-
|
30
|
-
def collect_where_condition(where_conditions, result)
|
31
|
-
where_method = WHERE_METHOD_MAP[where_conditions.type]
|
32
|
-
where_conditions.parts.each do |part|
|
33
|
-
if part.is_a? RademadeAdmin::Search::Conditions::Where
|
34
|
-
result = result.send(where_method, where_sub_condition(part))
|
35
|
-
else
|
36
|
-
field = part[:field]
|
37
|
-
field = field.in if part[:value].is_a? Array
|
38
|
-
result = result.send(where_method, field => part[:value])
|
39
|
-
end
|
40
|
-
end
|
41
|
-
result
|
42
|
-
end
|
43
|
-
|
44
|
-
def where_sub_condition(where_sub_conditions)
|
45
|
-
collect_where_condition(where_sub_conditions, @model.all).selector
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
module RademadeAdmin
|
3
|
-
module Search
|
4
|
-
class Searcher
|
5
|
-
|
6
|
-
def initialize(model_info)
|
7
|
-
@model_info = model_info
|
8
|
-
end
|
9
|
-
|
10
|
-
def search(search_conditions)
|
11
|
-
query_adapter.apply_conditions(search_conditions)
|
12
|
-
end
|
13
|
-
|
14
|
-
def query_adapter
|
15
|
-
@query_adapter ||= "RademadeAdmin::Search::QueryAdapter::#{@model_info.model_reflection.orm_type}".constantize.new(@model_info.model)
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
<% content_for :last_crumbs do %>
|
2
|
-
<%= link_to(admin_list_name(@parent_model_info), admin_list_uri(@parent_model_info)) %>
|
3
|
-
<span class="separator">-></span>
|
4
|
-
<%= link_to(@parent, admin_model_url_for(params[:parent], {
|
5
|
-
:action => :edit,
|
6
|
-
:id => params[:parent_id]
|
7
|
-
})) %>
|
8
|
-
<span class="separator">-></span>
|
9
|
-
<span><%= admin_list_name(@model_info) %></span>
|
10
|
-
<% end %>
|
11
|
-
|
12
|
-
<% content_for :page_header do %>
|
13
|
-
<h3><%= admin_list_name(@model_info) %> of "<%= @parent %>"</h3>
|
14
|
-
<% end %>
|
15
|
-
|
16
|
-
<% content_for :content do %>
|
17
|
-
<% autocomplete_uri = admin_link_autocomplete_uri(@model_info, {
|
18
|
-
:parent => params[:parent],
|
19
|
-
:parent_id => params[:parent_id],
|
20
|
-
:format => :json
|
21
|
-
}) %>
|
22
|
-
<%= content_tag(
|
23
|
-
:input,
|
24
|
-
nil,
|
25
|
-
:type => 'hidden',
|
26
|
-
:class => 'select2-add-link',
|
27
|
-
:'data-model' => @model_class.to_s,
|
28
|
-
:'data-rel-list-url' => autocomplete_uri)
|
29
|
-
%><table class="table table-hover">
|
30
|
-
<thead>
|
31
|
-
<tr>
|
32
|
-
<% @list_fields.each_with_index do |name, index| %>
|
33
|
-
<th class="col-md-3 sort-button" data-column="<%=name%>">
|
34
|
-
<% unless index == 0 %>
|
35
|
-
<span class="line"></span>
|
36
|
-
<% end %>
|
37
|
-
<span><%= field_to_label(name) + @sortable_service.sorting_sign(name) %></span>
|
38
|
-
</th>
|
39
|
-
<% end %>
|
40
|
-
|
41
|
-
<th class="col-md-3 align-right">
|
42
|
-
<span class="line"></span>
|
43
|
-
<span>Management</span>
|
44
|
-
</th>
|
45
|
-
</tr>
|
46
|
-
</thead>
|
47
|
-
|
48
|
-
<% has_position = @sortable_service.has_position? %>
|
49
|
-
<tbody data-position='false'>
|
50
|
-
<% @items.each do |item| %>
|
51
|
-
<tr<%
|
52
|
-
if has_position
|
53
|
-
%> id='<%= item.position %>'<%
|
54
|
-
end
|
55
|
-
%> data-id='<%= item.id %>'>
|
56
|
-
<% @list_fields.each do |name|
|
57
|
-
%><td><%
|
58
|
-
td_data = item.send(name)
|
59
|
-
if td_data.respond_to? :id
|
60
|
-
concat link_to td_data.to_s, admin_edit_uri(td_data)
|
61
|
-
else
|
62
|
-
concat td_data
|
63
|
-
end
|
64
|
-
%></td>
|
65
|
-
<% end %>
|
66
|
-
<td>
|
67
|
-
<ul class="actions">
|
68
|
-
<li>
|
69
|
-
<%= button_to 'Unlink', admin_unlink_uri(item, params[:parent], params[:parent_id]), {
|
70
|
-
:method => :patch,
|
71
|
-
:form => {:class => 'delete-item-form'}
|
72
|
-
} %>
|
73
|
-
</li>
|
74
|
-
</ul>
|
75
|
-
</td>
|
76
|
-
</tr>
|
77
|
-
<% end %>
|
78
|
-
</tbody>
|
79
|
-
</table>
|
80
|
-
|
81
|
-
<%= render 'rademade_admin/_blocks/pagination' %>
|
82
|
-
|
83
|
-
<% end %>
|
84
|
-
|
85
|
-
<%= render :template => 'rademade_admin/_layouts/inner' %>
|
@@ -1,251 +0,0 @@
|
|
1
|
-
# -*- encoding : utf-8 -*-
|
2
|
-
# Use this hook to configure devise mailer, warden hooks and so forth.
|
3
|
-
# Many of these configuration options can be set straight in your model.
|
4
|
-
Devise.setup do |config|
|
5
|
-
# The secret key used by Devise. Devise uses this key to generate
|
6
|
-
# random tokens. Changing this key will render invalid all existing
|
7
|
-
# confirmation, reset password and unlock tokens in the database.
|
8
|
-
# config.secret_key = 'a8e93fea4fcfb7b5344e894821ce50b935c6e8a16ec3e654a8ad400b0a8c1fe2e91a816fed223f885c090327701b2aa557d3ca97b02942e89d5410461490b81a'
|
9
|
-
|
10
|
-
# ==> Mailer Configuration
|
11
|
-
# Configure the e-mail address which will be shown in Devise::Mailer,
|
12
|
-
# note that it will be overwritten if you use your own mailer class
|
13
|
-
# with default "from" parameter.
|
14
|
-
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
15
|
-
|
16
|
-
# Configure the class responsible to send e-mails.
|
17
|
-
# config.mailer = 'Devise::Mailer'
|
18
|
-
|
19
|
-
# ==> Configuration for any authentication mechanism
|
20
|
-
# Configure which keys are used when authenticating a user. The default is
|
21
|
-
# just :email. You can configure it to use [:username, :subdomain], so for
|
22
|
-
# authenticating a user, both parameters are required. Remember that those
|
23
|
-
# parameters are used only when authenticating and not when retrieving from
|
24
|
-
# session. If you need permissions, you should implement that in a before filter.
|
25
|
-
# You can also supply a hash where the value is a boolean determining whether
|
26
|
-
# or not authentication should be aborted when the value is not present.
|
27
|
-
# config.authentication_keys = [ :email ]
|
28
|
-
|
29
|
-
# Configure parameters from the request object used for authentication. Each entry
|
30
|
-
# given should be a request method and it will automatically be passed to the
|
31
|
-
# find_for_authentication method and considered in your model lookup. For instance,
|
32
|
-
# if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
|
33
|
-
# The same considerations mentioned for authentication_keys also apply to request_keys.
|
34
|
-
# config.request_keys = []
|
35
|
-
|
36
|
-
# Configure which authentication keys should be case-insensitive.
|
37
|
-
# These keys will be downcased upon creating or modifying a user and when used
|
38
|
-
# to authenticate or find a user. Default is :email.
|
39
|
-
config.case_insensitive_keys = [ :email ]
|
40
|
-
|
41
|
-
# Configure which authentication keys should have whitespace stripped.
|
42
|
-
# These keys will have whitespace before and after removed upon creating or
|
43
|
-
# modifying a user and when used to authenticate or find a user. Default is :email.
|
44
|
-
config.strip_whitespace_keys = [ :email ]
|
45
|
-
|
46
|
-
# Tell if authentication through request.params is enabled. True by default.
|
47
|
-
# It can be set to an array that will enable params authentication only for the
|
48
|
-
# given strategies, for example, `config.params_authenticatable = [:database]` will
|
49
|
-
# enable it only for database (email + password) authentication.
|
50
|
-
# config.params_authenticatable = true
|
51
|
-
|
52
|
-
# Tell if authentication through HTTP Auth is enabled. False by default.
|
53
|
-
# It can be set to an array that will enable http authentication only for the
|
54
|
-
# given strategies, for example, `config.http_authenticatable = [:database]` will
|
55
|
-
# enable it only for database authentication. The supported strategies are:
|
56
|
-
# :database = Support basic authentication with authentication key + password
|
57
|
-
# config.http_authenticatable = false
|
58
|
-
|
59
|
-
# If http headers should be returned for AJAX requests. True by default.
|
60
|
-
# config.http_authenticatable_on_xhr = true
|
61
|
-
|
62
|
-
# The realm used in Http Basic Authentication. 'Application' by default.
|
63
|
-
# config.http_authentication_realm = 'Application'
|
64
|
-
|
65
|
-
# It will change confirmation, password recovery and other workflows
|
66
|
-
# to behave the same regardless if the e-mail provided was right or wrong.
|
67
|
-
# Does not affect registerable.
|
68
|
-
# config.paranoid = true
|
69
|
-
|
70
|
-
# By default Devise will store the user in session. You can skip storage for
|
71
|
-
# particular strategies by setting this option.
|
72
|
-
# Notice that if you are skipping storage for all authentication paths, you
|
73
|
-
# may want to disable generating routes to Devise's sessions controller by
|
74
|
-
# passing skip: :sessions to `devise_for` in your config/routes.rb
|
75
|
-
config.skip_session_storage = [:http_auth]
|
76
|
-
|
77
|
-
# By default, Devise cleans up the CSRF token on authentication to
|
78
|
-
# avoid CSRF token fixation attacks. This means that, when using AJAX
|
79
|
-
# requests for sign in and sign up, you need to get a new CSRF token
|
80
|
-
# from the server. You can disable this option at your own risk.
|
81
|
-
# config.clean_up_csrf_token_on_authentication = true
|
82
|
-
|
83
|
-
# ==> Configuration for :database_authenticatable
|
84
|
-
# For bcrypt, this is the cost for hashing the password and defaults to 10. If
|
85
|
-
# using other encryptors, it sets how many times you want the password re-encrypted.
|
86
|
-
#
|
87
|
-
# Limiting the stretches to just one in testing will increase the performance of
|
88
|
-
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
|
89
|
-
# a value less than 10 in other environments. Note that, for bcrypt (the default
|
90
|
-
# encryptor), the cost increases exponentially with the number of stretches (e.g.
|
91
|
-
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
|
92
|
-
config.stretches = Rails.env.test? ? 1 : 10
|
93
|
-
|
94
|
-
# Setup a pepper to generate the encrypted password.
|
95
|
-
# config.pepper = '600068784bb72c4fe901cac99128dece3d376d51aa531b132d0e4768e75e5d4d7cd7f022e7a81f46a83d6b47b43466fd5205515625b665888324300fc105ffca'
|
96
|
-
|
97
|
-
# ==> Configuration for :confirmable
|
98
|
-
# A period that the user is allowed to access the website even without
|
99
|
-
# confirming their account. For instance, if set to 2.days, the user will be
|
100
|
-
# able to access the website for two days without confirming their account,
|
101
|
-
# access will be blocked just in the third day. Default is 0.days, meaning
|
102
|
-
# the user cannot access the website without confirming their account.
|
103
|
-
# config.allow_unconfirmed_access_for = 2.days
|
104
|
-
|
105
|
-
# A period that the user is allowed to confirm their account before their
|
106
|
-
# token becomes invalid. For example, if set to 3.days, the user can confirm
|
107
|
-
# their account within 3 days after the mail was sent, but on the fourth day
|
108
|
-
# their account can't be confirmed with the token any more.
|
109
|
-
# Default is nil, meaning there is no restriction on how long a user can take
|
110
|
-
# before confirming their account.
|
111
|
-
# config.confirm_within = 3.days
|
112
|
-
|
113
|
-
# If true, requires any email changes to be confirmed (exactly the same way as
|
114
|
-
# initial account confirmation) to be applied. Requires additional unconfirmed_email
|
115
|
-
# db field (see migrations). Until confirmed, new email is stored in
|
116
|
-
# unconfirmed_email column, and copied to email column on successful confirmation.
|
117
|
-
config.reconfirmable = true
|
118
|
-
|
119
|
-
# Defines which key will be used when confirming an account
|
120
|
-
# config.confirmation_keys = [ :email ]
|
121
|
-
|
122
|
-
# ==> Configuration for :rememberable
|
123
|
-
# The time the user will be remembered without asking for credentials again.
|
124
|
-
# config.remember_for = 2.weeks
|
125
|
-
|
126
|
-
# If true, extends the user's remember period when remembered via cookie.
|
127
|
-
# config.extend_remember_period = false
|
128
|
-
|
129
|
-
# Options to be passed to the created cookie. For instance, you can set
|
130
|
-
# secure: true in order to force SSL only cookies.
|
131
|
-
# config.rememberable_options = {}
|
132
|
-
|
133
|
-
# ==> Configuration for :validatable
|
134
|
-
# Range for password length.
|
135
|
-
config.password_length = 8..128
|
136
|
-
|
137
|
-
# Email regex used to validate email formats. It simply asserts that
|
138
|
-
# one (and only one) @ exists in the given string. This is mainly
|
139
|
-
# to give user feedback and not to assert the e-mail validity.
|
140
|
-
# config.email_regexp = /\A[^@]+@[^@]+\z/
|
141
|
-
|
142
|
-
# ==> Configuration for :timeoutable
|
143
|
-
# The time you want to timeout the user session without activity. After this
|
144
|
-
# time the user will be asked for credentials again. Default is 30 minutes.
|
145
|
-
# config.timeout_in = 30.minutes
|
146
|
-
|
147
|
-
# If true, expires auth token on session timeout.
|
148
|
-
# config.expire_auth_token_on_timeout = false
|
149
|
-
|
150
|
-
# ==> Configuration for :lockable
|
151
|
-
# Defines which strategy will be used to lock an account.
|
152
|
-
# :failed_attempts = Locks an account after a number of failed attempts to sign in.
|
153
|
-
# :none = No lock strategy. You should handle locking by yourself.
|
154
|
-
# config.lock_strategy = :failed_attempts
|
155
|
-
|
156
|
-
# Defines which key will be used when locking and unlocking an account
|
157
|
-
# config.unlock_keys = [ :email ]
|
158
|
-
|
159
|
-
# Defines which strategy will be used to unlock an account.
|
160
|
-
# :email = Sends an unlock link to the user email
|
161
|
-
# :time = Re-enables login after a certain amount of time (see :unlock_in below)
|
162
|
-
# :both = Enables both strategies
|
163
|
-
# :none = No unlock strategy. You should handle unlocking by yourself.
|
164
|
-
# config.unlock_strategy = :both
|
165
|
-
|
166
|
-
# Number of authentication tries before locking an account if lock_strategy
|
167
|
-
# is failed attempts.
|
168
|
-
# config.maximum_attempts = 20
|
169
|
-
|
170
|
-
# Time interval to unlock the account if :time is enabled as unlock_strategy.
|
171
|
-
# config.unlock_in = 1.hour
|
172
|
-
|
173
|
-
# Warn on the last attempt before the account is locked.
|
174
|
-
# config.last_attempt_warning = false
|
175
|
-
|
176
|
-
# ==> Configuration for :recoverable
|
177
|
-
#
|
178
|
-
# Defines which key will be used when recovering the password for an account
|
179
|
-
# config.reset_password_keys = [ :email ]
|
180
|
-
|
181
|
-
# Time interval you can reset your password with a reset password key.
|
182
|
-
# Don't put a too small interval or your users won't have the time to
|
183
|
-
# change their passwords.
|
184
|
-
config.reset_password_within = 6.hours
|
185
|
-
|
186
|
-
# ==> Configuration for :encryptable
|
187
|
-
# Allow you to use another encryption algorithm besides bcrypt (default). You can use
|
188
|
-
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
|
189
|
-
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
|
190
|
-
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy
|
191
|
-
# REST_AUTH_SITE_KEY to pepper).
|
192
|
-
#
|
193
|
-
# Require the `devise-encryptable` gem when using anything other than bcrypt
|
194
|
-
# config.encryptor = :sha512
|
195
|
-
|
196
|
-
# ==> Scopes configuration
|
197
|
-
# Turn scoped views on. Before rendering "sessions/new", it will first check for
|
198
|
-
# "users/sessions/new". It's turned off by default because it's slower if you
|
199
|
-
# are using only default views.
|
200
|
-
# config.scoped_views = false
|
201
|
-
|
202
|
-
# Configure the default scope given to Warden. By default it's the first
|
203
|
-
# devise role declared in your routes (usually :user).
|
204
|
-
# config.default_scope = :user
|
205
|
-
|
206
|
-
# Set this configuration to false if you want /users/sign_out to sign out
|
207
|
-
# only the current scope. By default, Devise signs out all scopes.
|
208
|
-
# config.sign_out_all_scopes = true
|
209
|
-
|
210
|
-
# ==> Navigation configuration
|
211
|
-
# Lists the formats that should be treated as navigational. Formats like
|
212
|
-
# :html, should redirect to the sign in page when the user does not have
|
213
|
-
# access, but formats like :xml or :json, should return 401.
|
214
|
-
#
|
215
|
-
# If you have any extra navigational formats, like :iphone or :mobile, you
|
216
|
-
# should add them to the navigational formats lists.
|
217
|
-
#
|
218
|
-
# The "*/*" below is required to match Internet Explorer requests.
|
219
|
-
# config.navigational_formats = ['*/*', :html]
|
220
|
-
|
221
|
-
# The default HTTP method used to sign out a resource. Default is :delete.
|
222
|
-
config.sign_out_via = :delete
|
223
|
-
|
224
|
-
# ==> OmniAuth
|
225
|
-
# Add a new OmniAuth provider. Check the wiki for more information on setting
|
226
|
-
# up on your models and hooks.
|
227
|
-
# config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
|
228
|
-
|
229
|
-
# ==> Warden configuration
|
230
|
-
# If you want to use other strategies, that are not supported by Devise, or
|
231
|
-
# change the failure app, you can configure them inside the config.warden block.
|
232
|
-
#
|
233
|
-
# config.warden do |manager|
|
234
|
-
# manager.intercept_401 = false
|
235
|
-
# manager.default_strategies(scope: :user).unshift :some_external_strategy
|
236
|
-
# end
|
237
|
-
|
238
|
-
# ==> Mountable engine configurations
|
239
|
-
# When using Devise inside an engine, let's call it `MyEngine`, and this engine
|
240
|
-
# is mountable, there are some extra configurations to be taken into account.
|
241
|
-
# The following options are available, assuming the engine is mounted as:
|
242
|
-
#
|
243
|
-
# mount MyEngine, at: '/my_engine'
|
244
|
-
#
|
245
|
-
# The router that invoked `devise_for`, in the example above, would be:
|
246
|
-
config.router_name = :rademade_admin
|
247
|
-
#
|
248
|
-
# When using omniauth, Devise cannot automatically set Omniauth path,
|
249
|
-
# so you need to do it manually. For the users scope, it would be:
|
250
|
-
# config.omniauth_path_prefix = '/my_engine/users/auth'
|
251
|
-
end
|