|
1 | | -# javascript-scheduler-ruby-rails-application |
| 1 | +<!-- |
| 2 | + howto.md |
| 3 | + A step-by-step guide to integrate Ruby on Rails with Syncfusion TS Scheduler |
| 4 | +--> |
| 5 | +# How to Integrate Ruby on Rails with Syncfusion TS Scheduler |
| 6 | +This repository contains a sample full-stack application demonstrating how to display events in syncfuison TS Scheduler component using Ruby on Rails. The TS frontend provides a responsive UI for viewing and managing calendar events. |
2 | 7 |
|
3 | 8 | ## Prerequisites |
| 9 | +-Ruby - (3.2.2) |
| 10 | +-Node JS - (>=18.13.0) |
| 11 | +-Yarn - (>=1.22.19) |
4 | 12 |
|
5 | | -Ruby - 3.2.2 |
6 | | -Node Js - 18.13.0 |
7 | | -Yarn - 1.22.19 |
| 13 | +## Project Structure |
| 14 | +``` |
| 15 | +├── README.md # This guide |
| 16 | +├── postcss.config.js |
| 17 | +├── package.json |
| 18 | +├── package-lock.json |
| 19 | +├── test |
| 20 | +│ ├── events_controller_test.rb |
| 21 | +│ ├── schedule_controller_test.rb |
| 22 | +├── app |
| 23 | +│ ├── javascript |
| 24 | +│ │ ├── application.js |
| 25 | +│ │ ├── controllers |
| 26 | +│ │ │ ├── index.js |
| 27 | + └── views |
| 28 | + ├── layouts |
| 29 | + │ ├── application.html.erb |
| 30 | + └── welcome |
| 31 | + └── index.html.erb |
| 32 | +``` |
8 | 33 |
|
9 | 34 | ## Ruby setup |
| 35 | +### Installation |
| 36 | +1. ## Ruby setup |
| 37 | + You can install the Ruby from the following link. |
| 38 | + [`https://www.ruby-lang.org/en/downloads/`](https://www.ruby-lang.org/en/downloads/) |
| 39 | +2. ## Install Rails |
| 40 | + ``` |
| 41 | + gem install rails |
| 42 | + ``` |
| 43 | +3. ## Install dependencies: |
| 44 | + ```bash |
| 45 | + npm install |
| 46 | + ``` |
| 47 | +4. ## Install dependencies: |
| 48 | + ```bash |
| 49 | + yarn install |
| 50 | + ``` |
| 51 | +## Running the Application |
| 52 | +1. Navigate to javascript-scheduler-ruby-rails-application folder |
| 53 | + ```bash |
| 54 | + cd javascript-scheduler-ruby-rails-application |
| 55 | + ``` |
| 56 | +2. Start the Scheduler FrontEnd |
| 57 | + ```bash |
| 58 | + rails server |
| 59 | + ``` |
| 60 | +3. Navigate to `http://localhost:3000` in your browser. (or) Ctrl + click the link in your terminal |
| 61 | +
|
| 62 | +
|
| 63 | +## OutputPreview |
| 64 | + |
| 65 | +
|
| 66 | +## Troubleshooting |
| 67 | +- **Version error**: Check and install the current version as by prerequistes. |
| 68 | +- **Port already in use**: Clear all the previous running applications in both browser and command prompt. |
| 69 | +
|
| 70 | +## Rails project creation Setup from the Scratch |
| 71 | +
|
| 72 | +## 1. Create your folder. |
| 73 | +Create a folder with your own application name. |
| 74 | +
|
| 75 | +
|
| 76 | +## 2. Create a Directory |
| 77 | +Run the below command in your project terminal to create a directory. |
| 78 | +```bash |
| 79 | + mkdir rails-ts-scheduler |
| 80 | +``` |
| 81 | + |
| 82 | +## 3. Navigate to your folder. |
| 83 | +```bash |
| 84 | + cd rails-ts-scheduler |
| 85 | +``` |
| 86 | + |
| 87 | +## 4. Creation of rails Project |
| 88 | +Create a new rails project in your folder using the below command. |
| 89 | +```bash |
| 90 | + rails new . --webpack --database=sqlite3 |
| 91 | +``` |
| 92 | + |
| 93 | +## 5. Create package.json file |
| 94 | +To create package.json file use the following command. |
| 95 | +```bash |
| 96 | + bundle add jsbundling-rails |
| 97 | +``` |
10 | 98 |
|
11 | | -You can install the Ruby from the following link. |
12 | | -[`https://www.ruby-lang.org/en/downloads/`](https://www.ruby-lang.org/en/downloads/) |
| 99 | +## 6. Add Scripts |
| 100 | +To add esbuild scripts, app/javascript/application.js use the following command |
| 101 | +```bash |
| 102 | + rails javascript:install:esbuild |
| 103 | +``` |
13 | 104 |
|
14 | | -## Install Rails |
| 105 | +## 7. Installation of syncfusion dependencies |
| 106 | +Install the syncfusion dependencies by the following commands. |
| 107 | +```bash |
| 108 | + |
| 109 | + yarn add @syncfusion/ej2-base |
| 110 | + yarn add @syncfusion/ej2-schedule |
| 111 | + yarn add @syncfusion/ej2-buttons @syncfusion/ej2-calendars |
15 | 112 |
|
16 | 113 | ``` |
17 | | -gem install rails |
| 114 | + |
| 115 | +## 8. Add CSS styles |
| 116 | +Add the Styles in app/javascript/application.js. |
| 117 | + |
| 118 | +import the necessary css styles from syncfusion documentatoion from the below link |
| 119 | +```bash |
| 120 | + https://ej2.syncfusion.com/documentation/schedule/getting-started |
| 121 | + |
18 | 122 | ``` |
19 | 123 |
|
20 | | -## Add Syncfusion Scheduler component in your application |
| 124 | +## 9. Creation of event models |
| 125 | +To Create the event model in your application use the below commands. |
| 126 | +```bash |
| 127 | + rails generate model Event title:string start:datetime end:datetime description:text |
| 128 | + rails db:migrate |
21 | 129 |
|
22 | | -Refer the following UG documenation for adding Syncfusion React component in your application |
23 | | -* [Getting Started of Syncfusion Javascript Scheduler component](https://ej2.syncfusion.com/javascript/documentation/schedule/getting-started) |
| 130 | +``` |
| 131 | + |
| 132 | +## 10. Create controller and Routes |
| 133 | +To Create Events Controller + Routes use following commands. |
| 134 | +```bash |
| 135 | + rails generate controller Events |
| 136 | +``` |
24 | 137 |
|
25 | | -## Run the project |
| 138 | +## 11. Creation of Home folder |
| 139 | +Create the folder Home and index.html |
| 140 | +```bash |
| 141 | + rails generate controller Home index |
| 142 | +``` |
26 | 143 |
|
| 144 | +## 12. Update the code in index.html |
| 145 | +Update the file app/views/Home/index.html or refer syncfusion documentation for different scheduler |
| 146 | + https://ej2.syncfusion.com/documentation/schedule/getting-started |
| 147 | +```bash |
| 148 | + |
| 149 | + <section> |
| 150 | + <script src="https://cdn.syncfusion.com/ej2/22.1.38/dist/ej2.min.js" type="text/javascript"></script> |
| 151 | + <link href="https://cdn.syncfusion.com/ej2/22.1.38/material.css" rel="stylesheet"> |
| 152 | + </section> |
| 153 | + <section> |
| 154 | + <div id="Schedule"></div> |
| 155 | + <script> |
| 156 | + var scheduleObj = new ej.schedule.Schedule({ |
| 157 | + height: '550px', |
| 158 | + width: '100%', |
| 159 | + selectedDate: new Date(2023, 6, 13), |
| 160 | + eventSettings: { |
| 161 | + dataSource: [{ |
| 162 | + Id: 1, |
| 163 | + Subject: 'Meeting', |
| 164 | + StartTime: new Date(2023, 6, 13, 10, 0), |
| 165 | + EndTime: new Date(2023, 6, 13, 12, 30) |
| 166 | + }] |
| 167 | + } |
| 168 | + }); |
| 169 | + scheduleObj.appendTo('#Schedule'); |
| 170 | + </script> |
| 171 | + </section> |
27 | 172 | ``` |
28 | | -yarn install |
29 | | -rails server |
| 173 | + |
| 174 | +## 13.Run the application |
| 175 | +Run the application using the following command. |
| 176 | +```bash |
| 177 | + rails server |
30 | 178 | ``` |
| 179 | + |
| 180 | + |
| 181 | + |
0 commit comments