Rust / Elm base full stack web framework.
- Must have ownership for particular crate at crates.io
- Must have login through terminal using cargo token.
- Change current version in Cargo.toml in increasing way (Digit places should be change according to feature).
- Do
cargo check --all
should not have any compile error, warning nothing. - Do
cargo fmt
- Do
git add <changes files>
- Do
git commit -m "message related to your changes"
- Do
git push
- Do
cargo package
- Do
cargo publish
, It should be successfully published.
- Added template based server side rendering. You may want to use:
fn main() {
for entry in walkdir::WalkDir::new("templates") {
let entry = entry.unwrap();
eprintln!("cargo:rerun-if-changed={}", entry.path().display());
}
}
// with the following in your Cargo.toml
// [package]
// build = "build.rs"
//
// [build-dependencies]
// walkdir = "2"
- Elm: Scroll to top of page on page change
- Elm: Sending a message after delay of 200ms to let app show a loading dialog
- Elm: BREAKING: removed Realm.Utils.{link, plainLink, newTabLink}, use Element versions instead.
- Elm: Added method
navigate : String -> Cmd (Msg msg)
inRealm.elm
. - Elm: Added method
mif : Maybe a -> (a -> E.Element msg) -> E.Element msg
inUtils.elm
. - Backtrace added for errors. Panics still needs to be cleaned.
- Added the following methods in
realm::base::In
:- is_anonymous: Returns true if the
ud
cookie is empty. - is_authenticated: Returns true if the
ud
cookie is not empty. - is_local: Returns true if the
HOST
is localhost, 127.0.0.1 or 127.0.0.2.
- is_anonymous: Returns true if the
- Added method
error<T>(key: &str, message: &str)
. Returns aFormError
containing thekey
andmessage
. - Added method
json<T>(&mut self, name: &str)
inRequestConfig
. Takes a field namename
and returns it's value if present in the body of the request. - Following Database related methods and properties are moved to
realm::base::pg
andrealm::base::sqlite
:- connection()
- connection_with_url()
- RealmConnection
- Generic ud cookie: Applications can define their own struct for
ud
cookie. This change is not compatible with the previous realm versions. Please refer to [UDMIGRATION.md] guide. - Enable one of the following features in
Cargo.toml
to use database:- Postgres: postgres+postgres_default
- SQLite: sqlite+sqlite_default
- Fix:
Realm.Test
on error from server, report it and keep tests running. realm::RequestConfig::required()
etc methods now returnrealm::Error(InputError)
instead ofrealm::request_config::Error
, middleware need only catch single error now:
let resp = match forward::magic(&in_) {
Ok(r) => Ok(r),
Err(e) => {
match e.downcast_ref::<realm::Error>()
{
Some(realm::Error::PageNotFound {message}) => fifthtry::http404(&in_, message.as_str()),
Some(realm::Error::InputError {error}) => fifthtry::http404(&in_, &error.to_string()),
_ => Err(e)
}
}
};
- Added support for extra Elm ports. Applications can add ports to
window.realm_extra_ports
inJavascript
. Applications can createPorts.elm
and specify ports like this:port something : JE.Value -> Cmd msg
. Applications can create a Javascript file and add the port and callback function like this towindow.realm_extra_ports
:
window.realm_extra_ports = {
"something": function(data) {
}
};
// the realm app is available as window.realm_app. so you can also do:
window.addEventListener("foo", function(evt) { window.realm_app.ports.foo.send(evt) })
- Added support for using custom html. Applications can create
index.html
and realm will use this while rendering a page.index.html
must contains special strings:__realm_title__
and__realm_data__
, these will be replaced by page title and page data. - Removed
APP_NAME
feature, use customindex.html
to overwrite script name instead. - Added
window.realm_app_init()
andwindow.realm_app_shutdown()
hooks, if you want to do something after realm app is initialized and is shutting down. - Added
In.darkMode
.
realm::base::CiString
is public now.- Elm backward incompatible: changed signature of
Realm.Utils.html
andRealm.Utils.htmlLine
to takeRealm.Utils.Rendered
as input instead ofString
. Realm.Test
: show failures in redRealm.Test
: keyboard shortcute
to toggle between showing all tests vs only failed onesRealm.Test
: on test completion narrow to only failed tests if test failed.- Added
.required2()
,.required3()
and.required4()
torealm::request_config::RequestConfig
. Advantage of these variants over multiple invocations of.required()
: all errors are shown in one go, with.required()
, only the first error is shown in response. - Added
Realm.Utils.maybe : Json.Decode.Decoder a -> Json.Decode.Decoder (Maybe a)
, which is a better version ofJson.Decode.maybe
. - Added
Realm.Utils.iff : Bool -> E.Element msg -> E.Element msg
(show something or use E.none if false). - Added
Realm.Utils.escEnter
to attach event handler for Escape and Enter keys. Also.onEnter
,.onSpaceAndEnter
and.button
. - Added logging of SQL queries to console in debug mode.
- Added
Realm.Utils.mapIth
and.mapAIth
for updating ith member of a list/array. - Fix: Constructing URL properly when doing submit with URLs including query parameters.
- Added
realm::is_realm_url()
andrealm::handle()
to handle realm related URLs. - Fix:
realm::base::rollback_if_required()
now rolls back if transaction depth managed by diesel is wrong. - Fix: If a nested elm module sent by server is not in
Elm
, thengetApp()
returns none instead of crashing, so it is consistent with what happens when a non nested, missing elm module is sent. - Fix: in test mode, on missing elm module, a proper message is shown and test continues.
- Added
realm::Response::redirect(next)
andrealm::Response::redirect_with(next, StatusCode)
methods. InLayout
mode, redirect tonext
page. InHTML/API
mode, sends HTTP 3xx response withlocation
header asnext
. - Location for
elm.js
ifAPP_NAME
environment variable is configured:/static/APP_NAME/elm.js
. Default location forelm.js
is/static/elm.js
. - Added
realm::base::db::db_test()
back.
realm::base::db::RealmConnection
: in release build this is an alias forPgConnection
, where as in debug build its an alias forDebugConnection
, which prints SQL queries and time for execution. It also prints every connection established and the time it took to establish the connection.- Removed unused
realm::base::UserStatus
type. - Added
Realm.Utils.html
andRealm.Utils.htmlLine
helpers to render server generated HTML in Elm.- They depend on html-parser, so add it:
elm install hecrj/html-parser
inside 'frontend' folder.
- They depend on html-parser, so add it:
- Added
realm::base::FormError::empty()
, and deprecated::new()
. - Added
realm::base::FormError::single()
to create one off error messages. - Added
realm::Error
andrealm::request_config::Error
so we can do following error handling in middleware:
if e.downcast_ref::<realm::Error>().is_some()
|| e.downcast_ref::<realm::request_config::Error>().is_some()
{
fifthtry::http404(&in_, error.as_str())
} else {
Err(e)
}
- Added
realm::Or404
trait and implemented it onResult<T, failure::Error>
so one can do eglet content = fifthtry_db::content::get(in_, id).or_404()?;
in routes to convert arbitrary errors to 404s. - Added
realm::request_config::RequestConfig.optional()
, to get optional values. - When getting input values using
.param()
or.optional()
, now onwardsnull
in json, and empty value in query params are treated same as missing keys. - Renamed/deprecated
.param()
to.required()
, which goes better with.optional()
. - Moved test.rs, storybook.rs and iframe.rs to realm.
- Added
RequestConfig.param()
to get a parameter from request. - Deprecated
RequestConfig.get()
,.param()
should be used now. - Added
Realm.tuple : JD.Decoder a -> JD.Decoder b -> JD.Decoder (a, b)
andRealm.tupleE : (a -> JE.Value) -> (b -> JE.Value) -> ((a, b) -> JE.Value)
. - Fix: Query params in URLs are not lost during navigation.
- Fix: Device switching in /storybook/ was buggy in some cases.
realm::Response
now implementsserde::Serialize
.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!