phcscriptcdn 7.0.1 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/README.md +43 -43
  4. data/Rakefile +33 -33
  5. data/app/assets/config/phcscriptcdn_manifest.js +2 -2
  6. data/app/assets/javascripts/phcscriptcdn/application.js +2 -2
  7. data/app/assets/stylesheets/phcscriptcdn/application.scss +2 -2
  8. data/app/controllers/phcscriptcdn/application_controller.rb +12 -12
  9. data/app/controllers/phcscriptcdn/script/authors_controller.rb +65 -65
  10. data/app/controllers/phcscriptcdn/script/extensions_controller.rb +65 -65
  11. data/app/controllers/phcscriptcdn/script/licences_controller.rb +65 -65
  12. data/app/controllers/phcscriptcdn/script/listings_controller.rb +65 -65
  13. data/app/controllers/phcscriptcdn/script/urls_controller.rb +74 -74
  14. data/app/controllers/phcscriptcdn/script/versions_controller.rb +65 -65
  15. data/app/helpers/phcscriptcdn/application_helper.rb +14 -14
  16. data/app/jobs/phcscriptcdn/application_job.rb +4 -4
  17. data/app/models/phcscriptcdn/application_record.rb +4 -4
  18. data/app/models/phcscriptcdn/script.rb +6 -6
  19. data/app/models/phcscriptcdn/script/author.rb +20 -20
  20. data/app/models/phcscriptcdn/script/extension.rb +24 -24
  21. data/app/models/phcscriptcdn/script/licence.rb +23 -23
  22. data/app/models/phcscriptcdn/script/listing.rb +32 -32
  23. data/app/models/phcscriptcdn/script/url.rb +26 -26
  24. data/app/models/phcscriptcdn/script/version.rb +20 -20
  25. data/app/views/layouts/phcscriptcdn/application.html.erb +56 -56
  26. data/app/views/layouts/phcscriptcdn/components/backend/footer/_footer.html.erb +4 -4
  27. data/app/views/layouts/phcscriptcdn/components/backend/navigation/_navigation.html.erb +56 -56
  28. data/app/views/layouts/phcscriptcdn/components/backend/topbar/_topbar.html.erb +5 -5
  29. data/app/views/layouts/phcscriptcdn/frontend.html.erb +22 -22
  30. data/app/views/phcscriptcdn/script/authors/_form.html.erb +36 -36
  31. data/app/views/phcscriptcdn/script/authors/edit.html.erb +39 -39
  32. data/app/views/phcscriptcdn/script/authors/index.html.erb +67 -67
  33. data/app/views/phcscriptcdn/script/authors/new.html.erb +39 -39
  34. data/app/views/phcscriptcdn/script/authors/show.html.erb +42 -42
  35. data/app/views/phcscriptcdn/script/extensions/_form.html.erb +28 -28
  36. data/app/views/phcscriptcdn/script/extensions/edit.html.erb +39 -39
  37. data/app/views/phcscriptcdn/script/extensions/index.html.erb +61 -61
  38. data/app/views/phcscriptcdn/script/extensions/new.html.erb +38 -38
  39. data/app/views/phcscriptcdn/script/extensions/show.html.erb +42 -42
  40. data/app/views/phcscriptcdn/script/licences/_form.html.erb +47 -47
  41. data/app/views/phcscriptcdn/script/licences/edit.html.erb +39 -39
  42. data/app/views/phcscriptcdn/script/licences/index.html.erb +71 -71
  43. data/app/views/phcscriptcdn/script/licences/new.html.erb +39 -39
  44. data/app/views/phcscriptcdn/script/licences/show.html.erb +42 -42
  45. data/app/views/phcscriptcdn/script/listings/_form.html.erb +68 -68
  46. data/app/views/phcscriptcdn/script/listings/edit.html.erb +39 -39
  47. data/app/views/phcscriptcdn/script/listings/index.html.erb +65 -65
  48. data/app/views/phcscriptcdn/script/listings/new.html.erb +39 -39
  49. data/app/views/phcscriptcdn/script/listings/show.html.erb +40 -40
  50. data/app/views/phcscriptcdn/script/urls/_form.html.erb +36 -36
  51. data/app/views/phcscriptcdn/script/urls/edit.html.erb +39 -39
  52. data/app/views/phcscriptcdn/script/urls/index.html.erb +63 -63
  53. data/app/views/phcscriptcdn/script/urls/new.html.erb +39 -39
  54. data/app/views/phcscriptcdn/script/urls/show.html.erb +41 -41
  55. data/app/views/phcscriptcdn/script/versions/_form.html.erb +20 -20
  56. data/app/views/phcscriptcdn/script/versions/edit.html.erb +39 -39
  57. data/app/views/phcscriptcdn/script/versions/index.html.erb +59 -59
  58. data/app/views/phcscriptcdn/script/versions/new.html.erb +39 -39
  59. data/app/views/phcscriptcdn/script/versions/show.html.erb +42 -42
  60. data/config/initializers/friendly_id.rb +92 -92
  61. data/config/routes.rb +30 -30
  62. data/db/migrate/20160731205205_create_phcscriptcdn_script_extensions.rb +20 -20
  63. data/db/migrate/20160731205917_create_phcscriptcdn_script_listings.rb +35 -35
  64. data/db/migrate/20160731205954_create_phcscriptcdn_script_versions.rb +18 -18
  65. data/db/migrate/20160731210626_create_phcscriptcdn_script_urls.rb +24 -24
  66. data/db/migrate/20160731210723_create_phcscriptcdn_script_authors.rb +23 -23
  67. data/db/migrate/20160801032225_create_phcscriptcdn_script_licences.rb +27 -27
  68. data/db/migrate/20170423022446_create_friendly_id_slugs.rb +15 -15
  69. data/lib/phcscriptcdn.rb +4 -4
  70. data/lib/phcscriptcdn/engine.rb +68 -68
  71. data/lib/phcscriptcdn/version.rb +3 -3
  72. data/lib/tasks/phcscriptcdn_tasks.rake +4 -4
  73. metadata +19 -49
@@ -1,20 +1,20 @@
1
- <%= form_for(script_version) do |f| %>
2
-
3
- <!-- PHC-Notifi Render Validation -->
4
- <%= render 'phcnotifi/validations', :object => @script_version %>
5
- <!-- PHC-Notifi Render Validation -->
6
-
7
- <!-- Form Fields -->
8
- <div class="form-group field_with_error">
9
- <%= f.label :scriptversion, "Version Number" %>
10
- <%= f.text_field :scriptversion, placeholder: "Version Number", class: "form-control" %>
11
- </div>
12
- <!-- Form Fields -->
13
-
14
- <!-- Form Button -->
15
- <div class="actions">
16
- <%= f.submit class: "btn btn-primary" %>
17
- </div>
18
- <!-- Form Button -->
19
-
20
- <% end %>
1
+ <%= form_for(script_version) do |f| %>
2
+
3
+ <!-- PHC-Notifi Render Validation -->
4
+ <%= render 'phcnotifi/validations', :object => @script_version %>
5
+ <!-- PHC-Notifi Render Validation -->
6
+
7
+ <!-- Form Fields -->
8
+ <div class="form-group field_with_error">
9
+ <%= f.label :scriptversion, "Version Number" %>
10
+ <%= f.text_field :scriptversion, placeholder: "Version Number", class: "form-control" %>
11
+ </div>
12
+ <!-- Form Fields -->
13
+
14
+ <!-- Form Button -->
15
+ <div class="actions">
16
+ <%= f.submit class: "btn btn-primary" %>
17
+ </div>
18
+ <!-- Form Button -->
19
+
20
+ <% end %>
@@ -1,39 +1,39 @@
1
- <!-- Title System -->
2
- <% phc_title "Script Listings Manager" %>
3
- <% phc_title_tagline "Update Script Version Information" %>
4
- <% phc_breadcrumb_one link_to "Script Version Index", phcscriptcdn.script_versions_path %>
5
- <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
- <!-- Title System -->
7
-
8
- <!-- Page Title Bar -->
9
- <section class="content-header">
10
- <!-- Page Title and BreadCrumb -->
11
- <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
12
- <ol class="breadcrumb">
13
- <li><%= yield(:phc_breadcrumb_one) %></li>
14
- <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
15
- </ol>
16
- <!-- Page Title and BreadCrumb -->
17
- </section>
18
- <!-- Page Title Bar -->
19
-
20
- <!-- Main Content -->
21
- <section class="content">
22
- <div class="row">
23
- <div class="col-lg-12">
24
- <div class="box">
25
- <div class="box-header with-border">
26
- <h3 class="box-title"><%= yield(:phc_title) %></h3>
27
- </div>
28
- <div class="box-body">
29
-
30
- <!-- Page Form (Edit) -->
31
- <%= render 'form', script_version: @script_version %>
32
- <!-- Page Form (Edit) -->
33
-
34
- </div>
35
- </div>
36
- </div>
37
- </div>
38
- </section>
39
- <!-- Main Content -->
1
+ <!-- Title System -->
2
+ <% phc_title "Script Listings Manager" %>
3
+ <% phc_title_tagline "Update Script Version Information" %>
4
+ <% phc_breadcrumb_one link_to "Script Version Index", phcscriptcdn.script_versions_path %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- Title System -->
7
+
8
+ <!-- Page Title Bar -->
9
+ <section class="content-header">
10
+ <!-- Page Title and BreadCrumb -->
11
+ <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
12
+ <ol class="breadcrumb">
13
+ <li><%= yield(:phc_breadcrumb_one) %></li>
14
+ <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
15
+ </ol>
16
+ <!-- Page Title and BreadCrumb -->
17
+ </section>
18
+ <!-- Page Title Bar -->
19
+
20
+ <!-- Main Content -->
21
+ <section class="content">
22
+ <div class="row">
23
+ <div class="col-lg-12">
24
+ <div class="box">
25
+ <div class="box-header with-border">
26
+ <h3 class="box-title"><%= yield(:phc_title) %></h3>
27
+ </div>
28
+ <div class="box-body">
29
+
30
+ <!-- Page Form (Edit) -->
31
+ <%= render 'form', script_version: @script_version %>
32
+ <!-- Page Form (Edit) -->
33
+
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </section>
39
+ <!-- Main Content -->
@@ -1,59 +1,59 @@
1
- <!-- Title System -->
2
- <% phc_title "Script Listings Manager" %>
3
- <% phc_title_tagline "Script Version Index" %>
4
- <% phc_breadcrumb_one yield(:phc_title_tagline) %>
5
- <!-- Title System -->
6
-
7
- <!-- Page Title Bar -->
8
- <section class="content-header">
9
- <!-- Page Title and BreadCrumb -->
10
- <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
11
- <ol class="breadcrumb">
12
- <li><%= yield(:phc_breadcrumb_one) %></li>
13
- <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
14
- </ol>
15
- <!-- Page Title and BreadCrumb -->
16
- </section>
17
- <!-- Page Title Bar -->
18
-
19
- <!-- Main Content -->
20
- <section class="content">
21
- <div class="row">
22
- <div class="col-lg-12">
23
- <div class="box">
24
- <div class="box-header with-border">
25
- <h3 class="box-title"><%= yield(:phc_title) %></h3>
26
- </div>
27
- <div class="box-body">
28
-
29
- <!-- Index Table -->
30
- <div class="table-responsive">
31
- <table class="table table-bordered table-striped table-hover">
32
- <thead>
33
- <tr>
34
- <th>Script Version</th>
35
- </tr>
36
- </thead>
37
- <tbody>
38
- <% @script_versions.each do |script_version| %>
39
- <tr>
40
- <td><%= link_to script_version.scriptversion, script_version %></td>
41
- </tr>
42
- <% end %>
43
- </tbody>
44
- </table>
45
- </div>
46
- <!-- Index Table -->
47
-
48
- <!-- Panel Footer -->
49
- <div class="box-footer clearfix">
50
- <%= link_to 'New Script Version', new_script_version_path, class: "btn btn-primary" %>
51
- </div>
52
- <!-- Panel Footer -->
53
-
54
- </div>
55
- </div>
56
- </div>
57
- </div>
58
- </section>
59
- <!-- Main Content -->
1
+ <!-- Title System -->
2
+ <% phc_title "Script Listings Manager" %>
3
+ <% phc_title_tagline "Script Version Index" %>
4
+ <% phc_breadcrumb_one yield(:phc_title_tagline) %>
5
+ <!-- Title System -->
6
+
7
+ <!-- Page Title Bar -->
8
+ <section class="content-header">
9
+ <!-- Page Title and BreadCrumb -->
10
+ <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
11
+ <ol class="breadcrumb">
12
+ <li><%= yield(:phc_breadcrumb_one) %></li>
13
+ <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
14
+ </ol>
15
+ <!-- Page Title and BreadCrumb -->
16
+ </section>
17
+ <!-- Page Title Bar -->
18
+
19
+ <!-- Main Content -->
20
+ <section class="content">
21
+ <div class="row">
22
+ <div class="col-lg-12">
23
+ <div class="box">
24
+ <div class="box-header with-border">
25
+ <h3 class="box-title"><%= yield(:phc_title) %></h3>
26
+ </div>
27
+ <div class="box-body">
28
+
29
+ <!-- Index Table -->
30
+ <div class="table-responsive">
31
+ <table class="table table-bordered table-striped table-hover">
32
+ <thead>
33
+ <tr>
34
+ <th>Script Version</th>
35
+ </tr>
36
+ </thead>
37
+ <tbody>
38
+ <% @script_versions.each do |script_version| %>
39
+ <tr>
40
+ <td><%= link_to script_version.scriptversion, script_version %></td>
41
+ </tr>
42
+ <% end %>
43
+ </tbody>
44
+ </table>
45
+ </div>
46
+ <!-- Index Table -->
47
+
48
+ <!-- Panel Footer -->
49
+ <div class="box-footer clearfix">
50
+ <%= link_to 'New Script Version', new_script_version_path, class: "btn btn-primary" %>
51
+ </div>
52
+ <!-- Panel Footer -->
53
+
54
+ </div>
55
+ </div>
56
+ </div>
57
+ </div>
58
+ </section>
59
+ <!-- Main Content -->
@@ -1,39 +1,39 @@
1
- <!-- Title System -->
2
- <% phc_title "Script Listings Manager" %>
3
- <% phc_title_tagline "Create a New Version" %>
4
- <% phc_breadcrumb_one link_to "Script Version Index", phcscriptcdn.script_versions_path %>
5
- <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
- <!-- Title System -->
7
-
8
- <!-- Page Title Bar -->
9
- <section class="content-header">
10
- <!-- Page Title and BreadCrumb -->
11
- <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
12
- <ol class="breadcrumb">
13
- <li><%= yield(:phc_breadcrumb_one) %></li>
14
- <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
15
- </ol>
16
- <!-- Page Title and BreadCrumb -->
17
- </section>
18
- <!-- Page Title Bar -->
19
-
20
- <!-- Main Content -->
21
- <section class="content">
22
- <div class="row">
23
- <div class="col-lg-12">
24
- <div class="box">
25
- <div class="box-header with-border">
26
- <h3 class="box-title"><%= yield(:phc_title) %></h3>
27
- </div>
28
- <div class="box-body">
29
-
30
- <!-- Page Form (New) -->
31
- <%= render 'form', script_version: @script_version %>
32
- <!-- Page Form (New) -->
33
-
34
- </div>
35
- </div>
36
- </div>
37
- </div>
38
- </section>
39
- <!-- Main Content -->
1
+ <!-- Title System -->
2
+ <% phc_title "Script Listings Manager" %>
3
+ <% phc_title_tagline "Create a New Version" %>
4
+ <% phc_breadcrumb_one link_to "Script Version Index", phcscriptcdn.script_versions_path %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- Title System -->
7
+
8
+ <!-- Page Title Bar -->
9
+ <section class="content-header">
10
+ <!-- Page Title and BreadCrumb -->
11
+ <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
12
+ <ol class="breadcrumb">
13
+ <li><%= yield(:phc_breadcrumb_one) %></li>
14
+ <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
15
+ </ol>
16
+ <!-- Page Title and BreadCrumb -->
17
+ </section>
18
+ <!-- Page Title Bar -->
19
+
20
+ <!-- Main Content -->
21
+ <section class="content">
22
+ <div class="row">
23
+ <div class="col-lg-12">
24
+ <div class="box">
25
+ <div class="box-header with-border">
26
+ <h3 class="box-title"><%= yield(:phc_title) %></h3>
27
+ </div>
28
+ <div class="box-body">
29
+
30
+ <!-- Page Form (New) -->
31
+ <%= render 'form', script_version: @script_version %>
32
+ <!-- Page Form (New) -->
33
+
34
+ </div>
35
+ </div>
36
+ </div>
37
+ </div>
38
+ </section>
39
+ <!-- Main Content -->
@@ -1,42 +1,42 @@
1
- <!-- Title System -->
2
- <% phc_title "Script Listings Manager" %>
3
- <% phc_title_tagline "Script Version Details" %>
4
- <% phc_breadcrumb_one link_to "Script Version Index", phcscriptcdn.script_versions_path %>
5
- <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
- <!-- Title System -->
7
-
8
- <!-- Page Title Bar -->
9
- <section class="content-header">
10
- <!-- Page Title and BreadCrumb -->
11
- <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
12
- <ol class="breadcrumb">
13
- <li><%= yield(:phc_breadcrumb_one) %></li>
14
- <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
15
- </ol>
16
- <!-- Page Title and BreadCrumb -->
17
- </section>
18
- <!-- Page Title Bar -->
19
-
20
- <!-- Main Content -->
21
- <section class="content">
22
- <div class="row">
23
- <div class="col-lg-12">
24
- <div class="box">
25
- <div class="box-header with-border">
26
- <h3 class="box-title"><%= yield(:phc_title) %></h3>
27
- </div>
28
- <div class="box-body">
29
-
30
- <!-- Show Content -->
31
- <div class="btn-group" role="group" aria-label="version_button_group">
32
- <%= link_to 'Edit', edit_script_version_path(@script_version), class: "btn btn-primary" %>
33
- <%= link_to 'Destroy', script_version_path(@script_version), method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-primary" %>
34
- </div>
35
- <!-- Show Content -->
36
-
37
- </div>
38
- </div>
39
- </div>
40
- </div>
41
- </section>
42
- <!-- Main Content -->
1
+ <!-- Title System -->
2
+ <% phc_title "Script Listings Manager" %>
3
+ <% phc_title_tagline "Script Version Details" %>
4
+ <% phc_breadcrumb_one link_to "Script Version Index", phcscriptcdn.script_versions_path %>
5
+ <% phc_breadcrumb_two yield(:phc_title_tagline) %>
6
+ <!-- Title System -->
7
+
8
+ <!-- Page Title Bar -->
9
+ <section class="content-header">
10
+ <!-- Page Title and BreadCrumb -->
11
+ <h1><%= yield(:phc_title) %> <small><%= yield(:phc_title_tagline) %></small></h1>
12
+ <ol class="breadcrumb">
13
+ <li><%= yield(:phc_breadcrumb_one) %></li>
14
+ <li class="active"><%= yield(:phc_breadcrumb_two) %></li>
15
+ </ol>
16
+ <!-- Page Title and BreadCrumb -->
17
+ </section>
18
+ <!-- Page Title Bar -->
19
+
20
+ <!-- Main Content -->
21
+ <section class="content">
22
+ <div class="row">
23
+ <div class="col-lg-12">
24
+ <div class="box">
25
+ <div class="box-header with-border">
26
+ <h3 class="box-title"><%= yield(:phc_title) %></h3>
27
+ </div>
28
+ <div class="box-body">
29
+
30
+ <!-- Show Content -->
31
+ <div class="btn-group" role="group" aria-label="version_button_group">
32
+ <%= link_to 'Edit', edit_script_version_path(@script_version), class: "btn btn-primary" %>
33
+ <%= link_to 'Destroy', script_version_path(@script_version), method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-primary" %>
34
+ </div>
35
+ <!-- Show Content -->
36
+
37
+ </div>
38
+ </div>
39
+ </div>
40
+ </div>
41
+ </section>
42
+ <!-- Main Content -->
@@ -1,92 +1,92 @@
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
- # ## Friendly Finders
23
- #
24
- # Uncomment this to use friendly finders in all models. By default, if
25
- # you wish to find a record by its friendly id, you must do:
26
- #
27
- # MyModel.friendly.find('foo')
28
- #
29
- # If you uncomment this, you can do:
30
- #
31
- # MyModel.find('foo')
32
- #
33
- # This is significantly more convenient but may not be appropriate for
34
- # all applications, so you must explicity opt-in to this behavior. You can
35
- # always also configure it on a per-model basis if you prefer.
36
- #
37
- # Something else to consider is that using the :finders addon boosts
38
- # performance because it will avoid Rails-internal code that makes runtime
39
- # calls to `Module.extend`.
40
- #
41
- # config.use :finders
42
- #
43
- # ## Slugs
44
- #
45
- # Most applications will use the :slugged module everywhere. If you wish
46
- # to do so, uncomment the following line.
47
- #
48
- # config.use :slugged
49
- #
50
- # By default, FriendlyId's :slugged addon expects the slug column to be named
51
- # 'slug', but you can change it if you wish.
52
- #
53
- # config.slug_column = 'slug'
54
- #
55
- # When FriendlyId can not generate a unique ID from your base method, it appends
56
- # a UUID, separated by a single dash. You can configure the character used as the
57
- # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
- # with two dashes.
59
- #
60
- # config.sequence_separator = '-'
61
- #
62
- # Note that you must use the :slugged addon **prior** to the line which
63
- # configures the sequence separator, or else FriendlyId will raise an undefined
64
- # method error.
65
- #
66
- # ## Tips and Tricks
67
- #
68
- # ### Controlling when slugs are generated
69
- #
70
- # As of FriendlyId 5.0, new slugs are generated only when the slug field is
71
- # nil, but if you're using a column as your base method can change this
72
- # behavior by overriding the `should_generate_new_friendly_id?` method that
73
- # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
74
- # more like 4.0.
75
- #
76
- # config.use Module.new {
77
- # def should_generate_new_friendly_id?
78
- # slug.blank? || <your_column_name_here>_changed?
79
- # end
80
- # }
81
- #
82
- # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
83
- # languages that don't use the Roman alphabet, that's not usually sufficient.
84
- # Here we use the Babosa library to transliterate Russian Cyrillic slugs to
85
- # ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
86
- #
87
- # config.use Module.new {
88
- # def normalize_friendly_id(text)
89
- # text.to_slug.normalize! :transliterations => [:russian, :latin]
90
- # end
91
- # }
92
- end
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
+ # ## Friendly Finders
23
+ #
24
+ # Uncomment this to use friendly finders in all models. By default, if
25
+ # you wish to find a record by its friendly id, you must do:
26
+ #
27
+ # MyModel.friendly.find('foo')
28
+ #
29
+ # If you uncomment this, you can do:
30
+ #
31
+ # MyModel.find('foo')
32
+ #
33
+ # This is significantly more convenient but may not be appropriate for
34
+ # all applications, so you must explicity opt-in to this behavior. You can
35
+ # always also configure it on a per-model basis if you prefer.
36
+ #
37
+ # Something else to consider is that using the :finders addon boosts
38
+ # performance because it will avoid Rails-internal code that makes runtime
39
+ # calls to `Module.extend`.
40
+ #
41
+ # config.use :finders
42
+ #
43
+ # ## Slugs
44
+ #
45
+ # Most applications will use the :slugged module everywhere. If you wish
46
+ # to do so, uncomment the following line.
47
+ #
48
+ # config.use :slugged
49
+ #
50
+ # By default, FriendlyId's :slugged addon expects the slug column to be named
51
+ # 'slug', but you can change it if you wish.
52
+ #
53
+ # config.slug_column = 'slug'
54
+ #
55
+ # When FriendlyId can not generate a unique ID from your base method, it appends
56
+ # a UUID, separated by a single dash. You can configure the character used as the
57
+ # separator. If you're upgrading from FriendlyId 4, you may wish to replace this
58
+ # with two dashes.
59
+ #
60
+ # config.sequence_separator = '-'
61
+ #
62
+ # Note that you must use the :slugged addon **prior** to the line which
63
+ # configures the sequence separator, or else FriendlyId will raise an undefined
64
+ # method error.
65
+ #
66
+ # ## Tips and Tricks
67
+ #
68
+ # ### Controlling when slugs are generated
69
+ #
70
+ # As of FriendlyId 5.0, new slugs are generated only when the slug field is
71
+ # nil, but if you're using a column as your base method can change this
72
+ # behavior by overriding the `should_generate_new_friendly_id?` method that
73
+ # FriendlyId adds to your model. The change below makes FriendlyId 5.0 behave
74
+ # more like 4.0.
75
+ #
76
+ # config.use Module.new {
77
+ # def should_generate_new_friendly_id?
78
+ # slug.blank? || <your_column_name_here>_changed?
79
+ # end
80
+ # }
81
+ #
82
+ # FriendlyId uses Rails's `parameterize` method to generate slugs, but for
83
+ # languages that don't use the Roman alphabet, that's not usually sufficient.
84
+ # Here we use the Babosa library to transliterate Russian Cyrillic slugs to
85
+ # ASCII. If you use this, don't forget to add "babosa" to your Gemfile.
86
+ #
87
+ # config.use Module.new {
88
+ # def normalize_friendly_id(text)
89
+ # text.to_slug.normalize! :transliterations => [:russian, :latin]
90
+ # end
91
+ # }
92
+ end