alchemymvc 1.2.4 → 1.2.6
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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/lib/app/assets/scripts/.gitkeep +0 -0
- package/lib/app/assets/stylesheets/alchemy-info.less +0 -0
- package/lib/app/behaviour/publishable_behaviour.js +0 -0
- package/lib/app/behaviour/revision_behaviour.js +0 -0
- package/lib/app/behaviour/sluggable_behaviour.js +0 -0
- package/lib/app/component/.gitkeep +0 -0
- package/lib/app/conduit/electron_conduit.js +0 -0
- package/lib/app/conduit/http_conduit.js +173 -173
- package/lib/app/conduit/socket_conduit.js +620 -620
- package/lib/app/controller/alchemy_info_controller.js +0 -0
- package/lib/app/datasource/mongo_datasource.js +0 -0
- package/lib/app/helper/client_collection.js +0 -0
- package/lib/app/helper/pagination_helper.js +0 -0
- package/lib/app/helper/router_helper.js +135 -3
- package/lib/app/helper/socket_helper.js +613 -613
- package/lib/app/helper_component/paginate_component.js +3 -1
- package/lib/app/helper_controller/component.js +0 -0
- package/lib/app/helper_controller/conduit.js +20 -0
- package/lib/app/helper_controller/controller.js +0 -0
- package/lib/app/helper_datasource/00-nosql_datasource.js +0 -0
- package/lib/app/helper_datasource/05-fallback_datasource.js +0 -0
- package/lib/app/helper_datasource/idb_datasource.js +0 -0
- package/lib/app/helper_datasource/indexed_db.js +0 -0
- package/lib/app/helper_field/00-objectid_field.js +0 -0
- package/lib/app/helper_field/06-text_field.js +0 -0
- package/lib/app/helper_field/10-number_field.js +0 -0
- package/lib/app/helper_field/boolean_field.js +0 -0
- package/lib/app/helper_field/date_field.js +0 -0
- package/lib/app/helper_field/datetime_field.js +0 -0
- package/lib/app/helper_field/enum_field.js +0 -0
- package/lib/app/helper_field/geopoint_field.js +0 -0
- package/lib/app/helper_field/habtm_field.js +0 -0
- package/lib/app/helper_field/hasoneparent_field.js +0 -0
- package/lib/app/helper_field/html_field.js +0 -0
- package/lib/app/helper_field/integer_field.js +0 -0
- package/lib/app/helper_field/object_field.js +0 -0
- package/lib/app/helper_field/regexp_field.js +0 -0
- package/lib/app/helper_field/schema_field.js +23 -2
- package/lib/app/helper_field/time_field.js +0 -0
- package/lib/app/helper_field/url_field.js +0 -0
- package/lib/app/helper_model/criteria.js +26 -1
- package/lib/app/helper_model/db_query.js +0 -0
- package/lib/app/helper_model/document.js +20 -12
- package/lib/app/helper_model/document_list.js +0 -0
- package/lib/app/helper_model/field_config.js +25 -12
- package/lib/app/helper_model/field_set.js +22 -1
- package/lib/app/helper_model/model.js +22 -10
- package/lib/app/model/alchemy_task_model.js +0 -0
- package/lib/app/routes.js +0 -0
- package/lib/app/view/alchemy/info.ejs +0 -0
- package/lib/app/view/error/unknown.ejs +0 -0
- package/lib/app/view/paginate/navlist.ejs +0 -0
- package/lib/bootstrap.js +0 -0
- package/lib/class/behaviour.js +0 -0
- package/lib/class/component.js +0 -0
- package/lib/class/conduit.js +2555 -2474
- package/lib/class/controller.js +4 -1
- package/lib/class/document_list.js +0 -0
- package/lib/class/element.js +2 -11
- package/lib/class/field.js +7 -1
- package/lib/class/helper.js +0 -0
- package/lib/class/inode.js +0 -0
- package/lib/class/inode_dir.js +0 -0
- package/lib/class/inode_file.js +112 -112
- package/lib/class/inode_list.js +0 -0
- package/lib/class/model.js +1772 -1761
- package/lib/class/path_definition.js +0 -0
- package/lib/class/route.js +92 -61
- package/lib/class/router.js +80 -3
- package/lib/class/schema_client.js +7 -2
- package/lib/class/session.js +0 -0
- package/lib/class/task.js +0 -0
- package/lib/core/base.js +50 -9
- package/lib/core/client_alchemy.js +48 -43
- package/lib/core/discovery.js +0 -0
- package/lib/core/middleware.js +72 -7
- package/lib/core/routing.js +0 -0
- package/lib/core/socket.js +159 -159
- package/lib/init/alchemy.js +1823 -1823
- package/lib/init/constants.js +0 -0
- package/lib/init/functions.js +8 -4
- package/lib/init/load_functions.js +0 -0
- package/lib/init/requirements.js +101 -101
- package/package.json +74 -73
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -29,14 +29,19 @@ var Route = Function.inherits('Alchemy.Helper.Router', function Route(renderer)
|
|
|
29
29
|
*
|
|
30
30
|
* @author Jelle De Loecker <jelle@develry.be>
|
|
31
31
|
* @since 1.1.0
|
|
32
|
-
* @version 1.
|
|
32
|
+
* @version 1.2.5
|
|
33
33
|
*
|
|
34
34
|
* @type {RURL}
|
|
35
35
|
*/
|
|
36
36
|
Router.setProperty(function current_url() {
|
|
37
|
-
if (this.
|
|
38
|
-
return this.
|
|
37
|
+
if (this.view_render?.variables?.__url) {
|
|
38
|
+
return this.view_render.variables.__url.clone();
|
|
39
39
|
} else if (Blast.isBrowser) {
|
|
40
|
+
|
|
41
|
+
if (hawkejs?.scene?.opening_url?.url) {
|
|
42
|
+
return Blast.Classes.RURL.parse(hawkejs.scene.opening_url.url);
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
return Blast.Classes.RURL.parse(window.location);
|
|
41
46
|
}
|
|
42
47
|
});
|
|
@@ -580,6 +585,129 @@ Router.setMethod(function getAnchor(name, parameters, options) {
|
|
|
580
585
|
return anchor;
|
|
581
586
|
});
|
|
582
587
|
|
|
588
|
+
/**
|
|
589
|
+
* Get the current route variables
|
|
590
|
+
*
|
|
591
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
592
|
+
* @since 1.2.5
|
|
593
|
+
* @version 1.2.5
|
|
594
|
+
*
|
|
595
|
+
* @return {Object}
|
|
596
|
+
*/
|
|
597
|
+
Router.setMethod(function getRouteVariables() {
|
|
598
|
+
|
|
599
|
+
let params,
|
|
600
|
+
route,
|
|
601
|
+
url;
|
|
602
|
+
|
|
603
|
+
if (this.view_render?.variables?.__route) {
|
|
604
|
+
route = this.view_render.variables.__route;
|
|
605
|
+
params = this.view_render.variables.__urlparams;
|
|
606
|
+
url = this.view_render.variables.__url;
|
|
607
|
+
} else if (Blast.isBrowser) {
|
|
608
|
+
route = alchemy.current_route;
|
|
609
|
+
params = alchemy.current_url_params;
|
|
610
|
+
url = alchemy.current_url;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
return {route, params, url};
|
|
614
|
+
});
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Update language switcher info
|
|
618
|
+
*
|
|
619
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
620
|
+
* @since 1.2.5
|
|
621
|
+
* @version 1.2.5
|
|
622
|
+
*
|
|
623
|
+
* @param {Element} element The element to apply to
|
|
624
|
+
*/
|
|
625
|
+
Router.setMethod(function updateLanguageSwitcher(element) {
|
|
626
|
+
|
|
627
|
+
let language = element.getAttribute('data-alchemy-language-switch');
|
|
628
|
+
|
|
629
|
+
if (!language) {
|
|
630
|
+
return;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
let url = this.translateCurrentRoute(language);
|
|
634
|
+
|
|
635
|
+
if (!url) {
|
|
636
|
+
url = '/' + language;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
element.setAttribute('href', url);
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Get a translated URL for the current route
|
|
644
|
+
*
|
|
645
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
646
|
+
* @since 1.2.5
|
|
647
|
+
* @version 1.2.5
|
|
648
|
+
*
|
|
649
|
+
* @param {String} prefix The prefix to use
|
|
650
|
+
*/
|
|
651
|
+
Router.setMethod(function translateCurrentRoute(prefix) {
|
|
652
|
+
|
|
653
|
+
let info = this.getRouteVariables();
|
|
654
|
+
|
|
655
|
+
if (!info.route) {
|
|
656
|
+
return;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
let config = this.routeConfig(info.route);
|
|
660
|
+
|
|
661
|
+
if (!config) {
|
|
662
|
+
return;
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
// Get the url string
|
|
666
|
+
let url = this.routeUrl(info.route, info.params, {locale: prefix});
|
|
667
|
+
|
|
668
|
+
// Turn it into an RURL object
|
|
669
|
+
url = RURL.parse(url);
|
|
670
|
+
|
|
671
|
+
if (url && url.pathname == '/') {
|
|
672
|
+
url.pathname = '/' + prefix + url.pathname;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
// Add the get queries
|
|
676
|
+
if (info.url && info.url.search) {
|
|
677
|
+
for (key in info.url.query) {
|
|
678
|
+
|
|
679
|
+
if (key == 'hajax' || key == 'h_diversion' || key == 'htop') {
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
url.addQuery(key, info.url.query[key]);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
return url;
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Turn the given element into a language switcher
|
|
692
|
+
*
|
|
693
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
694
|
+
* @since 1.2.5
|
|
695
|
+
* @version 1.2.5
|
|
696
|
+
*
|
|
697
|
+
* @param {Element} element The element to apply to
|
|
698
|
+
* @param {String} language The actual language
|
|
699
|
+
* @param {Object} options
|
|
700
|
+
*/
|
|
701
|
+
Router.setMethod(function languageSwitcherDirective(element, language, options) {
|
|
702
|
+
|
|
703
|
+
element.setAttribute('hreflang', language);
|
|
704
|
+
element.setAttribute('data-he-link', 'false');
|
|
705
|
+
element.setAttribute('data-alchemy-language-switch', language);
|
|
706
|
+
element.setAttribute('rel', 'nofollow');
|
|
707
|
+
|
|
708
|
+
this.updateLanguageSwitcher(element);
|
|
709
|
+
});
|
|
710
|
+
|
|
583
711
|
/**
|
|
584
712
|
* The switch language element
|
|
585
713
|
*
|
|
@@ -589,6 +717,10 @@ Router.setMethod(function getAnchor(name, parameters, options) {
|
|
|
589
717
|
*/
|
|
590
718
|
Router.setMethod(function languageSwitcher(options) {
|
|
591
719
|
|
|
720
|
+
if (arguments.length == 3) {
|
|
721
|
+
return this.languageSwitcherDirective(...arguments);
|
|
722
|
+
}
|
|
723
|
+
|
|
592
724
|
var prefixes = this.view.expose('prefixes'),
|
|
593
725
|
prefix,
|
|
594
726
|
config,
|