outpost-cms 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +295 -0
  3. data/Rakefile +26 -0
  4. data/app/assets/images/glyphicons-halflings-red.png +0 -0
  5. data/app/assets/javascripts/outpost/application.js +1 -0
  6. data/app/assets/javascripts/outpost/auto_slug_field.js.coffee +53 -0
  7. data/app/assets/javascripts/outpost/base.js.coffee +1 -0
  8. data/app/assets/javascripts/outpost/date_time_input.js.coffee +108 -0
  9. data/app/assets/javascripts/outpost/field_counter.js.coffee +93 -0
  10. data/app/assets/javascripts/outpost/field_manager.js.coffee +37 -0
  11. data/app/assets/javascripts/outpost/global_plugins.js.coffee +87 -0
  12. data/app/assets/javascripts/outpost/index_manager.js.coffee +88 -0
  13. data/app/assets/javascripts/outpost/notification.js.coffee +46 -0
  14. data/app/assets/javascripts/outpost/preview.js.coffee +60 -0
  15. data/app/assets/javascripts/outpost/templates/date_field.jst.eco +3 -0
  16. data/app/assets/javascripts/outpost/templates/loading.jst.eco +11 -0
  17. data/app/assets/javascripts/outpost/templates/slug_generate_button.jst.eco +1 -0
  18. data/app/assets/javascripts/outpost/templates/time_field.jst.eco +3 -0
  19. data/app/assets/javascripts/outpost/templates.js +1 -0
  20. data/app/assets/javascripts/outpost.js +32 -0
  21. data/app/assets/stylesheets/outpost/_base.css.scss +127 -0
  22. data/app/assets/stylesheets/outpost/_edit.css.scss +13 -0
  23. data/app/assets/stylesheets/outpost/_forms.css.scss +116 -0
  24. data/app/assets/stylesheets/outpost/_index.css.scss +68 -0
  25. data/app/assets/stylesheets/outpost/_utility.css.scss +16 -0
  26. data/app/assets/stylesheets/outpost/application.css.scss +1 -0
  27. data/app/assets/stylesheets/outpost/bootstrap/bootstrap.css.scss +49 -0
  28. data/app/assets/stylesheets/outpost/bootstrap/datepicker.css.scss +301 -0
  29. data/app/assets/stylesheets/outpost.css.scss +14 -0
  30. data/app/controllers/outpost/application_controller.rb +40 -0
  31. data/app/controllers/outpost/base_controller.rb +3 -0
  32. data/app/controllers/outpost/errors_controller.rb +9 -0
  33. data/app/controllers/outpost/home_controller.rb +2 -0
  34. data/app/controllers/outpost/resource_controller.rb +12 -0
  35. data/app/controllers/outpost/sessions_controller.rb +36 -0
  36. data/app/helpers/authorization_helper.rb +44 -0
  37. data/app/helpers/list_helper.rb +243 -0
  38. data/app/helpers/outpost_helper.rb +49 -0
  39. data/app/helpers/render_helper.rb +41 -0
  40. data/app/helpers/utility_helper.rb +136 -0
  41. data/app/inputs/date_time_input.rb +12 -0
  42. data/app/models/permission.rb +18 -0
  43. data/app/models/user_permission.rb +4 -0
  44. data/app/views/kaminari/bootstrap/_first_page.html.erb +3 -0
  45. data/app/views/kaminari/bootstrap/_gap.html.erb +3 -0
  46. data/app/views/kaminari/bootstrap/_last_page.html.erb +3 -0
  47. data/app/views/kaminari/bootstrap/_next_page.html.erb +3 -0
  48. data/app/views/kaminari/bootstrap/_page.html.erb +3 -0
  49. data/app/views/kaminari/bootstrap/_paginator.html.erb +17 -0
  50. data/app/views/kaminari/bootstrap/_prev_page.html.erb +3 -0
  51. data/app/views/layouts/outpost/application.html.erb +101 -0
  52. data/app/views/layouts/outpost/minimal.html.erb +26 -0
  53. data/app/views/outpost/errors/error_404.html.erb +1 -0
  54. data/app/views/outpost/errors/error_500.html.erb +8 -0
  55. data/app/views/outpost/home/dashboard.html.erb +1 -0
  56. data/app/views/outpost/resource/_errors.html.erb +11 -0
  57. data/app/views/outpost/resource/_extra_fields.html.erb +1 -0
  58. data/app/views/outpost/resource/_form_fields.html.erb +9 -0
  59. data/app/views/outpost/resource/edit.html.erb +44 -0
  60. data/app/views/outpost/resource/index.html.erb +22 -0
  61. data/app/views/outpost/resource/new.html.erb +21 -0
  62. data/app/views/outpost/resource/search.html.erb +1 -0
  63. data/app/views/outpost/resource/show.html.erb +1 -0
  64. data/app/views/outpost/sessions/new.html.erb +16 -0
  65. data/app/views/outpost/shared/_add_link.html.erb +1 -0
  66. data/app/views/outpost/shared/_breadcrumbs.html.erb +15 -0
  67. data/app/views/outpost/shared/_cancel_link.html.erb +1 -0
  68. data/app/views/outpost/shared/_columns.html.erb +5 -0
  69. data/app/views/outpost/shared/_filters.html.erb +16 -0
  70. data/app/views/outpost/shared/_flash_messages.html.erb +6 -0
  71. data/app/views/outpost/shared/_form_block.html.erb +18 -0
  72. data/app/views/outpost/shared/_form_nav.html.erb +12 -0
  73. data/app/views/outpost/shared/_headers.html.erb +16 -0
  74. data/app/views/outpost/shared/_index_header.html.erb +4 -0
  75. data/app/views/outpost/shared/_list_table.html.erb +7 -0
  76. data/app/views/outpost/shared/_modal.html.erb +16 -0
  77. data/app/views/outpost/shared/_navigation.html.erb +31 -0
  78. data/app/views/outpost/shared/_notice.html.erb +1 -0
  79. data/app/views/outpost/shared/_pagination.html.erb +2 -0
  80. data/app/views/outpost/shared/_preview_errors.html.erb +9 -0
  81. data/app/views/outpost/shared/_submit_row.html.erb +50 -0
  82. data/config/routes.rb +4 -0
  83. data/lib/action_view/helpers/form_builder.rb +71 -0
  84. data/lib/outpost/breadcrumbs.rb +73 -0
  85. data/lib/outpost/config.rb +63 -0
  86. data/lib/outpost/controller/actions.rb +72 -0
  87. data/lib/outpost/controller/authentication.rb +34 -0
  88. data/lib/outpost/controller/authorization.rb +28 -0
  89. data/lib/outpost/controller/callbacks.rb +14 -0
  90. data/lib/outpost/controller/custom_errors.rb +41 -0
  91. data/lib/outpost/controller/filtering.rb +22 -0
  92. data/lib/outpost/controller/helpers.rb +52 -0
  93. data/lib/outpost/controller/ordering.rb +46 -0
  94. data/lib/outpost/controller/preferences.rb +71 -0
  95. data/lib/outpost/controller.rb +123 -0
  96. data/lib/outpost/engine.rb +10 -0
  97. data/lib/outpost/helpers/naming.rb +22 -0
  98. data/lib/outpost/helpers.rb +6 -0
  99. data/lib/outpost/hook.rb +35 -0
  100. data/lib/outpost/list/base.rb +78 -0
  101. data/lib/outpost/list/column.rb +24 -0
  102. data/lib/outpost/list/filter.rb +37 -0
  103. data/lib/outpost/list.rb +15 -0
  104. data/lib/outpost/model/authentication.rb +34 -0
  105. data/lib/outpost/model/authorization.rb +32 -0
  106. data/lib/outpost/model/identifier.rb +39 -0
  107. data/lib/outpost/model/methods.rb +23 -0
  108. data/lib/outpost/model/naming.rb +63 -0
  109. data/lib/outpost/model/routing.rb +138 -0
  110. data/lib/outpost/model/serializer.rb +27 -0
  111. data/lib/outpost/model.rb +22 -0
  112. data/lib/outpost/test.rb +21 -0
  113. data/lib/outpost/version.rb +3 -0
  114. data/lib/outpost-cms.rb +2 -0
  115. data/lib/outpost.rb +80 -0
  116. data/lib/tasks/outpost_tasks.rake +7 -0
  117. data/spec/controllers/authentication_spec.rb +62 -0
  118. data/spec/controllers/sessions_controller_spec.rb +99 -0
  119. data/spec/factories.rb +31 -0
  120. data/spec/helpers/authorization_helper_spec.rb +47 -0
  121. data/spec/helpers/list_helper_spec.rb +74 -0
  122. data/spec/helpers/outpost_helper_spec.rb +5 -0
  123. data/spec/helpers/render_helper_spec.rb +19 -0
  124. data/spec/helpers/utility_helper_spec.rb +53 -0
  125. data/spec/internal/app/controllers/application_controller.rb +3 -0
  126. data/spec/internal/app/controllers/outpost/people_controller.rb +23 -0
  127. data/spec/internal/app/controllers/outpost/pidgeons_controller.rb +5 -0
  128. data/spec/internal/app/controllers/people_controller.rb +9 -0
  129. data/spec/internal/app/controllers/pidgeons_controller.rb +3 -0
  130. data/spec/internal/app/models/person.rb +10 -0
  131. data/spec/internal/app/models/pidgeon.rb +3 -0
  132. data/spec/internal/app/models/post.rb +4 -0
  133. data/spec/internal/app/models/user.rb +4 -0
  134. data/spec/internal/app/views/people/index.html.erb +7 -0
  135. data/spec/internal/app/views/people/show.html.erb +1 -0
  136. data/spec/internal/config/database.yml +3 -0
  137. data/spec/internal/config/initializers/configuration.rb +3 -0
  138. data/spec/internal/config/initializers/outpost.rb +6 -0
  139. data/spec/internal/config/routes.rb +16 -0
  140. data/spec/internal/db/combustion_test.sqlite +0 -0
  141. data/spec/internal/db/schema.rb +44 -0
  142. data/spec/internal/db/seeds.rb +14 -0
  143. data/spec/internal/log/test.log +59277 -0
  144. data/spec/internal/public/favicon.ico +0 -0
  145. data/spec/lib/breadcrumbs_spec.rb +54 -0
  146. data/spec/lib/config_spec.rb +76 -0
  147. data/spec/lib/controller/actions_spec.rb +5 -0
  148. data/spec/lib/controller/authorization_spec.rb +4 -0
  149. data/spec/lib/controller/callbacks_spec.rb +31 -0
  150. data/spec/lib/controller/helpers_spec.rb +33 -0
  151. data/spec/lib/controller_spec.rb +25 -0
  152. data/spec/lib/helpers/naming_spec.rb +10 -0
  153. data/spec/lib/hook_spec.rb +13 -0
  154. data/spec/lib/list/base_spec.rb +96 -0
  155. data/spec/lib/list/column_spec.rb +46 -0
  156. data/spec/lib/list/filter_spec.rb +44 -0
  157. data/spec/lib/model/authentication_spec.rb +29 -0
  158. data/spec/lib/model/authorization_spec.rb +66 -0
  159. data/spec/lib/model/identifier_spec.rb +51 -0
  160. data/spec/lib/model/methods_spec.rb +8 -0
  161. data/spec/lib/model/naming_spec.rb +55 -0
  162. data/spec/lib/model/routing_spec.rb +166 -0
  163. data/spec/lib/model/serializer_spec.rb +13 -0
  164. data/spec/lib/outpost_spec.rb +34 -0
  165. data/spec/models/permission_spec.rb +10 -0
  166. data/spec/models/user_permission_spec.rb +4 -0
  167. data/spec/spec_helper.rb +22 -0
  168. metadata +411 -0
@@ -0,0 +1,49 @@
1
+ // Core variables and mixins
2
+ // Must be first
3
+ @import "bootstrap/variables"; // Modify this for custom colors, font-sizes, etc
4
+ @import "bootstrap/mixins";
5
+
6
+ // CSS Reset
7
+ @import "bootstrap/reset";
8
+
9
+ // Grid system and page structure
10
+ @import "bootstrap/scaffolding";
11
+ @import "bootstrap/grid";
12
+ @import "bootstrap/layouts";
13
+
14
+ // Base CSS
15
+ @import "bootstrap/type";
16
+ @import "bootstrap/code";
17
+ @import "bootstrap/forms";
18
+ @import "bootstrap/tables";
19
+
20
+ // Components: common
21
+ @import "bootstrap/sprites";
22
+ @import "bootstrap/dropdowns";
23
+ @import "bootstrap/wells";
24
+ @import "bootstrap/component-animations";
25
+ @import "bootstrap/close";
26
+
27
+ // Components: Buttons & Alerts
28
+ @import "bootstrap/buttons";
29
+ @import "bootstrap/button-groups";
30
+ @import "bootstrap/alerts"; // Note: alerts share common CSS with buttons and thus have styles in buttons
31
+
32
+ // Components: Nav
33
+ @import "bootstrap/navs";
34
+ @import "bootstrap/navbar";
35
+ @import "bootstrap/breadcrumbs";
36
+ @import "bootstrap/pagination";
37
+ @import "bootstrap/pager";
38
+
39
+ // Components: Popovers
40
+ @import "bootstrap/modals";
41
+
42
+ // Components: Misc
43
+ @import "bootstrap/labels-badges";
44
+ //@import "progress-bars";
45
+
46
+ // Utility classes
47
+ @import "bootstrap/utilities"; // Has to be last to override when necessary
48
+
49
+ @import "outpost/bootstrap/datepicker"
@@ -0,0 +1,301 @@
1
+ /*!
2
+ * Datepicker for Bootstrap
3
+ *
4
+ * Copyright 2012 Stefan Petre
5
+ * Improvements by Andrew Rowls
6
+ * Licensed under the Apache License v2.0
7
+ * http://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ */
10
+ .datepicker {
11
+ padding: 4px;
12
+ /* margin-top: 1px; */
13
+ -webkit-border-radius: 4px;
14
+ -moz-border-radius: 4px;
15
+ border-radius: 4px;
16
+ direction: ltr;
17
+ /*.dow {
18
+ border-top: 1px solid #ddd !important;
19
+ }*/
20
+
21
+ }
22
+ .datepicker-inline {
23
+ width: 220px;
24
+ }
25
+ .datepicker.datepicker-rtl {
26
+ direction: rtl;
27
+ }
28
+ .datepicker.datepicker-rtl table tr td span {
29
+ float: right;
30
+ }
31
+ .datepicker-dropdown {
32
+ top: 0;
33
+ left: 0;
34
+ }
35
+ .datepicker-dropdown:before {
36
+ content: '';
37
+ display: inline-block;
38
+ border-left: 7px solid transparent;
39
+ border-right: 7px solid transparent;
40
+ border-bottom: 7px solid #ccc;
41
+ border-bottom-color: rgba(0, 0, 0, 0.2);
42
+ position: absolute;
43
+ top: -7px;
44
+ left: 6px;
45
+ }
46
+ .datepicker-dropdown:after {
47
+ content: '';
48
+ display: inline-block;
49
+ border-left: 6px solid transparent;
50
+ border-right: 6px solid transparent;
51
+ border-bottom: 6px solid #ffffff;
52
+ position: absolute;
53
+ top: -6px;
54
+ left: 7px;
55
+ }
56
+ .datepicker > div {
57
+ display: none;
58
+ }
59
+ .datepicker.days div.datepicker-days {
60
+ display: block;
61
+ }
62
+ .datepicker.months div.datepicker-months {
63
+ display: block;
64
+ }
65
+ .datepicker.years div.datepicker-years {
66
+ display: block;
67
+ }
68
+ .datepicker table {
69
+ margin: 0;
70
+ }
71
+ .datepicker td,
72
+ .datepicker th {
73
+ text-align: center;
74
+ width: 20px;
75
+ height: 20px;
76
+ -webkit-border-radius: 4px;
77
+ -moz-border-radius: 4px;
78
+ border-radius: 4px;
79
+ border: none;
80
+ }
81
+ .table-striped .datepicker table tr td,
82
+ .table-striped .datepicker table tr th {
83
+ background-color: transparent;
84
+ }
85
+ .datepicker table tr td.day:hover {
86
+ background: #eeeeee;
87
+ cursor: pointer;
88
+ }
89
+ .datepicker table tr td.old,
90
+ .datepicker table tr td.new {
91
+ color: #999999;
92
+ }
93
+ .datepicker table tr td.disabled,
94
+ .datepicker table tr td.disabled:hover {
95
+ background: none;
96
+ color: #999999;
97
+ cursor: default;
98
+ }
99
+ .datepicker table tr td.today,
100
+ .datepicker table tr td.today:hover,
101
+ .datepicker table tr td.today.disabled,
102
+ .datepicker table tr td.today.disabled:hover {
103
+ background-color: #fde19a;
104
+ background-image: -moz-linear-gradient(top, #fdd49a, #fdf59a);
105
+ background-image: -ms-linear-gradient(top, #fdd49a, #fdf59a);
106
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#fdd49a), to(#fdf59a));
107
+ background-image: -webkit-linear-gradient(top, #fdd49a, #fdf59a);
108
+ background-image: -o-linear-gradient(top, #fdd49a, #fdf59a);
109
+ background-image: linear-gradient(top, #fdd49a, #fdf59a);
110
+ background-repeat: repeat-x;
111
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fdd49a', endColorstr='#fdf59a', GradientType=0);
112
+ border-color: #fdf59a #fdf59a #fbed50;
113
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
114
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
115
+ }
116
+ .datepicker table tr td.today:hover,
117
+ .datepicker table tr td.today:hover:hover,
118
+ .datepicker table tr td.today.disabled:hover,
119
+ .datepicker table tr td.today.disabled:hover:hover,
120
+ .datepicker table tr td.today:active,
121
+ .datepicker table tr td.today:hover:active,
122
+ .datepicker table tr td.today.disabled:active,
123
+ .datepicker table tr td.today.disabled:hover:active,
124
+ .datepicker table tr td.today.active,
125
+ .datepicker table tr td.today:hover.active,
126
+ .datepicker table tr td.today.disabled.active,
127
+ .datepicker table tr td.today.disabled:hover.active,
128
+ .datepicker table tr td.today.disabled,
129
+ .datepicker table tr td.today:hover.disabled,
130
+ .datepicker table tr td.today.disabled.disabled,
131
+ .datepicker table tr td.today.disabled:hover.disabled,
132
+ .datepicker table tr td.today[disabled],
133
+ .datepicker table tr td.today:hover[disabled],
134
+ .datepicker table tr td.today.disabled[disabled],
135
+ .datepicker table tr td.today.disabled:hover[disabled] {
136
+ background-color: #fdf59a;
137
+ }
138
+ .datepicker table tr td.today:active,
139
+ .datepicker table tr td.today:hover:active,
140
+ .datepicker table tr td.today.disabled:active,
141
+ .datepicker table tr td.today.disabled:hover:active,
142
+ .datepicker table tr td.today.active,
143
+ .datepicker table tr td.today:hover.active,
144
+ .datepicker table tr td.today.disabled.active,
145
+ .datepicker table tr td.today.disabled:hover.active {
146
+ background-color: #fbf069 \9;
147
+ }
148
+ .datepicker table tr td.active,
149
+ .datepicker table tr td.active:hover,
150
+ .datepicker table tr td.active.disabled,
151
+ .datepicker table tr td.active.disabled:hover {
152
+ background-color: #006dcc;
153
+ background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
154
+ background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
155
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
156
+ background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
157
+ background-image: -o-linear-gradient(top, #0088cc, #0044cc);
158
+ background-image: linear-gradient(top, #0088cc, #0044cc);
159
+ background-repeat: repeat-x;
160
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
161
+ border-color: #0044cc #0044cc #002a80;
162
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
163
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
164
+ color: #fff;
165
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
166
+ }
167
+ .datepicker table tr td.active:hover,
168
+ .datepicker table tr td.active:hover:hover,
169
+ .datepicker table tr td.active.disabled:hover,
170
+ .datepicker table tr td.active.disabled:hover:hover,
171
+ .datepicker table tr td.active:active,
172
+ .datepicker table tr td.active:hover:active,
173
+ .datepicker table tr td.active.disabled:active,
174
+ .datepicker table tr td.active.disabled:hover:active,
175
+ .datepicker table tr td.active.active,
176
+ .datepicker table tr td.active:hover.active,
177
+ .datepicker table tr td.active.disabled.active,
178
+ .datepicker table tr td.active.disabled:hover.active,
179
+ .datepicker table tr td.active.disabled,
180
+ .datepicker table tr td.active:hover.disabled,
181
+ .datepicker table tr td.active.disabled.disabled,
182
+ .datepicker table tr td.active.disabled:hover.disabled,
183
+ .datepicker table tr td.active[disabled],
184
+ .datepicker table tr td.active:hover[disabled],
185
+ .datepicker table tr td.active.disabled[disabled],
186
+ .datepicker table tr td.active.disabled:hover[disabled] {
187
+ background-color: #0044cc;
188
+ }
189
+ .datepicker table tr td.active:active,
190
+ .datepicker table tr td.active:hover:active,
191
+ .datepicker table tr td.active.disabled:active,
192
+ .datepicker table tr td.active.disabled:hover:active,
193
+ .datepicker table tr td.active.active,
194
+ .datepicker table tr td.active:hover.active,
195
+ .datepicker table tr td.active.disabled.active,
196
+ .datepicker table tr td.active.disabled:hover.active {
197
+ background-color: #003399 \9;
198
+ }
199
+ .datepicker table tr td span {
200
+ display: block;
201
+ width: 23%;
202
+ height: 54px;
203
+ line-height: 54px;
204
+ float: left;
205
+ margin: 1%;
206
+ cursor: pointer;
207
+ -webkit-border-radius: 4px;
208
+ -moz-border-radius: 4px;
209
+ border-radius: 4px;
210
+ }
211
+ .datepicker table tr td span:hover {
212
+ background: #eeeeee;
213
+ }
214
+ .datepicker table tr td span.disabled,
215
+ .datepicker table tr td span.disabled:hover {
216
+ background: none;
217
+ color: #999999;
218
+ cursor: default;
219
+ }
220
+ .datepicker table tr td span.active,
221
+ .datepicker table tr td span.active:hover,
222
+ .datepicker table tr td span.active.disabled,
223
+ .datepicker table tr td span.active.disabled:hover {
224
+ background-color: #006dcc;
225
+ background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
226
+ background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
227
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
228
+ background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
229
+ background-image: -o-linear-gradient(top, #0088cc, #0044cc);
230
+ background-image: linear-gradient(top, #0088cc, #0044cc);
231
+ background-repeat: repeat-x;
232
+ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
233
+ border-color: #0044cc #0044cc #002a80;
234
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
235
+ filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
236
+ color: #fff;
237
+ text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
238
+ }
239
+ .datepicker table tr td span.active:hover,
240
+ .datepicker table tr td span.active:hover:hover,
241
+ .datepicker table tr td span.active.disabled:hover,
242
+ .datepicker table tr td span.active.disabled:hover:hover,
243
+ .datepicker table tr td span.active:active,
244
+ .datepicker table tr td span.active:hover:active,
245
+ .datepicker table tr td span.active.disabled:active,
246
+ .datepicker table tr td span.active.disabled:hover:active,
247
+ .datepicker table tr td span.active.active,
248
+ .datepicker table tr td span.active:hover.active,
249
+ .datepicker table tr td span.active.disabled.active,
250
+ .datepicker table tr td span.active.disabled:hover.active,
251
+ .datepicker table tr td span.active.disabled,
252
+ .datepicker table tr td span.active:hover.disabled,
253
+ .datepicker table tr td span.active.disabled.disabled,
254
+ .datepicker table tr td span.active.disabled:hover.disabled,
255
+ .datepicker table tr td span.active[disabled],
256
+ .datepicker table tr td span.active:hover[disabled],
257
+ .datepicker table tr td span.active.disabled[disabled],
258
+ .datepicker table tr td span.active.disabled:hover[disabled] {
259
+ background-color: #0044cc;
260
+ }
261
+ .datepicker table tr td span.active:active,
262
+ .datepicker table tr td span.active:hover:active,
263
+ .datepicker table tr td span.active.disabled:active,
264
+ .datepicker table tr td span.active.disabled:hover:active,
265
+ .datepicker table tr td span.active.active,
266
+ .datepicker table tr td span.active:hover.active,
267
+ .datepicker table tr td span.active.disabled.active,
268
+ .datepicker table tr td span.active.disabled:hover.active {
269
+ background-color: #003399 \9;
270
+ }
271
+ .datepicker table tr td span.old {
272
+ color: #999999;
273
+ }
274
+ .datepicker th.switch {
275
+ width: 145px;
276
+ }
277
+ .datepicker thead tr:first-child th,
278
+ .datepicker tfoot tr:first-child th {
279
+ cursor: pointer;
280
+ }
281
+ .datepicker thead tr:first-child th:hover,
282
+ .datepicker tfoot tr:first-child th:hover {
283
+ background: #eeeeee;
284
+ }
285
+ .datepicker .cw {
286
+ font-size: 10px;
287
+ width: 12px;
288
+ padding: 0 2px 0 5px;
289
+ vertical-align: middle;
290
+ }
291
+ .datepicker thead tr:first-child th.cw {
292
+ cursor: default;
293
+ background-color: transparent;
294
+ }
295
+ .input-append.date .add-on i,
296
+ .input-prepend.date .add-on i {
297
+ display: block;
298
+ cursor: pointer;
299
+ width: 16px;
300
+ height: 16px;
301
+ }
@@ -0,0 +1,14 @@
1
+ $gridColumnWidth: 75px;
2
+ $navOffset: 40px;
3
+ $breadcrumbOffset: 36px;
4
+ $iconRedSpritePath: 'glyphicons-halflings-red.png';
5
+
6
+
7
+ @import "outpost/bootstrap/bootstrap";
8
+ @import "select2";
9
+
10
+ @import "outpost/base";
11
+ @import "outpost/edit";
12
+ @import "outpost/forms";
13
+ @import "outpost/index";
14
+ @import "outpost/utility";
@@ -0,0 +1,40 @@
1
+ module Outpost
2
+ class ApplicationController < ActionController::Base
3
+ include Outpost::Breadcrumbs
4
+ include Outpost::Controller::Authorization
5
+ include Outpost::Controller::Authentication
6
+ include Outpost::Controller::CustomErrors
7
+
8
+ abstract!
9
+ protect_from_forgery
10
+ before_filter :root_breadcrumb
11
+ before_filter :set_sections
12
+
13
+ #------------------------
14
+ # Always want to add this link to the Breadcrumbs
15
+ def root_breadcrumb
16
+ breadcrumb "Outpost", outpost_root_path
17
+ end
18
+
19
+ #----------------------
20
+
21
+ def set_sections
22
+ @sections = {}
23
+ end
24
+
25
+ #----------------------
26
+
27
+ def with_rollback(object)
28
+ object.transaction do
29
+ yield if block_given?
30
+ raise ActiveRecord::Rollback
31
+ end
32
+ end
33
+
34
+ #----------------------
35
+
36
+ def render_preview_validation_errors(record)
37
+ render "/outpost/shared/_preview_errors", layout: "outpost/minimal", locals: { record: record }
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ class Outpost::BaseController < Outpost::ApplicationController
2
+ include Outpost::Controller::CustomErrors
3
+ end
@@ -0,0 +1,9 @@
1
+ class Outpost::ErrorsController < Outpost::BaseController
2
+ def not_found
3
+ render_error(404, ActionController::RoutingError.new("Not Found")) and return
4
+ end
5
+
6
+ def trigger_error
7
+ raise StandardError, "This is a test error. It works (or does it?)"
8
+ end
9
+ end
@@ -0,0 +1,2 @@
1
+ class Outpost::HomeController < Outpost::BaseController
2
+ end
@@ -0,0 +1,12 @@
1
+ module Outpost
2
+ class ResourceController < Outpost::BaseController
3
+ before_filter :extend_breadcrumbs_with_resource_root
4
+ respond_to :html, :json, :js
5
+
6
+ #-----------------
7
+
8
+ def extend_breadcrumbs_with_resource_root
9
+ breadcrumb model.to_title.pluralize, model.admin_index_path
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,36 @@
1
+ module Outpost
2
+ class SessionsController < Outpost::BaseController
3
+ skip_before_filter :require_login
4
+ before_filter :get_authentication_attribute
5
+
6
+ respond_to :html
7
+
8
+ def new
9
+ redirect_to outpost_root_path if current_user
10
+ end
11
+
12
+ def create
13
+ if user = Outpost.user_class.authenticate(params[@authentication_attribute], params[:password])
14
+ session[:user_id] = user.id
15
+ user.update_column(:last_login, Time.now)
16
+ redirect_to session[:return_to] || outpost_root_path, notice: "Logged in."
17
+ session[:return_to] = nil
18
+ else
19
+ flash.now[:alert] = "Invalid login information."
20
+ render :new
21
+ end
22
+ end
23
+
24
+ def destroy
25
+ @current_user = nil
26
+ session[:user_id] = nil
27
+ redirect_to outpost_login_path, notice: "Logged Out."
28
+ end
29
+
30
+ private
31
+
32
+ def get_authentication_attribute
33
+ @authentication_attribute = Outpost.config.authentication_attribute
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,44 @@
1
+ module AuthorizationHelper
2
+ # Public: Block out whole chunks of code based on permissions.
3
+ #
4
+ # resource - (Class) The model that the user must have permission
5
+ # to manage in order to see the block.
6
+ # message - (String) The message to display if the user isn't
7
+ # authorized (default: "").
8
+ # block - The block that will be captured if the user is authorized.
9
+ # Should return a String.
10
+ #
11
+ # Examples
12
+ #
13
+ # <%= guard Post, "You do not have permission to view this" do %>
14
+ # <%= @post.headline %>
15
+ # <% end %>
16
+ #
17
+ # Returns String of either the message or the captured block.
18
+ def guard(resource, message=nil, &block)
19
+ if current_user.can_manage?(resource)
20
+ capture(&block)
21
+ else
22
+ message.to_s
23
+ end
24
+ end
25
+
26
+ # Public: Conditionally link text based on permissions.
27
+ #
28
+ # resource - (Class) The model that the user must have permission
29
+ # to manage in order to see the link.
30
+ # args - Arguments to be passed directly to +link_to+ if necessary.
31
+ #
32
+ # Examples
33
+ #
34
+ # <%= guarded_link_to Post, @post.headline, edit_post_path(@post) %>
35
+ #
36
+ # Returns String of either a link tag, or just the link title.
37
+ def guarded_link_to(resource, *args)
38
+ if current_user.can_manage?(resource)
39
+ link_to *args
40
+ else
41
+ args[0] # Just the link title
42
+ end
43
+ end
44
+ end