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,13 @@
1
+ <div id="preview_<%= html_options['modal-id'] %>" class="modal fade">
2
+ <div class="modal-dialog">
3
+ <div class="modal-content">
4
+ <div class="modal-header">
5
+ <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
6
+ <h4 class="modal-title"><%= attachment.original_filename %></h4>
7
+ </div>
8
+ <div class="modal-body">
9
+ <%= image_tag preview %>
10
+ </div>
11
+ </div>
12
+ </div>
13
+ </div>
@@ -0,0 +1,86 @@
1
+ <!-- Brand and toggle get grouped for better mobile display -->
2
+ <div class="navbar-header">
3
+ <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
4
+ <span class="sr-only">Toggle navigation</span>
5
+ <span class="icon-bar"></span>
6
+ <span class="icon-bar"></span>
7
+ <span class="icon-bar"></span>
8
+ </button>
9
+ </div>
10
+
11
+ <!-- Collect the nav links, forms, and other content for toggling -->
12
+ <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
13
+ <ul class="nav navbar-nav">
14
+ <li class="<%= params[:controller].eql?('admin/dashboard') ? 'active' : 'inactive' %>">
15
+ <%= link_to admin_dashboard_index_path do %>
16
+ <i class="icon-home"></i>
17
+ <%= t("typus.dashboard.title") %>
18
+ <% end %>
19
+ </li>
20
+
21
+ <% admin_user.applications.each do |application| %>
22
+ <%
23
+ app_id, apps = application.parameterize, admin_user.application(application)
24
+ if (params[:application] == app_id) || (@resource && apps.include?(@resource.model_name))
25
+ klass = 'active'
26
+ end
27
+ %>
28
+
29
+ <li class="dropdown <%= klass %>">
30
+ <%= link_to "#", :class => "dropdown-toggle", "data-toggle" => "dropdown" do %>
31
+ <%= t("typus.application.#{application.parameterize('_')}", default: application) %>
32
+ <b class="caret"></b>
33
+ <% end %>
34
+
35
+ <ul class="dropdown-menu">
36
+ <% admin_user.application(application).map(&:constantize).each do |klass| %>
37
+ <% if klass.typus_options_for(:hide_from_dashboard) == false %>
38
+ <li><%= link_to klass.model_name.human(count: 1_000), controller: "/admin/#{klass.to_resource}" %></li>
39
+ <% end %>
40
+ <% end %>
41
+ </ul>
42
+ </li>
43
+ <% end %>
44
+ </ul>
45
+
46
+ <% if not admin_user.is_a?(FakeUser) %>
47
+ <ul class="nav navbar-nav navbar-right" style="margin-right: 5px;">
48
+ <ul class="nav navbar-nav navbar-right">
49
+ <li class="dropdown" data-dropdown="dropdown">
50
+ <%= link_to "#", :class => "dropdown-toggle", "data-toggle" => "dropdown" do %>
51
+ <%= admin_user.to_label %>
52
+ <b class="caret"></b>
53
+ <% end %>
54
+
55
+ <ul class="dropdown-menu">
56
+ <li>
57
+ <%= link_to url_for(admin_edit_user_path(admin_user)) do %>
58
+ <span class="glyphicon glyphicon-user"></span>
59
+ <%= t("typus.shared.settings") %>
60
+ <% end %>
61
+ </li>
62
+
63
+ <li class="divider"></li>
64
+
65
+ <% if Typus.link_to_help %>
66
+ <li>
67
+ <%= link_to '#' do %>
68
+ <span class="glyphicon glyphicon-info-sign"></span>
69
+ <%= t("typus.shared.help") %>
70
+ <% end %>
71
+ </li>
72
+ <% end %>
73
+
74
+ <li>
75
+ <%= link_to admin_sign_out_path, :method => :delete do %>
76
+ <span class="glyphicon glyphicon-off"></span>
77
+ <%= t('typus.buttons.sign_out') %>
78
+ <% end %>
79
+ </li>
80
+ </ul>
81
+ </li>
82
+ </ul>
83
+ </ul>
84
+ <% end %>
85
+
86
+ </div>
@@ -0,0 +1,6 @@
1
+ <ul class="breadcrumb">
2
+ <li><%= link_to "Dashboard", admin_dashboard_index_path %> <span class="divider">/</span></li>
3
+ <li><a href="#">Middle page</a> <span class="divider">/</span></li>
4
+ <li><a href="#">Another one</a> <span class="divider">/</span></li>
5
+ <li class="active">You are here</li>
6
+ </ul>
@@ -0,0 +1,3 @@
1
+ <div class="alert alert-<%= flash_type %>" data-alert="alert">
2
+ <%= message %>
3
+ </div>
@@ -0,0 +1,19 @@
1
+ <% if resources.any? %>
2
+
3
+ <table class="zebra-striped">
4
+
5
+ <thead>
6
+ <tr>
7
+ <th><%= t("typus.dashboard.resources") %></th>
8
+ </tr>
9
+ </thead>
10
+
11
+ <% resources.each do |resource| %>
12
+ <tr>
13
+ <td><%= link_to t(resource.titleize.capitalize), :controller => "/admin/#{resource.underscore}" %></td>
14
+ </tr>
15
+ <% end %>
16
+
17
+ </table>
18
+
19
+ <% end %>
@@ -0,0 +1,18 @@
1
+ <%= form_tag action: 'bulk', class: 'form-inline' do %>
2
+
3
+ <%= block.call %>
4
+
5
+ <% if bulk_actions.any? %>
6
+ <div class="well well-sm">
7
+ <select id="bulk_action" name="batch_action">
8
+ <option value="" selected="selected">Bulk actions</option>
9
+ <% bulk_actions.each do |name, action| %>
10
+ <option value="<%= action %>"><%= t(name) %></option>
11
+ <% end %>
12
+ </select>
13
+
14
+ <%= submit_tag t('typus.buttons.apply'), name: nil, class: 'btn btn-default btn-xs' %>
15
+ </div>
16
+ <% end %>
17
+
18
+ <% end %>
@@ -0,0 +1,12 @@
1
+ <% if @item.errors.any? %>
2
+ <div class="alert alert-danger">
3
+ <h4 class="alert-heading" style="margin-bottom: 10px;">
4
+ <%= t('typus.errors.intro', count: @item.errors.count) %>
5
+ </h4>
6
+ <ul>
7
+ <% @item.errors.full_messages.each do |full_message| %>
8
+ <li><%= full_message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
@@ -0,0 +1,16 @@
1
+ <div class="well well-sm" style="margin-top: 10px;">
2
+ <%= form_tag nil, method: :get, class: 'form-inline', role: 'form' do %>
3
+
4
+ <% filters.each do |filter| %>
5
+ <% key, value = filter[:key], filter[:value] %>
6
+ <%= select_tag key, options_for_select(value, params[key]) %>
7
+ <% end %>
8
+
9
+ <% hidden_filters.each do |key, value| %>
10
+ <%= hidden_field_tag key, value %>
11
+ <% end %>
12
+
13
+ <%= submit_tag t('typus.buttons.filter'), name: nil, class: 'btn btn-default btn-xs' %>
14
+
15
+ <% end %>
16
+ </div>
@@ -0,0 +1,17 @@
1
+ <div class="wello">
2
+ <h3><%= t('typus.sidebar.search') %></h3>
3
+ <ul class="nav nav-pills nav-stacked">
4
+ <li>
5
+ <%= form_tag typus_search_path, method: :get, class: 'form-search' do %>
6
+
7
+ <div class="input-append">
8
+ <%= search_field_tag 'search', nil, class: 'form-control input-sm', placeholder: params[:search] %>
9
+ </div>
10
+
11
+ <% hidden_filters.each do |key, value| %>
12
+ <%= hidden_field_tag key, value %>
13
+ <% end %>
14
+ <% end %>
15
+ </li>
16
+ </ul>
17
+ </div>
@@ -0,0 +1,4 @@
1
+ <%= admin_search %>
2
+ <%= render 'helpers/admin/resources/sidebar/items', actions: actions %>
3
+ <%= render 'helpers/admin/resources/sidebar/items_index' %>
4
+ <%= render 'helpers/admin/resources/sidebar/item' %>
@@ -0,0 +1,45 @@
1
+ <% yield_name = "table_headers_#{model}_#{rand(100)}" %>
2
+
3
+ <% content_for yield_name do %>
4
+ <thead>
5
+ <tr>
6
+ <% if controller.respond_to?(:bulk) %>
7
+ <th><%= check_box_tag "action-toggle", "", false, :class => "action-toggle" %></th>
8
+ <% end %>
9
+ <% headers.each do |header| %>
10
+ <th><%= header %></th>
11
+ <% end %>
12
+ <th width="120"><%= t('typus.dashboard.actions') %></th>
13
+ </tr>
14
+ </thead>
15
+ <% end %>
16
+
17
+ <table class="table table-hover">
18
+
19
+ <%= yield yield_name %>
20
+
21
+ <% items.each do |item| %>
22
+ <tr id="<%= dom_id(item) %>">
23
+ <% if controller.respond_to?(:bulk) %>
24
+ <td width="16">
25
+ <%= check_box_tag "selected_item_ids[]", item.id, false, :class => "action-select" %>
26
+ </td>
27
+ <% end %>
28
+ <% table_fields_for_item(item, fields).each do |field| %>
29
+ <td><%= field %></td>
30
+ <% end %>
31
+ <td width="250">
32
+ <div class="btn-group btn-group-xs">
33
+ <% table_actions(model, item).each do |action| %>
34
+ <% html_options = action[:options] || {} %>
35
+ <%= link_to url_for(action[:url]), html_options.merge(class: 'btn btn-default btn-sm') do %>
36
+ <span class="glyphicon glyphicon-<%= action[:options] && action[:options][:glyphicon] || 'asterisk' %>"></span>
37
+ <%= action[:message] %>
38
+ <% end %>
39
+ <% end %>
40
+ </div>
41
+ </td>
42
+ </tr>
43
+ <% end %>
44
+
45
+ </table>
@@ -0,0 +1,26 @@
1
+ <% if @item && @item.persisted? %>
2
+
3
+ <%
4
+ item_actions = {
5
+ edit: { message: t('typus.buttons.edit'), icon: 'edit' },
6
+ show: { message: t('typus.buttons.show'), icon: 'info-sign' },
7
+ destroy: { message: t('typus.buttons.destroy'), icon: 'remove' },
8
+ }
9
+ %>
10
+
11
+ <h3><%= t('typus.sidebar.entry') %></h3>
12
+
13
+ <ul class="nav nav-pills nav-stacked">
14
+ <% item_actions.each do |key, value| %>
15
+ <% if admin_user.can?(key.to_s, @resource.model_name) %>
16
+ <li class="<%= params[:action].to_sym.eql?(key) ? 'active' : 'inactive' %>">
17
+ <%= link_to url_for(params.merge(action: key)), data: value[:data] do %>
18
+ <span class="glyphicon glyphicon-<%= value[:icon] %>"></span>
19
+ <%= value[:message] %>
20
+ <% end %>
21
+ </li>
22
+ <% end %>
23
+ <% end %>
24
+ </ul>
25
+
26
+ <% end %>
@@ -0,0 +1,14 @@
1
+ <% if actions.any? %>
2
+ <h3><%= t('typus.sidebar.actions') %></h3>
3
+ <ul class="nav nav-pills nav-stacked">
4
+ <% actions.each do |action| %>
5
+ <% klass = action[:url][:action].eql?(params[:action]) && params[:scope].nil? ? 'active' : 'inactive' %>
6
+ <li class="<%= klass %>">
7
+ <%= link_to url_for(action[:url]) do %>
8
+ <span class="glyphicon glyphicon-<%= action[:icon] %>"></span>
9
+ <%= action[:message] %>
10
+ <% end %>
11
+ </li>
12
+ <% end %>
13
+ </ul>
14
+ <% end %>
@@ -0,0 +1,57 @@
1
+ <%
2
+ whitelist = %w(index trash)
3
+ return unless whitelist.include?(params[:action])
4
+ %>
5
+
6
+ <% if @resource.typus_scopes.any? %>
7
+ <h3><%= t('typus.sidebar.scopes') %></h3>
8
+
9
+ <ul class="nav nav-pills nav-stacked">
10
+ <% @resource.typus_scopes.each do |scope| %>
11
+ <% klass = params[:scope].eql?(scope) ? 'active' : 'inactive' %>
12
+ <li class="<%= klass %>">
13
+ <%= link_to url_for(params.dup.cleanup.merge(action: 'index', scope: scope)) do %>
14
+ <span class="glyphicon glyphicon-list"></span>
15
+ <%= t("activerecord.scopes.#{@resource.name.underscore}.#{scope}") %>
16
+ <% if @resource.typus_options_for(:counters) %>
17
+ <%= "&nbsp; <span class='badge'>#{@resource.send(scope).count}</span>".html_safe %>
18
+ <% end %>
19
+ <% end %>
20
+ </li>
21
+ <% end %>
22
+ </ul>
23
+ <% end %>
24
+
25
+ <% if predefined_filters.any? %>
26
+ <h3><%= t('typus.sidebar.filters') %></h3>
27
+
28
+ <ul class="nav nav-pills nav-stacked">
29
+ <% predefined_filters.each do |filter, action, scope| %>
30
+ <% klass = params[:action].eql?(action) ? 'active' : 'inactive' %>
31
+ <li class="<%= klass %>">
32
+ <% url = action.is_a?(String) ? params.dup.cleanup.merge(action: action) : action %>
33
+ <%= link_to url do %>
34
+ <%= t(filter) %>
35
+ <% if @resource.typus_options_for(:counters) && scope && @resource.respond_to?(scope) %>
36
+ <%= "&nbsp;<span class='badge'>#{@resource.send(scope).count}</span>".html_safe %>
37
+ <% end %>
38
+ <% end %>
39
+ </li>
40
+ <% end %>
41
+ </ul>
42
+ <% end %>
43
+
44
+ <% if resource.any? && (formats = resource.typus_options_for(:export).extract_settings).any? %>
45
+ <h3><%= t('typus.sidebar.export') %></h3>
46
+
47
+ <ul class="nav nav-pills nav-stacked">
48
+ <% formats.each do |format| %>
49
+ <li>
50
+ <%= link_to({ format: format }, { target: '_blank' }) do %>
51
+ <span class="glyphicon glyphicon-download"></span>
52
+ <%= format.upcase %>
53
+ <% end %>
54
+ </li>
55
+ <% end %>
56
+ </ul>
57
+ <% end %>
@@ -0,0 +1,30 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="<%= I18n.locale %>">
4
+
5
+ <head>
6
+ <%= render 'admin/shared/head' %>
7
+ </head>
8
+
9
+ <body class="<%= body_class %>">
10
+
11
+ <nav class="navbar navbar-inverse navbar-static-top" role="navigation">
12
+ <div class="container-fluid">
13
+ <%= render 'helpers/admin/base/apps' %>
14
+ </div>
15
+ </nav>
16
+
17
+ <div class="container-fluid">
18
+ <div class="row-fluid">
19
+ <div class="col-md-3 sidebar">
20
+ <%= render 'sidebar' %>
21
+ </div>
22
+ <div class="col-md-9 main">
23
+ <%= yield :main_grid %>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ </body>
29
+
30
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield :main_grid %>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html lang="<%= I18n.locale %>">
4
+
5
+ <head>
6
+ <%= render 'admin/shared/head' %>
7
+
8
+ <style type="text/css">
9
+ body { padding: 40px 0; background-color: #eee; }
10
+ </style>
11
+ </head>
12
+
13
+ <body class="base">
14
+ <div class="container">
15
+ <%= yield :layout %>
16
+
17
+ <% if content_for?(:actions) %>
18
+ <div class="form-signin actions">
19
+ <%= yield :actions %>
20
+ </div>
21
+ <% end %>
22
+ </div>
23
+
24
+ </body>
25
+
26
+ </html>
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env bash
2
+
3
+ export RAILS_ENV=test
4
+ export DB=postgresql
5
+
6
+ ./test/dummy/bin/setup
7
+ bundle exec rake
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
5
+ TEST_APP_ROOT = APP_ROOT.join('test', 'dummy')
6
+
7
+ Dir.chdir TEST_APP_ROOT do
8
+ system "./bin/setup"
9
+ end
@@ -0,0 +1,125 @@
1
+ en:
2
+ admin:
3
+ account:
4
+ new:
5
+ title: 'Initial registration'
6
+ forgot_password:
7
+ title: 'Forgot password?'
8
+ remember_password: "I remember my password"
9
+ form:
10
+ submit: 'Submit'
11
+ session:
12
+ new:
13
+ title: 'Please sign in'
14
+ recover_password: "Recover password"
15
+
16
+ typus:
17
+ dashboard: 'Dashboard'
18
+
19
+ # this is a catch-all for stuff I didn't know where else to put.
20
+ shared:
21
+ no_entries_found: "No entries found."
22
+ help: "Help"
23
+ settings: "Settings"
24
+ confirm_question: "Are you sure?"
25
+ restore_question: 'Restore?'
26
+
27
+ buttons:
28
+ add: "Add"
29
+ save: 'Save'
30
+ save_addanother: 'Save and add another'
31
+ save_continue: 'Save and continue editing'
32
+ filter: "Filter"
33
+ list: "List"
34
+ sign_in: "Sign in"
35
+ sign_up: "Sign up"
36
+ sign_out: "Sign out"
37
+ show: "Show"
38
+ edit: "Edit"
39
+ remove: "Remove"
40
+ preview: "Preview"
41
+ apply: "Apply"
42
+ restore: "Restore"
43
+ destroy: "Destroy"
44
+ destroy_permanently: "Destroy permanently"
45
+ position: "Position"
46
+ move_to_trash: "Move to Trash"
47
+ mark_published: "Mark as published"
48
+ mark_unpublished: "Mark as unpublished"
49
+
50
+ flash:
51
+ update_success: "%{model} successfully updated."
52
+ create_success: "%{model} successfully created."
53
+ delete_success: "%{model} successfully deleted."
54
+ wipe_success: "%{resource} has been successfully removed from trash."
55
+ bulk_delete_success:
56
+ one: "Successfully deleted entry."
57
+ other: "Successfully deleted %{count} entries."
58
+ settings_update_success: "Settings successfully updated." # this can probably be removed later
59
+ image_removed: "Featured image removed."
60
+ image_set: "Featured image set."
61
+ set_new_password: "Please set a new password."
62
+ password_reset_email_success: "Password recovery link sent to your email."
63
+ bulk_no_action: "No bulk action selected."
64
+ bulk_no_items: "Items must be selected in order to perform actions on them. No items have been changed."
65
+ trash_recover_success: "%{resource} recovered from trash."
66
+ trash_recover_failed: "%{resource} cannot be recovered from trash."
67
+
68
+ errors:
69
+ intro:
70
+ one: "An error prohibited this page from being saved:"
71
+ other: "%{count} errors prohibited this page from being saved:"
72
+
73
+ dashboard:
74
+ title: "Dashboard"
75
+ model: "Model"
76
+ model_name: "Model Name"
77
+ items: "Items"
78
+ actions: "Actions"
79
+ no_applications: "No applications detected."
80
+ user: "User"
81
+ user: "Users"
82
+ status: "Status"
83
+ last_logged_in: "Last logged in"
84
+ resources: "Resources"
85
+ name: "Name"
86
+
87
+ resources:
88
+ add:
89
+ title: "Add %{resource}"
90
+ edit:
91
+ title: "Edit '%{label}'"
92
+ show:
93
+ title: "Details for '%{label}'"
94
+ edited_recently:
95
+ title: "Edited recently"
96
+ destroy:
97
+ title: "Destroy %{label}"
98
+
99
+ sessions:
100
+ new:
101
+ title: "Sign in"
102
+
103
+ pagination:
104
+ previous: "&larr; Previous"
105
+ next: "Next &rarr;"
106
+
107
+ sidebar:
108
+ filters: "Filters"
109
+ scopes: "Scopes"
110
+ export: "Export"
111
+ entry: "Entry"
112
+ actions: "Actions"
113
+ view_site: "View site"
114
+ search: "Search"
115
+
116
+ labels:
117
+ read_only: "Read only"
118
+
119
+ emails:
120
+ password_reset:
121
+ title: "[%{admin_title}] Reset password"
122
+
123
+ filters:
124
+ trash: "Trash"
125
+ view_all: "View all %{attribute}"