typus-rails4 4.0.0.beta6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +488 -0
  3. data/Gemfile +57 -0
  4. data/Gemfile.lock +253 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +101 -0
  7. data/Rakefile +51 -0
  8. data/app/assets/javascripts/typus/application.js +11 -0
  9. data/app/assets/javascripts/typus/custom.js +2 -0
  10. data/app/assets/javascripts/typus/jquery-2.1.1.min.js +4 -0
  11. data/app/assets/javascripts/typus/jquery.application.js +30 -0
  12. data/app/assets/stylesheets/typus/application.css +6 -0
  13. data/app/assets/stylesheets/typus/custom.scss +4 -0
  14. data/app/assets/stylesheets/typus/overrides.scss +10 -0
  15. data/app/assets/stylesheets/typus/signin.scss +45 -0
  16. data/app/controllers/admin/account_controller.rb +47 -0
  17. data/app/controllers/admin/base_controller.rb +40 -0
  18. data/app/controllers/admin/dashboard_controller.rb +6 -0
  19. data/app/controllers/admin/resource_controller.rb +8 -0
  20. data/app/controllers/admin/resources_controller.rb +268 -0
  21. data/app/controllers/admin/session_controller.rb +43 -0
  22. data/app/controllers/concerns/admin/actions.rb +88 -0
  23. data/app/controllers/concerns/admin/acts_as_list.rb +35 -0
  24. data/app/controllers/concerns/admin/ancestry.rb +26 -0
  25. data/app/controllers/concerns/admin/autocomplete.rb +11 -0
  26. data/app/controllers/concerns/admin/bulk.rb +76 -0
  27. data/app/controllers/concerns/admin/featured_image.rb +22 -0
  28. data/app/controllers/concerns/admin/filters.rb +57 -0
  29. data/app/controllers/concerns/admin/format.rb +49 -0
  30. data/app/controllers/concerns/admin/headless.rb +23 -0
  31. data/app/controllers/concerns/admin/hooks.rb +4 -0
  32. data/app/controllers/concerns/admin/multisite.rb +10 -0
  33. data/app/controllers/concerns/admin/navigation.rb +27 -0
  34. data/app/controllers/concerns/admin/trash.rb +65 -0
  35. data/app/helpers/admin/base_helper.rb +78 -0
  36. data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +88 -0
  37. data/app/helpers/admin/resources/data_types/boolean_helper.rb +33 -0
  38. data/app/helpers/admin/resources/data_types/date_helper.rb +16 -0
  39. data/app/helpers/admin/resources/data_types/datetime_helper.rb +19 -0
  40. data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +49 -0
  41. data/app/helpers/admin/resources/data_types/float_helper.rb +2 -0
  42. data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +59 -0
  43. data/app/helpers/admin/resources/data_types/has_many_helper.rb +76 -0
  44. data/app/helpers/admin/resources/data_types/has_one_helper.rb +44 -0
  45. data/app/helpers/admin/resources/data_types/integer_helper.rb +13 -0
  46. data/app/helpers/admin/resources/data_types/paperclip_helper.rb +49 -0
  47. data/app/helpers/admin/resources/data_types/selector_helper.rb +11 -0
  48. data/app/helpers/admin/resources/data_types/string_helper.rb +38 -0
  49. data/app/helpers/admin/resources/data_types/text_helper.rb +6 -0
  50. data/app/helpers/admin/resources/data_types/transversal_helper.rb +8 -0
  51. data/app/helpers/admin/resources/data_types/tree_helper.rb +28 -0
  52. data/app/helpers/admin/resources/display_helper.rb +27 -0
  53. data/app/helpers/admin/resources/filters_helper.rb +18 -0
  54. data/app/helpers/admin/resources/form_helper.rb +85 -0
  55. data/app/helpers/admin/resources/list_helper.rb +31 -0
  56. data/app/helpers/admin/resources/pagination_helper.rb +28 -0
  57. data/app/helpers/admin/resources/relationships_helper.rb +33 -0
  58. data/app/helpers/admin/resources/sidebar_helper.rb +34 -0
  59. data/app/helpers/admin/resources/table_helper.rb +69 -0
  60. data/app/helpers/admin/resources_helper.rb +25 -0
  61. data/app/mailers/admin/mailer.rb +19 -0
  62. data/app/views/admin/account/_form.html.erb +17 -0
  63. data/app/views/admin/account/forgot_password.html.erb +16 -0
  64. data/app/views/admin/account/new.html.erb +10 -0
  65. data/app/views/admin/dashboard/_sidebar.html.erb +14 -0
  66. data/app/views/admin/dashboard/index.html.erb +8 -0
  67. data/app/views/admin/dashboard/styles.html.erb +153 -0
  68. data/app/views/admin/dashboard/widgets/_applications.html.erb +44 -0
  69. data/app/views/admin/dashboard/widgets/_default.html.erb +43 -0
  70. data/app/views/admin/dashboard/widgets/_models.html.erb +23 -0
  71. data/app/views/admin/dashboard/widgets/_models_extended.html.erb +25 -0
  72. data/app/views/admin/dashboard/widgets/_resources.html.erb +23 -0
  73. data/app/views/admin/dashboard/widgets/_users.html.erb +23 -0
  74. data/app/views/admin/mailer/reset_password_instructions.html.erb +7 -0
  75. data/app/views/admin/mailer/reset_password_instructions.text.erb +7 -0
  76. data/app/views/admin/resource/_sidebar.html.erb +14 -0
  77. data/app/views/admin/resources/_edit.html.erb +0 -0
  78. data/app/views/admin/resources/_form.html.erb +28 -0
  79. data/app/views/admin/resources/_form_javascripts.html.erb +0 -0
  80. data/app/views/admin/resources/_form_modal.html.erb +13 -0
  81. data/app/views/admin/resources/_index.html.erb +0 -0
  82. data/app/views/admin/resources/_new.html.erb +0 -0
  83. data/app/views/admin/resources/_pagination.html.erb +15 -0
  84. data/app/views/admin/resources/_show.html.erb +0 -0
  85. data/app/views/admin/resources/_sidebar.html.erb +1 -0
  86. data/app/views/admin/resources/destroy.html.erb +16 -0
  87. data/app/views/admin/resources/edit.html.erb +22 -0
  88. data/app/views/admin/resources/edit/_actions.html.erb +7 -0
  89. data/app/views/admin/resources/edit/_recently_edited.html.erb +8 -0
  90. data/app/views/admin/resources/index.html.erb +29 -0
  91. data/app/views/admin/resources/new.html.erb +20 -0
  92. data/app/views/admin/resources/show.html.erb +26 -0
  93. data/app/views/admin/session/new.html.erb +18 -0
  94. data/app/views/admin/shared/_head.html.erb +24 -0
  95. data/app/views/admin/shared/_modals.html.erb +3 -0
  96. data/app/views/admin/shared/_sidebar_placeholder.html.erb +0 -0
  97. data/app/views/admin/templates/README.md +5 -0
  98. data/app/views/admin/templates/_belongs_to.html.erb +8 -0
  99. data/app/views/admin/templates/_boolean.html.erb +7 -0
  100. data/app/views/admin/templates/_date.html.erb +6 -0
  101. data/app/views/admin/templates/_datetime.html.erb +8 -0
  102. data/app/views/admin/templates/_dragonfly.html.erb +6 -0
  103. data/app/views/admin/templates/_dragonfly_form_preview.html.erb +21 -0
  104. data/app/views/admin/templates/_dragonfly_preview.html.erb +12 -0
  105. data/app/views/admin/templates/_has_and_belongs_to_many.html.erb +21 -0
  106. data/app/views/admin/templates/_has_many.html.erb +18 -0
  107. data/app/views/admin/templates/_has_one.html.erb +14 -0
  108. data/app/views/admin/templates/_json.html.erb +11 -0
  109. data/app/views/admin/templates/_paperclip.html.erb +5 -0
  110. data/app/views/admin/templates/_paperclip_form_preview.html.erb +21 -0
  111. data/app/views/admin/templates/_paperclip_preview.html.erb +12 -0
  112. data/app/views/admin/templates/_password.html.erb +6 -0
  113. data/app/views/admin/templates/_position.html.erb +5 -0
  114. data/app/views/admin/templates/_profile_sidebar.html.erb +4 -0
  115. data/app/views/admin/templates/_selector.html.erb +4 -0
  116. data/app/views/admin/templates/_string.html.erb +4 -0
  117. data/app/views/admin/templates/_string_with_preview.html.erb +11 -0
  118. data/app/views/admin/templates/_text.html.erb +11 -0
  119. data/app/views/admin/templates/_text_with_ckeditor.html.erb +24 -0
  120. data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +38 -0
  121. data/app/views/admin/templates/_time.html.erb +9 -0
  122. data/app/views/admin/templates/_tree.html.erb +6 -0
  123. data/app/views/admin/templates/modals/_belongs_to.html.erb +60 -0
  124. data/app/views/admin/templates/modals/_dragonfly.html.erb +13 -0
  125. data/app/views/admin/templates/modals/_has_and_belongs_to_many.html.erb +25 -0
  126. data/app/views/admin/templates/modals/_has_many.html.erb +59 -0
  127. data/app/views/admin/templates/modals/_paperclip.html.erb +13 -0
  128. data/app/views/helpers/admin/base/_apps.html.erb +86 -0
  129. data/app/views/helpers/admin/base/_breadcrumbs.html.erb +6 -0
  130. data/app/views/helpers/admin/base/_flash_message.html.erb +3 -0
  131. data/app/views/helpers/admin/base/_login_info.html.erb +0 -0
  132. data/app/views/helpers/admin/dashboard/_resources.html.erb +19 -0
  133. data/app/views/helpers/admin/resources/_actions.html.erb +18 -0
  134. data/app/views/helpers/admin/resources/_errors.html.erb +12 -0
  135. data/app/views/helpers/admin/resources/_filters.html.erb +16 -0
  136. data/app/views/helpers/admin/resources/_search.html.erb +17 -0
  137. data/app/views/helpers/admin/resources/_sidebar.html.erb +4 -0
  138. data/app/views/helpers/admin/resources/_table.html.erb +45 -0
  139. data/app/views/helpers/admin/resources/sidebar/_item.html.erb +26 -0
  140. data/app/views/helpers/admin/resources/sidebar/_items.html.erb +14 -0
  141. data/app/views/helpers/admin/resources/sidebar/_items_index.html.erb +57 -0
  142. data/app/views/layouts/admin/base.html.erb +30 -0
  143. data/app/views/layouts/admin/headless.html.erb +1 -0
  144. data/app/views/layouts/admin/session.html.erb +26 -0
  145. data/bin/run-tests +7 -0
  146. data/bin/setup +9 -0
  147. data/config/locales/typus.en.yml +125 -0
  148. data/config/routes.rb +46 -0
  149. data/lib/generators/templates/config/initializers/typus.rb +34 -0
  150. data/lib/generators/templates/config/initializers/typus_authentication.rb +18 -0
  151. data/lib/generators/templates/config/initializers/typus_resources.rb +24 -0
  152. data/lib/generators/templates/config/typus/README +58 -0
  153. data/lib/generators/templates/config/typus/application.yml +3 -0
  154. data/lib/generators/templates/config/typus/application_roles.yml +4 -0
  155. data/lib/generators/templates/config/typus/typus.yml +15 -0
  156. data/lib/generators/templates/config/typus/typus_roles.yml +4 -0
  157. data/lib/generators/templates/controller.erb +2 -0
  158. data/lib/generators/templates/migration.erb +22 -0
  159. data/lib/generators/templates/view.html.erb +13 -0
  160. data/lib/generators/typus/config_generator.rb +67 -0
  161. data/lib/generators/typus/controller_generator.rb +26 -0
  162. data/lib/generators/typus/initializers_generator.rb +20 -0
  163. data/lib/generators/typus/migration_generator.rb +94 -0
  164. data/lib/generators/typus/model_generator.rb +93 -0
  165. data/lib/generators/typus/typus_generator.rb +54 -0
  166. data/lib/generators/typus/views_generator.rb +19 -0
  167. data/lib/support/active_record.rb +42 -0
  168. data/lib/support/fake_user.rb +47 -0
  169. data/lib/support/hash.rb +8 -0
  170. data/lib/support/object.rb +9 -0
  171. data/lib/support/string.rb +40 -0
  172. data/lib/tasks/typus.rake +11 -0
  173. data/lib/typus.rb +215 -0
  174. data/lib/typus/authentication/base.rb +39 -0
  175. data/lib/typus/authentication/devise.rb +19 -0
  176. data/lib/typus/authentication/http_basic.rb +18 -0
  177. data/lib/typus/authentication/none.rb +15 -0
  178. data/lib/typus/authentication/none_with_role.rb +15 -0
  179. data/lib/typus/authentication/session.rb +123 -0
  180. data/lib/typus/configuration.rb +43 -0
  181. data/lib/typus/engine.rb +4 -0
  182. data/lib/typus/orm/active_record.rb +10 -0
  183. data/lib/typus/orm/active_record/admin_user.rb +65 -0
  184. data/lib/typus/orm/active_record/class_methods.rb +104 -0
  185. data/lib/typus/orm/active_record/instance_methods.rb +76 -0
  186. data/lib/typus/orm/active_record/search.rb +43 -0
  187. data/lib/typus/orm/base/class_methods.rb +188 -0
  188. data/lib/typus/orm/base/search.rb +70 -0
  189. data/lib/typus/regex.rb +11 -0
  190. data/lib/typus/resources.rb +55 -0
  191. data/lib/typus/version.rb +10 -0
  192. data/typus.gemspec +27 -0
  193. data/vendor/assets/chosen/LICENSE.md +24 -0
  194. data/vendor/assets/chosen/chosen-sprite.png +0 -0
  195. data/vendor/assets/chosen/chosen-sprite@2x.png +0 -0
  196. data/vendor/assets/chosen/chosen.jquery.js +1239 -0
  197. data/vendor/assets/chosen/chosen.scss +437 -0
  198. metadata +271 -0
@@ -0,0 +1,43 @@
1
+ <%
2
+ applications = admin_user.applications
3
+
4
+ if params[:application]
5
+ applications.reject! { |a| a.parameterize != params[:application] }
6
+ end
7
+ %>
8
+
9
+ <div class="col-md-12">
10
+
11
+ <h2><%= t('typus.dashboard.title') %></h2>
12
+
13
+ <% if applications.any? %>
14
+ <% applications.each do |app| %>
15
+
16
+ <table class="table">
17
+
18
+ <thead>
19
+ <tr>
20
+ <th><%= t("typus.application.#{app.parameterize('_')}", default: app) %></th>
21
+ </tr>
22
+ </thead>
23
+
24
+ <% admin_user.application(app).map(&:constantize).each do |klass| %>
25
+ <% unless klass.typus_options_for(:hide_from_dashboard) %>
26
+ <tr>
27
+ <td>
28
+ <%= link_to klass.model_name.human(count: 1_000), controller: "/admin/#{klass.to_resource}" %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ <% end %>
33
+
34
+ </table>
35
+
36
+ <% end %>
37
+ <% else %>
38
+ <div class="notice">
39
+ <%= t('typus.dashboard.no_applications') %>
40
+ </div>
41
+ <% end %>
42
+
43
+ </div>
@@ -0,0 +1,23 @@
1
+ <!-- List of all available models -->
2
+
3
+ <h2><%= t('typus.dashboard.title') %></h2>
4
+
5
+ <table>
6
+
7
+ <thead>
8
+ <tr>
9
+ <th><%= t('typus.dashboard.model_name') %></th>
10
+ <th></th>
11
+ </tr>
12
+ </thead>
13
+
14
+ <% admin_user.models.map(&:constantize).each do |klass| %>
15
+ <tr>
16
+ <td><%= link_to klass.model_name.human(count: 1_000), controller: "/admin/#{klass.to_resource}" %></td>
17
+ <td width="80px" align="right">
18
+ <%= link_to t('typus.buttons.add'), controller: "/admin/#{klass.to_resource}", action: 'new' %>
19
+ </td>
20
+ </tr>
21
+ <% end %>
22
+
23
+ </table>
@@ -0,0 +1,25 @@
1
+ <!-- List of all available models -->
2
+
3
+ <h2><%= t('typus.dashboard.title') %></h2>
4
+
5
+ <table class="table">
6
+
7
+ <thead>
8
+ <tr>
9
+ <th><%= t('typus.dashboard.model') %></th>
10
+ <th><%= t('typus.dashboard.items') %></th>
11
+ <th><%= t('typus.dashboard.actions') %></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <% admin_user.models.map(&:constantize).each do |klass| %>
16
+ <tr>
17
+ <td><%= link_to klass.model_name.human(count: 1_000), controller: "/admin/#{klass.to_resource}" %></td>
18
+ <td><%= klass.count %></td>
19
+ <td width="100px">
20
+ <%= link_to t('typus.buttons.add'), controller: "/admin/#{klass.to_resource}", action: 'new' %>
21
+ </td>
22
+ </tr>
23
+ <% end %>
24
+
25
+ </table>
@@ -0,0 +1,23 @@
1
+ <!-- This probably needs a rename, but for the moment is ok -->
2
+
3
+ <% if (resources = Typus.resources.delete_if { |r| !(admin_user.is_a?(FakeUser) || admin_user.resources.include?(r)) }).any? %>
4
+
5
+ <h2><%= t("typus.dashboard.resources") %></h2>
6
+
7
+ <table>
8
+
9
+ <thead>
10
+ <tr>
11
+ <th><%= t("typus.dashboard.name") %></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <% resources.each do |resource| %>
16
+ <tr>
17
+ <td><%= link_to t(resource.titleize.capitalize), :controller => "/admin/#{resource.underscore}" %></td>
18
+ </tr>
19
+ <% end %>
20
+
21
+ </table>
22
+
23
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <!-- List of all available models -->
2
+
3
+ <h2><%= t("typus.dashboard.users") %> <%= Typus.user_class.count %></h2>
4
+
5
+ <table class="table">
6
+
7
+ <thead>
8
+ <tr>
9
+ <th><%= t('typus.dashboard.user') %></th>
10
+ <th><%= t('typus.dashboard.status') %></th>
11
+ <th><%= t('typus.dashboard.last_logged_in') %></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <% Typus.user_class.limit(5).each do |user| %>
16
+ <tr>
17
+ <td><%= user.email %></td>
18
+ <td><%= user.status %></td>
19
+ <td><%= user.created_at %></td>
20
+ </tr>
21
+ <% end %>
22
+
23
+ </table>
@@ -0,0 +1,7 @@
1
+ <p>Someone has requested a link to change your password, and you can do this through the link below.</p>
2
+
3
+ <p><%= link_to 'Change my password', @token_url %></p>
4
+
5
+ <p>If you didn't request this, please ignore this email.</p>
6
+
7
+ <p>Your password won't change until you access the link above and create a new one.</p>
@@ -0,0 +1,7 @@
1
+ Someone has requested a link to change your password, and you can do this through the link below.
2
+
3
+ <%= @token_url %>
4
+
5
+ If you didn't request this, please ignore this email.
6
+
7
+ Your password won't change until you access the link above and create a new one.
@@ -0,0 +1,14 @@
1
+ <h2>Welcome!</h2>
2
+
3
+ <%
4
+ issue = link_to('issue', 'https://github.com/typus/typus/issues')
5
+ user_guide = link_to('user guide', 'http://docs.typuscmf.com/')
6
+ %>
7
+
8
+ <p>Learn more about configuring the interface in the official <%= user_guide %>.</p>
9
+
10
+ <p>If you find a bug or think something in the documentation is
11
+ missing don't hesitate in opening an <%= issue %>.</p>
12
+
13
+ <p>Replace this sidebar by dropping a file named
14
+ <code>_sidebar.html.erb</code> on the <code>app/views/admin/dashboard</code> folder.</p>
@@ -0,0 +1,28 @@
1
+ <%= render 'form_javascripts' %>
2
+
3
+ <%= form_for @item, url: options, html: { role: 'form', multipart: true } do |form| %>
4
+
5
+ <%= render 'helpers/admin/resources/errors' %>
6
+
7
+ <%= build_form(fields, form) %>
8
+
9
+ <% if headless_mode? %>
10
+ <% unless @item.new_record? %>
11
+ <%= hidden_field_tag '_id', @item.id %>
12
+ <%= hidden_field_tag '_label', @item.to_label %>
13
+ <% end %>
14
+ <%= hidden_field_tag '_continue' %>
15
+ <% else %>
16
+ <% resources_actions_for_current_role.map do |body, url, options| %>
17
+ <%= link_to t(body), params.dup.merge!(url).compact.cleanup, options || {class: 'btn btn-default'} %>
18
+ <% end %>
19
+ <% build_save_options.each do |key, value, special| %>
20
+ <%
21
+ klass = key.eql?(:_save) ? 'btn btn-primary' : 'btn btn-default'
22
+ options = { name: key, onclick: 'Typus.setConfirmUnload(false);', class: klass }
23
+ %>
24
+ <%= submit_tag t(value), options %>
25
+ <% end %>
26
+ <% end %>
27
+
28
+ <% end %>
@@ -0,0 +1,13 @@
1
+ <%= render 'form_javascripts' %>
2
+
3
+ <%= form_for @item,
4
+ url: options,
5
+ html: { multipart: true, class: 'form-horizontal' } do |form| %>
6
+
7
+ <%= render 'helpers/admin/resources/errors' %>
8
+
9
+ <fieldset>
10
+ <%= build_form(fields, form) %>
11
+ </fieldset>
12
+
13
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <ul class="pager">
2
+ <% if options[:previous] %>
3
+ <li class="previous">
4
+ <% message = t('typus.pagination.previous').html_safe %>
5
+ <%= link_to message, options[:previous] %>
6
+ </li>
7
+ <% end %>
8
+
9
+ <% if options[:next] %>
10
+ <li class="next">
11
+ <% message = t('typus.pagination.next').html_safe %>
12
+ <%= link_to message, options[:next] %>
13
+ </li>
14
+ <% end %>
15
+ </ul>
@@ -0,0 +1 @@
1
+ <%= build_sidebar unless headless_mode? %>
@@ -0,0 +1,16 @@
1
+ <%
2
+ page_title = t("typus.resources.destroy.title", label: @item.to_label)
3
+ admin_title(page_title)
4
+ %>
5
+
6
+ <% content_for :main_grid do %>
7
+ <h1><%= page_title %></h1>
8
+
9
+ <%= admin_display_flash_message %>
10
+
11
+ <%= form_for @item, url: {}, html: { method: :delete }, html_options: { role: 'form', multipart: true } do |f| %>
12
+ <%= f.submit t('typus.buttons.destroy'), class: 'btn btn-danger' %>
13
+ <% end %>
14
+
15
+ <%= render 'admin/shared/modals' %>
16
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <%
2
+ page_title = t('typus.resources.edit.title', label: @item.to_label)
3
+ admin_title(page_title)
4
+ %>
5
+
6
+ <% content_for :main_grid do %>
7
+ <%= render 'edit' %>
8
+
9
+ <% unless headless_mode? %>
10
+ <h1><%= page_title %></h1>
11
+ <% end %>
12
+
13
+ <%= admin_display_flash_message %>
14
+
15
+ <% locals = { options: params.dup.cleanup.merge!(action: 'update') } %>
16
+ <%= render 'form', locals %>
17
+
18
+ <% unless headless_mode? %>
19
+ <%= render 'admin/shared/modals' %>
20
+ <%= typus_relationships %>
21
+ <% end %>
22
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <h3>Actions</h3>
2
+
3
+ <ul>
4
+ <li>Action number one</li>
5
+ <li>Action number two</li>
6
+ <li>Action number three</li>
7
+ </ul>
@@ -0,0 +1,8 @@
1
+ <% if (items = @resource.limit(10)).any? %>
2
+ <h3><%= t('typus.resources.edited_recently.title') %></h3>
3
+ <ul>
4
+ <% items.each do |item| %>
5
+ <li><%= link_to item.to_label, :action => 'edit', :id => item %></li>
6
+ <% end %>
7
+ </ul>
8
+ <% end %>
@@ -0,0 +1,29 @@
1
+ <%
2
+ page_title = @resource.model_name.human(count: 1_000)
3
+ admin_title(page_title)
4
+ %>
5
+
6
+ <% content_for :main_grid do %>
7
+
8
+ <% render 'index' %>
9
+
10
+ <h1><%= page_title %></h1>
11
+
12
+ <%= admin_display_flash_message %>
13
+
14
+ <%= build_filters %>
15
+
16
+ <% if @items.any? -%>
17
+ <% if controller.respond_to?(:bulk) %>
18
+ <%= build_actions { build_list(@resource, fields, @items) } %>
19
+ <% else %>
20
+ <%= build_list(@resource, fields, @items) %>
21
+ <% end %>
22
+ <%= admin_paginate %>
23
+ <% else %>
24
+ <div class="alert alert-info">
25
+ <p><%= t('typus.shared.no_entries_found') %></p>
26
+ </div>
27
+ <% end %>
28
+
29
+ <% end %>
@@ -0,0 +1,20 @@
1
+ <%
2
+ page_title = t('typus.resources.add.title', :resource => @resource.model_name.human)
3
+ admin_title(page_title)
4
+ %>
5
+
6
+ <% content_for :main_grid do %>
7
+ <%= render 'new' %>
8
+
9
+ <% unless headless_mode? %>
10
+ <h1><%= page_title %></h1>
11
+ <% end %>
12
+
13
+ <%= admin_display_flash_message %>
14
+
15
+ <%= render 'form', { options: params.dup.cleanup.merge(:action => 'create') } %>
16
+
17
+ <% unless headless_mode? %>
18
+ <%= render 'admin/shared/modals' %>
19
+ <% end %>
20
+ <% end %>
@@ -0,0 +1,26 @@
1
+ <%
2
+ page_title = t('typus.resources.show.title', label: @item.to_label)
3
+ admin_title(page_title)
4
+ %>
5
+
6
+ <% content_for :main_grid do %>
7
+
8
+ <% unless headless_mode? %>
9
+ <h1><%= page_title %></h1>
10
+ <% end %>
11
+
12
+ <%= admin_display_flash_message %>
13
+
14
+ <%= render 'show' %>
15
+
16
+ <% build_display(@item, fields).each do |attribute, type| %>
17
+ <div class="panel panel-default">
18
+ <div class="panel-heading">
19
+ <h3 class="panel-title"><%= attribute %></h3>
20
+ </div>
21
+ <div class="panel-body">
22
+ <%= type %>
23
+ </div>
24
+ </div>
25
+ <% end %>
26
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <%
2
+ @page_title = t('.title')
3
+ admin_title(@page_title)
4
+ %>
5
+
6
+ <%= form_for Typus.user_class_as_symbol,
7
+ url: { action: :create, return_to: params[:return_to] },
8
+ html: { class: "form-signin" } do |form| %>
9
+ <%= render partial: 'admin/account/form', locals: { form: form } %>
10
+ <% end %>
11
+
12
+ <% if Typus.mailer_sender %>
13
+ <% content_for :actions do %>
14
+ <ul>
15
+ <li><%= link_to t('.recover_password'), forgot_password_admin_account_index_path %></li>
16
+ </ul>
17
+ <% end %>
18
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <meta charset="utf-8" />
2
+ <meta name="apple-mobile-web-app-capable" content="yes" />
3
+ <meta name="generator" content="Typus <%= Typus::VERSION::STRING %>" />
4
+
5
+ <link rel="shortcut icon" href="/favicon.ico" />
6
+
7
+ <title><%= yield :title %> &middot; <%= Typus.admin_title %></title>
8
+
9
+ <%= stylesheet_link_tag 'typus/application' %>
10
+ <%= javascript_include_tag 'typus/application' %>
11
+
12
+ <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
13
+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
14
+
15
+ <%= yield :stylesheets -%>
16
+ <%= yield :javascripts -%>
17
+
18
+ <%= csrf_meta_tag %>
19
+
20
+ <% if Rails.env.development? %>
21
+ <style type="text/css">
22
+ .translation_missing { background: red; color: white; padding: 5px; }
23
+ </style>
24
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <% fields.reject { |_, v| ![:belongs_to, :has_and_belongs_to_many].include?(v) }.keys.each do |key| %>
2
+ <%= yield "modal_for_#{key}" %>
3
+ <% end %>
@@ -0,0 +1,5 @@
1
+ Some snippets to use in the future:
2
+
3
+ <input type="hidden"
4
+ id="pageListJSON"
5
+ value="[<%= Page.all.map { |p| "['#{p.to_label}', '/pages/#{p.respond?(:permalink) p.permalink : p.id}']" }.join(", ") %>]">