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.
Files changed (223) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/fonts/glyphicons-halflings-regular.eot +0 -0
  3. data/app/assets/fonts/glyphicons-halflings-regular.svg +229 -0
  4. data/app/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  5. data/app/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  6. data/app/assets/images/rademade_admin/ico/btn-attach.png +0 -0
  7. data/app/assets/images/rademade_admin/logos/logo.png +0 -0
  8. data/app/assets/javascripts/rademade_admin.coffee +8 -4
  9. data/app/assets/javascripts/rademade_admin/app/app.coffee +2 -1
  10. data/app/assets/javascripts/rademade_admin/app/common/datetime-picker.coffee +7 -0
  11. data/app/assets/javascripts/rademade_admin/app/common/dnd-sort.coffee +23 -32
  12. data/app/assets/javascripts/rademade_admin/app/common/droplist.coffee +8 -0
  13. data/app/assets/javascripts/rademade_admin/app/common/lang-panel.coffee +6 -0
  14. data/app/assets/javascripts/rademade_admin/app/common/related-index.coffee +6 -9
  15. data/app/assets/javascripts/rademade_admin/app/common/sort-list.coffee +10 -14
  16. data/app/assets/javascripts/rademade_admin/app/common/uploader.coffee +3 -3
  17. data/app/assets/javascripts/rademade_admin/app/form-popup/initializer.coffee +24 -37
  18. data/app/assets/javascripts/rademade_admin/app/form-popup/view.coffee +32 -18
  19. data/app/assets/javascripts/rademade_admin/app/forms/remove.coffee +4 -3
  20. data/app/assets/javascripts/rademade_admin/app/select2/model.coffee +7 -0
  21. data/app/assets/javascripts/rademade_admin/app/select2/related/collection-view.coffee +35 -0
  22. data/app/assets/javascripts/rademade_admin/app/select2/related/collection.coffee +28 -0
  23. data/app/assets/javascripts/rademade_admin/app/select2/related/model.coffee +15 -0
  24. data/app/assets/javascripts/rademade_admin/app/select2/related/view.coffee +40 -0
  25. data/app/assets/javascripts/rademade_admin/app/select2/view.coffee +78 -0
  26. data/app/assets/javascripts/rademade_admin/form/form-ajax.coffee +48 -0
  27. data/app/assets/javascripts/rademade_admin/form/form-initializater.coffee +45 -0
  28. data/app/assets/javascripts/rademade_admin/form/form-validation.coffee +42 -0
  29. data/app/assets/javascripts/rademade_admin/form/form.coffee +62 -0
  30. data/app/assets/javascripts/rademade_admin/library/ckeditor/config.js +14 -12
  31. data/app/assets/stylesheets/{rademade_admin/bootstrap → old/-bootstrap}/bootstrap-overrides.css.erb +0 -0
  32. data/app/assets/stylesheets/{rademade_admin/bootstrap → old/-bootstrap}/main.scss.erb +0 -0
  33. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/chart-showcase.scss.erb +0 -0
  34. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/datatables.scss.erb +0 -0
  35. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/elements.scss.erb +0 -0
  36. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/error.scss.erb +0 -0
  37. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/form-showcase.scss.erb +0 -0
  38. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/form-wizard.scss.erb +0 -0
  39. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/gallery.scss.erb +0 -0
  40. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/grids.scss.erb +0 -0
  41. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/icons.scss.erb +0 -0
  42. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/index.scss.erb +0 -0
  43. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/layout.scss.erb +0 -0
  44. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/new-user.scss.erb +0 -0
  45. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/personal-info.scss.erb +0 -0
  46. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/popup.scss.erb +0 -0
  47. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/signin.scss.erb +0 -0
  48. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/tables.scss.erb +0 -0
  49. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/ui-elements.scss.erb +0 -0
  50. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/user-list.scss.erb +0 -0
  51. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/user-profile.scss.erb +0 -0
  52. data/app/assets/stylesheets/{rademade_admin/detail_admin → old/-detail_admin}/web-app-icons.scss.erb +0 -0
  53. data/app/assets/stylesheets/{rademade_admin/lib → old/-lib}/bootstrap.datepicker.css.erb +0 -0
  54. data/app/assets/stylesheets/{rademade_admin/lib → old/-lib}/morris.css.erb +0 -0
  55. data/app/assets/stylesheets/{rademade_admin → old}/base.scss.erb +0 -0
  56. data/app/assets/stylesheets/{rademade_admin → old}/edit.css +0 -0
  57. data/app/assets/stylesheets/{rademade_admin → old}/file-upload.scss.erb +0 -0
  58. data/app/assets/stylesheets/{rademade_admin → old}/notifier.custom.css.erb +0 -0
  59. data/app/assets/stylesheets/{rademade_admin → old}/scaffolds.scss.erb +0 -0
  60. data/app/assets/stylesheets/rademade_admin.sass.erb +96 -0
  61. data/app/assets/stylesheets/rademade_admin/base/main.sass +71 -0
  62. data/app/assets/stylesheets/rademade_admin/blocks/buttons/main.sass +81 -0
  63. data/app/assets/stylesheets/rademade_admin/blocks/form/input.sass +29 -0
  64. data/app/assets/stylesheets/rademade_admin/blocks/form/label.sass +31 -0
  65. data/app/assets/stylesheets/rademade_admin/blocks/form/select.sass +26 -0
  66. data/app/assets/stylesheets/rademade_admin/blocks/form/select2.sass +67 -0
  67. data/app/assets/stylesheets/rademade_admin/blocks/form/table.sass +42 -0
  68. data/app/assets/stylesheets/rademade_admin/blocks/form/texarea.sass +20 -0
  69. data/app/assets/stylesheets/rademade_admin/blocks/header/_logo.sass +7 -0
  70. data/app/assets/stylesheets/rademade_admin/blocks/header/_menu.sass +80 -0
  71. data/app/assets/stylesheets/rademade_admin/blocks/header/_search.sass +37 -0
  72. data/app/assets/stylesheets/rademade_admin/blocks/page/content/_main.sass +11 -0
  73. data/app/assets/stylesheets/rademade_admin/blocks/page/headline/main.sass +44 -0
  74. data/app/assets/stylesheets/rademade_admin/blocks/page/menu/_main.sass +31 -0
  75. data/app/assets/stylesheets/rademade_admin/lib/datepicker.sass +373 -0
  76. data/app/assets/stylesheets/rademade_admin/lib/glyphicon.sass.erb +618 -0
  77. data/app/assets/stylesheets/rademade_admin/lib/notifier.css.erb +661 -0
  78. data/app/assets/stylesheets/rademade_admin/lib/uploader.sass +66 -0
  79. data/app/assets/stylesheets/rademade_admin/mixins/clear.sass +5 -0
  80. data/app/assets/stylesheets/rademade_admin/mixins/fonts.sass +8 -0
  81. data/app/assets/stylesheets/rademade_admin/mixins/sprite.sass +7 -0
  82. data/app/assets/stylesheets/rademade_admin/mixins/text-overflow.sass +6 -0
  83. data/app/assets/stylesheets/rademade_admin/mixins/user-select.sass +5 -0
  84. data/app/assets/stylesheets/rademade_admin/modules/breadcrumbs/main.sass +30 -0
  85. data/app/assets/stylesheets/rademade_admin/modules/errors/error.sass.erb +19 -0
  86. data/app/assets/stylesheets/rademade_admin/modules/form/main.sass +15 -0
  87. data/app/assets/stylesheets/rademade_admin/modules/header/main.sass +6 -0
  88. data/app/assets/stylesheets/rademade_admin/modules/login/_main.sass +79 -0
  89. data/app/assets/stylesheets/rademade_admin/modules/main-menu/main.sass +0 -0
  90. data/app/assets/stylesheets/rademade_admin/modules/page/main.sass +16 -0
  91. data/app/assets/stylesheets/rademade_admin/modules/pagination/main.sass +51 -0
  92. data/app/assets/stylesheets/rademade_admin/modules/popup/new.sass +18 -0
  93. data/app/assets/stylesheets/rademade_admin/var/colors.sass +0 -0
  94. data/app/assets/stylesheets/rademade_admin/var/images.sass +2 -0
  95. data/app/assets/stylesheets/rademade_admin/var/width.sass +13 -0
  96. data/app/controllers/rademade_admin/abstract_controller.rb +18 -2
  97. data/app/controllers/rademade_admin/application_controller.rb +1 -1
  98. data/app/controllers/rademade_admin/dashboard_controller.rb +1 -1
  99. data/app/controllers/rademade_admin/file_controller.rb +25 -0
  100. data/app/controllers/rademade_admin/model_controller.rb +66 -47
  101. data/app/controllers/rademade_admin/sessions_controller.rb +3 -3
  102. data/app/helpers/rademade_admin/field_helper.rb +21 -32
  103. data/app/helpers/rademade_admin/form_helper.rb +57 -27
  104. data/app/helpers/rademade_admin/menu_helper.rb +12 -5
  105. data/app/helpers/rademade_admin/uri_helper.rb +50 -62
  106. data/app/inputs/rademade_admin/date_time_input.rb +13 -0
  107. data/app/inputs/rademade_admin/file_input.rb +72 -0
  108. data/app/inputs/rademade_admin/related_select_input.rb +78 -0
  109. data/app/serializers/autocomplete/link_serializer.rb +6 -4
  110. data/app/services/linker.rb +8 -14
  111. data/app/services/login.rb +5 -3
  112. data/app/services/model_controller/breadcrumbs.rb +36 -0
  113. data/app/services/model_controller/instance_options.rb +7 -5
  114. data/app/services/model_controller/model_options.rb +10 -7
  115. data/app/services/model_controller/notifier.rb +10 -6
  116. data/app/services/model_controller/templates.rb +4 -3
  117. data/app/services/relation_service.rb +11 -0
  118. data/app/services/saver.rb +59 -24
  119. data/app/services/search/conditions/abstract.rb +15 -14
  120. data/app/services/search/conditions/autocomplete.rb +11 -9
  121. data/app/services/search/conditions/list.rb +6 -5
  122. data/app/services/search/conditions/related_list.rb +17 -13
  123. data/app/services/search/{conditions/part/where.rb → part/abstract.rb} +7 -9
  124. data/app/services/search/part/order.rb +17 -0
  125. data/app/services/search/part/where.rb +19 -0
  126. data/app/services/sortable_service.rb +27 -27
  127. data/app/services/template_service.rb +68 -0
  128. data/app/services/upload/preview_service.rb +86 -0
  129. data/app/views/layouts/rademade_admin.html.erb +13 -4
  130. data/app/views/rademade_admin/_blocks/_header.html.erb +35 -28
  131. data/app/views/rademade_admin/_blocks/_menu.html.erb +20 -23
  132. data/app/views/rademade_admin/_blocks/_on_page_select.html.erb +15 -0
  133. data/app/views/rademade_admin/_blocks/_pagination.html.erb +1 -18
  134. data/app/views/rademade_admin/_blocks/_sub_menu.html.erb +3 -3
  135. data/app/views/rademade_admin/_blocks/form/_control.html.erb +3 -0
  136. data/app/views/rademade_admin/_blocks/form/_lang_panel.html.erb +19 -0
  137. data/app/views/rademade_admin/_blocks/sub_menu/_link.html.erb +6 -5
  138. data/app/views/rademade_admin/_blocks/table/_head.html.erb +13 -0
  139. data/app/views/rademade_admin/_layouts/inner.html.erb +21 -33
  140. data/app/views/rademade_admin/_layouts/inner/form.html.erb +6 -13
  141. data/app/views/rademade_admin/_layouts/inner/index_table.html.erb +31 -55
  142. data/app/views/rademade_admin/_layouts/inner/related_index_table.html.erb +26 -54
  143. data/app/views/rademade_admin/abstract/_form.html.erb +6 -9
  144. data/app/views/rademade_admin/abstract/edit.html.erb +3 -8
  145. data/app/views/rademade_admin/abstract/index.html.erb +38 -67
  146. data/app/views/rademade_admin/abstract/new.html.erb +3 -8
  147. data/app/views/rademade_admin/abstract/related.html.erb +48 -0
  148. data/app/views/rademade_admin/dashboard/index.html.erb +4 -5
  149. data/app/views/rademade_admin/dashboard/login.html.erb +19 -30
  150. data/config/initializers/carrier_wave/mongoid.rb +48 -0
  151. data/config/initializers/ckeditor.rb +3 -0
  152. data/config/initializers/kaminari_route_proxy.rb +16 -0
  153. data/config/initializers/simple_form.rb +147 -0
  154. data/config/initializers/simple_form/rademade_component.rb +9 -0
  155. data/config/initializers/simple_form/wrappers.rb +28 -0
  156. data/config/locales/rademade_admin.en.yml +28 -0
  157. data/config/locales/simple_form.en.yml +26 -0
  158. data/config/routes.rb +1 -2
  159. data/lib/rademade_admin.rb +7 -5
  160. data/lib/rademade_admin/bower/performer.rb +1 -1
  161. data/lib/rademade_admin/breadcrumbs/render/rademade.rb +31 -0
  162. data/lib/rademade_admin/engine.rb +2 -2
  163. data/lib/rademade_admin/input/related_select_input/model_data.rb +40 -0
  164. data/lib/rademade_admin/input/related_select_input/related_list.rb +60 -0
  165. data/lib/rademade_admin/model/adapter/data.rb +119 -0
  166. data/lib/rademade_admin/model/adapter/data/active_record.rb +109 -0
  167. data/lib/rademade_admin/model/adapter/data/mongoid.rb +77 -0
  168. data/{app/services/search/query_adapter/abstract.rb → lib/rademade_admin/model/adapter/query.rb} +15 -5
  169. data/lib/rademade_admin/model/adapter/query/active_record.rb +50 -0
  170. data/lib/rademade_admin/model/adapter/query/mongoid.rb +57 -0
  171. data/lib/rademade_admin/model/configuration.rb +43 -16
  172. data/lib/rademade_admin/model/configuration/field_label.rb +16 -0
  173. data/lib/rademade_admin/model/configuration/fields.rb +47 -21
  174. data/lib/rademade_admin/model/configuration/fields_labels.rb +31 -0
  175. data/lib/rademade_admin/model/configuration/form_field.rb +27 -0
  176. data/lib/rademade_admin/model/configuration/form_fields.rb +18 -0
  177. data/lib/rademade_admin/model/configuration/list_field.rb +21 -0
  178. data/lib/rademade_admin/model/configuration/list_fields.rb +18 -0
  179. data/lib/rademade_admin/model/graph.rb +9 -9
  180. data/lib/rademade_admin/model/info.rb +53 -68
  181. data/lib/rademade_admin/model/info/data_item.rb +130 -0
  182. data/lib/rademade_admin/model/info/data_items.rb +130 -0
  183. data/lib/rademade_admin/model/info/field.rb +39 -0
  184. data/lib/rademade_admin/model/info/fields.rb +87 -0
  185. data/lib/rademade_admin/model/info/relation.rb +49 -0
  186. data/lib/rademade_admin/model/info/relations.rb +40 -0
  187. data/lib/rademade_admin/model/info/uploader.rb +16 -0
  188. data/lib/rademade_admin/model/info/uploaders.rb +35 -0
  189. data/lib/rademade_admin/model/reflection.rb +38 -9
  190. data/lib/rademade_admin/routing/mapper.rb +9 -5
  191. data/lib/rademade_admin/search/searcher.rb +22 -0
  192. data/lib/rademade_admin/sortable.rb +1 -0
  193. data/lib/rademade_admin/uploader/photo.rb +1 -0
  194. data/lib/rademade_admin/user.rb +7 -6
  195. data/lib/rademade_admin/version.rb +1 -1
  196. data/lib/tasks/rademade_bower_install.rake +10 -2
  197. data/lib/templates/erb/scaffold/_form.html.erb +13 -0
  198. metadata +195 -109
  199. data/app/assets/javascripts/rademade_admin/app/common/relation-list.coffee +0 -109
  200. data/app/assets/javascripts/rademade_admin/app/form-popup/collection.coffee +0 -20
  201. data/app/assets/javascripts/rademade_admin/app/form-popup/model.coffee +0 -4
  202. data/app/assets/javascripts/rademade_admin/detail_admin/theme.js +0 -56
  203. data/app/assets/javascripts/rademade_admin/form/form-ajax-submit.coffee +0 -157
  204. data/app/assets/stylesheets/rademade_admin.scss.erb +0 -19
  205. data/app/helpers/rademade_admin/name_helper.rb +0 -18
  206. data/app/helpers/rademade_admin/upload_preview_helper.rb +0 -60
  207. data/app/inputs/rademade_admin/admin_file_input.rb +0 -71
  208. data/app/inputs/rademade_admin/admin_select_input.rb +0 -82
  209. data/app/inputs/rademade_admin/admin_textarea_input.rb +0 -6
  210. data/app/inputs/rademade_admin/boolean_input.rb +0 -14
  211. data/app/services/form_builder.rb +0 -4
  212. data/app/services/search/query_adapter/active_record.rb +0 -45
  213. data/app/services/search/query_adapter/mongoid.rb +0 -51
  214. data/app/services/search/searcher.rb +0 -20
  215. data/app/views/rademade_admin/_blocks/_form_control.html.erb +0 -5
  216. data/app/views/rademade_admin/abstract/related_index.html.erb +0 -85
  217. data/config/initializers/devise.rb +0 -251
  218. data/config/initializers/formtastic.rb +0 -13
  219. data/lib/rademade_admin/model/data_adapter.rb +0 -64
  220. data/lib/rademade_admin/model/data_adapter/active_record.rb +0 -59
  221. data/lib/rademade_admin/model/data_adapter/mongoid.rb +0 -54
  222. data/lib/rademade_admin/model/reflection/data.rb +0 -48
  223. data/lib/rademade_admin/model/reflection/uploader.rb +0 -18
@@ -1,10 +1,7 @@
1
- <%= admin_form(@item, @model_class) do |f| %>
2
- <%= f.inputs do %>
3
- <% @semantic_form_fields.each do |name, field_params|
4
- admin_field(f, name, field_params, @model_info, @item)
1
+ <%= admin_form(@item, @model_class) do |f| %><%
2
+ @form_fields_without_locale.each do |form_field|
3
+ admin_field(f, form_field, @model_info)
5
4
  end
6
- end
7
-
8
- concat render :partial => 'rademade_admin/_blocks/form_control', :locals => {:f => f}
9
-
10
- end %>
5
+ concat render @template_service.form_lang_panel, { :f => f }
6
+ concat render @template_service.form_control_block, { :f => f }
7
+ end %>
@@ -1,9 +1,4 @@
1
- <% content_for :form_last_crumbs do %>
2
- <span>Edit</span>
3
- <% end %>
4
-
5
1
  <% content_for :page_header do %>
6
- <h3>Edit "<%=@item.to_s%>"</h3>
7
- <% end %>
8
-
9
- <%= render :template => 'rademade_admin/_layouts/inner/form' %>
2
+ <h3><%= t('rademade_admin.edit') %> "<%= @item.to_s %>"</h3>
3
+ <% end
4
+ concat render :template => @template_service.inner_form_layout %>
@@ -1,78 +1,49 @@
1
- <% content_for :last_crumbs do %>
2
- <span><%= admin_list_name(@model_info) %></span>
3
- <% end %>
4
-
5
1
  <% content_for :page_header do %>
6
- <h3><%= admin_list_name(@model_info) %></h3>
2
+ <h3><%= @model_info.item_name %></h3>
7
3
  <% end %>
8
4
 
9
5
  <% content_for :nav_buttons do %><%
10
6
  new_uri = admin_new_uri(@model_info)
11
7
  if new_uri
12
- concat link_to admin_add_name(@model_info) + '+', new_uri, :class => 'btn-flat success new-product'
8
+ concat link_to t('rademade_admin.new_record') + '+', new_uri, :class => 'btn yellow-btn fl-l'
13
9
  end
14
- %><% end %>
15
-
16
- <% content_for :content do %>
17
- <% if @sortable_service.can_reset? %>
18
- <a href="<%= request.path %>">Reset sorting</a>
19
- <% end %>
20
- <table class="table table-hover">
10
+ end %>
21
11
 
22
- <thead>
23
- <tr>
24
- <% @list_fields.each_with_index do |name, index|
25
- list_field_name = field_name(name)
26
- %><th class="col-md-3 sort-button" data-column="<%= list_field_name %>">
27
- <% unless index == 0 %>
28
- <span class="line"></span>
29
- <% end %>
30
- <span><%= field_to_label(name) + @sortable_service.sorting_sign(list_field_name) %></span>
31
- </th>
32
- <% end %>
33
-
34
- <th class="col-md-3 align-right">
35
- <span class="line"></span>
36
- <span>Management</span>
37
- </th>
38
- </tr>
39
- </thead>
40
-
41
- <% has_position = @sortable_service.has_position? %>
42
- <tbody class="table-sortable" data-position='<%= has_position %>'>
43
- <% @items.each_with_index do |item| %>
44
- <tr<%
12
+ <% content_for :content do %><%
13
+ concat render @template_service.on_page_select_block
14
+ if @sortable_service.can_reset?
15
+ %><a href="<%= request.path %>"><%= t('rademade_admin.reset_sort') %></a><%
16
+ end
17
+ %><table class="table-box"><%
18
+ concat render @template_service.table_head_block, {
19
+ :list_fields => @list_fields
20
+ }
21
+ has_position = @sortable_service.has_position?
22
+ %><tbody class="table-content" data-sortable="<%= has_position %>"><%
23
+ @items.each do |item|
24
+ %><tr id="item_<%= item.id %>" class="table-line" data-id="<%= item.id %>"<%
45
25
  if has_position
46
- %> id='<%= item.position %>'<%
26
+ %> data-position="<%= item.position %>"<%
47
27
  end
48
- %> data-id='<%= item.id %>'>
49
- <% @list_fields.each do |name|
50
- %><td><%
51
- value = field_value(name, item)
52
- # todo remove hard code, extract helper (data adapter)
53
- if value.respond_to? :id
54
- concat link_to value.to_s, admin_edit_uri(value)
55
- else
56
- concat value
57
- end
58
- %></td>
59
- <% end %>
60
- <td>
61
- <ul class="actions">
62
- <li><%= link_to 'Edit', admin_edit_uri(item) %></li>
63
- <li><%= button_to 'Destroy', admin_delete_uri(item), {
64
- :method => :delete,
65
- :form => {:class => 'delete-item-form'}
66
- } %></li>
67
- </ul>
28
+ %>><%
29
+ @list_fields.each do |field|
30
+ %><td class="table-item"><%= display_item_value(item, field) %></td><%
31
+ end
32
+ %><td class="table-item">
33
+ <span class="table-actions"><%
34
+ concat link_to t('rademade_admin.edit'), admin_edit_uri(item), :class => 'glyphicon glyphicon-pencil fl-l'
35
+ %><div class="glyphicon glyphicon-remove fl-l"><%
36
+ concat button_to t('rademade_admin.destroy'), admin_delete_uri(item), {
37
+ :method => :delete,
38
+ :form => { :class => 'delete-item-form' }
39
+ }
40
+ %></div>
41
+ </span>
68
42
  </td>
69
- </tr>
70
- <% end %>
71
- </tbody>
72
- </table>
73
-
74
- <%= render 'rademade_admin/_blocks/pagination' %>
75
-
76
- <% end %>
77
-
78
- <%= render :template => 'rademade_admin/_layouts/inner' %>
43
+ </tr><%
44
+ end
45
+ %></tbody>
46
+ </table><%
47
+ concat render @template_service.pagination_block
48
+ end
49
+ concat render :template => @template_service.inner_layout %>
@@ -1,9 +1,4 @@
1
- <% content_for(:form_last_crumbs) do %>
2
- <span>Add</span>
3
- <% end %>
4
-
5
1
  <% content_for(:page_header) do %>
6
- <h3><%= admin_add_name(@model_info) %></h3>
7
- <% end %>
8
-
9
- <%= render :template => 'rademade_admin/_layouts/inner/form' %>
2
+ <h3><%= t('rademade_admin.new_record') %></h3>
3
+ <% end
4
+ concat render :template => @template_service.inner_form_layout %>
@@ -0,0 +1,48 @@
1
+ <%
2
+ related_list_fields = @related_model_info.data_items.list_fields
3
+ %><% content_for :page_header do %>
4
+ <h3><%= @related_model_info.item_name %></h3><%
5
+ end
6
+ %><% content_for :content do %><%
7
+ autocomplete_uri = admin_link_autocomplete_uri(@item, params[:relation], {
8
+ :format => :json
9
+ })
10
+ %><%= content_tag(
11
+ :input,
12
+ nil,
13
+ :type => 'hidden',
14
+ :class => 'select2-add-link',
15
+ :'data-model' => @model_class.to_s,
16
+ :'data-rel-list-url' => autocomplete_uri
17
+ )%><table class="table-box"><%
18
+ concat render @template_service.table_head_block, {
19
+ :list_fields => related_list_fields
20
+ }
21
+ has_position = @sortable_service.has_position?
22
+ %><tbody class="table-content" data-position='false'><%
23
+ @items.each do |item|
24
+ %><tr class="table-line" <%
25
+ if has_position
26
+ %> id='<%= item.position %>'<%
27
+ end
28
+ %> data-id='<%= item.id %>'><%
29
+ related_list_fields.each do |field|
30
+ %><td><%= display_item_value(item, field) %></td><%
31
+ end
32
+ %><td class="table-item">
33
+ <span class="table-actions"><%=
34
+ button_to t('rademade_admin.unlink'), admin_unlink_uri(@item, params[:relation], {
35
+ :related_id => item.id
36
+ }), {
37
+ :method => :delete,
38
+ :form => { :class => 'delete-item-form' }
39
+ } %></span>
40
+ </td>
41
+ </tr><%
42
+ end
43
+ %></tbody>
44
+ </table><%
45
+ concat render @template_service.pagination_block
46
+ end
47
+
48
+ concat render :template => @template_service.inner_layout %>
@@ -1,9 +1,8 @@
1
1
  <% content_for(:content) do %>
2
-
3
- <div class="head">
4
- <h3>Hello, <%= current_user %></h3>
2
+ <div class="page-headline">
3
+ <h1><%= t('rademade_admin.hello') %>, <%= @current_user %></h1>
4
+ <span class="title-description"><%= t('rademade_admin.title_description') %></span>
5
5
  </div>
6
-
7
6
  <% end %>
8
7
 
9
- <%= render :template => 'rademade_admin/_layouts/inner' %>
8
+ <%= render :template => @template_service.inner_layout %>
@@ -1,31 +1,20 @@
1
1
  <div class="login-bg">
2
- <div class="login-wrapper">
3
- <img class="logo" src="<%=image_path('rademade_admin/logos/logo-white.png')%>" alt="Rademade.com">
4
- <div class="box">
5
- <div class="content-wrap">
6
- <h6>Log in</h6>
7
-
8
- <%=semantic_form_for(RademadeAdmin.user_class.new,
9
- :url => [:sessions],
10
- :as => :data,
11
- :html => { :id => 'login-form'}) do |f|
12
-
13
- concat f.input :email,
14
- :label => false,
15
- :input_html => {:class => 'form-control'}
16
-
17
- concat f.input :password,
18
- :label => false,
19
- :input_html => {:class => 'form-control'}
20
-
21
- concat f.action :submit,
22
- :label => 'Log in',
23
- :as => :button,
24
- :button_html => {:class => 'btn-glow primary login'}
25
-
26
- end
27
-
28
- %></div>
29
- </div>
30
- </div>
31
- </div>
2
+ <img class="admin-logo" src="<%= image_path('rademade_admin/logos/logo.png') %>" alt="Rademade.com">
3
+ <div class="login-form">
4
+ <p class="login-form-title"><%= t('rademade_admin.login') %></p>
5
+ <%= simple_form_for(RademadeAdmin.user_class.new, :url => [:sessions], :as => :data, :html => { :id => 'login-form' }) do |f| %>
6
+ <%#= rm_todo wrapper %>
7
+ <div class="form-box"><%
8
+ concat f.input :email, :label => false, :input_html => { :class => 'form-input' }
9
+ %><label class="form-label login" for="data_email"><i class="glyphicon glyphicon-user"></i></label>
10
+ </div>
11
+ <div class="form-box"><%
12
+ concat f.input :password, :label => false, :input_html => { :class => 'form-input' }
13
+ %><label class="form-label password" for="data_password"><i class="glyphicon glyphicon-lock"></i></label>
14
+ </div>
15
+ <div class="form-box"><%
16
+ concat f.submit t('rademade_admin.login'), :class => 'btn blue-btn login-btn'
17
+ %></div><%
18
+ end
19
+ %></div>
20
+ </div>
@@ -0,0 +1,48 @@
1
+ module CarrierWave
2
+ module Mongoid
3
+
4
+ alias_method :original_mount_uploader, :mount_uploader
5
+
6
+ def mount_uploader(column, uploader = nil, options = {}, &block)
7
+ if options[:localize]
8
+
9
+ field options[:mount_on] || column, :localize => true
10
+
11
+ I18n.available_locales.each do |locale|
12
+ original_mount_uploader("#{column}_#{locale}", uploader, options, &block)
13
+ end
14
+
15
+ # todo if it is ok - make also remove method
16
+ class_eval <<-RUBY, __FILE__, __LINE__+1
17
+
18
+ def #{column}=(new_file)
19
+ send(:"#{column}_\#{I18n.locale}=", new_file)
20
+ end
21
+
22
+ def #{column}
23
+ send(:"#{column}_\#{I18n.locale}")
24
+ end
25
+
26
+ def #{column}_translations=(translations)
27
+ translations.each do |locale, translation|
28
+ send(:"#{column}_\#{locale}=", translation)
29
+ end
30
+ end
31
+
32
+ def #{column}_translations
33
+ translations = {}
34
+ I18n.available_locales.each do |locale|
35
+ translations[locale] = send(:"#{column}_\#{locale}")
36
+ end
37
+ translations
38
+ end
39
+
40
+ RUBY
41
+
42
+ else
43
+ original_mount_uploader(column, uploader, options, &block)
44
+ end
45
+ end
46
+
47
+ end
48
+ end
@@ -0,0 +1,3 @@
1
+ Ckeditor.setup do |config|
2
+ config.assets_languages = I18n.available_locales.map &:to_s
3
+ end
@@ -0,0 +1,16 @@
1
+ module Kaminari
2
+ module Helpers
3
+ class Tag
4
+ def page_url_for(page)
5
+ admin_params = @params.extract!(:admin_params)
6
+ params = @params.merge(@param_name => (page <= 1 ? nil : page), :only_path => true)
7
+ if admin_params.empty?
8
+ @template.url_for params
9
+ else
10
+ symbolized_params = params.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
11
+ Rails.application.routes.url_for(symbolized_params)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,147 @@
1
+ # Use this setup block to configure all options available in SimpleForm.
2
+ SimpleForm.setup do |config|
3
+ # Wrappers are used by the form builder to generate a
4
+ # complete input. You can remove any component from the
5
+ # wrapper, change the order or even add your own to the
6
+ # stack. The options given below are used to wrap the
7
+ # whole input.
8
+
9
+ config.wrappers :default, class: :input,
10
+ hint_class: :field_with_hint, error_class: :field_with_errors do |b|
11
+ ## Extensions enabled by default
12
+ # Any of these extensions can be disabled for a
13
+ # given input by passing: `f.input EXTENSION_NAME => false`.
14
+ # You can make any of these extensions optional by
15
+ # renaming `b.use` to `b.optional`.
16
+
17
+ # Determines whether to use HTML5 (:email, :url, ...)
18
+ # and required attributes
19
+ b.use :html5
20
+
21
+ # Calculates placeholders automatically from I18n
22
+ # You can also pass a string as f.input placeholder: "Placeholder"
23
+ b.use :placeholder
24
+
25
+ ## Optional extensions
26
+ # They are disabled unless you pass `f.input EXTENSION_NAME => :lookup`
27
+ # to the input. If so, they will retrieve the values from the model
28
+ # if any exists. If you want to enable the lookup for any of those
29
+ # extensions by default, you can change `b.optional` to `b.use`.
30
+
31
+ # Calculates maxlength from length validations for string inputs
32
+ b.optional :maxlength
33
+
34
+ # Calculates pattern from format validations for string inputs
35
+ b.optional :pattern
36
+
37
+ # Calculates min and max from length validations for numeric inputs
38
+ b.optional :min_max
39
+
40
+ # Calculates readonly automatically from readonly attributes
41
+ b.optional :readonly
42
+
43
+ ## Inputs
44
+ b.use :label_input
45
+ b.use :hint, wrap_with: { tag: :span, class: :hint }
46
+ b.use :error, wrap_with: { tag: :span, class: :error }
47
+ end
48
+
49
+ # The default wrapper to be used by the FormBuilder.
50
+ config.default_wrapper = :default
51
+
52
+ # Define the way to render check boxes / radio buttons with labels.
53
+ # Defaults to :nested for bootstrap config.
54
+ # inline: input + label
55
+ # nested: label > input
56
+ config.boolean_style = :inline
57
+
58
+ # Default class for buttons
59
+ config.button_class = 'btn'
60
+
61
+ # Method used to tidy up errors. Specify any Rails Array method.
62
+ # :first lists the first message for each field.
63
+ # Use :to_sentence to list all errors for each field.
64
+ # config.error_method = :first
65
+
66
+ # Default tag used for error notification helper.
67
+ config.error_notification_tag = :div
68
+
69
+ # CSS class to add for error notification helper.
70
+ config.error_notification_class = 'alert alert-error'
71
+
72
+ # ID to add for error notification helper.
73
+ # config.error_notification_id = nil
74
+
75
+ # Series of attempts to detect a default label method for collection.
76
+ # config.collection_label_methods = [ :to_label, :name, :title, :to_s ]
77
+
78
+ # Series of attempts to detect a default value method for collection.
79
+ # config.collection_value_methods = [ :id, :to_s ]
80
+
81
+ # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none.
82
+ # config.collection_wrapper_tag = nil
83
+
84
+ # You can define the class to use on all collection wrappers. Defaulting to none.
85
+ # config.collection_wrapper_class = nil
86
+
87
+ # You can wrap each item in a collection of radio/check boxes with a tag,
88
+ # defaulting to :span. Please note that when using :boolean_style = :nested,
89
+ # SimpleForm will force this option to be a label.
90
+ # config.item_wrapper_tag = :span
91
+
92
+ # You can define a class to use in all item wrappers. Defaulting to none.
93
+ # config.item_wrapper_class = nil
94
+
95
+ # How the label text should be generated altogether with the required text.
96
+ # config.label_text = lambda { |label, required| "#{required} #{label}" }
97
+
98
+ # You can define the class to use on all labels. Default is nil.
99
+ config.label_class = 'control-label'
100
+
101
+ # You can define the class to use on all forms. Default is simple_form.
102
+ # config.form_class = :simple_form
103
+
104
+ # You can define which elements should obtain additional classes
105
+ # config.generate_additional_classes_for = [:wrapper, :label, :input]
106
+
107
+ # Whether attributes are required by default (or not). Default is true.
108
+ # config.required_by_default = true
109
+
110
+ # Tell browsers whether to use the native HTML5 validations (novalidate form option).
111
+ # These validations are enabled in SimpleForm's internal config but disabled by default
112
+ # in this configuration, which is recommended due to some quirks from different browsers.
113
+ # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations,
114
+ # change this configuration to true.
115
+ config.browser_validations = false
116
+
117
+ # Collection of methods to detect if a file type was given.
118
+ # config.file_methods = [ :mounted_as, :file?, :public_filename ]
119
+
120
+ # Custom mappings for input types. This should be a hash containing a regexp
121
+ # to match as key, and the input type that will be used when the field name
122
+ # matches the regexp as value.
123
+ # config.input_mappings = { /count/ => :integer }
124
+
125
+ # Custom wrappers for input types. This should be a hash containing an input
126
+ # type as key and the wrapper that will be used for all inputs with specified type.
127
+ # config.wrapper_mappings = { string: :prepend }
128
+
129
+ # Default priority for time_zone inputs.
130
+ # config.time_zone_priority = nil
131
+
132
+ # Default priority for country inputs.
133
+ # config.country_priority = nil
134
+
135
+ # When false, do not use translations for labels.
136
+ # config.translate_labels = true
137
+
138
+ # Automatically discover new inputs in Rails' autoload path.
139
+ # config.inputs_discovery = true
140
+
141
+ # Cache SimpleForm inputs discovery
142
+ # config.cache_discovery = !Rails.env.development?
143
+
144
+ # Default class for inputs
145
+ # config.input_class = nil
146
+
147
+ end