phcdevworks_scripts 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +35 -0
- data/Rakefile +32 -0
- data/app/assets/config/phcdevworks_scripts_manifest.js +1 -0
- data/app/assets/javascripts/phcdevworks_scripts/application.js +2 -0
- data/app/assets/javascripts/phcdevworks_scripts/script/versions.coffee +3 -0
- data/app/assets/stylesheets/phcdevworks_scripts/application.scss +2 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/authors.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/extensions.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/listings.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/urls.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/script/versions.scss +3 -0
- data/app/assets/stylesheets/phcdevworks_scripts/snippet/posts.css +4 -0
- data/app/assets/stylesheets/phcdevworks_scripts/snippet/urls.css +4 -0
- data/app/controllers/phcdevworks_scripts/application_controller.rb +13 -0
- data/app/controllers/phcdevworks_scripts/script/authors_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/script/extensions_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/script/listings_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/script/urls_controller.rb +77 -0
- data/app/controllers/phcdevworks_scripts/script/versions_controller.rb +82 -0
- data/app/controllers/phcdevworks_scripts/snippet/posts_controller.rb +80 -0
- data/app/controllers/phcdevworks_scripts/snippet/urls_controller.rb +76 -0
- data/app/helpers/phcdevworks_scripts/application_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/authors_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/extensions_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/listings_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/urls_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/script/versions_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/snippet/posts_helper.rb +4 -0
- data/app/helpers/phcdevworks_scripts/snippet/urls_helper.rb +4 -0
- data/app/jobs/phcdevworks_scripts/application_job.rb +4 -0
- data/app/mailers/phcdevworks_scripts/application_mailer.rb +6 -0
- data/app/models/phcdevworks_scripts/application_record.rb +5 -0
- data/app/models/phcdevworks_scripts/author_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/extension_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/listing_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/script.rb +7 -0
- data/app/models/phcdevworks_scripts/script/author.rb +33 -0
- data/app/models/phcdevworks_scripts/script/extension.rb +32 -0
- data/app/models/phcdevworks_scripts/script/listing.rb +38 -0
- data/app/models/phcdevworks_scripts/script/url.rb +24 -0
- data/app/models/phcdevworks_scripts/script/version.rb +26 -0
- data/app/models/phcdevworks_scripts/scriptversion_versions.rb +5 -0
- data/app/models/phcdevworks_scripts/snippet.rb +7 -0
- data/app/models/phcdevworks_scripts/snippet/post.rb +25 -0
- data/app/models/phcdevworks_scripts/snippet/url.rb +16 -0
- data/app/models/phcdevworks_scripts/url_versions.rb +5 -0
- data/app/views/layouts/phcdevworks_scripts/application.html.erb +94 -0
- data/app/views/layouts/phcdevworks_scripts/components/backend/footer/_footer.html.erb +16 -0
- data/app/views/layouts/phcdevworks_scripts/components/backend/navigation/_top_menu.html.erb +37 -0
- data/app/views/layouts/phcdevworks_scripts/components/backend/sidebars/_side_menu.html.erb +183 -0
- data/app/views/phcdevworks_scripts/script/authors/_form.html.erb +32 -0
- data/app/views/phcdevworks_scripts/script/authors/edit.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/authors/index.html.erb +63 -0
- data/app/views/phcdevworks_scripts/script/authors/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/authors/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/script/extensions/_form.html.erb +28 -0
- data/app/views/phcdevworks_scripts/script/extensions/edit.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/extensions/index.html.erb +59 -0
- data/app/views/phcdevworks_scripts/script/extensions/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/extensions/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/script/listings/_form.html.erb +62 -0
- data/app/views/phcdevworks_scripts/script/listings/edit.html.erb +35 -0
- data/app/views/phcdevworks_scripts/script/listings/index.html.erb +62 -0
- data/app/views/phcdevworks_scripts/script/listings/new.html.erb +36 -0
- data/app/views/phcdevworks_scripts/script/listings/show.html.erb +48 -0
- data/app/views/phcdevworks_scripts/script/urls/_form.html.erb +36 -0
- data/app/views/phcdevworks_scripts/script/urls/edit.html.erb +36 -0
- data/app/views/phcdevworks_scripts/script/urls/index.html.erb +61 -0
- data/app/views/phcdevworks_scripts/script/urls/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/urls/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/script/versions/_form.html.erb +20 -0
- data/app/views/phcdevworks_scripts/script/versions/edit.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/versions/index.html.erb +57 -0
- data/app/views/phcdevworks_scripts/script/versions/new.html.erb +37 -0
- data/app/views/phcdevworks_scripts/script/versions/show.html.erb +49 -0
- data/app/views/phcdevworks_scripts/snippet/posts/_form.html.erb +26 -0
- data/app/views/phcdevworks_scripts/snippet/posts/edit.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/posts/index.html.erb +68 -0
- data/app/views/phcdevworks_scripts/snippet/posts/new.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/posts/show.html.erb +71 -0
- data/app/views/phcdevworks_scripts/snippet/urls/_form.html.erb +22 -0
- data/app/views/phcdevworks_scripts/snippet/urls/edit.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/urls/index.html.erb +66 -0
- data/app/views/phcdevworks_scripts/snippet/urls/new.html.erb +39 -0
- data/app/views/phcdevworks_scripts/snippet/urls/show.html.erb +71 -0
- data/config/initializers/friendly_id.rb +107 -0
- data/config/routes.rb +32 -0
- data/db/migrate/20170509002355_create_phcdevworks_scripts_friendly_id_slugs.rb +18 -0
- data/db/migrate/20170517064030_create_phcdevworks_scripts_extension_versions.rb +17 -0
- data/db/migrate/20170517064049_create_phcdevworks_scripts_listing_versions.rb +17 -0
- data/db/migrate/20170517064114_create_phcdevworks_scripts_scriptversion_versions.rb +17 -0
- data/db/migrate/20170517064150_create_phcdevworks_scripts_url_versions.rb +17 -0
- data/db/migrate/20170517064208_create_phcdevworks_scripts_author_versions.rb +17 -0
- data/db/migrate/20170517064427_create_phcdevworks_scripts_licence_versions.rb +17 -0
- data/db/migrate/20190818022002_create_phcdevworks_scripts_snippet_posts.rb +16 -0
- data/db/migrate/20190818022024_create_phcdevworks_scripts_snippet_urls.rb +17 -0
- data/db/migrate/20190818022939_create_phcdevworks_scripts_script_authors.rb +18 -0
- data/db/migrate/20190818023353_create_phcdevworks_scripts_script_listings.rb +27 -0
- data/db/migrate/20190818023709_create_phcdevworks_scripts_script_extensions.rb +17 -0
- data/db/migrate/20190818023911_create_phcdevworks_scripts_script_urls.rb +21 -0
- data/db/migrate/20190818031653_create_phcdevworks_scripts_script_versions.rb +15 -0
- data/lib/phcdevworks_scripts.rb +5 -0
- data/lib/phcdevworks_scripts/engine.rb +33 -0
- data/lib/phcdevworks_scripts/version.rb +3 -0
- data/lib/tasks/phcdevworks_scripts_tasks.rake +4 -0
- metadata +352 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Update Asset Index" %>
|
4
|
+
<% phc_breadcrumb_one yield(:phc_title_tagline) %>
|
5
|
+
<% phc_breadcrumb_two link_to "Code Snippet Index", phcdevworks_scripts.snippet_posts_path %>
|
6
|
+
<!-- Title System -->
|
7
|
+
|
8
|
+
<!-- Page Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb pull-right">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
+
</ol>
|
13
|
+
<!-- Page Bradcrumbs -->
|
14
|
+
|
15
|
+
<!-- Page Header -->
|
16
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<div class="panel-heading">
|
23
|
+
<div class="panel-heading-btn">
|
24
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
25
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
26
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
27
|
+
</div>
|
28
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Table - Snippet Index -->
|
34
|
+
<div class="table-responsive">
|
35
|
+
<table class="table table-striped table-bordered">
|
36
|
+
<thead>
|
37
|
+
<tr>
|
38
|
+
<th>Script Url</th>
|
39
|
+
<th colspan="3"></th>
|
40
|
+
</tr>
|
41
|
+
</thead>
|
42
|
+
<tbody>
|
43
|
+
<% @script_urls.each do |script_url| %>
|
44
|
+
<tr>
|
45
|
+
<td><%= script_url.script_url %></td>
|
46
|
+
<td>
|
47
|
+
<div class="btn-group d-flex" role="group">
|
48
|
+
<%= link_to 'Details', snippet_post_url_path(script_url.snippet, script_url), class: "btn btn-purple btn-xs" %>
|
49
|
+
<%= link_to 'Update', edit_snippet_post_url_path(script_url.snippet, script_url), class: "btn btn-primary btn-xs" %>
|
50
|
+
<%= link_to 'Remove', snippet_post_url_path(script_url.snippet, script_url), method: :delete, data: { confirm: 'Are you sure? This action cannot be reversed.' }, class: "btn btn-danger btn-xs" %>
|
51
|
+
</div>
|
52
|
+
</td>
|
53
|
+
</tr>
|
54
|
+
<% end %>
|
55
|
+
</tbody>
|
56
|
+
</table>
|
57
|
+
<%= link_to phcdevworks_scripts.new_snippet_post_url_path, class: "btn btn-primary btn-sm" do %>
|
58
|
+
<i class="fas fa-plus-circle"></i>
|
59
|
+
Add a New Script URL
|
60
|
+
<% end %>
|
61
|
+
</div>
|
62
|
+
<!-- Table - Snippet Index -->
|
63
|
+
</div>
|
64
|
+
<!-- Panel Body -->
|
65
|
+
</div>
|
66
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Create a New Asset URL" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phcdevworks_scripts.snippet_posts_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
7
|
+
|
8
|
+
<!-- Page Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb pull-right">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
+
</ol>
|
13
|
+
<!-- Page Bradcrumbs -->
|
14
|
+
|
15
|
+
<!-- Page Header -->
|
16
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page & Panel Content -->
|
20
|
+
<div class="panel panel-inverse">
|
21
|
+
<!-- Panel Heading -->
|
22
|
+
<div class="panel-heading">
|
23
|
+
<div class="panel-heading-btn">
|
24
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
25
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
26
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
27
|
+
</div>
|
28
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<!-- Form for New Script Asset URL -->
|
34
|
+
<%= render 'form', { form_url: snippet_post_urls_path } %>
|
35
|
+
<!-- Form for New Script Asset URL -->
|
36
|
+
</div>
|
37
|
+
<!-- Panel Body -->
|
38
|
+
</div>
|
39
|
+
<!-- Page & Panel Content -->
|
@@ -0,0 +1,71 @@
|
|
1
|
+
<!-- Title System -->
|
2
|
+
<% phc_title "Code Snippet Manager" %>
|
3
|
+
<% phc_title_tagline "Asset URL Details" %>
|
4
|
+
<% phc_breadcrumb_one link_to "Code Snippet Index", phcdevworks_scripts.snippet_posts_path %>
|
5
|
+
<% phc_breadcrumb_two yield(:phc_title_tagline) %>
|
6
|
+
<!-- Title System -->
|
7
|
+
|
8
|
+
<!-- Page Bradcrumbs -->
|
9
|
+
<ol class="breadcrumb pull-right">
|
10
|
+
<li class="breadcrumb-item"><%= yield(:phc_breadcrumb_one) %></li>
|
11
|
+
<li class="breadcrumb-item active"><%= yield(:phc_breadcrumb_two) %></li>
|
12
|
+
</ol>
|
13
|
+
<!-- Page Bradcrumbs -->
|
14
|
+
|
15
|
+
<!-- Page Header -->
|
16
|
+
<h1 class="page-header"><%= yield(:phc_title) %></h1>
|
17
|
+
<!-- Page Header -->
|
18
|
+
|
19
|
+
<!-- Page Content -->
|
20
|
+
<div class="row">
|
21
|
+
|
22
|
+
<!-- Button Area -->
|
23
|
+
<div class="col-lg-4">
|
24
|
+
<!-- Button Panel -->
|
25
|
+
<div class="panel panel-inverse">
|
26
|
+
<!-- Panel Heading -->
|
27
|
+
<div class="panel-heading">
|
28
|
+
<h4 class="panel-title">Options Panel</h4>
|
29
|
+
</div>
|
30
|
+
<!-- Panel Heading -->
|
31
|
+
<!-- Panel Body -->
|
32
|
+
<div class="panel-body">
|
33
|
+
<div class="btn-group d-flex" role="group">
|
34
|
+
<%= link_to 'Update', phcdevworks_scripts.edit_snippet_post_url_path, class: "btn btn-primary" %>
|
35
|
+
<%= link_to 'Remove', phcdevworks_scripts.snippet_post_urls_path, method: :delete, data: { confirm: 'Are you sure?' }, class: "btn btn-danger" %>
|
36
|
+
</div>
|
37
|
+
</div>
|
38
|
+
<!-- Panel Body -->
|
39
|
+
</div>
|
40
|
+
<!-- Button Panel -->
|
41
|
+
</div>
|
42
|
+
<!-- Button Area -->
|
43
|
+
|
44
|
+
<!-- Main Area -->
|
45
|
+
<div class="col-lg-8">
|
46
|
+
<!-- Main Panel -->
|
47
|
+
<div class="panel panel-inverse">
|
48
|
+
<!-- Panel Heading -->
|
49
|
+
<div class="panel-heading">
|
50
|
+
<div class="panel-heading-btn">
|
51
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-default" data-click="panel-expand"><i class="fa fa-expand"></i></a>
|
52
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-success" data-click="panel-reload"><i class="fa fa-redo"></i></a>
|
53
|
+
<a href="javascript:;" class="btn btn-xs btn-icon btn-circle btn-warning" data-click="panel-collapse"><i class="fa fa-minus"></i></a>
|
54
|
+
</div>
|
55
|
+
<h4 class="panel-title"><%= yield(:phc_title_tagline) %></h4>
|
56
|
+
</div>
|
57
|
+
<!-- Panel Heading -->
|
58
|
+
<!-- Panel Body -->
|
59
|
+
<div class="panel-body">
|
60
|
+
<p class="h3">Script Snippet URL</p>
|
61
|
+
<hr>
|
62
|
+
<pre><code><%= @script_url.script_url %></code></pre>
|
63
|
+
</div>
|
64
|
+
<!-- Panel Body -->
|
65
|
+
</div>
|
66
|
+
<!-- Main Panel -->
|
67
|
+
</div>
|
68
|
+
<!-- Main Area -->
|
69
|
+
|
70
|
+
</div>
|
71
|
+
<!-- Page Content -->
|
@@ -0,0 +1,107 @@
|
|
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
|
data/config/routes.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PhcdevworksScripts::Engine.routes.draw do
|
2
|
+
|
3
|
+
# API Routes
|
4
|
+
namespace :api, :path => "", :constraints => {:subdomain => "api"} do
|
5
|
+
namespace :v1 do
|
6
|
+
resources :mains, defaults: {format: 'json'}
|
7
|
+
resources :informations, defaults: {format: 'json'}
|
8
|
+
resources :versions, defaults: {format: 'json'}
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Script CDN Routes
|
13
|
+
namespace :script do
|
14
|
+
resources :listings, class_name: 'PhcdevworksScripts::Script::Listing' do
|
15
|
+
resources :urls, class_name: 'PhcdevworksScripts::Script::Url'
|
16
|
+
end
|
17
|
+
resources :authors, class_name: 'PhcdevworksScripts::Script::Author'
|
18
|
+
resources :extensions, class_name: 'PhcdevworksScripts::Script::Extension'
|
19
|
+
resources :versions, class_name: 'PhcdevworksScripts::Script::Version'
|
20
|
+
end
|
21
|
+
|
22
|
+
# Script Snippet Routes
|
23
|
+
namespace :snippet do
|
24
|
+
resources :posts, class_name: 'PhcdevworksScripts::Snippet::Post' do
|
25
|
+
resources :urls, class_name: 'PhcdevworksScripts::Snippet::Url'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Mount Routes
|
30
|
+
mount PhcdevworksAccounts::Engine, :at => '/'
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreatePhcdevworksScriptsFriendlyIdSlugs < ActiveRecord::Migration[5.2]
|
2
|
+
def change
|
3
|
+
|
4
|
+
create_table :phcdevworks_scripts_friendly_id_slugs do |t|
|
5
|
+
t.string :slug, :null => false
|
6
|
+
t.integer :sluggable_id, :null => false
|
7
|
+
t.string :sluggable_type, :limit => 50
|
8
|
+
t.string :scope
|
9
|
+
t.datetime :created_at
|
10
|
+
end
|
11
|
+
|
12
|
+
add_index :phcdevworks_scripts_friendly_id_slugs, :sluggable_id
|
13
|
+
add_index :phcdevworks_scripts_friendly_id_slugs, [:slug, :sluggable_type], name: 'scriptcdnpro_fri_id_slugable_type', length: { slug: 140, sluggable_type: 50 }
|
14
|
+
add_index :phcdevworks_scripts_friendly_id_slugs, [:slug, :sluggable_type, :scope], name: 'scriptcdnpro_fri_id_slugable_scope_type', length: { slug: 70, sluggable_type: 50, scope: 70 }, unique: true
|
15
|
+
add_index :phcdevworks_scripts_friendly_id_slugs, :sluggable_type
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhcdevworksScriptsExtensionVersions < ActiveRecord::Migration[5.2]
|
2
|
+
TEXT_BYTES = 1_073_741_823
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :phcdevworks_scripts_extension_versions do |t|
|
6
|
+
t.string :item_type, {:null=>false}
|
7
|
+
t.integer :item_id, null: false
|
8
|
+
t.string :event, null: false
|
9
|
+
t.string :whodunnit
|
10
|
+
t.text :object, limit: TEXT_BYTES
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :phcdevworks_scripts_extension_versions, %i(item_type item_id), :name => 'scriptcdnpro_ext_versions'
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhcdevworksScriptsListingVersions < ActiveRecord::Migration[5.2]
|
2
|
+
TEXT_BYTES = 1_073_741_823
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :phcdevworks_scripts_listing_versions do |t|
|
6
|
+
t.string :item_type, {:null=>false}
|
7
|
+
t.integer :item_id, null: false
|
8
|
+
t.string :event, null: false
|
9
|
+
t.string :whodunnit
|
10
|
+
t.text :object, limit: TEXT_BYTES
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :phcdevworks_scripts_listing_versions, %i(item_type item_id), :name => 'scriptcdnpro_listing_versions'
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhcdevworksScriptsScriptversionVersions < ActiveRecord::Migration[5.2]
|
2
|
+
TEXT_BYTES = 1_073_741_823
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :phcdevworks_scripts_scriptversion_versions do |t|
|
6
|
+
t.string :item_type, {:null=>false}
|
7
|
+
t.integer :item_id, null: false
|
8
|
+
t.string :event, null: false
|
9
|
+
t.string :whodunnit
|
10
|
+
t.text :object, limit: TEXT_BYTES
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :phcdevworks_scripts_scriptversion_versions, %i(item_type item_id), :name => 'scriptcdnpro_scriptversion_versions'
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhcdevworksScriptsUrlVersions < ActiveRecord::Migration[5.2]
|
2
|
+
TEXT_BYTES = 1_073_741_823
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :phcdevworks_scripts_url_versions do |t|
|
6
|
+
t.string :item_type, {:null=>false}
|
7
|
+
t.integer :item_id, null: false
|
8
|
+
t.string :event, null: false
|
9
|
+
t.string :whodunnit
|
10
|
+
t.text :object, limit: TEXT_BYTES
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :phcdevworks_scripts_url_versions, %i(item_type item_id), :name => 'scriptcdnpro_url_versions'
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhcdevworksScriptsAuthorVersions < ActiveRecord::Migration[5.2]
|
2
|
+
TEXT_BYTES = 1_073_741_823
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :phcdevworks_scripts_author_versions do |t|
|
6
|
+
t.string :item_type, {:null=>false}
|
7
|
+
t.integer :item_id, null: false
|
8
|
+
t.string :event, null: false
|
9
|
+
t.string :whodunnit
|
10
|
+
t.text :object, limit: TEXT_BYTES
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :phcdevworks_scripts_author_versions, %i(item_type item_id), :name => 'scriptcdnpro_author_versions'
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class CreatePhcdevworksScriptsLicenceVersions < ActiveRecord::Migration[5.2]
|
2
|
+
TEXT_BYTES = 1_073_741_823
|
3
|
+
def change
|
4
|
+
|
5
|
+
create_table :phcdevworks_scripts_licence_versions do |t|
|
6
|
+
t.string :item_type, {:null=>false}
|
7
|
+
t.integer :item_id, null: false
|
8
|
+
t.string :event, null: false
|
9
|
+
t.string :whodunnit
|
10
|
+
t.text :object, limit: TEXT_BYTES
|
11
|
+
t.datetime :created_at
|
12
|
+
end
|
13
|
+
|
14
|
+
add_index :phcdevworks_scripts_licence_versions, %i(item_type item_id), :name => 'scriptcdnpro_licence_versions'
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|