rails-page-builder 0.1.0
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.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +132 -0
- data/LICENSE.txt +21 -0
- data/README.md +416 -0
- data/Rakefile +8 -0
- data/lib/rails/page/builder/version.rb +9 -0
- data/lib/rails/page/builder.rb +39 -0
- data/sig/rails/page/builder.rbs +8 -0
- metadata +87 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a69c9faa532a545fd7ef40dbce79737ae5ee1f3fcf49d3ef62c07187ba3e9518
|
4
|
+
data.tar.gz: 231d118319ea48abb3766f454d7c3bc35105c060921a02cb6901ce22846b7a79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 036e819d59020bdcc0747a0763d0e1b17ec252ce076082b4366ead42a0920cbbbc1655d69f81cc2e9c2f00f413f455f6c83298c2fd7844ab4f76bbcd74fce774
|
7
|
+
data.tar.gz: a17fbc6ae1ba96c579d7a638242fc47745fa63cc7cb9af5837c7611eedfe00e3f9631d4c2252daec35bb2968f5d17df2aa525f03b9109cb0a10bdb19faf16dd3
|
data/.rspec
ADDED
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
10
|
+
identity and orientation.
|
11
|
+
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
13
|
+
diverse, inclusive, and healthy community.
|
14
|
+
|
15
|
+
## Our Standards
|
16
|
+
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
18
|
+
community include:
|
19
|
+
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
24
|
+
and learning from the experience
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
26
|
+
community
|
27
|
+
|
28
|
+
Examples of unacceptable behavior include:
|
29
|
+
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
31
|
+
any kind
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
33
|
+
* Public or private harassment
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
35
|
+
without their explicit permission
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
37
|
+
professional setting
|
38
|
+
|
39
|
+
## Enforcement Responsibilities
|
40
|
+
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
44
|
+
or harmful.
|
45
|
+
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
49
|
+
decisions when appropriate.
|
50
|
+
|
51
|
+
## Scope
|
52
|
+
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
54
|
+
an individual is officially representing the community in public spaces.
|
55
|
+
Examples of representing our community include using an official email address,
|
56
|
+
posting via an official social media account, or acting as an appointed
|
57
|
+
representative at an online or offline event.
|
58
|
+
|
59
|
+
## Enforcement
|
60
|
+
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
62
|
+
reported to the community leaders responsible for enforcement at
|
63
|
+
[INSERT CONTACT METHOD].
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
65
|
+
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
67
|
+
reporter of any incident.
|
68
|
+
|
69
|
+
## Enforcement Guidelines
|
70
|
+
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
73
|
+
|
74
|
+
### 1. Correction
|
75
|
+
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
77
|
+
unprofessional or unwelcome in the community.
|
78
|
+
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
82
|
+
|
83
|
+
### 2. Warning
|
84
|
+
|
85
|
+
**Community Impact**: A violation through a single incident or series of
|
86
|
+
actions.
|
87
|
+
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
92
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
93
|
+
ban.
|
94
|
+
|
95
|
+
### 3. Temporary Ban
|
96
|
+
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
98
|
+
sustained inappropriate behavior.
|
99
|
+
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
101
|
+
communication with the community for a specified period of time. No public or
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
104
|
+
Violating these terms may lead to a permanent ban.
|
105
|
+
|
106
|
+
### 4. Permanent Ban
|
107
|
+
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
111
|
+
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
113
|
+
community.
|
114
|
+
|
115
|
+
## Attribution
|
116
|
+
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
118
|
+
version 2.1, available at
|
119
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
120
|
+
|
121
|
+
Community Impact Guidelines were inspired by
|
122
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
123
|
+
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
125
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
126
|
+
[https://www.contributor-covenant.org/translations][translations].
|
127
|
+
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
129
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
130
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
131
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2025 Hadi
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,416 @@
|
|
1
|
+
# Rails Page Builder
|
2
|
+
|
3
|
+
[English](#english) | [فارسی](#فارسی)
|
4
|
+
|
5
|
+
---
|
6
|
+
|
7
|
+
## English
|
8
|
+
|
9
|
+
A visual drag-and-drop page builder for Ruby on Rails applications, designed to simplify view development for developers without extensive frontend experience. Similar to Elementor or WPBakery, but built specifically for Rails.
|
10
|
+
|
11
|
+
### 🚀 Features
|
12
|
+
|
13
|
+
- 🎨 **Visual Page Builder**: Intuitive drag-and-drop interface
|
14
|
+
- 🌍 **Multi-language Support**: Built-in support for English, Persian (Farsi), Arabic, and Hebrew
|
15
|
+
- ↔️ **RTL Support**: Full right-to-left text support for RTL languages
|
16
|
+
- 📱 **Responsive Design**: Mobile-friendly design with device preview
|
17
|
+
- 🔧 **Configurable**: Easy configuration through Rails initializers
|
18
|
+
- 📦 **Custom Blocks**: Add your own custom content blocks
|
19
|
+
- 🎯 **Rails Integration**: Seamless integration with Rails applications
|
20
|
+
- 🔌 **Plugin System**: Extensible plugin architecture
|
21
|
+
- 📊 **Analytics**: Built-in analytics and reporting features
|
22
|
+
- 🔒 **Security**: Permission-based access control
|
23
|
+
|
24
|
+
### 📦 Installation
|
25
|
+
|
26
|
+
Add this line to your application's Gemfile:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
gem 'rails-page-builder'
|
30
|
+
```
|
31
|
+
|
32
|
+
And then execute:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
bundle install
|
36
|
+
```
|
37
|
+
|
38
|
+
Or install it yourself as:
|
39
|
+
|
40
|
+
```bash
|
41
|
+
gem install rails-page-builder
|
42
|
+
```
|
43
|
+
|
44
|
+
### ⚙️ Setup
|
45
|
+
|
46
|
+
After installing the gem, run the install generator:
|
47
|
+
|
48
|
+
```bash
|
49
|
+
rails generate rails_page_builder:install
|
50
|
+
```
|
51
|
+
|
52
|
+
This will:
|
53
|
+
- Create the pages migration
|
54
|
+
- Generate controller, views, and model files
|
55
|
+
- Add the engine route to your application
|
56
|
+
- Create an initializer for configuration
|
57
|
+
|
58
|
+
Run the migration:
|
59
|
+
|
60
|
+
```bash
|
61
|
+
rails db:migrate
|
62
|
+
```
|
63
|
+
|
64
|
+
### 🎯 Usage
|
65
|
+
|
66
|
+
#### Basic Configuration
|
67
|
+
|
68
|
+
Configure the page builder in `config/initializers/rails_page_builder.rb`:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
Rails::Page::Builder.configure do |config|
|
72
|
+
# Set default language
|
73
|
+
config.default_language = :en # :en, :fa, :ar, :he
|
74
|
+
|
75
|
+
# Supported languages
|
76
|
+
config.supported_languages = [:en, :fa, :ar, :he]
|
77
|
+
|
78
|
+
# Enable plugins
|
79
|
+
config.enable_plugins = true
|
80
|
+
|
81
|
+
# Enable analytics
|
82
|
+
config.enable_analytics = true
|
83
|
+
end
|
84
|
+
```
|
85
|
+
|
86
|
+
#### Using the Page Builder
|
87
|
+
|
88
|
+
1. **Access the builder**: Visit `/rails_page_builder` in your Rails application
|
89
|
+
2. **Create pages**: Use the visual interface to build pages
|
90
|
+
3. **Save and publish**: Save your pages and integrate them into your Rails views
|
91
|
+
|
92
|
+
#### Rendering Pages
|
93
|
+
|
94
|
+
In your Rails views:
|
95
|
+
|
96
|
+
```erb
|
97
|
+
<!-- Render a page builder editor -->
|
98
|
+
<%= rails_page_builder_editor(language: :fa) %>
|
99
|
+
|
100
|
+
<!-- Render saved page content -->
|
101
|
+
<%= rails_page_builder_content(@page) %>
|
102
|
+
```
|
103
|
+
|
104
|
+
#### Custom Blocks
|
105
|
+
|
106
|
+
Add custom blocks through configuration:
|
107
|
+
|
108
|
+
```ruby
|
109
|
+
Rails::Page::Builder.configure do |config|
|
110
|
+
config.custom_blocks = [
|
111
|
+
{
|
112
|
+
id: 'custom-hero',
|
113
|
+
label: 'Hero Section',
|
114
|
+
content: '<div class="hero">Hero Content</div>',
|
115
|
+
category: 'Layout',
|
116
|
+
icon: '🎯'
|
117
|
+
}
|
118
|
+
]
|
119
|
+
end
|
120
|
+
```
|
121
|
+
|
122
|
+
### 🌍 Multi-language Support
|
123
|
+
|
124
|
+
The gem automatically detects RTL languages and adjusts the interface accordingly:
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
# Supported languages with RTL detection
|
128
|
+
languages = {
|
129
|
+
en: { name: 'English', rtl: false },
|
130
|
+
fa: { name: 'فارسی', rtl: true },
|
131
|
+
ar: { name: 'العربية', rtl: true },
|
132
|
+
he: { name: 'עברית', rtl: true }
|
133
|
+
}
|
134
|
+
```
|
135
|
+
|
136
|
+
### 🔧 Advanced Features
|
137
|
+
|
138
|
+
#### Plugin System
|
139
|
+
```ruby
|
140
|
+
# Register a plugin
|
141
|
+
Rails::Page::Builder::PluginSystem.register_plugin('my-plugin', {
|
142
|
+
name: 'My Custom Plugin',
|
143
|
+
version: '1.0.0',
|
144
|
+
assets: ['my-plugin.js', 'my-plugin.css']
|
145
|
+
})
|
146
|
+
```
|
147
|
+
|
148
|
+
#### Analytics
|
149
|
+
```ruby
|
150
|
+
# Track page events
|
151
|
+
Rails::Page::Builder::Analytics.track_event(:page_view, {
|
152
|
+
page_id: @page.id,
|
153
|
+
user_id: current_user.id
|
154
|
+
})
|
155
|
+
```
|
156
|
+
|
157
|
+
### 🛠️ Development
|
158
|
+
|
159
|
+
To test the gem locally:
|
160
|
+
|
161
|
+
```bash
|
162
|
+
# Clone the repository
|
163
|
+
git clone https://github.com/hadivarp/rails-page-builder.git
|
164
|
+
cd rails-page-builder
|
165
|
+
|
166
|
+
# Install dependencies
|
167
|
+
bundle install
|
168
|
+
|
169
|
+
# Run the demo server
|
170
|
+
./start_demo.sh
|
171
|
+
|
172
|
+
# Visit http://localhost:4567/interactive
|
173
|
+
```
|
174
|
+
|
175
|
+
### 📄 License
|
176
|
+
|
177
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
178
|
+
|
179
|
+
### 🤝 Contributing
|
180
|
+
|
181
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hadivarp/rails-page-builder.
|
182
|
+
|
183
|
+
---
|
184
|
+
|
185
|
+
## فارسی
|
186
|
+
|
187
|
+
سازنده صفحه بصری کشیدن و رها کردن برای اپلیکیشنهای Ruby on Rails، طراحی شده برای سادهسازی توسعه view برای توسعهدهندگانی که تجربه گستردهای در frontend ندارند. شبیه به Elementor یا WPBakery، اما مخصوص Rails ساخته شده است.
|
188
|
+
|
189
|
+
### 🚀 ویژگیها
|
190
|
+
|
191
|
+
- 🎨 **سازنده صفحه بصری**: رابط کاربری بصری کشیدن و رها کردن
|
192
|
+
- 🌍 **پشتیبانی چند زبانه**: پشتیبانی داخلی از انگلیسی، فارسی، عربی و عبری
|
193
|
+
- ↔️ **پشتیبانی RTL**: پشتیبانی کامل از متن راست به چپ برای زبانهای RTL
|
194
|
+
- 📱 **طراحی ریسپانسیو**: طراحی موبایل-فرندلی با پیشنمایش دستگاه
|
195
|
+
- 🔧 **قابل پیکربندی**: پیکربندی آسان از طریق initializer های Rails
|
196
|
+
- 📦 **بلوکهای سفارشی**: اضافه کردن بلوکهای محتوای سفارشی
|
197
|
+
- 🎯 **یکپارچگی Rails**: یکپارچگی بدون درز با اپلیکیشنهای Rails
|
198
|
+
- 🔌 **سیستم پلاگین**: معماری پلاگین قابل گسترش
|
199
|
+
- 📊 **آنالیتیکس**: ویژگیهای آنالیتیکس و گزارشگیری داخلی
|
200
|
+
- 🔒 **امنیت**: کنترل دسترسی مبتنی بر مجوز
|
201
|
+
|
202
|
+
### 📦 نصب
|
203
|
+
|
204
|
+
این خط را به Gemfile اپلیکیشن خود اضافه کنید:
|
205
|
+
|
206
|
+
```ruby
|
207
|
+
gem 'rails-page-builder'
|
208
|
+
```
|
209
|
+
|
210
|
+
و سپس اجرا کنید:
|
211
|
+
|
212
|
+
```bash
|
213
|
+
bundle install
|
214
|
+
```
|
215
|
+
|
216
|
+
یا خودتان نصب کنید:
|
217
|
+
|
218
|
+
```bash
|
219
|
+
gem install rails-page-builder
|
220
|
+
```
|
221
|
+
|
222
|
+
### ⚙️ راهاندازی
|
223
|
+
|
224
|
+
پس از نصب gem، generator نصب را اجرا کنید:
|
225
|
+
|
226
|
+
```bash
|
227
|
+
rails generate rails_page_builder:install
|
228
|
+
```
|
229
|
+
|
230
|
+
این کار موارد زیر را انجام میدهد:
|
231
|
+
- ایجاد migration صفحات
|
232
|
+
- تولید فایلهای controller، view و model
|
233
|
+
- اضافه کردن مسیر engine به اپلیکیشن شما
|
234
|
+
- ایجاد initializer برای پیکربندی
|
235
|
+
|
236
|
+
migration را اجرا کنید:
|
237
|
+
|
238
|
+
```bash
|
239
|
+
rails db:migrate
|
240
|
+
```
|
241
|
+
|
242
|
+
### 🎯 استفاده
|
243
|
+
|
244
|
+
#### پیکربندی پایه
|
245
|
+
|
246
|
+
سازنده صفحه را در `config/initializers/rails_page_builder.rb` پیکربندی کنید:
|
247
|
+
|
248
|
+
```ruby
|
249
|
+
Rails::Page::Builder.configure do |config|
|
250
|
+
# تنظیم زبان پیشفرض
|
251
|
+
config.default_language = :fa # :en, :fa, :ar, :he
|
252
|
+
|
253
|
+
# زبانهای پشتیبانی شده
|
254
|
+
config.supported_languages = [:en, :fa, :ar, :he]
|
255
|
+
|
256
|
+
# فعالسازی پلاگینها
|
257
|
+
config.enable_plugins = true
|
258
|
+
|
259
|
+
# فعالسازی آنالیتیکس
|
260
|
+
config.enable_analytics = true
|
261
|
+
end
|
262
|
+
```
|
263
|
+
|
264
|
+
#### استفاده از سازنده صفحه
|
265
|
+
|
266
|
+
1. **دسترسی به سازنده**: `/rails_page_builder` را در اپلیکیشن Rails خود بازدید کنید
|
267
|
+
2. **ایجاد صفحات**: از رابط بصری برای ساخت صفحات استفاده کنید
|
268
|
+
3. **ذخیره و انتشار**: صفحات خود را ذخیره کنید و در view های Rails خود یکپارچه کنید
|
269
|
+
|
270
|
+
#### رندر کردن صفحات
|
271
|
+
|
272
|
+
در view های Rails خود:
|
273
|
+
|
274
|
+
```erb
|
275
|
+
<!-- رندر کردن ویرایشگر سازنده صفحه -->
|
276
|
+
<%= rails_page_builder_editor(language: :fa) %>
|
277
|
+
|
278
|
+
<!-- رندر کردن محتوای صفحه ذخیره شده -->
|
279
|
+
<%= rails_page_builder_content(@page) %>
|
280
|
+
```
|
281
|
+
|
282
|
+
#### بلوکهای سفارشی
|
283
|
+
|
284
|
+
بلوکهای سفارشی را از طریق پیکربندی اضافه کنید:
|
285
|
+
|
286
|
+
```ruby
|
287
|
+
Rails::Page::Builder.configure do |config|
|
288
|
+
config.custom_blocks = [
|
289
|
+
{
|
290
|
+
id: 'hero-farsi',
|
291
|
+
label: 'بخش هیرو',
|
292
|
+
content: '<div class="hero">محتوای هیرو</div>',
|
293
|
+
category: 'لایهبندی',
|
294
|
+
icon: '🎯'
|
295
|
+
}
|
296
|
+
]
|
297
|
+
end
|
298
|
+
```
|
299
|
+
|
300
|
+
### 🌍 پشتیبانی چند زبانه
|
301
|
+
|
302
|
+
gem به طور خودکار زبانهای RTL را تشخیص میدهد و رابط را متناسب تنظیم میکند:
|
303
|
+
|
304
|
+
```ruby
|
305
|
+
# زبانهای پشتیبانی شده با تشخیص RTL
|
306
|
+
languages = {
|
307
|
+
en: { name: 'English', rtl: false },
|
308
|
+
fa: { name: 'فارسی', rtl: true },
|
309
|
+
ar: { name: 'العربية', rtl: true },
|
310
|
+
he: { name: 'עברית', rtl: true }
|
311
|
+
}
|
312
|
+
```
|
313
|
+
|
314
|
+
### 🔧 ویژگیهای پیشرفته
|
315
|
+
|
316
|
+
#### سیستم پلاگین
|
317
|
+
```ruby
|
318
|
+
# ثبت یک پلاگین
|
319
|
+
Rails::Page::Builder::PluginSystem.register_plugin('my-plugin', {
|
320
|
+
name: 'پلاگین سفارشی من',
|
321
|
+
version: '1.0.0',
|
322
|
+
assets: ['my-plugin.js', 'my-plugin.css']
|
323
|
+
})
|
324
|
+
```
|
325
|
+
|
326
|
+
#### آنالیتیکس
|
327
|
+
```ruby
|
328
|
+
# ردیابی رویدادهای صفحه
|
329
|
+
Rails::Page::Builder::Analytics.track_event(:page_view, {
|
330
|
+
page_id: @page.id,
|
331
|
+
user_id: current_user.id
|
332
|
+
})
|
333
|
+
```
|
334
|
+
|
335
|
+
### 🛠️ توسعه
|
336
|
+
|
337
|
+
برای تست gem به صورت محلی:
|
338
|
+
|
339
|
+
```bash
|
340
|
+
# کلون کردن مخزن
|
341
|
+
git clone https://github.com/hadivarp/rails-page-builder.git
|
342
|
+
cd rails-page-builder
|
343
|
+
|
344
|
+
# نصب وابستگیها
|
345
|
+
bundle install
|
346
|
+
|
347
|
+
# اجرای سرور نمایشی
|
348
|
+
./start_demo.sh
|
349
|
+
|
350
|
+
# بازدید از http://localhost:4567/interactive
|
351
|
+
```
|
352
|
+
|
353
|
+
### 📄 مجوز
|
354
|
+
|
355
|
+
این gem تحت شرایط [مجوز MIT](https://opensource.org/licenses/MIT) به عنوان منبع باز در دسترس است.
|
356
|
+
|
357
|
+
### 🤝 مشارکت
|
358
|
+
|
359
|
+
گزارش باگ و pull request ها در GitHub به آدرس https://github.com/hadivarp/rails-page-builder خوشآمد هستند.
|
360
|
+
|
361
|
+
---
|
362
|
+
|
363
|
+
## Demo & Examples
|
364
|
+
|
365
|
+
### Interactive Demo
|
366
|
+
Start the demo server to see the page builder in action:
|
367
|
+
|
368
|
+
```bash
|
369
|
+
./start_demo.sh
|
370
|
+
```
|
371
|
+
|
372
|
+
Visit:
|
373
|
+
- **Interactive Builder**: http://localhost:4567/interactive
|
374
|
+
- **Dashboard**: http://localhost:4567/dashboard
|
375
|
+
- **Persian Showcase**: http://localhost:4567/showcase/fa
|
376
|
+
- **English Showcase**: http://localhost:4567/showcase/en
|
377
|
+
|
378
|
+
### Example Usage in Rails App
|
379
|
+
|
380
|
+
```ruby
|
381
|
+
# In your controller
|
382
|
+
class PagesController < ApplicationController
|
383
|
+
def show
|
384
|
+
@page = Rails::Page::Builder::Page.find(params[:id])
|
385
|
+
end
|
386
|
+
|
387
|
+
def edit
|
388
|
+
@page = Rails::Page::Builder::Page.find(params[:id])
|
389
|
+
end
|
390
|
+
end
|
391
|
+
```
|
392
|
+
|
393
|
+
```erb
|
394
|
+
<!-- In your view -->
|
395
|
+
<div class="page-content" dir="<%= @page.rtl? ? 'rtl' : 'ltr' %>">
|
396
|
+
<%= rails_page_builder_content(@page) %>
|
397
|
+
</div>
|
398
|
+
```
|
399
|
+
|
400
|
+
### API Examples
|
401
|
+
|
402
|
+
```ruby
|
403
|
+
# Create a new page
|
404
|
+
page = Rails::Page::Builder::Page.create!(
|
405
|
+
title: 'صفحه نمونه',
|
406
|
+
language: 'fa',
|
407
|
+
content: Rails::Page::Builder::BlockLibrary.build_page([
|
408
|
+
{ type: 'hero', title: 'عنوان اصلی', content: 'محتوای توضیحی' },
|
409
|
+
{ type: 'features', items: ['ویژگی ۱', 'ویژگی ۲', 'ویژگی ۳'] }
|
410
|
+
])
|
411
|
+
)
|
412
|
+
|
413
|
+
# Render in different languages
|
414
|
+
english_content = page.render(language: :en)
|
415
|
+
persian_content = page.render(language: :fa)
|
416
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "builder/version"
|
4
|
+
require_relative "builder/engine"
|
5
|
+
require_relative "builder/configuration"
|
6
|
+
require_relative "builder/helpers"
|
7
|
+
require_relative "builder/block_library"
|
8
|
+
require_relative "builder/template_system"
|
9
|
+
require_relative "builder/template_manager"
|
10
|
+
require_relative "builder/asset_manager"
|
11
|
+
require_relative "builder/plugin_system"
|
12
|
+
require_relative "builder/api_integration"
|
13
|
+
require_relative "builder/advanced_editor"
|
14
|
+
require_relative "builder/component_library"
|
15
|
+
require_relative "builder/collaboration"
|
16
|
+
require_relative "builder/websocket_manager"
|
17
|
+
require_relative "builder/security"
|
18
|
+
require_relative "builder/permissions"
|
19
|
+
require_relative "builder/performance"
|
20
|
+
require_relative "builder/analytics"
|
21
|
+
require_relative "builder/reporting"
|
22
|
+
|
23
|
+
module Rails
|
24
|
+
module Page
|
25
|
+
module Builder
|
26
|
+
class Error < StandardError; end
|
27
|
+
|
28
|
+
class << self
|
29
|
+
def configuration
|
30
|
+
@configuration ||= Configuration.new
|
31
|
+
end
|
32
|
+
|
33
|
+
def configure
|
34
|
+
yield(configuration)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-page-builder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hadi
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-08-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '6.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '6.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sprockets-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.0'
|
41
|
+
description: |-
|
42
|
+
This gem is designed to help you simplify working with views in Rails frameworks — especially for developers who have no background in frontend development but need to build an app.
|
43
|
+
The initial idea was to create something similar to Elementor or WPBakery, but for Rails.
|
44
|
+
I hope it’s useful. If you encounter any issues, please open a commit or let me know — I’ll do my best to fix it.
|
45
|
+
email:
|
46
|
+
- h.varposhti@roundtableapps.com
|
47
|
+
executables: []
|
48
|
+
extensions: []
|
49
|
+
extra_rdoc_files: []
|
50
|
+
files:
|
51
|
+
- ".rspec"
|
52
|
+
- CHANGELOG.md
|
53
|
+
- CODE_OF_CONDUCT.md
|
54
|
+
- LICENSE.txt
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- lib/rails/page/builder.rb
|
58
|
+
- lib/rails/page/builder/version.rb
|
59
|
+
- sig/rails/page/builder.rbs
|
60
|
+
homepage: https://github.com/hadivarp/rails-page-builder
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata:
|
64
|
+
homepage_uri: https://github.com/hadivarp/rails-page-builder
|
65
|
+
source_code_uri: https://github.com/hadivarp/rails-page-builder
|
66
|
+
changelog_uri: https://github.com/hadivarp/rails-page-builder/blob/main/CHANGELOG.md
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.0.0
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubygems_version: 3.4.10
|
83
|
+
signing_key:
|
84
|
+
specification_version: 4
|
85
|
+
summary: A visual page builder for Ruby on Rails using GrapesJS with multi-language
|
86
|
+
support
|
87
|
+
test_files: []
|