alchemy-chimera 0.5.4 → 1.0.2

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 (128) hide show
  1. package/CHANGELOG.md +39 -4
  2. package/assets/scripts/chimera/chimera.js +13 -288
  3. package/assets/stylesheets/chimera/chimera.scss +451 -0
  4. package/bootstrap.js +6 -302
  5. package/config/routes.js +53 -5
  6. package/controller/00-chimera_controller.js +16 -0
  7. package/controller/chimera_editor_controller.js +159 -614
  8. package/controller/chimera_static_controller.js +102 -9
  9. package/lib/chimera_config.js +138 -163
  10. package/model/model.js +1 -1
  11. package/package.json +8 -12
  12. package/view/chimera/dashboard.hwk +8 -0
  13. package/view/chimera/editor/index.hwk +20 -0
  14. package/view/chimera/sidebar.hwk +4 -0
  15. package/view/chimera/widgets.hwk +8 -0
  16. package/view/layouts/chimera_base.hwk +15 -0
  17. package/view/layouts/chimera_basics.hwk +15 -0
  18. package/view/layouts/chimera_body.hwk +24 -0
  19. package/assets/scripts/chimera/assoc_field.js +0 -311
  20. package/assets/scripts/chimera/boolean_field.js +0 -53
  21. package/assets/scripts/chimera/chimera_field.js +0 -622
  22. package/assets/scripts/chimera/chimera_field_wrapper.js +0 -558
  23. package/assets/scripts/chimera/date_field.js +0 -170
  24. package/assets/scripts/chimera/geopoint_field.js +0 -147
  25. package/assets/scripts/chimera/medium-button.js +0 -6
  26. package/assets/scripts/chimera/object_field.js +0 -51
  27. package/assets/scripts/chimera/page-editor.js +0 -3
  28. package/assets/scripts/chimera/password_field.js +0 -73
  29. package/assets/scripts/chimera/schema_field.js +0 -300
  30. package/assets/scripts/chimera/text_field.js +0 -119
  31. package/assets/scripts/rome/rome.js +0 -4978
  32. package/assets/scripts/vex/vex.dialog.js +0 -151
  33. package/assets/scripts/vex/vex.js +0 -193
  34. package/assets/stylesheets/chimera/chimera.less +0 -1075
  35. package/assets/stylesheets/chimera_old/chimera.less +0 -351
  36. package/assets/stylesheets/chimera_old/core.less +0 -315
  37. package/assets/stylesheets/chimera_old/font.less +0 -38
  38. package/assets/stylesheets/chimera_old/mixins.less +0 -35
  39. package/assets/stylesheets/chimera_old/page-editor.less +0 -23
  40. package/assets/stylesheets/rome/rome.less +0 -130
  41. package/assets/stylesheets/vex/vex-theme-bottom-right-corner.less +0 -613
  42. package/assets/stylesheets/vex/vex.default.less +0 -501
  43. package/assets/stylesheets/vex/vex.flat.less +0 -443
  44. package/assets/stylesheets/vex/vex.less +0 -320
  45. package/controller/chimera_page_controller.js +0 -14
  46. package/controller/chimera_settings_controller.js +0 -129
  47. package/controller/tasks_chimera_controller.js +0 -106
  48. package/helper/chimera_helper.js +0 -202
  49. package/lib/chimera_action_fields.js +0 -292
  50. package/lib/chimera_field/belongsto_chimera_field.js +0 -160
  51. package/lib/chimera_field/boolean_chimera_field.js +0 -19
  52. package/lib/chimera_field/date_chimera_field.js +0 -20
  53. package/lib/chimera_field/datetime_chimera_field.js +0 -20
  54. package/lib/chimera_field/enum_chimera_field.js +0 -131
  55. package/lib/chimera_field/geopoint_chimera_field.js +0 -20
  56. package/lib/chimera_field/habtm_chimera_field.js +0 -55
  57. package/lib/chimera_field/hasoneparent_chimera_field.js +0 -18
  58. package/lib/chimera_field/html_chimera_field.js +0 -20
  59. package/lib/chimera_field/object_chimera_field.js +0 -18
  60. package/lib/chimera_field/password_chimera_field.js +0 -18
  61. package/lib/chimera_field/schema_chimera_field.js +0 -149
  62. package/lib/chimera_field/text_chimera_field.js +0 -20
  63. package/lib/chimera_field/time_chimera_field.js +0 -18
  64. package/lib/chimera_field.js +0 -208
  65. package/model/setting_model.js +0 -51
  66. package/public/chimera/codedor.svg +0 -28
  67. package/view/chimera/dashboard.ejs +0 -5
  68. package/view/chimera/editor/add.ejs +0 -32
  69. package/view/chimera/editor/edit.ejs +0 -33
  70. package/view/chimera/editor/index.ejs +0 -87
  71. package/view/chimera/editor/remove.ejs +0 -23
  72. package/view/chimera/editor/view.ejs +0 -54
  73. package/view/chimera/elements/editor_actions.ejs +0 -4
  74. package/view/chimera/elements/empty +0 -0
  75. package/view/chimera/field_wrappers/_entries.ejs +0 -91
  76. package/view/chimera/field_wrappers/_wrapper.ejs +0 -82
  77. package/view/chimera/field_wrappers/date_edit.ejs +0 -23
  78. package/view/chimera/field_wrappers/date_list.ejs +0 -3
  79. package/view/chimera/field_wrappers/date_view.ejs +0 -16
  80. package/view/chimera/field_wrappers/default_edit.ejs +0 -22
  81. package/view/chimera/field_wrappers/default_list.ejs +0 -3
  82. package/view/chimera/field_wrappers/default_peek.ejs +0 -3
  83. package/view/chimera/field_wrappers/default_view.ejs +0 -14
  84. package/view/chimera/field_wrappers/geopoint_edit.ejs +0 -25
  85. package/view/chimera/field_wrappers/geopoint_list.ejs +0 -5
  86. package/view/chimera/field_wrappers/geopoint_view.ejs +0 -18
  87. package/view/chimera/field_wrappers/schema_edit.ejs +0 -19
  88. package/view/chimera/field_wrappers/text_edit.ejs +0 -22
  89. package/view/chimera/field_wrappers/text_list.ejs +0 -1
  90. package/view/chimera/fields/belongsto_edit.ejs +0 -4
  91. package/view/chimera/fields/belongsto_list.ejs +0 -1
  92. package/view/chimera/fields/belongsto_peek.ejs +0 -1
  93. package/view/chimera/fields/boolean_edit.ejs +0 -17
  94. package/view/chimera/fields/boolean_list.ejs +0 -3
  95. package/view/chimera/fields/boolean_view.ejs +0 -3
  96. package/view/chimera/fields/date_edit.ejs +0 -14
  97. package/view/chimera/fields/date_list.ejs +0 -9
  98. package/view/chimera/fields/date_peek.ejs +0 -9
  99. package/view/chimera/fields/date_view.ejs +0 -9
  100. package/view/chimera/fields/datetime_edit.ejs +0 -24
  101. package/view/chimera/fields/datetime_list.ejs +0 -9
  102. package/view/chimera/fields/datetime_view.ejs +0 -10
  103. package/view/chimera/fields/default_edit.ejs +0 -10
  104. package/view/chimera/fields/default_list.ejs +0 -15
  105. package/view/chimera/fields/default_view.ejs +0 -1
  106. package/view/chimera/fields/enum_edit.ejs +0 -10
  107. package/view/chimera/fields/geopoint_edit.ejs +0 -10
  108. package/view/chimera/fields/geopoint_list.ejs +0 -9
  109. package/view/chimera/fields/geopoint_view.ejs +0 -9
  110. package/view/chimera/fields/habtm_edit.ejs +0 -5
  111. package/view/chimera/fields/hasoneparent_edit.ejs +0 -6
  112. package/view/chimera/fields/hasoneparent_list.ejs +0 -1
  113. package/view/chimera/fields/object_edit.ejs +0 -8
  114. package/view/chimera/fields/password_edit.ejs +0 -12
  115. package/view/chimera/fields/schema_edit.ejs +0 -14
  116. package/view/chimera/fields/text_edit.ejs +0 -5
  117. package/view/chimera/fields/text_list.ejs +0 -9
  118. package/view/chimera/fields/text_view.ejs +0 -3
  119. package/view/chimera/fields/time_edit.ejs +0 -15
  120. package/view/chimera/fields/time_list.ejs +0 -9
  121. package/view/chimera/fields/time_view.ejs +0 -9
  122. package/view/chimera/page/edit.ejs +0 -18
  123. package/view/chimera/page_editor.ejs +0 -5
  124. package/view/chimera/sidebar.ejs +0 -40
  125. package/view/chimera/tasks/index.ejs +0 -114
  126. package/view/layouts/chimera.ejs +0 -12
  127. package/view/layouts/chimera_base.ejs +0 -11
  128. package/view/layouts/chimera_body.ejs +0 -43
package/bootstrap.js CHANGED
@@ -1,309 +1,13 @@
1
- var ChimeraController,
2
- options;
3
-
4
- alchemy.requirePlugin(['acl', 'menu']);
1
+ alchemy.requirePlugin('widget');
5
2
 
6
3
  // Define the default options
7
- options = {
8
-
9
- // Extra classes
10
- extra_class: '',
11
-
12
- // The name of the base layout
13
- baselayout: 'admin_base',
14
-
15
- // The name of the body layout
16
- bodylayout: 'admin_body',
17
-
18
- // The name of the body block
19
- bodyblock: 'admin-body',
20
-
21
- // The name of the main block
22
- mainblock: 'admin-main',
23
-
24
- // The name of the content block
25
- contentblock: 'admin-content',
26
-
4
+ let options = {
27
5
  // The name to use in the routing
28
- routename: 'chimera',
29
-
30
- // The default theme to use
31
- theme: 'ajatar',
6
+ base_path: 'chimera',
32
7
 
33
- // The title to show in the top left corner
34
- title: 'Alchemy Admin'
8
+ // Use a custom theme?
9
+ theme : false
35
10
  };
36
11
 
37
12
  // Inject the user-overridden options
38
- alchemy.plugins.chimera = Object.merge(options, alchemy.plugins.chimera);
39
- global.chimera = alchemy.plugins.chimera;
40
-
41
- if (options.hide_translate_buttons) {
42
- options.extra_class += ' hide-translate-buttons';
43
- }
44
-
45
- if (!alchemy.plugins.acl) {
46
- alchemy.plugins.acl = {placeholders: {}}
47
- log.todo('Acl settings for Chimera');
48
- }
49
-
50
- // Set the acl placeholder variable
51
- //alchemy.plugins.acl.placeholders.chimeraRouteName = alchemy.plugins.chimera.routename;
52
-
53
- // Construct the view settings
54
- options.view_settings = {
55
- baselayout : 'layouts/' + options.baselayout,
56
- bodylayout : 'layouts/' + options.bodylayout,
57
- bodyblock : options.bodyblock,
58
- mainblock : options.mainblock,
59
- contentblock : options.contentblock,
60
- theme : options.theme,
61
- title : options.title
62
- };
63
-
64
- if (options.theme == 'ajatar') {
65
- alchemy.usePlugin('ajatar-theme');
66
- }
67
-
68
- /**
69
- * Function to asynchronously get the menu item
70
- *
71
- * @author Jelle De Loecker <jelle@develry.be>
72
- * @since 0.3.0
73
- * @version 0.3.0
74
- *
75
- * @param {Function} callback
76
- */
77
- alchemy.plugins.chimera.getMenu = function getMenu(callback) {
78
- alchemy.plugins.menu.getDefault('chimera_menu', callback);
79
- };
80
-
81
- /**
82
- * Backwards compatibility for synchronously adding items
83
- *
84
- * @author Jelle De Loecker <jelle@develry.be>
85
- * @since 0.3.0
86
- * @version 0.3.0
87
- */
88
- alchemy.plugins.chimera.menu = {
89
- set : function set(name, options, weight) {
90
- alchemy.plugins.chimera.getMenu(function gotMenu(err, menu) {
91
-
92
- var config = {
93
- title : name,
94
- settings : options,
95
- weight : weight
96
- };
97
-
98
- if (options.icon) {
99
- options.decoration = options.icon;
100
- }
101
-
102
- menu.addItem('route', config);
103
- });
104
- }
105
- };
106
-
107
- /**
108
- * Get the chimera menu and add some entries
109
- *
110
- * @author Jelle De Loecker <jelle@develry.be>
111
- * @since 0.3.0
112
- * @version 0.3.0
113
- */
114
- alchemy.plugins.chimera.getMenu(function gotMenu(err, menu) {
115
-
116
- // Set the position name
117
- menu.position_name = 'chimera_main_sidebar';
118
-
119
- // Set the title
120
- menu.title = __('chimera', 'Chimera');
121
-
122
- /**
123
- * Add the dashboard to the menu
124
- *
125
- * @author Jelle De Loecker <jelle@develry.be>
126
- * @since 0.2.0
127
- * @version 0.4.0
128
- */
129
- menu.addItem('route', {
130
- weight : 9999,
131
- settings : {
132
- name : 'dashboard',
133
- title : __('chimera', 'Dashboard'),
134
- route : 'chimera@Dashboard',
135
- icon : {
136
- svg : 'chimera/home',
137
- fa : 'tachometer-alt'
138
- }
139
- }
140
- });
141
-
142
- /**
143
- * Add the users model to the menu
144
- *
145
- * @author Jelle De Loecker <jelle@develry.be>
146
- * @since 0.2.0
147
- * @version 0.4.0
148
- */
149
- menu.addItem('route', {
150
- weight : 9900,
151
- settings : {
152
- name : 'users',
153
- title : __('chimera', 'Users'),
154
- route : 'chimera@ModelAction',
155
- parameters : {
156
- controller : 'Editor',
157
- subject : 'user',
158
- action : 'index'
159
- },
160
- icon : {
161
- svg : 'chimera/office-worker',
162
- fa : 'user'
163
- }
164
- }
165
- });
166
- });
167
-
168
- chimera.menu.set('i18n', {
169
- title: 'I18n',
170
- route: 'chimera@ModelAction',
171
- name : 'i18n',
172
- parameters: {
173
- controller: 'Editor',
174
- subject: 'i18n',
175
- action: 'index'
176
- },
177
- icon : {
178
- fa: 'language'
179
- }
180
- });
181
-
182
- var ChimeraController = Function.inherits('Alchemy.Controller', 'Alchemy.Controller.Chimera', function Chimera(conduit, options) {
183
-
184
- Chimera.super.call(this, conduit, options);
185
-
186
- // Set the theme
187
- this.view_render.setTheme(alchemy.plugins.chimera.theme);
188
-
189
- // Set the chimera options
190
- this.set('chimera_options', alchemy.plugins.chimera);
191
- this.expose('chimera_options', alchemy.plugins.chimera);
192
-
193
- this.actions = {};
194
- });
195
-
196
- /**
197
- * Add a chimera action
198
- *
199
- * @author Jelle De Loecker <jelle@develry.be>
200
- * @since 0.2.0
201
- * @version 0.2.0
202
- */
203
- ChimeraController.setMethod(function addAction(type, fncname, options) {
204
-
205
- var obj;
206
-
207
- if (options == null) {
208
- options = {};
209
- }
210
-
211
- obj = this.getActions(type);
212
-
213
- options.type = type;
214
-
215
- if (options.title == null) {
216
- options.title = fncname.humanize();
217
- }
218
-
219
- if (options.controller == null) {
220
- options.controller = this.name.underscore();
221
- }
222
-
223
- options.name = fncname;
224
-
225
- obj.set(fncname, options);
226
- });
227
-
228
- /**
229
- * Get all chimera actions
230
- *
231
- * @author Jelle De Loecker <jelle@develry.be>
232
- * @since 0.2.0
233
- * @version 0.2.0
234
- */
235
- ChimeraController.setMethod(function getActions(type) {
236
-
237
- if (this.actions == null) {
238
- this.actions = {};
239
- }
240
-
241
- if (type == null) {
242
- return this.actions;
243
- }
244
-
245
- if (this.actions[type] == null) {
246
- this.actions[type] = new Deck();
247
- }
248
-
249
- return this.actions[type];
250
- });
251
-
252
- /**
253
- * Ensure Chimera ACL rules are set,
254
- * don't start the server before it's done
255
- */
256
- alchemy.sputnik.beforeSerial('startServer', function beforeStartServer(done) {
257
-
258
- var AclRule = Model.get('AclRule'),
259
- rules;
260
-
261
- rules = [
262
- {
263
- // Deny "everyone" group access to chimera section
264
- _id : '52efff0000a1c00002000000',
265
- type : 'route_acl_rule_type',
266
- target_groups_id : [alchemy.plugins.acl.EveryoneGroupId],
267
- settings : {
268
- section : 'chimera',
269
- allow : false,
270
- weight : 9999
271
- }
272
- },
273
- {
274
- // Allow "everyone" group access to chimera section
275
- _id : '52efff0000a1c00002000001',
276
- type : 'route_acl_rule_type',
277
- target_groups_id : [alchemy.plugins.acl.SuperUserGroupId],
278
- settings : {
279
- section : 'chimera',
280
- allow : true,
281
- weight : 100
282
- }
283
- }
284
- ];
285
-
286
- AclRule.ensureIds(rules, function doneEnsuring(err) {
287
-
288
- if (err) {
289
- return log.error('Can not start server, error ensuring ACL rules.', {err: err});
290
- }
291
-
292
- done();
293
- });
294
- });
295
-
296
- /*
297
- {
298
- "_id" : ObjectId("58457c242ceac61b95d09e19"),
299
- "created" : ISODate("2016-12-05T14:39:39.641Z"),
300
- "updated" : ISODate("2016-12-05T22:35:32.593Z"),
301
- "type" : "route_acl_rule_type",
302
- "settings" : {
303
- "section" : "chimera"
304
- },
305
- "target_groups_id" : [
306
- ObjectId("52efff000001000001000000")
307
- ]
308
- }
309
- */
13
+ alchemy.plugins.chimera = Object.merge(options, alchemy.plugins.chimera);
package/config/routes.js CHANGED
@@ -1,8 +1,56 @@
1
- var chimera_section,
2
- chimera_menu;
1
+ // Create a new chimera section.
2
+ // By default this will be /chimera
3
+ let chimera_section = Router.section('chimera', '/' + alchemy.plugins.chimera.base_path);
3
4
 
4
- // Create a new chimera section
5
- chimera_section = Router.section('chimera', '/' + alchemy.plugins.chimera.routename);
5
+ // Link to the dashboard
6
+ chimera_section.add({
7
+ title : __('chimera', 'Dashboard'),
8
+ name : 'Dashboard',
9
+ methods : 'get',
10
+ paths : '/',
11
+ handler : 'Chimera.Static#dashboard',
12
+ });
13
+
14
+ // Editor index action
15
+ chimera_section.add({
16
+ name : 'Chimera.Editor#index',
17
+ methods : 'get',
18
+ paths : '/editor/{model}/index',
19
+ breadcrumb : 'chimera.editor.{model}.index'
20
+ });
21
+
22
+ // Editor add action
23
+ chimera_section.add({
24
+ name : 'Chimera.Editor#add',
25
+ methods : ['get', 'post'],
26
+ paths : '/editor/{model}/add',
27
+ breadcrumb : 'chimera.editor.{model}.add'
28
+ });
29
+
30
+ // Editor edit action
31
+ chimera_section.add({
32
+ name : 'Chimera.Editor#edit',
33
+ methods : ['get', 'post'],
34
+ paths : '/editor/{model}/edit/{pk}',
35
+ breadcrumb : 'chimera.editor.{model}.edit.{pk}'
36
+ });
37
+
38
+ // Editor data action
39
+ chimera_section.add({
40
+ name : 'Chimera.Editor#records',
41
+ methods : ['post'],
42
+ paths : '/api/editor/{model}/records',
43
+ });
44
+
45
+ // Sidebar
46
+ chimera_section.add({
47
+ name : 'Chimera.Static#sidebar',
48
+ methods : ['get'],
49
+ paths : '/api/content/sidebar',
50
+ });
51
+
52
+ return
53
+ var chimera_menu;
6
54
 
7
55
  // Link to the dashboard
8
56
  chimera_section.add({
@@ -73,7 +121,7 @@ chimera_section.use(function setChimeraData(req, res, next) {
73
121
  req.conduit.internal('UserData', req.conduit.session('UserData') || {});
74
122
 
75
123
  // Set the theme to use
76
- req.conduit.view_render.setTheme(alchemy.plugins.chimera.view_settings.theme);
124
+ req.conduit.renderer.setTheme(alchemy.plugins.chimera.view_settings.theme);
77
125
 
78
126
  // Skip the rest if it's an ajax call
79
127
  if (req.conduit.ajax) {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The base Chimera Controller class
3
+ *
4
+ * @author Jelle De Loecker <jelle@elevenways.be>
5
+ * @since 0.1.0
6
+ * @version 1.0.0
7
+ */
8
+ let ChimeraController = Function.inherits('Alchemy.Controller', 'Alchemy.Controller.Chimera', function Chimera(conduit, options) {
9
+
10
+ Chimera.super.call(this, conduit, options);
11
+
12
+ // Set the theme
13
+ if (alchemy.plugins.chimera.theme) {
14
+ this.view_render.setTheme(alchemy.plugins.chimera.theme);
15
+ }
16
+ });