phcdevworks_tutorials 2.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -27
- data/app/assets/config/phcdevworks_tutorials_manifest.js +1 -1
- data/app/assets/stylesheets/phcdevworks_tutorials/category/posts.css +4 -0
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.css +4 -0
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.css +4 -0
- data/app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb +2 -3
- data/app/controllers/phcdevworks_tutorials/tutorial/posts_controller.rb +5 -6
- data/app/controllers/phcdevworks_tutorials/tutorial/steps_controller.rb +6 -12
- data/app/models/phcdevworks_tutorials/category.rb +7 -0
- data/app/models/phcdevworks_tutorials/tutorial/category.rb +3 -3
- data/app/models/phcdevworks_tutorials/tutorial/post.rb +8 -8
- data/app/models/phcdevworks_tutorials/tutorial/step.rb +1 -1
- data/app/views/layouts/phcdevworks_tutorials/application.html.erb +62 -77
- data/app/views/layouts/phcdevworks_tutorials/components/backend/footer/_footer.html.erb +7 -7
- data/app/views/layouts/phcdevworks_tutorials/components/backend/navigation/_top_menu.html.erb +37 -37
- data/app/views/layouts/phcdevworks_tutorials/components/backend/sidebars/_side_menu.html.erb +257 -239
- data/app/views/layouts/phcdevworks_tutorials/frontend.html.erb +0 -5
- data/app/views/phcdevworks_tutorials/tutorial/categories/_form.html.erb +16 -14
- data/app/views/phcdevworks_tutorials/tutorial/categories/edit.html.erb +31 -23
- data/app/views/phcdevworks_tutorials/tutorial/categories/index.html.erb +63 -52
- data/app/views/phcdevworks_tutorials/tutorial/categories/new.html.erb +31 -23
- data/app/views/phcdevworks_tutorials/tutorial/categories/show.html.erb +1 -1
- data/app/views/phcdevworks_tutorials/tutorial/posts/_form.html.erb +46 -46
- data/app/views/phcdevworks_tutorials/tutorial/posts/edit.html.erb +31 -23
- data/app/views/phcdevworks_tutorials/tutorial/posts/index.html.erb +68 -56
- data/app/views/phcdevworks_tutorials/tutorial/posts/new.html.erb +31 -23
- data/app/views/phcdevworks_tutorials/tutorial/steps/_form.html.erb +36 -48
- data/app/views/phcdevworks_tutorials/tutorial/steps/edit.html.erb +31 -23
- data/app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb +57 -52
- data/app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb +31 -23
- data/config/routes.rb +3 -3
- data/db/migrate/{20190911225813_create_phcdevworks_tutorials_tutorial_posts.rb → 20191017235259_create_phcdevworks_tutorials_tutorial_posts.rb} +4 -6
- data/db/migrate/{20190923113101_create_phcdevworks_tutorials_tutorial_steps.rb → 20191017235421_create_phcdevworks_tutorials_tutorial_steps.rb} +4 -6
- data/db/migrate/{20190911225925_create_phcdevworks_tutorials_tutorial_categories.rb → 20191018124910_create_phcdevworks_tutorials_tutorial_categories.rb} +1 -1
- data/db/migrate/20191024232406_create_phcdevworks_tutorials_categories_posts.rb +8 -0
- data/lib/phcdevworks_tutorials/engine.rb +6 -8
- data/lib/phcdevworks_tutorials/version.rb +1 -1
- metadata +36 -18
- data/app/assets/javascripts/phcdevworks_tutorials/tutorial/posts.coffee +0 -3
- data/app/assets/javascripts/phcdevworks_tutorials/tutorial/steps.coffee +0 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.scss +0 -3
- data/app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.scss +0 -3
- data/app/assets/stylesheets/scaffolds.scss +0 -65
- data/config/initializers/friendly_id.rb +0 -107
- data/db/migrate/20191003235303_create_join_table_categories_posts.rb +0 -10
@@ -1,39 +1,47 @@
|
|
1
|
-
<!-- Title
|
1
|
+
<!-- PHCTitleSEO Title Variables -->
|
2
2
|
<% phc_title "Tutorial Post Manager" %>
|
3
3
|
<% phc_title_tagline "Add a New Step" %>
|
4
4
|
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
5
|
<% phc_breadcrumb_two link_to "Tutorial Step Index", phcdevworks_tutorials.tutorial_post_steps_path %>
|
6
|
-
<!-- Title
|
6
|
+
<!-- PHCTitleSEO Title Variables -->
|
7
7
|
|
8
8
|
<!-- Page Bradcrumbs -->
|
9
9
|
<ol class="breadcrumb pull-right">
|
10
|
-
|
11
|
-
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
12
|
</ol>
|
13
13
|
<!-- Page Bradcrumbs -->
|
14
14
|
|
15
15
|
<!-- Page Header -->
|
16
|
-
<
|
16
|
+
<h2 class="page-header"><%= yield(:phc_title) %></h2>
|
17
17
|
<!-- Page Header -->
|
18
18
|
|
19
|
-
<!-- Page
|
20
|
-
<div class="
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
19
|
+
<!-- Page Content -->
|
20
|
+
<div class="row">
|
21
|
+
<div class="col-lg-12">
|
22
|
+
|
23
|
+
<!-- Panel -->
|
24
|
+
<div class="panel panel-inverse">
|
25
|
+
|
26
|
+
<!-- Panel - Heading -->
|
27
|
+
<div class="panel-heading">
|
28
|
+
<h4 class="panel-title"><%= yield(:phc_title) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel - Heading -->
|
31
|
+
|
32
|
+
<!-- Panel - Body -->
|
33
|
+
<div class="panel-body">
|
34
|
+
|
35
|
+
<!-- New Form -->
|
36
|
+
<%= render "form", { form_url: tutorial_post_steps_path } %>
|
37
|
+
<!-- New Form -->
|
38
|
+
|
39
|
+
</div>
|
40
|
+
<!-- Panel - Body -->
|
41
|
+
|
27
42
|
</div>
|
28
|
-
|
29
|
-
|
30
|
-
<!-- Panel Heading -->
|
31
|
-
<!-- Panel Body -->
|
32
|
-
<div class="panel-body">
|
33
|
-
<!-- Form to Edit Member Address -->
|
34
|
-
<%= render "form", { form_url: tutorial_post_steps_path } %>
|
35
|
-
<!-- Form to Edit Member Address -->
|
43
|
+
<!-- Panel -->
|
44
|
+
|
36
45
|
</div>
|
37
|
-
<!-- Panel Body -->
|
38
46
|
</div>
|
39
|
-
<!-- Page
|
47
|
+
<!-- Page Content -->
|
data/config/routes.rb
CHANGED
@@ -2,10 +2,10 @@ PhcdevworksTutorials::Engine.routes.draw do
|
|
2
2
|
|
3
3
|
# Tutorial Routs
|
4
4
|
namespace :tutorial do
|
5
|
-
resources :posts, class_name: "
|
6
|
-
resources :steps, class_name: "
|
5
|
+
resources :posts, class_name: "Tutorial::Post" do
|
6
|
+
resources :steps, class_name: "Tutorial::Step"
|
7
7
|
end
|
8
|
-
resources :categories, class_name: "
|
8
|
+
resources :categories, class_name: "Tutorial::Category"
|
9
9
|
end
|
10
10
|
|
11
11
|
# Frontend Routes
|
@@ -2,12 +2,10 @@ class CreatePhcdevworksTutorialsTutorialPosts < ActiveRecord::Migration[6.0]
|
|
2
2
|
def change
|
3
3
|
create_table :phcdevworks_tutorials_tutorial_posts do |t|
|
4
4
|
|
5
|
-
t.string :
|
6
|
-
t.
|
7
|
-
t.string :
|
8
|
-
|
9
|
-
t.string :tutorial_post_image
|
10
|
-
t.string :tutorial_post_images
|
5
|
+
t.string :post_title
|
6
|
+
t.string :post_description
|
7
|
+
t.string :post_status
|
8
|
+
t.string :post_image
|
11
9
|
|
12
10
|
t.string :slug
|
13
11
|
t.string :user_id
|
@@ -2,12 +2,10 @@ class CreatePhcdevworksTutorialsTutorialSteps < ActiveRecord::Migration[6.0]
|
|
2
2
|
def change
|
3
3
|
create_table :phcdevworks_tutorials_tutorial_steps do |t|
|
4
4
|
|
5
|
-
t.
|
6
|
-
t.string :
|
7
|
-
t.
|
8
|
-
|
9
|
-
t.string :tutorial_step_image
|
10
|
-
t.string :tutorial_step_images
|
5
|
+
t.string :step_number
|
6
|
+
t.string :step_title
|
7
|
+
t.string :step_description
|
8
|
+
t.string :step_image
|
11
9
|
|
12
10
|
t.string :slug
|
13
11
|
t.string :user_id
|
@@ -11,23 +11,21 @@ module PhcdevworksTutorials
|
|
11
11
|
require "phcthemes_web_theme_pack"
|
12
12
|
|
13
13
|
# Load Helper Dependencies
|
14
|
-
|
14
|
+
require "phcdevworks_core"
|
15
15
|
require "phcdevworks_active_menus"
|
16
16
|
require "phcdevworks_notifications"
|
17
17
|
require "phcdevworks_titleseo"
|
18
18
|
|
19
|
+
# Load Upload Dependencies
|
20
|
+
require "aws-sdk-s3"
|
21
|
+
require "google-cloud-storage"
|
22
|
+
require "mini_magick"
|
23
|
+
|
19
24
|
# Load User Accounts
|
20
25
|
require "phcdevworks_accounts"
|
21
26
|
|
22
27
|
# Engine Namespace
|
23
28
|
isolate_namespace PhcdevworksTutorials
|
24
29
|
|
25
|
-
# Load Requried Helper Files
|
26
|
-
config.to_prepare do
|
27
|
-
PhcdevworksActiveMenus::ApplicationController.helper(ApplicationHelper)
|
28
|
-
PhcdevworksNotifications::ApplicationController.helper(ApplicationHelper)
|
29
|
-
PhcdevworksTitleseo::ApplicationController.helper(ApplicationHelper)
|
30
|
-
end
|
31
|
-
|
32
30
|
end
|
33
31
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phcdevworks_tutorials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PHCDevworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.1.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: phcdevworks_core
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.1
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.1
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: phcdevworks_active_menus
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +212,20 @@ dependencies:
|
|
198
212
|
requirements:
|
199
213
|
- - "~>"
|
200
214
|
- !ruby/object:Gem::Version
|
201
|
-
version: 1.
|
215
|
+
version: '1.3'
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: 1.3.1
|
202
219
|
type: :runtime
|
203
220
|
prerelease: false
|
204
221
|
version_requirements: !ruby/object:Gem::Requirement
|
205
222
|
requirements:
|
206
223
|
- - "~>"
|
207
224
|
- !ruby/object:Gem::Version
|
208
|
-
version: 1.
|
225
|
+
version: '1.3'
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: 1.3.1
|
209
229
|
- !ruby/object:Gem::Dependency
|
210
230
|
name: sqlite3
|
211
231
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,9 +240,9 @@ dependencies:
|
|
220
240
|
- - "~>"
|
221
241
|
- !ruby/object:Gem::Version
|
222
242
|
version: '1.4'
|
223
|
-
description: Ruby on Rails 6
|
243
|
+
description: Ruby on Rails 6 Engine to Manage Online Tutorials.
|
224
244
|
email:
|
225
|
-
-
|
245
|
+
- info@phcdevworks.com
|
226
246
|
executables: []
|
227
247
|
extensions: []
|
228
248
|
extra_rdoc_files: []
|
@@ -234,14 +254,12 @@ files:
|
|
234
254
|
- app/assets/javascripts/phcdevworks_tutorials/application.js
|
235
255
|
- app/assets/javascripts/phcdevworks_tutorials/blog/tutorials.coffee
|
236
256
|
- app/assets/javascripts/phcdevworks_tutorials/tutorial/categories.coffee
|
237
|
-
- app/assets/javascripts/phcdevworks_tutorials/tutorial/posts.coffee
|
238
|
-
- app/assets/javascripts/phcdevworks_tutorials/tutorial/steps.coffee
|
239
257
|
- app/assets/stylesheets/phcdevworks_tutorials/application.scss
|
240
258
|
- app/assets/stylesheets/phcdevworks_tutorials/blog/tutorials.scss
|
259
|
+
- app/assets/stylesheets/phcdevworks_tutorials/category/posts.css
|
241
260
|
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/categories.scss
|
242
|
-
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.
|
243
|
-
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.
|
244
|
-
- app/assets/stylesheets/scaffolds.scss
|
261
|
+
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/posts.css
|
262
|
+
- app/assets/stylesheets/phcdevworks_tutorials/tutorial/steps.css
|
245
263
|
- app/controllers/phcdevworks_tutorials/application_controller.rb
|
246
264
|
- app/controllers/phcdevworks_tutorials/blog/tutorials_controller.rb
|
247
265
|
- app/controllers/phcdevworks_tutorials/tutorial/categories_controller.rb
|
@@ -255,6 +273,7 @@ files:
|
|
255
273
|
- app/jobs/phcdevworks_tutorials/application_job.rb
|
256
274
|
- app/mailers/phcdevworks_tutorials/application_mailer.rb
|
257
275
|
- app/models/phcdevworks_tutorials/application_record.rb
|
276
|
+
- app/models/phcdevworks_tutorials/category.rb
|
258
277
|
- app/models/phcdevworks_tutorials/tutorial.rb
|
259
278
|
- app/models/phcdevworks_tutorials/tutorial/category.rb
|
260
279
|
- app/models/phcdevworks_tutorials/tutorial/post.rb
|
@@ -281,12 +300,11 @@ files:
|
|
281
300
|
- app/views/phcdevworks_tutorials/tutorial/steps/index.html.erb
|
282
301
|
- app/views/phcdevworks_tutorials/tutorial/steps/new.html.erb
|
283
302
|
- app/views/phcdevworks_tutorials/tutorial/steps/show.html.erb
|
284
|
-
- config/initializers/friendly_id.rb
|
285
303
|
- config/routes.rb
|
286
|
-
- db/migrate/
|
287
|
-
- db/migrate/
|
288
|
-
- db/migrate/
|
289
|
-
- db/migrate/
|
304
|
+
- db/migrate/20191017235259_create_phcdevworks_tutorials_tutorial_posts.rb
|
305
|
+
- db/migrate/20191017235421_create_phcdevworks_tutorials_tutorial_steps.rb
|
306
|
+
- db/migrate/20191018124910_create_phcdevworks_tutorials_tutorial_categories.rb
|
307
|
+
- db/migrate/20191024232406_create_phcdevworks_tutorials_categories_posts.rb
|
290
308
|
- lib/phcdevworks_tutorials.rb
|
291
309
|
- lib/phcdevworks_tutorials/engine.rb
|
292
310
|
- lib/phcdevworks_tutorials/version.rb
|
@@ -310,8 +328,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
328
|
- !ruby/object:Gem::Version
|
311
329
|
version: '0'
|
312
330
|
requirements: []
|
313
|
-
rubygems_version: 3.0.
|
331
|
+
rubygems_version: 3.0.6
|
314
332
|
signing_key:
|
315
333
|
specification_version: 4
|
316
|
-
summary: Rails 6
|
334
|
+
summary: Rails 6 - Engine - Tutorials
|
317
335
|
test_files: []
|
@@ -1,65 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
background-color: #fff;
|
3
|
-
color: #333;
|
4
|
-
margin: 33px; }
|
5
|
-
|
6
|
-
body, p, ol, ul, td {
|
7
|
-
font-family: verdana, arial, helvetica, sans-serif;
|
8
|
-
font-size: 13px;
|
9
|
-
line-height: 18px; }
|
10
|
-
|
11
|
-
pre {
|
12
|
-
background-color: #eee;
|
13
|
-
padding: 10px;
|
14
|
-
font-size: 11px; }
|
15
|
-
|
16
|
-
a {
|
17
|
-
color: #000; }
|
18
|
-
|
19
|
-
a:visited {
|
20
|
-
color: #666; }
|
21
|
-
|
22
|
-
a:hover {
|
23
|
-
color: #fff;
|
24
|
-
background-color: #000; }
|
25
|
-
|
26
|
-
th {
|
27
|
-
padding-bottom: 5px; }
|
28
|
-
|
29
|
-
td {
|
30
|
-
padding: 0 5px 7px; }
|
31
|
-
|
32
|
-
div.field,
|
33
|
-
div.actions {
|
34
|
-
margin-bottom: 10px; }
|
35
|
-
|
36
|
-
#notice {
|
37
|
-
color: green; }
|
38
|
-
|
39
|
-
.field_with_errors {
|
40
|
-
padding: 2px;
|
41
|
-
background-color: red;
|
42
|
-
display: table; }
|
43
|
-
|
44
|
-
#error_explanation {
|
45
|
-
width: 450px;
|
46
|
-
border: 2px solid red;
|
47
|
-
padding: 7px 7px 0;
|
48
|
-
margin-bottom: 20px;
|
49
|
-
background-color: #f0f0f0; }
|
50
|
-
|
51
|
-
#error_explanation h2 {
|
52
|
-
text-align: left;
|
53
|
-
font-weight: bold;
|
54
|
-
padding: 5px 5px 5px 15px;
|
55
|
-
font-size: 12px;
|
56
|
-
margin: -7px -7px 0;
|
57
|
-
background-color: #c00;
|
58
|
-
color: #fff; }
|
59
|
-
|
60
|
-
#error_explanation ul li {
|
61
|
-
font-size: 12px;
|
62
|
-
list-style: square; }
|
63
|
-
|
64
|
-
label {
|
65
|
-
display: block; }
|
@@ -1,107 +0,0 @@
|
|
1
|
-
# FriendlyId Global Configuration
|
2
|
-
#
|
3
|
-
# Use this to set up shared configuration options for your entire application.
|
4
|
-
# Any of the configuration options shown here can also be applied to single
|
5
|
-
# models by passing arguments to the `friendly_id` class method or defining
|
6
|
-
# methods in your model.
|
7
|
-
#
|
8
|
-
# To learn more, check out the guide:
|
9
|
-
#
|
10
|
-
# http://norman.github.io/friendly_id/file.Guide.html
|
11
|
-
|
12
|
-
FriendlyId.defaults do |config|
|
13
|
-
# ## Reserved Words
|
14
|
-
#
|
15
|
-
# Some words could conflict with Rails's routes when used as slugs, or are
|
16
|
-
# undesirable to allow as slugs. Edit this list as needed for your app.
|
17
|
-
config.use :reserved
|
18
|
-
|
19
|
-
config.reserved_words = %w(new edit index session login logout users admin
|
20
|
-
stylesheets assets javascripts images)
|
21
|
-
|
22
|
-
# This adds an option to treat reserved words as conflicts rather than exceptions.
|
23
|
-
# When there is no good candidate, a UUID will be appended, matching the existing
|
24
|
-
# conflict behavior.
|
25
|
-
|
26
|
-
# config.treat_reserved_as_conflict = true
|
27
|
-
|
28
|
-
# ## Friendly Finders
|
29
|
-
#
|
30
|
-
# Uncomment this to use friendly finders in all models. By default, if
|
31
|
-
# you wish to find a record by its friendly id, you must do:
|
32
|
-
#
|
33
|
-
# MyModel.friendly.find('foo')
|
34
|
-
#
|
35
|
-
# If you uncomment this, you can do:
|
36
|
-
#
|
37
|
-
# MyModel.find('foo')
|
38
|
-
#
|
39
|
-
# This is significantly more convenient but may not be appropriate for
|
40
|
-
# all applications, so you must explicity opt-in to this behavior. You can
|
41
|
-
# always also configure it on a per-model basis if you prefer.
|
42
|
-
#
|
43
|
-
# Something else to consider is that using the :finders addon boosts
|
44
|
-
# performance because it will avoid Rails-internal code that makes runtime
|
45
|
-
# calls to `Module.extend`.
|
46
|
-
#
|
47
|
-
# config.use :finders
|
48
|
-
#
|
49
|
-
# ## Slugs
|
50
|
-
#
|
51
|
-
# Most applications will use the :slugged module everywhere. If you wish
|
52
|
-
# to do so, uncomment the following line.
|
53
|
-
#
|
54
|
-
# config.use :slugged
|
55
|
-
#
|
56
|
-
# By default, FriendlyId's :slugged addon expects the slug column to be named
|
57
|
-
# 'slug', but you can change it if you wish.
|
58
|
-
#
|
59
|
-
# config.slug_column = 'slug'
|
60
|
-
#
|
61
|
-
# By default, slug has no size limit, but you can change it if you wish.
|
62
|
-
#
|
63
|
-
# config.slug_limit = 255
|
64
|
-
#
|
65
|
-
# When FriendlyId can not generate a unique ID from your base method, it appends
|
66
|
-
# a UUID, separated by a single dash. You can configure the character used as the
|
67
|
-
# separator. If you're upgrading from FriendlyId 4, you may wish to replace this
|
68
|
-
# with two dashes.
|
69
|
-
#
|
70
|
-
# config.sequence_separator = '-'
|
71
|
-
#
|
72
|
-
# Note that you must use the :slugged addon **prior** to the line which
|
73
|
-
# configures the sequence separator, or else FriendlyId will raise an undefined
|
74
|
-
# method error.
|
75
|
-
#
|
76
|
-
# ## Tips and Tricks
|
77
|
-
#
|
78
|
-
# ### Controlling when slugs are generated
|
79
|
-
#
|
80
|
-
# As of FriendlyId 5.0, new slugs are generated only when the slug field is
|
81
|
-
# nil, but if you're using a column as your base method can change this
|
82
|
-
# behavior by overriding the `should_generate_new_friendly_id?` method that
|
83
|
-
# FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
|
84
|
-
# more like 4.0.
|
85
|
-
# Note: Use(include) Slugged module in the config if using the anonymous module.
|
86
|
-
# If you have `friendly_id :name, use: slugged` in the model, Slugged module
|
87
|
-
# is included after the anonymous module defined in the initializer, so it
|
88
|
-
# overrides the `should_generate_new_friendly_id?` method from the anonymous module.
|
89
|
-
#
|
90
|
-
# config.use :slugged
|
91
|
-
# config.use Module.new {
|
92
|
-
# def should_generate_new_friendly_id?
|
93
|
-
# slug.blank? || <your_column_name_here>_changed?
|
94
|
-
# end
|
95
|
-
# }
|
96
|
-
#
|
97
|
-
# FriendlyId uses Rails's `parameterize` method to generate slugs, but for
|
98
|
-
# languages that don't use the Roman alphabet, that's not usually sufficient.
|
99
|
-
# Here we use the Babosa library to transliterate Russian Cyrillic slugs to
|
100
|
-
# ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
|
101
|
-
#
|
102
|
-
# config.use Module.new {
|
103
|
-
# def normalize_friendly_id(text)
|
104
|
-
# text.to_slug.normalize! :transliterations => [:russian, :latin]
|
105
|
-
# end
|
106
|
-
# }
|
107
|
-
end
|