mokio 0.0.15 → 2.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/assets/javascripts/backend.js +6 -3
- data/app/assets/javascripts/backend/datatable.js.coffee.erb +28 -26
- data/app/assets/javascripts/backend/head.js +1 -0
- data/app/assets/javascripts/backend/main.js +69 -44
- data/app/assets/javascripts/backend/mokio_dynamic_fields.js +20 -0
- data/app/assets/javascripts/backend/vendors/select2/select2.min.js +2 -0
- data/app/assets/stylesheets/backend.scss +6 -2
- data/app/assets/stylesheets/backend/custom.scss +13 -1
- data/app/assets/stylesheets/backend/main.scss +74 -73
- data/app/assets/stylesheets/backend/plugins/forms/select2/select2.scss +4 -0
- data/app/assets/stylesheets/backend/plugins/tables/dataTables/{jquery.dataTables.scss → jquery.dataTables.css} +7 -7
- data/app/assets/stylesheets/backend/theme/main.scss +413 -0
- data/app/assets/stylesheets/backend/theme/nice-select/_nice-select-prefixed.scss +190 -0
- data/app/assets/stylesheets/backend/theme/nice-select/nice-select.scss +178 -0
- data/app/assets/stylesheets/backend/theme/nice-select/style.scss +20 -0
- data/app/assets/stylesheets/backend/vendors/select2/select2.min.css +1 -0
- data/app/datatables/commons_datatable.rb +56 -36
- data/app/helpers/mokio/backend/backend_helper.rb +27 -1
- data/app/helpers/mokio/backend/common_helper.rb +9 -4
- data/app/helpers/mokio/backend/dynamic_fields_helper.rb +91 -0
- data/app/models/devise_custom_failure.rb +9 -0
- data/app/models/mokio/article.rb +0 -1
- data/app/models/mokio/contact.rb +0 -1
- data/app/models/mokio/content.rb +0 -1
- data/app/models/mokio/menu.rb +0 -1
- data/app/models/mokio/mov_gallery.rb +0 -1
- data/app/models/mokio/pic_gallery.rb +0 -1
- data/app/models/mokio/seo_tag.rb +5 -0
- data/app/models/mokio/support.rb +0 -1
- data/app/uploaders/ckeditor_picture_uploader.rb +2 -2
- data/app/views/devise/sessions/new.html.haml +2 -1
- data/app/views/mokio/articles/_form.html.slim +6 -3
- data/app/views/mokio/common/_form_content.html.slim +4 -4
- data/app/views/mokio/common/edit.html.slim +1 -5
- data/app/views/mokio/common/index.html.slim +3 -0
- data/app/views/mokio/common/modals/_modal_seo_tags.html.slim +47 -0
- data/app/views/mokio/common/new.html.slim +1 -4
- data/app/views/mokio/contacts/_form.html.slim +9 -7
- data/app/views/mokio/contents/new.html.slim +1 -2
- data/app/views/mokio/data_files/_file_upload.html.erb +1 -6
- data/app/views/mokio/layout/sidebar.html.slim +6 -13
- data/app/views/mokio/menus/_form.html.slim +97 -0
- data/app/views/mokio/menus/{_form.html.haml → _old_form.html.haml} +5 -6
- data/app/views/mokio/menus/{_form_slim.html.slim → _old_form_slim.html.slim} +8 -10
- data/app/views/mokio/menus/new_menu_position.slim +1 -1
- data/app/views/mokio/mov_galleries/_form_inputs.html.slim +3 -3
- data/app/views/mokio/pic_galleries/_form_inputs.html.slim +3 -3
- data/app/views/mokio/static_modules/_form.html.slim +2 -1
- data/config/initializers/frontend.rb +3 -0
- data/config/initializers/simple_form.rb +9 -0
- data/config/locales/en.yml +16 -26
- data/config/locales/pl.yml +11 -20
- data/db/migrate/20140422135850_add_mokio_to_application.rb +22 -24
- data/db/migrate/20191217135611_create_mokio_seo_tags.rb +11 -0
- data/lib/mokio.rb +37 -10
- data/lib/mokio/concerns.rb +3 -13
- data/lib/mokio/concerns/common/controller_functions.rb +1 -15
- data/lib/mokio/concerns/common/controller_object.rb +2 -2
- data/lib/mokio/concerns/common/seo_tags.rb +32 -0
- data/lib/mokio/concerns/common/services/sitemap_service.rb +196 -0
- data/lib/mokio/concerns/controllers/application.rb +5 -5
- data/lib/mokio/concerns/controllers/base.rb +12 -12
- data/lib/mokio/concerns/controllers/common.rb +6 -4
- data/lib/mokio/concerns/controllers/data_files.rb +3 -3
- data/lib/mokio/concerns/controllers/menus.rb +11 -13
- data/lib/mokio/concerns/controllers/mov_galleries.rb +1 -2
- data/lib/mokio/concerns/controllers/photos.rb +10 -10
- data/lib/mokio/concerns/controllers/pic_galleries.rb +2 -3
- data/lib/mokio/concerns/controllers/users.rb +4 -3
- data/lib/mokio/concerns/controllers/youtubes.rb +7 -7
- data/lib/mokio/concerns/models/available_module.rb +3 -3
- data/lib/mokio/concerns/models/common.rb +1 -29
- data/lib/mokio/concerns/models/contact_template.rb +0 -4
- data/lib/mokio/concerns/models/content.rb +15 -7
- data/lib/mokio/concerns/models/data_file.rb +3 -9
- data/lib/mokio/concerns/models/lang.rb +11 -7
- data/lib/mokio/concerns/models/menu.rb +4 -4
- data/lib/mokio/concerns/models/module_position.rb +1 -1
- data/lib/mokio/concerns/models/recipient.rb +0 -2
- data/lib/mokio/concerns/models/seo_tag.rb +118 -0
- data/lib/mokio/concerns/models/static_module.rb +2 -2
- data/lib/mokio/concerns/models/user.rb +1 -1
- data/lib/mokio/engine.rb +7 -17
- data/lib/mokio/frontend_helpers.rb +1 -0
- data/lib/mokio/frontend_helpers/seo_tag_helper.rb +33 -0
- data/lib/mokio/simple-form-wrappers.rb +11 -0
- data/lib/mokio/version.rb +1 -1
- data/lib/tasks/mokio_install.rake +37 -9
- data/spec/dummy/Rakefile +1 -3
- data/spec/dummy/app/controllers/application_controller.rb +1 -1
- data/spec/dummy/config.ru +1 -2
- data/spec/dummy/config/application.rb +9 -12
- data/spec/dummy/config/database.yml +18 -0
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/log/development.log +0 -0
- data/spec/dummy/log/development_mokio.log +9 -0
- data/spec/models/content_spec.rb +0 -1
- data/spec/models/menu_spec.rb +8 -9
- data/spec/models/mov_gallery_spec.rb +0 -1
- data/spec/models/pic_gallery_spec.rb +0 -1
- metadata +212 -407
- data/README.rdoc +0 -47
- data/app/assets/javascripts/backend/plugins/forms/select/select2.js +0 -2195
- data/app/assets/javascripts/backend/plugins/forms/select/select2.min.js +0 -76
- data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.js +0 -12099
- data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.min.js +0 -155
- data/app/controllers/mokio/base_articles_controller.rb +0 -3
- data/app/controllers/mokio/base_contacts_controller.rb +0 -5
- data/app/controllers/mokio/base_contents_controller.rb +0 -3
- data/app/controllers/mokio/base_mov_galleries_controller.rb +0 -3
- data/app/controllers/mokio/base_pic_galleries_controller.rb +0 -4
- data/app/controllers/passwords_controller.rb +0 -14
- data/app/models/mokio/base_article.rb +0 -29
- data/app/models/mokio/base_contact.rb +0 -30
- data/app/models/mokio/base_content.rb +0 -5
- data/app/models/mokio/base_mov_gallery.rb +0 -30
- data/app/models/mokio/base_pic_gallery.rb +0 -30
- data/app/models/mokio/meta.rb +0 -24
- data/app/views/mokio/backend/articles/_form.html.haml +0 -9
- data/app/views/mokio/backend/common/_form_content.html.haml +0 -36
- data/app/views/mokio/backend/common/_gmap.html.haml +0 -39
- data/app/views/mokio/backend/common/_main_pic.html.haml +0 -4
- data/app/views/mokio/backend/common/_meta.html.haml +0 -51
- data/app/views/mokio/backend/common/_notice.html.haml +0 -3
- data/app/views/mokio/backend/common/_obj.html.haml +0 -16
- data/app/views/mokio/backend/common/copy.html.haml +0 -5
- data/app/views/mokio/backend/common/edit.html.haml +0 -6
- data/app/views/mokio/backend/common/index.html.haml +0 -19
- data/app/views/mokio/backend/common/new.html.haml +0 -6
- data/app/views/mokio/backend/contacts/_form.html.haml +0 -42
- data/app/views/mokio/backend/contents/_content_info_widget.html.haml +0 -22
- data/app/views/mokio/backend/dashboard/_content.html.haml +0 -9
- data/app/views/mokio/backend/dashboard/show.html.haml +0 -35
- data/app/views/mokio/backend/dashboard/tbl_content.html.haml +0 -24
- data/app/views/mokio/backend/data_files/_file_upload.html.erb +0 -71
- data/app/views/mokio/backend/data_files/uploader.html.haml +0 -15
- data/app/views/mokio/backend/errors/404.html.haml +0 -45
- data/app/views/mokio/backend/errors/unauthorized.html.haml +0 -11
- data/app/views/mokio/backend/layout/_user_widget.html.haml +0 -8
- data/app/views/mokio/backend/layout/header.html.haml +0 -14
- data/app/views/mokio/backend/layout/sidebar.html.haml +0 -59
- data/app/views/mokio/backend/menus/_form.html.haml +0 -66
- data/app/views/mokio/backend/menus/_menu.html.haml +0 -24
- data/app/views/mokio/backend/menus/index.html.haml +0 -53
- data/app/views/mokio/backend/menus/index.json.jbuilder +0 -4
- data/app/views/mokio/backend/menus/lang_changed.js.haml +0 -6
- data/app/views/mokio/backend/menus/sort.html.haml +0 -1
- data/app/views/mokio/backend/menus/update_menu_breadcrumps.js.haml +0 -1
- data/app/views/mokio/backend/mov_galleries/_form.html.haml +0 -17
- data/app/views/mokio/backend/mov_galleries/_form_inputs.html.haml +0 -8
- data/app/views/mokio/backend/photos/_gallery.html.haml +0 -25
- data/app/views/mokio/backend/photos/create.js.haml +0 -1
- data/app/views/mokio/backend/photos/crop_photo.js.haml +0 -10
- data/app/views/mokio/backend/photos/crop_thumb.js.haml +0 -11
- data/app/views/mokio/backend/photos/destroy.js.haml +0 -1
- data/app/views/mokio/backend/photos/from_external_link.html.haml +0 -19
- data/app/views/mokio/backend/photos/get_photo.js.haml +0 -1
- data/app/views/mokio/backend/photos/get_thumb.js.haml +0 -1
- data/app/views/mokio/backend/photos/photo.html.haml +0 -54
- data/app/views/mokio/backend/photos/remove_thumb.js.haml +0 -10
- data/app/views/mokio/backend/photos/rotate_photo.js.haml +0 -10
- data/app/views/mokio/backend/photos/rotate_thumb.js.haml +0 -11
- data/app/views/mokio/backend/photos/thumb.html.haml +0 -9
- data/app/views/mokio/backend/photos/update_thumb.js.haml +0 -11
- data/app/views/mokio/backend/photos/upload_external_links.js.haml +0 -4
- data/app/views/mokio/backend/pic_galleries/_form.html.haml +0 -16
- data/app/views/mokio/backend/pic_galleries/_form_inputs.html.haml +0 -9
- data/app/views/mokio/backend/site_helper/first_login.html.haml +0 -14
- data/app/views/mokio/backend/static_modules/_form.html.haml +0 -9
- data/app/views/mokio/backend/users/_form.html.haml +0 -11
- data/app/views/mokio/backend/users/edit_password.html.haml +0 -13
- data/app/views/mokio/backend/youtubes/_edit.html.haml +0 -49
- data/app/views/mokio/backend/youtubes/_gallery.html.haml +0 -24
- data/app/views/mokio/backend/youtubes/_new.html.haml +0 -4
- data/app/views/mokio/backend/youtubes/_preview_movie.html.haml +0 -1
- data/app/views/mokio/backend/youtubes/_search_yt.html.haml +0 -8
- data/app/views/mokio/backend/youtubes/_search_yt_body.html.haml +0 -11
- data/app/views/mokio/backend/youtubes/find.js.haml +0 -1
- data/app/views/mokio/backend/youtubes/preview.html.haml +0 -36
- data/app/views/mokio/backend/youtubes/preview_movie.js.haml +0 -5
- data/app/views/mokio/backend/youtubes/thumb.html.haml +0 -14
- data/app/views/mokio/backend/youtubes/uploader.html.haml +0 -10
- data/app/views/mokio/backend/youtubes/youtube.html.haml +0 -12
- data/app/views/mokio/base_articles/_multi_lang_form.html.slim +0 -18
- data/app/views/mokio/base_contacts/_multi_lang_form.html.slim +0 -48
- data/app/views/mokio/base_contents/update_content_form.js.slim +0 -1
- data/app/views/mokio/base_pic_galleries/_multi_lang_form.html.slim +0 -13
- data/app/views/mokio/common/_meta.html.slim +0 -50
- data/app/views/mokio/common/_multi_lang_gmap.html.slim +0 -41
- data/app/views/mokio/common/_multi_lang_meta.html.slim +0 -50
- data/app/views/mokio/common/multi_lang_form_content.html.slim +0 -56
- data/db/migrate/20140731061227_create_mokio_external_scripts.rb +0 -12
- data/db/migrate/20141009125027_alter_external_scripts.rb +0 -13
- data/db/migrate/20141024131942_migrate_external_codes_to_external_scripts.rb +0 -25
- data/db/migrate/20141209072051_change_data_type_for_display_dates.rb +0 -8
- data/db/migrate/20141209101853_add_menu_css_options.rb +0 -6
- data/db/migrate/20150220071158_add_subtitle_to_contents.rb +0 -7
- data/db/migrate/20150220091326_add_main_pic_to_mokio_menu.rb +0 -5
- data/db/migrate/20150408074951_create_mokio_base_contents.rb +0 -17
- data/db/migrate/20150408075454_add_base_content_id_to_mokio_contents.mokio.rb +0 -6
- data/db/migrate/20150414054139_add_name_to_mokio_users.rb +0 -6
- data/db/migrate/20150414070406_add_author_and_editor_to_mokio_content.rb +0 -6
- data/db/migrate/20150528104851_add_base_content_id_to_mokio_data_files.rb +0 -5
- data/lib/mokio/concerns/controllers/base_articles.rb +0 -31
- data/lib/mokio/concerns/controllers/base_contacts.rb +0 -32
- data/lib/mokio/concerns/controllers/base_contents.rb +0 -167
- data/lib/mokio/concerns/controllers/base_mov_galleries.rb +0 -48
- data/lib/mokio/concerns/controllers/base_pic_galleries.rb +0 -32
- data/lib/mokio/concerns/models/base_article.rb +0 -21
- data/lib/mokio/concerns/models/base_contact.rb +0 -36
- data/lib/mokio/concerns/models/base_content.rb +0 -51
- data/lib/mokio/concerns/models/base_mov_gallery.rb +0 -19
- data/lib/mokio/concerns/models/base_pic_gallery.rb +0 -22
- data/lib/mokio/concerns/models/meta.rb +0 -39
- data/spec/factories/meta.rb +0 -37
- data/spec/models/meta_spec.rb +0 -26
@@ -0,0 +1,190 @@
|
|
1
|
+
// Default variables
|
2
|
+
$font_size: 14px !default;
|
3
|
+
$font_size_small: 12px !default;
|
4
|
+
|
5
|
+
$input_border_radius: 5px !default;
|
6
|
+
$input_height: 42px !default;
|
7
|
+
$input_height_small: 36px !default;
|
8
|
+
$dropdown_padding: 18px !default;
|
9
|
+
|
10
|
+
$gray_dark: #444 !default;
|
11
|
+
$gray: #999 !default;
|
12
|
+
$gray_light: #e8e8e8 !default;
|
13
|
+
$gray_lighter: #f6f6f6 !default;
|
14
|
+
$primary_light: $gray !default;
|
15
|
+
$arrow_color: $gray !default;
|
16
|
+
|
17
|
+
// Style the dropdown
|
18
|
+
.nice-select {
|
19
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
20
|
+
background-color: #fff;
|
21
|
+
border-radius: $input_border_radius;
|
22
|
+
border: solid 1px $gray_light;
|
23
|
+
box-sizing: border-box;
|
24
|
+
clear: both;
|
25
|
+
cursor: pointer;
|
26
|
+
display: block;
|
27
|
+
float: left;
|
28
|
+
font-family: inherit;
|
29
|
+
font-size: $font_size;
|
30
|
+
font-weight: normal;
|
31
|
+
height: $input_height;
|
32
|
+
line-height: $input_height - 2;
|
33
|
+
outline: none;
|
34
|
+
padding-left: $dropdown_padding;
|
35
|
+
padding-right: $dropdown_padding + 12;
|
36
|
+
position: relative;
|
37
|
+
text-align: left !important;
|
38
|
+
-webkit-transition: all 0.2s ease-in-out;
|
39
|
+
transition: all 0.2s ease-in-out;
|
40
|
+
-webkit-user-select: none;
|
41
|
+
-moz-user-select: none;
|
42
|
+
-ms-user-select: none;
|
43
|
+
user-select: none;
|
44
|
+
white-space: nowrap;
|
45
|
+
width: auto;
|
46
|
+
&:hover {
|
47
|
+
border-color: darken($gray_light, 5%);
|
48
|
+
}
|
49
|
+
&:active, &:focus {
|
50
|
+
border-color: $primary_light;
|
51
|
+
}
|
52
|
+
// Arrow
|
53
|
+
&:after {
|
54
|
+
border-bottom: 2px solid $arrow_color;
|
55
|
+
border-right: 2px solid $arrow_color;
|
56
|
+
content: '';
|
57
|
+
display: block;
|
58
|
+
height: 5px;
|
59
|
+
margin-top: -4px;
|
60
|
+
pointer-events: none;
|
61
|
+
position: absolute;
|
62
|
+
right: 12px;
|
63
|
+
top: 50%;
|
64
|
+
-webkit-transform-origin: 66% 66%;
|
65
|
+
-ms-transform-origin: 66% 66%;
|
66
|
+
transform-origin: 66% 66%;
|
67
|
+
-webkit-transform: rotate(45deg);
|
68
|
+
-ms-transform: rotate(45deg);
|
69
|
+
transform: rotate(45deg);
|
70
|
+
-webkit-transition: all 0.15s ease-in-out;
|
71
|
+
transition: all 0.15s ease-in-out;
|
72
|
+
width: 5px;
|
73
|
+
}
|
74
|
+
|
75
|
+
&.open {
|
76
|
+
@extend :active;
|
77
|
+
&:after {
|
78
|
+
-webkit-transform: rotate(-135deg);
|
79
|
+
-ms-transform: rotate(-135deg);
|
80
|
+
transform: rotate(-135deg);
|
81
|
+
}
|
82
|
+
.list {
|
83
|
+
opacity: 1;
|
84
|
+
pointer-events: auto;
|
85
|
+
-webkit-transform: scale(1) translateY(0);
|
86
|
+
-ms-transform: scale(1) translateY(0);
|
87
|
+
transform: scale(1) translateY(0);
|
88
|
+
}
|
89
|
+
}
|
90
|
+
&.disabled {
|
91
|
+
border-color: lighten($gray_light, 2%);
|
92
|
+
color: $gray;
|
93
|
+
pointer-events: none;
|
94
|
+
&:after {
|
95
|
+
border-color: lighten($arrow_color, 20%);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
|
99
|
+
// Modifiers
|
100
|
+
&.wide {
|
101
|
+
width: 100%;
|
102
|
+
.list {
|
103
|
+
left: 0 !important;
|
104
|
+
right: 0 !important;
|
105
|
+
}
|
106
|
+
}
|
107
|
+
&.right {
|
108
|
+
float: right;
|
109
|
+
.list {
|
110
|
+
left: auto;
|
111
|
+
right: 0;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
&.small {
|
115
|
+
font-size: $font_size_small;
|
116
|
+
height: $input_height_small;
|
117
|
+
line-height: $input_height_small - 2;
|
118
|
+
&:after {
|
119
|
+
height: 4px;
|
120
|
+
width: 4px;
|
121
|
+
}
|
122
|
+
.option {
|
123
|
+
line-height: $input_height_small - 2;
|
124
|
+
min-height: $input_height_small - 2;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
|
128
|
+
// List and options
|
129
|
+
.list {
|
130
|
+
background-color: #fff;
|
131
|
+
border-radius: $input_border_radius;
|
132
|
+
box-shadow: 0 0 0 1px rgba($gray_dark, .11);
|
133
|
+
box-sizing: border-box;
|
134
|
+
margin-top: 4px;
|
135
|
+
opacity: 0;
|
136
|
+
overflow: hidden;
|
137
|
+
padding: 0;
|
138
|
+
pointer-events: none;
|
139
|
+
position: absolute;
|
140
|
+
top: 100%; left: 0;
|
141
|
+
-webkit-transform-origin: 50% 0;
|
142
|
+
-ms-transform-origin: 50% 0;
|
143
|
+
transform-origin: 50% 0;
|
144
|
+
-webkit-transform: scale(.75) translateY(- $input_height / 2);
|
145
|
+
-ms-transform: scale(.75) translateY(- $input_height / 2);
|
146
|
+
transform: scale(.75) translateY(- $input_height / 2);
|
147
|
+
-webkit-transition: all .2s cubic-bezier(0.5, 0, 0, 1.25), opacity .15s ease-out;
|
148
|
+
transition: all .2s cubic-bezier(0.5, 0, 0, 1.25), opacity .15s ease-out;
|
149
|
+
z-index: 9;
|
150
|
+
&:hover .option:not(:hover) {
|
151
|
+
background-color: transparent !important;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
.option {
|
155
|
+
cursor: pointer;
|
156
|
+
font-weight: 400;
|
157
|
+
line-height: $input_height - 2;
|
158
|
+
list-style: none;
|
159
|
+
min-height: $input_height - 2;
|
160
|
+
outline: none;
|
161
|
+
padding-left: $dropdown_padding;
|
162
|
+
padding-right: $dropdown_padding + 11;
|
163
|
+
text-align: left;
|
164
|
+
-webkit-transition: all 0.2s;
|
165
|
+
transition: all 0.2s;
|
166
|
+
&:hover, &.focus, &.selected.focus {
|
167
|
+
background-color: $gray_lighter;
|
168
|
+
}
|
169
|
+
&.selected {
|
170
|
+
font-weight: bold;
|
171
|
+
}
|
172
|
+
&.disabled {
|
173
|
+
background-color: transparent;
|
174
|
+
color: $gray;
|
175
|
+
cursor: default;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
// Use display instead of opacity for IE <= 10
|
181
|
+
.no-csspointerevents .nice-select {
|
182
|
+
.list {
|
183
|
+
display: none;
|
184
|
+
}
|
185
|
+
&.open {
|
186
|
+
.list {
|
187
|
+
display: block;
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
@@ -0,0 +1,178 @@
|
|
1
|
+
// Default variables
|
2
|
+
$font_size: 14px !default;
|
3
|
+
$font_size_small: 12px !default;
|
4
|
+
|
5
|
+
$input_border_radius: 0px !default;
|
6
|
+
$input_height: 42px !default;
|
7
|
+
$input_height_small: 36px !default;
|
8
|
+
$dropdown_padding: 18px !default;
|
9
|
+
|
10
|
+
$gray_dark: #444 !default;
|
11
|
+
$gray: #ccc !default;
|
12
|
+
$gray_light: #e8e8e8 !default;
|
13
|
+
$gray_lighter: #f6f6f6 !default;
|
14
|
+
$primary_light: $gray !default;
|
15
|
+
$arrow_color: $gray !default;
|
16
|
+
|
17
|
+
// Style the dropdown
|
18
|
+
.nice-select {
|
19
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
20
|
+
background-color: #fff;
|
21
|
+
border-radius: $input_border_radius;
|
22
|
+
border: solid 1px #ccc;
|
23
|
+
box-sizing: border-box;
|
24
|
+
clear: both;
|
25
|
+
cursor: pointer;
|
26
|
+
display: block;
|
27
|
+
float: left;
|
28
|
+
font-family: inherit;
|
29
|
+
font-size: $font_size;
|
30
|
+
font-weight: normal;
|
31
|
+
height: $input_height;
|
32
|
+
line-height: $input_height - 2;
|
33
|
+
margin: 0;
|
34
|
+
min-width: 220px;
|
35
|
+
outline: none;
|
36
|
+
padding-left: $dropdown_padding;
|
37
|
+
padding-right: $dropdown_padding + 12;
|
38
|
+
position: relative;
|
39
|
+
text-align: left !important;
|
40
|
+
transition: all 0.2s ease-in-out;
|
41
|
+
user-select: none;
|
42
|
+
white-space: nowrap;
|
43
|
+
width: auto;
|
44
|
+
&:hover {
|
45
|
+
border-color: darken($gray_light, 5%);
|
46
|
+
}
|
47
|
+
&:active, &:focus {
|
48
|
+
border-color: $primary_light;
|
49
|
+
}
|
50
|
+
// Arrow
|
51
|
+
&:after {
|
52
|
+
border-bottom: 2px solid $arrow_color;
|
53
|
+
border-right: 2px solid $arrow_color;
|
54
|
+
content: '';
|
55
|
+
display: block;
|
56
|
+
height: 5px;
|
57
|
+
margin-top: -4px;
|
58
|
+
pointer-events: none;
|
59
|
+
position: absolute;
|
60
|
+
right: 12px;
|
61
|
+
top: 50%;
|
62
|
+
transform-origin: 66% 66%;
|
63
|
+
transform: rotate(45deg);
|
64
|
+
transition: all 0.15s ease-in-out;
|
65
|
+
width: 5px;
|
66
|
+
}
|
67
|
+
|
68
|
+
&.open {
|
69
|
+
@extend :active;
|
70
|
+
&:after {
|
71
|
+
transform: rotate(-135deg);
|
72
|
+
}
|
73
|
+
.list {
|
74
|
+
opacity: 1;
|
75
|
+
pointer-events: auto;
|
76
|
+
transform: scale(1) translateY(0);
|
77
|
+
}
|
78
|
+
}
|
79
|
+
&.disabled {
|
80
|
+
border-color: lighten($gray_light, 2%);
|
81
|
+
color: $gray;
|
82
|
+
pointer-events: none;
|
83
|
+
&:after {
|
84
|
+
border-color: lighten($arrow_color, 20%);
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
// Modifiers
|
89
|
+
&.wide {
|
90
|
+
width: 100%;
|
91
|
+
.list {
|
92
|
+
left: 0 !important;
|
93
|
+
right: 0 !important;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
&.right {
|
97
|
+
float: right;
|
98
|
+
.list {
|
99
|
+
left: auto;
|
100
|
+
right: 0;
|
101
|
+
}
|
102
|
+
}
|
103
|
+
&.small {
|
104
|
+
font-size: $font_size_small;
|
105
|
+
height: $input_height_small;
|
106
|
+
line-height: $input_height_small - 2;
|
107
|
+
&:after {
|
108
|
+
height: 4px;
|
109
|
+
width: 4px;
|
110
|
+
}
|
111
|
+
.option {
|
112
|
+
line-height: $input_height_small - 2;
|
113
|
+
min-height: $input_height_small - 2;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
// List and options
|
118
|
+
.list {
|
119
|
+
background-color: #fff;
|
120
|
+
border-radius: $input_border_radius;
|
121
|
+
box-shadow: 0 0 0 1px rgba($gray_dark, .11);
|
122
|
+
box-sizing: border-box;
|
123
|
+
margin: 1px 0 0 -1px;
|
124
|
+
max-height: 400px;
|
125
|
+
min-width: 220px;
|
126
|
+
opacity: 0;
|
127
|
+
overflow: auto;
|
128
|
+
padding: 0;
|
129
|
+
pointer-events: none;
|
130
|
+
position: absolute;
|
131
|
+
top: 100%; left: 0;
|
132
|
+
transform-origin: 50% 0;
|
133
|
+
transform: scale(.75) translateY(- $input_height / 2);
|
134
|
+
transition: all .2s cubic-bezier(0.5, 0, 0, 1.25), opacity .15s ease-out;
|
135
|
+
z-index: 9;
|
136
|
+
&:hover .option:not(:hover) {
|
137
|
+
background-color: transparent !important;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
.option {
|
141
|
+
cursor: pointer;
|
142
|
+
font-size: 13px;
|
143
|
+
font-weight: 400;
|
144
|
+
// line-height: $input_height - 2;
|
145
|
+
list-style: none;
|
146
|
+
margin: 0;
|
147
|
+
// min-height: $input_height - 2;
|
148
|
+
outline: none;
|
149
|
+
// padding-left: $dropdown_padding;
|
150
|
+
// padding-right: $dropdown_padding + 11;
|
151
|
+
padding: 5px 10px;
|
152
|
+
text-align: left;
|
153
|
+
transition: all 0.2s;
|
154
|
+
&:hover, &.focus, &.selected.focus {
|
155
|
+
background-color: $gray_lighter;
|
156
|
+
}
|
157
|
+
&.selected {
|
158
|
+
font-weight: bold;
|
159
|
+
}
|
160
|
+
&.disabled {
|
161
|
+
background-color: transparent;
|
162
|
+
color: $gray;
|
163
|
+
cursor: default;
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}
|
167
|
+
|
168
|
+
// Use display instead of opacity for IE <= 10
|
169
|
+
.no-csspointerevents .nice-select {
|
170
|
+
.list {
|
171
|
+
display: none;
|
172
|
+
}
|
173
|
+
&.open {
|
174
|
+
.list {
|
175
|
+
display: block;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
$gray_dark: #445870;
|
2
|
+
$gray: #90a1b5;
|
3
|
+
$gray_light: #e0e7ee;
|
4
|
+
$gray_lighter: #f6f7f9;
|
5
|
+
$blue: #55a1fb;
|
6
|
+
$blue_light: #88bfff;
|
7
|
+
$primary: $blue;
|
8
|
+
$primary_light: $blue_light;
|
9
|
+
|
10
|
+
@import 'nice-select';
|
11
|
+
|
12
|
+
@mixin clearfix() {
|
13
|
+
&:before, &:after {
|
14
|
+
content: "";
|
15
|
+
display: table;
|
16
|
+
}
|
17
|
+
&:after {
|
18
|
+
clear: both;
|
19
|
+
}
|
20
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin-top:5px;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:white;border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff;filter:alpha(opacity=0)}.select2-hidden-accessible{border:0 !important;clip:rect(0 0 0 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;height:1px !important;overflow:hidden !important;padding:0 !important;position:absolute !important;width:1px !important;white-space:nowrap !important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-top:5px;margin-right:10px;padding:1px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline{float:right}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid black 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--single,.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:transparent;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected]{background-color:#5897fb;color:white}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:-webkit-linear-gradient(top, #fff 50%, #eee 100%);background-image:-o-linear-gradient(top, #fff 50%, #eee 100%);background-image:linear-gradient(to bottom, #fff 50%, #eee 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic .select2-selection--single:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:bold;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:-webkit-linear-gradient(top, #eee 50%, #ccc 100%);background-image:-o-linear-gradient(top, #eee 50%, #ccc 100%);background-image:linear-gradient(to bottom, #eee 50%, #ccc 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0)}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #5897fb}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:transparent;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:-webkit-linear-gradient(top, #fff 0%, #eee 50%);background-image:-o-linear-gradient(top, #fff 0%, #eee 50%);background-image:linear-gradient(to bottom, #fff 0%, #eee 50%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0)}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:-webkit-linear-gradient(top, #eee 50%, #fff 100%);background-image:-o-linear-gradient(top, #eee 50%, #fff 100%);background-image:linear-gradient(to bottom, #eee 50%, #fff 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0)}.select2-container--classic .select2-selection--multiple{background-color:white;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #5897fb}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:bold;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice{float:right;margin-left:5px;margin-right:auto}.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #5897fb}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#5897fb}
|
@@ -3,15 +3,15 @@ include Mokio
|
|
3
3
|
|
4
4
|
class CommonsDatatable
|
5
5
|
|
6
|
-
delegate :params,
|
7
|
-
:h,
|
8
|
-
:edit_url,
|
9
|
-
:obj_url,
|
10
|
-
:copy_url,
|
11
|
-
:table_controls_edit_btn,
|
6
|
+
delegate :params,
|
7
|
+
:h,
|
8
|
+
:edit_url,
|
9
|
+
:obj_url,
|
10
|
+
:copy_url,
|
11
|
+
:table_controls_edit_btn,
|
12
12
|
:table_controls_delete_btn,
|
13
13
|
:table_controls_copy_btn,
|
14
|
-
to: :@view
|
14
|
+
to: :@view
|
15
15
|
|
16
16
|
def initialize(view, obj_class)
|
17
17
|
@view = view
|
@@ -63,7 +63,7 @@ private
|
|
63
63
|
html += table_controls_copy_btn( copy_url(@obj_class, row) ) if row_cloneable? row
|
64
64
|
html += table_controls_delete_btn( obj_url(@obj_class, row)) if row.deletable
|
65
65
|
html
|
66
|
-
end
|
66
|
+
end
|
67
67
|
|
68
68
|
def row_cloneable?(row)
|
69
69
|
(row.respond_to? "cloneable?") ? row.cloneable? : true
|
@@ -79,56 +79,76 @@ private
|
|
79
79
|
|
80
80
|
def fetch_commons
|
81
81
|
|
82
|
-
if params[:
|
83
|
-
|
84
|
-
|
82
|
+
if params[:search].present? && params[:search][:value].present?
|
85
83
|
# TODO Check Solr Server Running
|
86
|
-
|
84
|
+
if Mokio.solr_enabled
|
87
85
|
searched = Sunspot.search @obj_class do
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
86
|
+
fulltext params[:search][:value]
|
87
|
+
paginate page: page, per_page: per_page
|
88
|
+
end
|
89
|
+
collection = searched.results
|
92
90
|
else
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
91
|
+
columns = ''
|
92
|
+
first_col = true
|
93
|
+
@obj_class.columns.each do |c|
|
94
|
+
next unless [:string, :text].include? c.type
|
95
|
+
columns << " OR " unless first_col
|
96
|
+
columns << c.name
|
97
|
+
columns << ' LIKE :kw'
|
98
|
+
first_col = false
|
99
|
+
end
|
100
|
+
collection = @obj_class
|
101
|
+
.order("#{sort_column} #{sort_direction}")
|
102
|
+
.where("#{columns}", :kw=>"%#{params[:search][:value]}%")
|
103
|
+
collection = collection.page(page).per_page(per_page)
|
106
104
|
end
|
107
105
|
|
108
106
|
elsif params[:only_loose].present?
|
109
|
-
collection = @obj_class
|
107
|
+
collection = @obj_class
|
108
|
+
.includes(:menus)
|
109
|
+
.where(:mokio_content_links => {:content_id => nil})
|
110
|
+
.order("#{sort_column} #{sort_direction}")
|
110
111
|
collection = collection.page(page).per_page(per_page)
|
111
112
|
else
|
112
113
|
collection = @obj_class.order("#{sort_column} #{sort_direction}")
|
113
114
|
collection = collection.page(page).per_page(per_page)
|
114
115
|
end
|
115
|
-
|
116
116
|
collection
|
117
117
|
end
|
118
118
|
|
119
119
|
def page
|
120
|
-
params[:
|
120
|
+
params[:start].to_i/per_page + 1
|
121
121
|
end
|
122
122
|
|
123
123
|
def per_page
|
124
|
-
params[:
|
124
|
+
params[:length].to_i > 0 ? params[:length].to_i : Mokio.backend_default_per_page
|
125
125
|
end
|
126
126
|
|
127
127
|
def sort_column
|
128
|
-
@obj_class.columns_for_table[
|
128
|
+
param_column = @obj_class.columns_for_table[sort_column_index]
|
129
|
+
column_name = nil
|
130
|
+
if @obj_class.respond_to? :override_column_sort
|
131
|
+
column_name = @obj_class.override_column_sort[param_column.to_sym]
|
132
|
+
end
|
133
|
+
column_name ? column_name : param_column
|
134
|
+
end
|
135
|
+
|
136
|
+
def sort_column_index
|
137
|
+
sort_data[:column]
|
129
138
|
end
|
130
139
|
|
131
140
|
def sort_direction
|
132
|
-
|
141
|
+
sort_data[:direction]
|
142
|
+
end
|
143
|
+
|
144
|
+
def sort_data
|
145
|
+
if params[:order]
|
146
|
+
if params[:order]["0"]
|
147
|
+
index = params[:order]["0"]["column"].to_i
|
148
|
+
dir = params[:order]["0"]["dir"]
|
149
|
+
return {column: index, direction: dir}
|
150
|
+
end
|
151
|
+
end
|
152
|
+
return {column: 0, direction: "asc"}
|
133
153
|
end
|
134
|
-
end
|
154
|
+
end
|