itsf_backend 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +43 -0
  4. data/Rakefile +21 -0
  5. data/app/assets/images/itsf/backend/favicon.png +0 -0
  6. data/app/assets/javascripts/itsf/backend/application.js +21 -0
  7. data/app/assets/javascripts/itsf/backend/application/ace.coffee +51 -0
  8. data/app/assets/javascripts/itsf/backend/application/acts-as-list.coffee +21 -0
  9. data/app/assets/javascripts/itsf/backend/application/auto-submit.coffee +21 -0
  10. data/app/assets/javascripts/itsf/backend/application/autofocus-last.coffee +4 -0
  11. data/app/assets/javascripts/itsf/backend/application/drop-down-hover.coffee +8 -0
  12. data/app/assets/javascripts/itsf/backend/application/itsf-logo.coffee +24 -0
  13. data/app/assets/javascripts/itsf/backend/vendor/jQueryRotate.js +339 -0
  14. data/app/assets/javascripts/itsf/backend/vendor/jquery.redirect.js +119 -0
  15. data/app/assets/javascripts/itsf_backend.js +1 -0
  16. data/app/assets/stylesheets/itsf/backend/application.css.less +30 -0
  17. data/app/assets/stylesheets/itsf/backend/application/ace.css.less +6 -0
  18. data/app/assets/stylesheets/itsf/backend/application/basic-page.css.less +10 -0
  19. data/app/assets/stylesheets/itsf/backend/application/bootstrap-extensions.css.less +48 -0
  20. data/app/assets/stylesheets/itsf/backend/application/bottom-margin-extension.css.less +9 -0
  21. data/app/assets/stylesheets/itsf/backend/application/button-responsive.css.less +7 -0
  22. data/app/assets/stylesheets/itsf/backend/application/check-box-margin-fix.css.less +5 -0
  23. data/app/assets/stylesheets/itsf/backend/application/code.css.less +6 -0
  24. data/app/assets/stylesheets/itsf/backend/application/form-errors.css.less +6 -0
  25. data/app/assets/stylesheets/itsf/backend/application/form-inline-margin-fixes.css.less +9 -0
  26. data/app/assets/stylesheets/itsf/backend/application/hexagon.css.less +161 -0
  27. data/app/assets/stylesheets/itsf/backend/application/itsf-dashboard-panels.css.less +9 -0
  28. data/app/assets/stylesheets/itsf/backend/application/itsf-logo.css.less +107 -0
  29. data/app/assets/stylesheets/itsf/backend/application/navigation-logo.css.less +5 -0
  30. data/app/assets/stylesheets/itsf/backend/application/panel-footer-pagination.css.less +8 -0
  31. data/app/assets/stylesheets/itsf/backend/application/panel-with-actions.css.less +21 -0
  32. data/app/assets/stylesheets/itsf/backend/application/table-actions.css.less +9 -0
  33. data/app/assets/stylesheets/itsf/backend/application/table-responsive.css.less +3 -0
  34. data/app/assets/stylesheets/itsf/backend/bootstrap_and_overrides.css.less +34 -0
  35. data/app/assets/stylesheets/itsf/backend/vendor/timeline.min.css +1 -0
  36. data/app/assets/stylesheets/itsf_backend.css +3 -0
  37. data/app/concerns/routing/service_concern.rb +12 -0
  38. data/app/controllers/concerns/controller/acts_as_list_concern.rb +13 -0
  39. data/app/controllers/concerns/controller/acts_as_published_concern.rb +13 -0
  40. data/app/controllers/concerns/controller/pagination_concern.rb +15 -0
  41. data/app/controllers/concerns/controller/pundit_namespaced_authorize_concern.rb +19 -0
  42. data/app/controllers/concerns/controller/ransack_concern.rb +25 -0
  43. data/app/controllers/concerns/controller/rest_actions_concern_with_pundit.rb +93 -0
  44. data/app/controllers/itsf/backend/application_controller.rb +6 -0
  45. data/app/controllers/itsf/backend/base_controller.rb +34 -0
  46. data/app/controllers/itsf/backend/dashboard_controller.rb +20 -0
  47. data/app/controllers/itsf/backend/home_controller.rb +27 -0
  48. data/app/controllers/itsf/backend/resource/base_controller.rb +35 -0
  49. data/app/controllers/itsf/backend/service/base_controller.rb +29 -0
  50. data/app/extensions/concerns/head_row/acts_as_list_extensions.rb +11 -0
  51. data/app/extensions/concerns/head_row/association_extensions.rb +14 -0
  52. data/app/extensions/concerns/head_row/paperclip_extensions.rb +11 -0
  53. data/app/extensions/concerns/head_row/published_extensions.rb +11 -0
  54. data/app/extensions/concerns/head_row/ransack_extensions.rb +7 -0
  55. data/app/extensions/concerns/head_row/timestamp_extensions.rb +21 -0
  56. data/app/extensions/concerns/object_extensions.rb +8 -0
  57. data/app/extensions/concerns/ransack_form_builder_extensions.rb +72 -0
  58. data/app/extensions/concerns/resource_row/acts_as_list_extensions.rb +28 -0
  59. data/app/extensions/concerns/resource_row/association_extensions.rb +22 -0
  60. data/app/extensions/concerns/resource_row/paperclip_extensions.rb +18 -0
  61. data/app/extensions/concerns/resource_row/published_extensions.rb +24 -0
  62. data/app/extensions/concerns/resource_row/timestamp_extensions.rb +23 -0
  63. data/app/extensions/concerns/simple_form_form_builder_extensions.rb +28 -0
  64. data/app/helpers/itsf/backend/application_helper.rb +9 -0
  65. data/app/policies/itsf/backend/base_policy.rb +67 -0
  66. data/app/policies/itsf/backend/dashboard_policy.rb +14 -0
  67. data/app/policies/itsf/backend/engine_policy.rb +14 -0
  68. data/app/policies/itsf/backend/service/base_policy.rb +29 -0
  69. data/app/presenters/bootstrap_table_presenter.rb.old +106 -0
  70. data/app/views/itsf/backend/dashboard/_dashboard_panel.html.haml +18 -0
  71. data/app/views/itsf/backend/dashboard/index.html.haml +7 -0
  72. data/app/views/itsf/backend/home/_dashboard_panel.html.haml +26 -0
  73. data/app/views/itsf/backend/home/_index_extras.html.haml +0 -0
  74. data/app/views/itsf/backend/home/index.html.haml +14 -0
  75. data/app/views/itsf/backend/i18n/_navigation.html.haml +10 -0
  76. data/app/views/itsf/backend/resource/base/_form.html.haml +2 -0
  77. data/app/views/itsf/backend/resource/base/_form_errors.html.haml +6 -0
  78. data/app/views/itsf/backend/resource/base/_scopes.html.haml +1 -0
  79. data/app/views/itsf/backend/resource/base/_search.html.haml +3 -0
  80. data/app/views/itsf/backend/resource/base/_show.html.haml +2 -0
  81. data/app/views/itsf/backend/resource/base/_show_extras.html.haml +0 -0
  82. data/app/views/itsf/backend/resource/base/_table.html.haml +2 -0
  83. data/app/views/itsf/backend/resource/base/_table_actions.html.haml +15 -0
  84. data/app/views/itsf/backend/resource/base/edit.html.haml +17 -0
  85. data/app/views/itsf/backend/resource/base/index.html.haml +48 -0
  86. data/app/views/itsf/backend/resource/base/new.html.haml +15 -0
  87. data/app/views/itsf/backend/resource/base/show.html.haml +28 -0
  88. data/app/views/itsf/backend/service/base/_form.html.haml +0 -0
  89. data/app/views/itsf/backend/service/base/_form_errors.html.haml +6 -0
  90. data/app/views/itsf/backend/service/base/_messages.html.erb +5 -0
  91. data/app/views/itsf/backend/service/base/index.html.haml +18 -0
  92. data/app/views/itsf/backend/service/base/invoke.html.haml +16 -0
  93. data/app/views/itsf/backend/service/base/success.html.haml +13 -0
  94. data/app/views/layouts/itsf/backend/_footer.html.haml +1 -0
  95. data/app/views/layouts/itsf/backend/_logo.html.haml +4 -0
  96. data/app/views/layouts/itsf/backend/_main_navigation.html.haml +6 -0
  97. data/app/views/layouts/itsf/backend/_main_navigation_drop_down.html.haml +20 -0
  98. data/app/views/layouts/itsf/backend/base.html.haml +56 -0
  99. data/config/initializers/assets.rb +3 -0
  100. data/config/initializers/extend_object.rb +1 -0
  101. data/config/initializers/extend_ransack_form_builder.rb +4 -0
  102. data/config/initializers/extend_simple_form_form_builder.rb +5 -0
  103. data/config/locales/de.yml +104 -0
  104. data/config/locales/en.yml +99 -0
  105. data/config/rbac.yml +7 -0
  106. data/config/routes.rb +3 -0
  107. data/lib/generators/itsf/backend/home_controller/home_controller_generator.rb +77 -0
  108. data/lib/generators/itsf/backend/home_controller/templates/home_controller.rb +6 -0
  109. data/lib/generators/itsf/backend/home_controller/templates/routes.source +2 -0
  110. data/lib/generators/itsf/backend/install/install_generator.rb +23 -0
  111. data/lib/generators/itsf/backend/install/templates/backend_controller.rb +2 -0
  112. data/lib/generators/itsf/backend/install/templates/initializer.rb +95 -0
  113. data/lib/generators/itsf/backend/install/templates/routes.source +9 -0
  114. data/lib/generators/itsf/backend/resource/resource_generator.rb +96 -0
  115. data/lib/generators/itsf/backend/resource/templates/controller.rb +34 -0
  116. data/lib/generators/itsf/backend/resource/templates/routes.source +2 -0
  117. data/lib/itsf/backend.rb +11 -0
  118. data/lib/itsf/backend/configuration.rb +38 -0
  119. data/lib/itsf/backend/engine.rb +16 -0
  120. data/lib/itsf/backend/features.rb +13 -0
  121. data/lib/itsf/backend/policies.rb +13 -0
  122. data/lib/itsf/backend/spec_helpers.rb +47 -0
  123. data/lib/itsf/backend/version.rb +5 -0
  124. data/lib/itsf_backend.rb +21 -0
  125. data/lib/tasks/itsf/backend_tasks.rake +4 -0
  126. data/spec/dummy/README.rdoc +28 -0
  127. data/spec/dummy/Rakefile +6 -0
  128. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  129. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  130. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  131. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  132. data/spec/dummy/app/models/post.rb +2 -0
  133. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  134. data/spec/dummy/bin/bundle +3 -0
  135. data/spec/dummy/bin/rails +4 -0
  136. data/spec/dummy/bin/rake +4 -0
  137. data/spec/dummy/bin/setup +29 -0
  138. data/spec/dummy/config.ru +4 -0
  139. data/spec/dummy/config/application.rb +38 -0
  140. data/spec/dummy/config/boot.rb +5 -0
  141. data/spec/dummy/config/database.yml +25 -0
  142. data/spec/dummy/config/environment.rb +5 -0
  143. data/spec/dummy/config/environments/development.rb +41 -0
  144. data/spec/dummy/config/environments/production.rb +79 -0
  145. data/spec/dummy/config/environments/test.rb +42 -0
  146. data/spec/dummy/config/initializers/assets.rb +11 -0
  147. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  148. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  149. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  150. data/spec/dummy/config/initializers/inflections.rb +16 -0
  151. data/spec/dummy/config/initializers/itsf_backend.rb +15 -0
  152. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  153. data/spec/dummy/config/initializers/session_store.rb +3 -0
  154. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  155. data/spec/dummy/config/locales/en.yml +23 -0
  156. data/spec/dummy/config/routes.rb +56 -0
  157. data/spec/dummy/config/secrets.yml +22 -0
  158. data/spec/dummy/db/migrate/20151024185112_create_posts.rb +10 -0
  159. data/spec/dummy/db/schema.rb +15 -0
  160. data/spec/dummy/public/404.html +67 -0
  161. data/spec/dummy/public/422.html +67 -0
  162. data/spec/dummy/public/500.html +66 -0
  163. data/spec/dummy/public/favicon.ico +0 -0
  164. data/spec/factories/posts.rb +6 -0
  165. data/spec/models/post_spec.rb +5 -0
  166. data/spec/rails_helper.rb +52 -0
  167. data/spec/spec_helper.rb +90 -0
  168. data/spec/support/addons.rb +3 -0
  169. metadata +688 -0
@@ -0,0 +1,107 @@
1
+ @import "hexagon.css.less";
2
+
3
+ .itsf-logo-38 {
4
+ display: inline-block;
5
+
6
+ .first-hexagon {
7
+ .hexagon(10px, #58585A);
8
+ display: inline-block;
9
+ }
10
+
11
+ .second-hexagon {
12
+ .hexagon(10px, #81C5E2);
13
+ display: inline-block;
14
+ margin-left: -1px;
15
+ width: 17px;
16
+ }
17
+
18
+ .third-hexagon {
19
+ .hexagon(10px, #A5C85F);
20
+ margin-left: 10px;
21
+ margin-top: -3px;
22
+ }
23
+ }
24
+
25
+ .itsf-logo-25 {
26
+ display: inline-block;
27
+
28
+ .first-hexagon {
29
+ .hexagon(6px, #58585A);
30
+ display: inline-block;
31
+ }
32
+
33
+ .second-hexagon {
34
+ .hexagon(6px, #81C5E2);
35
+ display: inline-block;
36
+ margin-left: -3px;
37
+ }
38
+
39
+ .third-hexagon {
40
+ .hexagon(6px, #A5C85F);
41
+ margin-left: 6px;
42
+ margin-top: -4px;
43
+ }
44
+ }
45
+
46
+ .itsf-logo-50 {
47
+ display: inline-block;
48
+
49
+ .first-hexagon {
50
+ .hexagon(12px, #58585A);
51
+ display: inline-block;
52
+ }
53
+
54
+ .second-hexagon {
55
+ .hexagon(12px, #81C5E2);
56
+ display: inline-block;
57
+ margin-left: -1px;
58
+ }
59
+
60
+ .third-hexagon {
61
+ .hexagon(12px, #A5C85F);
62
+ margin-left: 12px;
63
+ margin-top: -3px;
64
+ }
65
+ }
66
+
67
+ .itsf-logo-52 {
68
+ display: inline-block;
69
+
70
+ .first-hexagon {
71
+ .hexagon(14px, #58585A);
72
+ display: inline-block;
73
+ }
74
+
75
+ .second-hexagon {
76
+ .hexagon(14px, #81C5E2);
77
+ display: inline-block;
78
+ margin-left: -1px;
79
+ }
80
+
81
+ .third-hexagon {
82
+ .hexagon(14px, #A5C85F);
83
+ margin-left: 13px;
84
+ margin-top: -2px;
85
+ }
86
+ }
87
+
88
+ .itsf-logo-128 {
89
+ display: inline-block;
90
+
91
+ .first-hexagon {
92
+ .hexagon(34px, #58585A);
93
+ display: inline-block;
94
+ }
95
+
96
+ .second-hexagon {
97
+ .hexagon(34px, #81C5E2);
98
+ display: inline-block;
99
+ margin-left: 1px;
100
+ }
101
+
102
+ .third-hexagon {
103
+ .hexagon(34px, #A5C85F);
104
+ margin-left: 32px;
105
+ margin-top: -1px;
106
+ }
107
+ }
@@ -0,0 +1,5 @@
1
+ #navigation-logo {
2
+ margin-top: 6px;
3
+ margin-right: 8px;
4
+
5
+ }
@@ -0,0 +1,8 @@
1
+ .panel {
2
+ .panel-footer {
3
+ .pagination {
4
+ margin-top: 0;
5
+ margin-bottom: 0;
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,21 @@
1
+ .panel-with-actions {
2
+ .panel-heading {
3
+ display: table;
4
+ width: 100%;
5
+ }
6
+ .panel-heading .panel-title {
7
+ display: table-cell;
8
+ vertical-align: middle;
9
+ text-align: left;
10
+ }
11
+ .panel-heading .panel-actions {
12
+ display: table-cell;
13
+ vertical-align: middle;
14
+ text-align: right;
15
+ }
16
+
17
+ .panel-heading {
18
+ h1, h2, h3, h4, h5, h6 { display: inline-block; margin-top: 0px; margin-bottom: 0px; }
19
+ .label { display: inline-block; vertical-align: middle; margin-top: -0.2em; padding: .2em .6em .2em; }
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ th[role=actions] {
2
+
3
+ }
4
+
5
+ td[role=actions] {
6
+ .btn-group {
7
+ display: flex;
8
+ }
9
+ }
@@ -0,0 +1,3 @@
1
+ .table-responsive {
2
+ overflow-x: auto;
3
+ }
@@ -0,0 +1,34 @@
1
+ @import "twitter/bootstrap/bootstrap";
2
+
3
+ // Set the correct sprite paths
4
+ @iconSpritePath: image-url("twitter/bootstrap/glyphicons-halflings.png");
5
+ @iconWhiteSpritePath: image-url("twitter/bootstrap/glyphicons-halflings-white.png");
6
+
7
+ // Set the Font Awesome (Font Awesome is default. You can disable by commenting below lines)
8
+ //@fontAwesomeEotPath: font-url("fontawesome-webfont.eot");
9
+ //@fontAwesomeEotPath_iefix: font-url("fontawesome-webfont.eot?#iefix");
10
+ //@fontAwesomeWoffPath: font-url("fontawesome-webfont.woff");
11
+ //@fontAwesomeTtfPath: font-url("fontawesome-webfont.ttf");
12
+ //@fontAwesomeSvgPath: font-url("fontawesome-webfont.svg#fontawesomeregular");
13
+ //@import "fontawesome/font-awesome";
14
+
15
+ // Glyphicons are not required by default, uncomment the following lines to enable them.
16
+ @glyphiconsEotPath: font-url("glyphicons-halflings-regular.eot");
17
+ @glyphiconsEotPath_iefix: font-url("glyphicons-halflings-regular.eot?#iefix");
18
+ @glyphiconsWoffPath: font-url("glyphicons-halflings-regular.woff");
19
+ @glyphiconsTtfPath: font-url("glyphicons-halflings-regular.ttf");
20
+ @glyphiconsSvgPath: font-url("glyphicons-halflings-regular.svg#glyphicons_halflingsregular");
21
+
22
+ @import "twitter/bootstrap/glyphicons.less";
23
+
24
+ // Your custom LESS stylesheets goes here
25
+ //
26
+ // Since bootstrap was imported above you have access to its mixins which
27
+ // you may use and inherit here
28
+ //
29
+ // If you'd like to override bootstrap's own variables, you can do so here as well
30
+ // See http://twitter.github.com/bootstrap/customize.html#variables for their names and documentation
31
+ //
32
+ // Example:
33
+ // @link-color: #ff0000;
34
+ @icon-font-path: "/assets/";
@@ -0,0 +1 @@
1
+ .timeline,.timeline *,.timeline ::before,.timeline::before{box-sizing:border-box}.timeline{position:relative;font-size:1em;width:100%;height:100%;margin:0 auto;overflow-y:hidden}.timeline .timeline-block{margin:40px 0}.timeline .timeline-icon{position:absolute;width:32px;height:32px;left:50%;margin-left:-16px;margin-top:-2px;border:4px solid #FF6961;border-radius:100%;background-color:#fff;text-align:center}.timeline .timeline-icon.timeline-icon-hide-border{border:0}.timeline .timeline-icon.timeline-icon-hide-border i.fa,.timeline .timeline-icon.timeline-icon-hide-border img{margin-left:0;margin-top:0}.timeline .timeline-icon i.fa,.timeline .timeline-icon img{display:inline-block;width:32px;height:32px;margin-left:-4px;margin-top:-4px;vertical-align:bottom;line-height:32px;text-align:center;font-size:30px}.timeline .timeline-icon img{border-radius:100%}.timeline .timeline-content{position:relative;width:45%;padding:12px;background-color:#EEE;border:1px solid #e5e5e5;line-height:20px;min-height:64px}.timeline.gray-blue::before,.timeline.gray-red::before,.timeline::before{background-color:#CFCFC4}.timeline.gray-blue.timeline-with-arrows .timeline-content::before,.timeline.gray-blue.timeline-with-arrows.timeline-alternating .timeline-content::before,.timeline.gray-red.timeline-with-arrows .timeline-content::before,.timeline.gray-red.timeline-with-arrows.timeline-alternating .timeline-content::before{border-left-color:#e5e5e5}.timeline.gray-blue.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.gray-blue.timeline-with-arrows.timeline-left .timeline-content::before,.timeline.gray-red.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.gray-red.timeline-with-arrows.timeline-left .timeline-content::before{border-right-color:#e5e5e5}.timeline .timeline-date{position:absolute;width:auto;top:0;left:118%;font-size:80%}.timeline::before{position:absolute;width:2px;height:100%;top:0;left:50%;margin-left:-1px;content:""}@media screen and (min-width:800px){.timeline.timeline-alternating:not(.timeline-left) .timeline-block:nth-of-type(2n) .timeline-content{left:55%}.timeline.timeline-alternating:not(.timeline-left) .timeline-block:nth-of-type(2n) .timeline-date{left:auto;right:118%;margin-left:-400px}}@media screen and (max-width:800px){.timeline.timeline-collapsing::before{left:auto;margin-left:140px}.timeline.timeline-collapsing .timeline-block{margin-left:174px;margin-right:10px}.timeline.timeline-collapsing .timeline-icon{left:auto;margin-left:-49px}.timeline.timeline-collapsing .timeline-content{width:auto}.timeline.timeline-collapsing .timeline-date{width:auto;left:0;margin-left:-130px;text-align:right}.timeline.gray-red.timeline-with-arrows.timeline-collapsing .timeline-content::before{border-right-color:#e5e5e5}}.timeline.timeline-left::before{left:auto;margin-left:140px}.timeline.timeline-left .timeline-block{margin-left:174px;margin-right:10px}.timeline.timeline-left .timeline-icon{left:auto;margin-left:-49px}.timeline.timeline-left .timeline-content{width:auto}.timeline.timeline-left .timeline-date{width:auto;left:0;margin-left:-130px;text-align:right}.timeline.gray-red .timeline-icon{border-color:#C23B22}.timeline.gray-red .timeline-content,.timeline.gray-red .timeline-icon.timeline-icon-text span{border-color:#e5e5e5}.timeline.gray-blue .timeline-icon{border-color:#779ECB}.timeline.gray-blue .timeline-content,.timeline.gray-blue .timeline-icon.timeline-icon-text span{border-color:#e5e5e5}.timeline.blue-yellow-yellow.timeline-with-arrows .timeline-content::before,.timeline.blue-yellow-yellow.timeline-with-arrows.timeline-alternating .timeline-content::before{border-left-color:#AEC6CF}@media screen and (max-width:800px){.timeline.gray-blue.timeline-with-arrows.timeline-collapsing .timeline-content::before{border-right-color:#e5e5e5}.timeline.blue-yellow-yellow.timeline-with-arrows.timeline-collapsing .timeline-content::before{border-right-color:#AEC6CF}}.timeline.blue-yellow-yellow.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.blue-yellow-yellow.timeline-with-arrows.timeline-left .timeline-content::before{border-right-color:#AEC6CF}.timeline.blue-yellow-yellow::before{background-color:#AEC6CF}.timeline.blue-yellow-yellow .timeline-icon{border-color:#FFB347}.timeline.blue-yellow-yellow .timeline-content,.timeline.blue-yellow-yellow .timeline-icon.timeline-icon-text span{border-color:#AEC6CF}.timeline.blue-red-red.timeline-with-arrows .timeline-content::before,.timeline.blue-red-red.timeline-with-arrows.timeline-alternating .timeline-content::before{border-left-color:#C23B22}.timeline.blue-red-red.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.blue-red-red.timeline-with-arrows.timeline-left .timeline-content::before{border-right-color:#C23B22}.timeline.blue-red-red::before{background-color:#779ECB}.timeline.blue-red-red .timeline-content,.timeline.blue-red-red .timeline-icon,.timeline.blue-red-red .timeline-icon.timeline-icon-text span{border-color:#C23B22}.timeline.purple-flirt.timeline-with-arrows .timeline-content::before,.timeline.purple-flirt.timeline-with-arrows.timeline-alternating .timeline-content::before{border-left-color:#e5e5e5}@media screen and (max-width:800px){.timeline.blue-red-red.timeline-with-arrows.timeline-collapsing .timeline-content::before{border-right-color:#C23B22}.timeline.purple-flirt.timeline-with-arrows.timeline-collapsing .timeline-content::before{border-right-color:#e5e5e5}}.timeline.purple-flirt.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.purple-flirt.timeline-with-arrows.timeline-left .timeline-content::before{border-right-color:#e5e5e5}.timeline.purple-flirt::before{background-color:#B19CD9}.timeline.purple-flirt .timeline-icon{border-color:#A2006D}.timeline.purple-flirt .timeline-content,.timeline.purple-flirt .timeline-icon.timeline-icon-text span{border-color:#e5e5e5}.timeline.blue-blue-blue.timeline-with-arrows .timeline-content::before,.timeline.blue-blue-blue.timeline-with-arrows.timeline-alternating .timeline-content::before{border-left-color:#AEC6CF}.timeline.blue-blue-blue.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.blue-blue-blue.timeline-with-arrows.timeline-left .timeline-content::before{border-right-color:#AEC6CF}.timeline.blue-blue-blue::before{background-color:#AEC6CF}.timeline.blue-blue-blue .timeline-content,.timeline.blue-blue-blue .timeline-icon,.timeline.blue-blue-blue .timeline-icon.timeline-icon-text span{border-color:#AEC6CF}@media screen and (max-width:800px){.timeline.blue-blue-blue.timeline-with-arrows.timeline-collapsing .timeline-content::before{border-right-color:#AEC6CF}}.timeline.timeline-with-arrows .timeline-content::after,.timeline.timeline-with-arrows .timeline-content::before{left:100%;top:0;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}.timeline.timeline-with-arrows .timeline-content::after{border-left-color:#EEE;border-width:14px;margin-left:0;margin-top:0}.timeline.timeline-with-arrows .timeline-content::before{border-left-color:#e5e5e5;border-width:15px;margin-left:1px;margin-top:-1px}.timeline.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::after,.timeline.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before,.timeline.timeline-with-arrows.timeline-left .timeline-content::after,.timeline.timeline-with-arrows.timeline-left .timeline-content::before{right:100%;border-left-color:transparent!important;left:0}.timeline.timeline-with-arrows.timeline-left .timeline-content::after{border-right-color:#EEE;margin-left:-28px}.timeline.timeline-with-arrows.timeline-left .timeline-content::before{border-right-color:#e5e5e5;margin-top:-1px;margin-left:-31px}.timeline.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::after{border-right-color:#EEE;margin-left:-28px}.timeline.timeline-with-arrows.timeline-alternating .timeline-block:nth-of-type(2n) .timeline-content::before{border-right-color:#e5e5e5;margin-top:-1px;margin-left:-31px}@media screen and (max-width:800px){.timeline.timeline-with-arrows .timeline-content::after,.timeline.timeline-with-arrows .timeline-content::before{left:0;right:100%;border-left-color:transparent!important}.timeline.timeline-with-arrows .timeline-content::after{border-right-color:#EEE;margin-left:-28px}.timeline.timeline-with-arrows .timeline-content::before{border-right-color:#e5e5e5;margin-top:-1px;margin-left:-31px}}.timeline-icon.timeline-icon-text{left:0;width:100%;margin:0;text-align:center;height:40px;line-height:40px;border-radius:0;background-color:transparent}.timeline-icon.timeline-icon-text span{display:inline-block;width:auto;background-color:#EEE;border:1px solid #e5e5e5;padding:0 10px}@media screen and (max-width:800px){.timeline-icon.timeline-icon-text{left:auto;width:auto;margin-left:0!important}}.timeline.timeline-left .timeline-icon.timeline-icon-text{left:auto;width:auto;margin-left:0!important}.timeline-block.timeline-block-icon-only .timeline-content{visibility:hidden}
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= require itsf/backend/application
3
+ */
@@ -0,0 +1,12 @@
1
+ module Routing
2
+ module ServiceConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ def service(service_name)
6
+ resources service_name, only: [:index] do
7
+ get :invoke, on: :collection
8
+ post :call, on: :collection
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,13 @@
1
+ module Controller
2
+ module ActsAsListConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ def reposition
6
+ @resource = load_resource
7
+ @dropped_resource = resource_class.find(params[:dropped_id])
8
+ @dropped_resource.set_list_position(@resource.position)
9
+ position = @dropped_resource.position < @resource.position ? :before : :after
10
+ redirect_to collection_path, notice: I18n.t("acts_as_list.inserted_#{position}", target_resource: @resource.try_all(*Itsf::Backend::Configuration.resource_title_methods), inserted_resource: @dropped_resource.try_all(*Itsf::Backend::Configuration.resource_title_methods))
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Controller
2
+ module ActsAsPublishedConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ def toggle_published
6
+ @resource = load_resource
7
+ @resource.toggle_published!
8
+ action_taken = @resource.published? ? 'published' : 'unpublished'
9
+ resource_label = @resource.try_all(*Itsf::Backend::Configuration.resource_title_methods)
10
+ redirect_to :back, notice: I18n.t("acts_as_published.notices.#{action_taken}", name: resource_label)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,15 @@
1
+ module Controller
2
+ module PaginationConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ private
6
+
7
+ def load_collection
8
+ collection_scope.page(params[:page]).per(pagination_size)
9
+ end
10
+
11
+ def pagination_size
12
+ Itsf::Backend::Configuration.default_pagination_size
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,19 @@
1
+ module Controller
2
+ module PunditNamespacedAuthorizeConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ helper_method :engine_policy
7
+ end
8
+
9
+ def authorize(policy, action, namespace = nil)
10
+ policy = "#{namespace}::#{policy.to_s.camelize}".to_sym if namespace.present?
11
+ super(policy, action)
12
+ end
13
+
14
+ def engine_policy(engine)
15
+ policy_name = engine.name.to_sym
16
+ policy(policy_name)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ module Controller
2
+ module RansackConcern
3
+ extend ActiveSupport::Concern
4
+
5
+ private
6
+
7
+ def collection_scope
8
+ @q = collection_scope_with_search_scopes(resource_class).ransack(params[:q])
9
+ @q.result(distinct: true)
10
+ end
11
+
12
+ def collection_scope_with_search_scopes(base_scope)
13
+ final_scope = base_scope
14
+ search_scopes.each do |scope|
15
+ final_scope = final_scope.send(scope)
16
+ end
17
+ final_scope
18
+ end
19
+
20
+ def search_scopes
21
+ return [] unless params.key?(:q) && params[:q].key?(:scopes)
22
+ params[:q][:scopes].keys - ['unscoped']
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,93 @@
1
+ module Controller
2
+ module RestActionsConcernWithPundit
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ respond_to :html
7
+ responders :flash
8
+ end
9
+
10
+ def index
11
+ if Itsf::Backend.features?(:ransack)
12
+ @q = collection_scope_with_search_scopes(collection_scope).ransack(params[:q])
13
+ @collection = @q.result.page(params[:page]).per(pagination_size)
14
+ else
15
+ @collection = collection_scope.page(params[:page]).per(pagination_size)
16
+ end
17
+ authorize_action
18
+ respond_with @collection
19
+ end
20
+
21
+ def new
22
+ @resource = resource_class.new
23
+ authorize_action
24
+ respond_with @resource
25
+ end
26
+
27
+ def create
28
+ @resource = resource_class.new(permitted_params)
29
+ authorize_action
30
+ @resource.save
31
+ respond_with @resource, location: collection_path
32
+ end
33
+
34
+ def show
35
+ @resource = load_resource
36
+ authorize_action
37
+ respond_with @resource
38
+ end
39
+
40
+ def edit
41
+ @resource = load_resource
42
+ authorize_action
43
+ respond_with @resource
44
+ end
45
+
46
+ def update
47
+ @resource = load_resource
48
+ authorize_action
49
+ @resource.update_attributes(permitted_params)
50
+ respond_with @resource, location: collection_path
51
+ end
52
+
53
+ def destroy
54
+ @resource = load_resource
55
+ authorize_action
56
+ @resource.destroy
57
+ respond_with @resource, location: collection_path
58
+ end
59
+
60
+ private
61
+
62
+ def authorize_action
63
+ action = action_name.to_sym
64
+ case action
65
+ when :index
66
+ authorize resource_class, :index?
67
+ else
68
+ authorize @resource, "#{action}?".to_sym
69
+ end
70
+ end
71
+
72
+ def collection_scope_with_search_scopes
73
+ final_scope = collection_scope
74
+ search_scopes.each do |scope|
75
+ final_scope = final_scope.send(scope)
76
+ end
77
+ final_scope
78
+ end
79
+
80
+ def collection_scope
81
+ resource_class
82
+ end
83
+
84
+ def load_resource
85
+ resource_class.find(params[:id])
86
+ end
87
+
88
+ def search_scopes
89
+ return [] unless params.key?(:q) && params[:q].key?(:scopes)
90
+ params[:q][:scopes].keys - ['unscoped']
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,6 @@
1
+ module Itsf
2
+ module Backend
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,34 @@
1
+ require 'ransack' if Itsf::Backend.features?(:ransack)
2
+ require 'kaminari' if Itsf::Backend.features?(:kaminari)
3
+
4
+ module Itsf::Backend
5
+ class BaseController < Configuration.resource_base_controller.constantize
6
+ if Itsf::Backend.features?(:pundit)
7
+ include Controller::RestActionsConcernWithPundit
8
+ include Pundit
9
+ prepend Controller::PunditNamespacedAuthorizeConcern
10
+ helper_method :engine_policy
11
+ else
12
+ include Controller::RestActionsConcern
13
+ end
14
+ include Controller::ResourceUrlsConcern
15
+ include Controller::ResourceInflectionsConcern
16
+ include Controller::RansackConcern if Itsf::Backend.features?(:ransack)
17
+ include Controller::PaginationConcern if Itsf::Backend.features?(:kaminari)
18
+ include Controller::JsonApiConcern
19
+ helper Itsf::Backend::ApplicationHelper
20
+ helper MultiClientHelper if Itsf::Backend.features?(:multi_client)
21
+
22
+ helper_method :resource_class
23
+
24
+ helper ResourceRenderer::ViewHelper
25
+
26
+ def self.resource_class
27
+ name.gsub('Controller', '').constantize
28
+ end
29
+
30
+ def resource_class
31
+ self.class.resource_class
32
+ end
33
+ end
34
+ end