sydevs / WeMeditate

International website promoting the practice of meditation, with online resources and free local classes.
https://www.wemeditate.com
5 stars 7 forks source link

About WeMeditate

The WeMeditate project is comprehensive website promoting the practice of meditation through the techniques of Sahaja Yoga meditation. This website is designed to be translated to almost any language world wide and provide the following features:

Knowing the above features will also help one understand broadly what is going on in the code.

Browser Support

We support only the most recent versions of Chrome, Safari, Firefox, Edge, and Opera - including the mobile versions of these browsers. No other browser is officially supported. Internet Explorer is not supported.

Getting Started

Prerequisites

Setup

Once the server is running you should be able to can access these urls

When accessing the admin site you will be asked to login, in the development environment you can use a simple dropdown (shown under the login window) to select which account you want to be logged in as, without having to enter a password.

Framework & Languages

Concepts

There are a few pointers that it will be helpful to know when navigating the codebase.

Models / Views / Controllers

This is a core concept of how Rails works. Models represent entries in the database. Views represent pages of the website that will be shown to users. When a user accesses a URL on the website, the controller will fetch models from the database and prepare any other data, then send that information to a view to be rendered.

Concerns

Concerns are packages of code which get added to a model or controller. This are mainly used for grouping related features that can be reused across multiple models or controllers.

Translation / Drafting

Almost every model in this project can be translated, and most of them can also save a draft version of the model, for a administrator to later approve. This allows the site to have users with multiple levels of access who can propose changes to the site which are then later approved.

However this cross-section of Translaton and Drafting, and also image uploads creates some of the most difficult challenges in the code base, which you will often encounter.

Generally speaking most drafting code is contained to the Draftable concern, and most translation code to the Translatable concern. However these often bleed into other parts of the code.

Content Editor

The website's content is build using independent blocks that can be shuffled, reorganized and tweaked in the CMS. This is done using a visual block-based editor called EditorJS (formerly the CodeX Editor).

This means that much of the CSS and Html is segmented along the lines of these "blocks", unaware of the context in which they are being rendered.

Image, Audio, and Videos

Images and audio are hosted simply on Google Cloud storage and uploaded to via the Carrierwave gem.

However the Video hosting is a little bit more complicated. All our videos are hosted on Vimeo. When the video is hosted on the WeMeditate Vimeo Pro account then we embed it using our custom HTML5 player (using the Afterglow js library), however other vimeo videos must fallback to the Vimeo player.

Those vimeo videos that use the HTML5 player must have vimeo metadata loaded, and must have download links in the metadata (that is why we can only use HTML5 for Vimeo Pro videos)

An additional complication is that some videos, such as those on the Meditation and Treatment pages also have vertical versions of those videos, which are used for mobile. JS/CSS code is set up to switch between these two orientations.

Inline SVGs

In many parts of the code we render SVGs inline so that we can then manipulate them using CSS. Unfortunately we use two methods to accomplish this inlining. One is the inline_svg gem/method on the server side, which is the preferred method. However some SVGs must be inlined using JavaScript and the js-inline-svg class. This is because those SVGs are hosted externally (on Google Cloud) and the inline_svg_tag method is not able to handle them.

Ideally we would find a solution to remove the js-inline-svg method, and only using inline_svg_tag, but for the moment this is how it works.

CMS Code

The entirety of the CMS rails code is heavily abstracted, because all these models are managed in almost the same patterns. As such, you wll not see the normal rails views folder structures. Instead there is just one index, show, edit, and new view for the whole CMS, and each model is rendered using partials within these views.

Models

Each model corresponds to a table in the database, and collectively these form the core of the website's content. Here is a brief overview of the models used in this site, and how they correspond to site features.

Pages

Resources

Filters

These are used to categorize other types of models

People

Code Structure

This is mainly useful for those who are not already familiar with Ruby on Rails. This is just a quick overview of the most important folders and files to help you find what you're looking for.

Deployment & Infrastructure

The project's servers and hosted and deployed using Heroku. Any changes which are pushed to the master branch will be automatically deployed to the staging server (staging.wemeditate.com). If you need access to the staging server, please ask and a login will be created for you.

Once a change has been verified on the staging server it can be deployed to production in the Heroku dashboard.

External Libraries and Services

If you are implementing a new feature that touches on one of these areas, please use the existing integration or library.

Libraries

This is a list of some of the key libraries that are used to manage major features.

Ruby Gems:

JavaScript Libraries:

CSS Libraries:

Services

This is a list of all external services used by the WeMeditate project.

This list is provided for reference, to help track down various parts of the site.

G Suite and Namecheap may only be accessed with the sydevelopers.com account, but all other accounts can be set up for people to use their personal accounts.

All accounts are managed and billed by the sydevelopers.com account.