mokio 0.0.15 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +5 -5
  2. data/app/assets/javascripts/backend.js +6 -3
  3. data/app/assets/javascripts/backend/datatable.js.coffee.erb +28 -26
  4. data/app/assets/javascripts/backend/head.js +1 -0
  5. data/app/assets/javascripts/backend/main.js +69 -44
  6. data/app/assets/javascripts/backend/mokio_dynamic_fields.js +20 -0
  7. data/app/assets/javascripts/backend/vendors/select2/select2.min.js +2 -0
  8. data/app/assets/stylesheets/backend.scss +6 -2
  9. data/app/assets/stylesheets/backend/custom.scss +13 -1
  10. data/app/assets/stylesheets/backend/main.scss +74 -73
  11. data/app/assets/stylesheets/backend/plugins/forms/select2/select2.scss +4 -0
  12. data/app/assets/stylesheets/backend/plugins/tables/dataTables/{jquery.dataTables.scss → jquery.dataTables.css} +7 -7
  13. data/app/assets/stylesheets/backend/theme/main.scss +413 -0
  14. data/app/assets/stylesheets/backend/theme/nice-select/_nice-select-prefixed.scss +190 -0
  15. data/app/assets/stylesheets/backend/theme/nice-select/nice-select.scss +178 -0
  16. data/app/assets/stylesheets/backend/theme/nice-select/style.scss +20 -0
  17. data/app/assets/stylesheets/backend/vendors/select2/select2.min.css +1 -0
  18. data/app/datatables/commons_datatable.rb +56 -36
  19. data/app/helpers/mokio/backend/backend_helper.rb +27 -1
  20. data/app/helpers/mokio/backend/common_helper.rb +9 -4
  21. data/app/helpers/mokio/backend/dynamic_fields_helper.rb +91 -0
  22. data/app/models/devise_custom_failure.rb +9 -0
  23. data/app/models/mokio/article.rb +0 -1
  24. data/app/models/mokio/contact.rb +0 -1
  25. data/app/models/mokio/content.rb +0 -1
  26. data/app/models/mokio/menu.rb +0 -1
  27. data/app/models/mokio/mov_gallery.rb +0 -1
  28. data/app/models/mokio/pic_gallery.rb +0 -1
  29. data/app/models/mokio/seo_tag.rb +5 -0
  30. data/app/models/mokio/support.rb +0 -1
  31. data/app/uploaders/ckeditor_picture_uploader.rb +2 -2
  32. data/app/views/devise/sessions/new.html.haml +2 -1
  33. data/app/views/mokio/articles/_form.html.slim +6 -3
  34. data/app/views/mokio/common/_form_content.html.slim +4 -4
  35. data/app/views/mokio/common/edit.html.slim +1 -5
  36. data/app/views/mokio/common/index.html.slim +3 -0
  37. data/app/views/mokio/common/modals/_modal_seo_tags.html.slim +47 -0
  38. data/app/views/mokio/common/new.html.slim +1 -4
  39. data/app/views/mokio/contacts/_form.html.slim +9 -7
  40. data/app/views/mokio/contents/new.html.slim +1 -2
  41. data/app/views/mokio/data_files/_file_upload.html.erb +1 -6
  42. data/app/views/mokio/layout/sidebar.html.slim +6 -13
  43. data/app/views/mokio/menus/_form.html.slim +97 -0
  44. data/app/views/mokio/menus/{_form.html.haml → _old_form.html.haml} +5 -6
  45. data/app/views/mokio/menus/{_form_slim.html.slim → _old_form_slim.html.slim} +8 -10
  46. data/app/views/mokio/menus/new_menu_position.slim +1 -1
  47. data/app/views/mokio/mov_galleries/_form_inputs.html.slim +3 -3
  48. data/app/views/mokio/pic_galleries/_form_inputs.html.slim +3 -3
  49. data/app/views/mokio/static_modules/_form.html.slim +2 -1
  50. data/config/initializers/frontend.rb +3 -0
  51. data/config/initializers/simple_form.rb +9 -0
  52. data/config/locales/en.yml +16 -26
  53. data/config/locales/pl.yml +11 -20
  54. data/db/migrate/20140422135850_add_mokio_to_application.rb +22 -24
  55. data/db/migrate/20191217135611_create_mokio_seo_tags.rb +11 -0
  56. data/lib/mokio.rb +37 -10
  57. data/lib/mokio/concerns.rb +3 -13
  58. data/lib/mokio/concerns/common/controller_functions.rb +1 -15
  59. data/lib/mokio/concerns/common/controller_object.rb +2 -2
  60. data/lib/mokio/concerns/common/seo_tags.rb +32 -0
  61. data/lib/mokio/concerns/common/services/sitemap_service.rb +196 -0
  62. data/lib/mokio/concerns/controllers/application.rb +5 -5
  63. data/lib/mokio/concerns/controllers/base.rb +12 -12
  64. data/lib/mokio/concerns/controllers/common.rb +6 -4
  65. data/lib/mokio/concerns/controllers/data_files.rb +3 -3
  66. data/lib/mokio/concerns/controllers/menus.rb +11 -13
  67. data/lib/mokio/concerns/controllers/mov_galleries.rb +1 -2
  68. data/lib/mokio/concerns/controllers/photos.rb +10 -10
  69. data/lib/mokio/concerns/controllers/pic_galleries.rb +2 -3
  70. data/lib/mokio/concerns/controllers/users.rb +4 -3
  71. data/lib/mokio/concerns/controllers/youtubes.rb +7 -7
  72. data/lib/mokio/concerns/models/available_module.rb +3 -3
  73. data/lib/mokio/concerns/models/common.rb +1 -29
  74. data/lib/mokio/concerns/models/contact_template.rb +0 -4
  75. data/lib/mokio/concerns/models/content.rb +15 -7
  76. data/lib/mokio/concerns/models/data_file.rb +3 -9
  77. data/lib/mokio/concerns/models/lang.rb +11 -7
  78. data/lib/mokio/concerns/models/menu.rb +4 -4
  79. data/lib/mokio/concerns/models/module_position.rb +1 -1
  80. data/lib/mokio/concerns/models/recipient.rb +0 -2
  81. data/lib/mokio/concerns/models/seo_tag.rb +118 -0
  82. data/lib/mokio/concerns/models/static_module.rb +2 -2
  83. data/lib/mokio/concerns/models/user.rb +1 -1
  84. data/lib/mokio/engine.rb +7 -17
  85. data/lib/mokio/frontend_helpers.rb +1 -0
  86. data/lib/mokio/frontend_helpers/seo_tag_helper.rb +33 -0
  87. data/lib/mokio/simple-form-wrappers.rb +11 -0
  88. data/lib/mokio/version.rb +1 -1
  89. data/lib/tasks/mokio_install.rake +37 -9
  90. data/spec/dummy/Rakefile +1 -3
  91. data/spec/dummy/app/controllers/application_controller.rb +1 -1
  92. data/spec/dummy/config.ru +1 -2
  93. data/spec/dummy/config/application.rb +9 -12
  94. data/spec/dummy/config/database.yml +18 -0
  95. data/spec/dummy/config/environment.rb +1 -1
  96. data/spec/dummy/log/development.log +0 -0
  97. data/spec/dummy/log/development_mokio.log +9 -0
  98. data/spec/models/content_spec.rb +0 -1
  99. data/spec/models/menu_spec.rb +8 -9
  100. data/spec/models/mov_gallery_spec.rb +0 -1
  101. data/spec/models/pic_gallery_spec.rb +0 -1
  102. metadata +212 -407
  103. data/README.rdoc +0 -47
  104. data/app/assets/javascripts/backend/plugins/forms/select/select2.js +0 -2195
  105. data/app/assets/javascripts/backend/plugins/forms/select/select2.min.js +0 -76
  106. data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.js +0 -12099
  107. data/app/assets/javascripts/backend/plugins/tables/dataTables/jquery.dataTables.min.js +0 -155
  108. data/app/controllers/mokio/base_articles_controller.rb +0 -3
  109. data/app/controllers/mokio/base_contacts_controller.rb +0 -5
  110. data/app/controllers/mokio/base_contents_controller.rb +0 -3
  111. data/app/controllers/mokio/base_mov_galleries_controller.rb +0 -3
  112. data/app/controllers/mokio/base_pic_galleries_controller.rb +0 -4
  113. data/app/controllers/passwords_controller.rb +0 -14
  114. data/app/models/mokio/base_article.rb +0 -29
  115. data/app/models/mokio/base_contact.rb +0 -30
  116. data/app/models/mokio/base_content.rb +0 -5
  117. data/app/models/mokio/base_mov_gallery.rb +0 -30
  118. data/app/models/mokio/base_pic_gallery.rb +0 -30
  119. data/app/models/mokio/meta.rb +0 -24
  120. data/app/views/mokio/backend/articles/_form.html.haml +0 -9
  121. data/app/views/mokio/backend/common/_form_content.html.haml +0 -36
  122. data/app/views/mokio/backend/common/_gmap.html.haml +0 -39
  123. data/app/views/mokio/backend/common/_main_pic.html.haml +0 -4
  124. data/app/views/mokio/backend/common/_meta.html.haml +0 -51
  125. data/app/views/mokio/backend/common/_notice.html.haml +0 -3
  126. data/app/views/mokio/backend/common/_obj.html.haml +0 -16
  127. data/app/views/mokio/backend/common/copy.html.haml +0 -5
  128. data/app/views/mokio/backend/common/edit.html.haml +0 -6
  129. data/app/views/mokio/backend/common/index.html.haml +0 -19
  130. data/app/views/mokio/backend/common/new.html.haml +0 -6
  131. data/app/views/mokio/backend/contacts/_form.html.haml +0 -42
  132. data/app/views/mokio/backend/contents/_content_info_widget.html.haml +0 -22
  133. data/app/views/mokio/backend/dashboard/_content.html.haml +0 -9
  134. data/app/views/mokio/backend/dashboard/show.html.haml +0 -35
  135. data/app/views/mokio/backend/dashboard/tbl_content.html.haml +0 -24
  136. data/app/views/mokio/backend/data_files/_file_upload.html.erb +0 -71
  137. data/app/views/mokio/backend/data_files/uploader.html.haml +0 -15
  138. data/app/views/mokio/backend/errors/404.html.haml +0 -45
  139. data/app/views/mokio/backend/errors/unauthorized.html.haml +0 -11
  140. data/app/views/mokio/backend/layout/_user_widget.html.haml +0 -8
  141. data/app/views/mokio/backend/layout/header.html.haml +0 -14
  142. data/app/views/mokio/backend/layout/sidebar.html.haml +0 -59
  143. data/app/views/mokio/backend/menus/_form.html.haml +0 -66
  144. data/app/views/mokio/backend/menus/_menu.html.haml +0 -24
  145. data/app/views/mokio/backend/menus/index.html.haml +0 -53
  146. data/app/views/mokio/backend/menus/index.json.jbuilder +0 -4
  147. data/app/views/mokio/backend/menus/lang_changed.js.haml +0 -6
  148. data/app/views/mokio/backend/menus/sort.html.haml +0 -1
  149. data/app/views/mokio/backend/menus/update_menu_breadcrumps.js.haml +0 -1
  150. data/app/views/mokio/backend/mov_galleries/_form.html.haml +0 -17
  151. data/app/views/mokio/backend/mov_galleries/_form_inputs.html.haml +0 -8
  152. data/app/views/mokio/backend/photos/_gallery.html.haml +0 -25
  153. data/app/views/mokio/backend/photos/create.js.haml +0 -1
  154. data/app/views/mokio/backend/photos/crop_photo.js.haml +0 -10
  155. data/app/views/mokio/backend/photos/crop_thumb.js.haml +0 -11
  156. data/app/views/mokio/backend/photos/destroy.js.haml +0 -1
  157. data/app/views/mokio/backend/photos/from_external_link.html.haml +0 -19
  158. data/app/views/mokio/backend/photos/get_photo.js.haml +0 -1
  159. data/app/views/mokio/backend/photos/get_thumb.js.haml +0 -1
  160. data/app/views/mokio/backend/photos/photo.html.haml +0 -54
  161. data/app/views/mokio/backend/photos/remove_thumb.js.haml +0 -10
  162. data/app/views/mokio/backend/photos/rotate_photo.js.haml +0 -10
  163. data/app/views/mokio/backend/photos/rotate_thumb.js.haml +0 -11
  164. data/app/views/mokio/backend/photos/thumb.html.haml +0 -9
  165. data/app/views/mokio/backend/photos/update_thumb.js.haml +0 -11
  166. data/app/views/mokio/backend/photos/upload_external_links.js.haml +0 -4
  167. data/app/views/mokio/backend/pic_galleries/_form.html.haml +0 -16
  168. data/app/views/mokio/backend/pic_galleries/_form_inputs.html.haml +0 -9
  169. data/app/views/mokio/backend/site_helper/first_login.html.haml +0 -14
  170. data/app/views/mokio/backend/static_modules/_form.html.haml +0 -9
  171. data/app/views/mokio/backend/users/_form.html.haml +0 -11
  172. data/app/views/mokio/backend/users/edit_password.html.haml +0 -13
  173. data/app/views/mokio/backend/youtubes/_edit.html.haml +0 -49
  174. data/app/views/mokio/backend/youtubes/_gallery.html.haml +0 -24
  175. data/app/views/mokio/backend/youtubes/_new.html.haml +0 -4
  176. data/app/views/mokio/backend/youtubes/_preview_movie.html.haml +0 -1
  177. data/app/views/mokio/backend/youtubes/_search_yt.html.haml +0 -8
  178. data/app/views/mokio/backend/youtubes/_search_yt_body.html.haml +0 -11
  179. data/app/views/mokio/backend/youtubes/find.js.haml +0 -1
  180. data/app/views/mokio/backend/youtubes/preview.html.haml +0 -36
  181. data/app/views/mokio/backend/youtubes/preview_movie.js.haml +0 -5
  182. data/app/views/mokio/backend/youtubes/thumb.html.haml +0 -14
  183. data/app/views/mokio/backend/youtubes/uploader.html.haml +0 -10
  184. data/app/views/mokio/backend/youtubes/youtube.html.haml +0 -12
  185. data/app/views/mokio/base_articles/_multi_lang_form.html.slim +0 -18
  186. data/app/views/mokio/base_contacts/_multi_lang_form.html.slim +0 -48
  187. data/app/views/mokio/base_contents/update_content_form.js.slim +0 -1
  188. data/app/views/mokio/base_pic_galleries/_multi_lang_form.html.slim +0 -13
  189. data/app/views/mokio/common/_meta.html.slim +0 -50
  190. data/app/views/mokio/common/_multi_lang_gmap.html.slim +0 -41
  191. data/app/views/mokio/common/_multi_lang_meta.html.slim +0 -50
  192. data/app/views/mokio/common/multi_lang_form_content.html.slim +0 -56
  193. data/db/migrate/20140731061227_create_mokio_external_scripts.rb +0 -12
  194. data/db/migrate/20141009125027_alter_external_scripts.rb +0 -13
  195. data/db/migrate/20141024131942_migrate_external_codes_to_external_scripts.rb +0 -25
  196. data/db/migrate/20141209072051_change_data_type_for_display_dates.rb +0 -8
  197. data/db/migrate/20141209101853_add_menu_css_options.rb +0 -6
  198. data/db/migrate/20150220071158_add_subtitle_to_contents.rb +0 -7
  199. data/db/migrate/20150220091326_add_main_pic_to_mokio_menu.rb +0 -5
  200. data/db/migrate/20150408074951_create_mokio_base_contents.rb +0 -17
  201. data/db/migrate/20150408075454_add_base_content_id_to_mokio_contents.mokio.rb +0 -6
  202. data/db/migrate/20150414054139_add_name_to_mokio_users.rb +0 -6
  203. data/db/migrate/20150414070406_add_author_and_editor_to_mokio_content.rb +0 -6
  204. data/db/migrate/20150528104851_add_base_content_id_to_mokio_data_files.rb +0 -5
  205. data/lib/mokio/concerns/controllers/base_articles.rb +0 -31
  206. data/lib/mokio/concerns/controllers/base_contacts.rb +0 -32
  207. data/lib/mokio/concerns/controllers/base_contents.rb +0 -167
  208. data/lib/mokio/concerns/controllers/base_mov_galleries.rb +0 -48
  209. data/lib/mokio/concerns/controllers/base_pic_galleries.rb +0 -32
  210. data/lib/mokio/concerns/models/base_article.rb +0 -21
  211. data/lib/mokio/concerns/models/base_contact.rb +0 -36
  212. data/lib/mokio/concerns/models/base_content.rb +0 -51
  213. data/lib/mokio/concerns/models/base_mov_gallery.rb +0 -19
  214. data/lib/mokio/concerns/models/base_pic_gallery.rb +0 -22
  215. data/lib/mokio/concerns/models/meta.rb +0 -39
  216. data/spec/factories/meta.rb +0 -37
  217. 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[:sSearch].present?
83
-
84
-
82
+ if params[:search].present? && params[:search][:value].present?
85
83
  # TODO Check Solr Server Running
86
- if Mokio.solr_enabled
84
+ if Mokio.solr_enabled
87
85
  searched = Sunspot.search @obj_class do
88
- fulltext params[:sSearch]
89
- paginate page: page, per_page: per_page
90
- end
91
- collection = searched.results
86
+ fulltext params[:search][:value]
87
+ paginate page: page, per_page: per_page
88
+ end
89
+ collection = searched.results
92
90
  else
93
-
94
- columns = ''
95
- first_col = true
96
- @obj_class.columns.each do |c|
97
- next unless [:string, :text].include? c.type
98
- columns << " OR " unless first_col
99
- columns << c.name
100
- columns << ' LIKE :kw'
101
- first_col = false
102
- end
103
-
104
- collection = @obj_class.order("#{sort_column} #{sort_direction}").where("#{columns}",:kw=>"%#{params[:sSearch]}%")
105
- collection = collection.page(page).per_page(per_page)
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.includes(:menus).where(:mokio_content_links => {:content_id => nil}).order("#{sort_column} #{sort_direction}")
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[:iDisplayStart].to_i/per_page + 1
120
+ params[:start].to_i/per_page + 1
121
121
  end
122
122
 
123
123
  def per_page
124
- params[:iDisplayLength].to_i > 0 ? params[:iDisplayLength].to_i : Mokio.backend_default_per_page
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[params[:iSortCol_0].to_i]
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
- params[:sSortDir_0] == "desc" ? "desc" : "asc"
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