phcscriptcdnpro 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +238 -0
- data/README.md +10 -0
- data/Rakefile +21 -0
- data/app/assets/javascripts/phcscriptcdnpro/application.js +16 -0
- data/app/assets/stylesheets/phcscriptcdnpro/application.css.scss +10 -0
- data/app/assets/stylesheets/phcscriptcdnpro/custom.scss +4 -0
- data/app/controllers/phcscriptcdnpro/application_controller.rb +9 -0
- data/app/controllers/phcscriptcdnpro/scriptcdn/scripts_controller.rb +82 -0
- data/app/controllers/phcscriptcdnpro/scriptcdn/scripturls_controller.rb +89 -0
- data/app/controllers/phcscriptcdnpro/scriptcdn/scriptversions_controller.rb +63 -0
- data/app/helpers/phcscriptcdnpro/application_helper.rb +4 -0
- data/app/helpers/phcscriptcdnpro/scriptcdn/scripts_helper.rb +4 -0
- data/app/helpers/phcscriptcdnpro/scriptcdn/scripturls_helper.rb +4 -0
- data/app/helpers/phcscriptcdnpro/scriptcdn/scriptversions_helper.rb +4 -0
- data/app/models/phcscriptcdnpro/scriptcdn.rb +7 -0
- data/app/models/phcscriptcdnpro/scriptcdn/script.rb +15 -0
- data/app/models/phcscriptcdnpro/scriptcdn/scripturl.rb +14 -0
- data/app/models/phcscriptcdnpro/scriptcdn/scriptversion.rb +15 -0
- data/app/views/layouts/phcscriptcdnpro/application.html.erb +21 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/_form.html.erb +22 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/edit.html.erb +12 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/index.html.erb +36 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/index_scriptlist.html.erb +8 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/new.html.erb +11 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/show.html.erb +19 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripts/show_scriptlisting.html.erb +16 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripturls/_form.html.erb +22 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripturls/_formpatch.html.erb +22 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripturls/edit.html.erb +12 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripturls/index.html.erb +37 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripturls/new.html.erb +12 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scripturls/show.html.erb +11 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scriptversions/_form.html.erb +19 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scriptversions/edit.html.erb +12 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scriptversions/index.html.erb +37 -0
- data/app/views/phcscriptcdnpro/scriptcdn/scriptversions/new.html.erb +12 -0
- data/config/routes.rb +11 -0
- data/db/migrate/20160222025658_create_phcscriptcdnpro_scriptcdn_scripts.rb +12 -0
- data/db/migrate/20160222030223_create_phcscriptcdnpro_scriptcdn_scriptversions.rb +12 -0
- data/db/migrate/20160222030446_create_phcscriptcdnpro_scriptcdn_scripturls.rb +13 -0
- data/lib/phcscriptcdnpro.rb +4 -0
- data/lib/phcscriptcdnpro/engine.rb +37 -0
- data/lib/phcscriptcdnpro/version.rb +3 -0
- data/lib/tasks/phcscriptcdnpro_tasks.rake +4 -0
- metadata +455 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
require_dependency "phcscriptcdnpro/application_controller"
|
2
|
+
|
3
|
+
module Phcscriptcdnpro
|
4
|
+
class Scriptcdn::ScriptversionsController < ApplicationController
|
5
|
+
|
6
|
+
# Security & Action Filters
|
7
|
+
before_action :require_user
|
8
|
+
before_action :set_scriptcdn_scriptversion, only: [:edit, :update, :destroy]
|
9
|
+
|
10
|
+
# Script Version Index
|
11
|
+
def index
|
12
|
+
@scriptcdn_scriptversions = Scriptcdn::Scriptversion.all
|
13
|
+
end
|
14
|
+
|
15
|
+
# New Script Version for CDN
|
16
|
+
def new
|
17
|
+
@scriptcdn_scriptversion = Scriptcdn::Scriptversion.new
|
18
|
+
end
|
19
|
+
|
20
|
+
# Edit Script Version
|
21
|
+
def edit
|
22
|
+
end
|
23
|
+
|
24
|
+
# POST Script Version
|
25
|
+
def create
|
26
|
+
@scriptcdn_scriptversion = Scriptcdn::Scriptversion.new(scriptcdn_scriptversion_params)
|
27
|
+
|
28
|
+
if @scriptcdn_scriptversion.save
|
29
|
+
redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully created.'
|
30
|
+
else
|
31
|
+
render :new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# PATCH/PUT Script Version
|
36
|
+
def update
|
37
|
+
if @scriptcdn_scriptversion.update(scriptcdn_scriptversion_params)
|
38
|
+
redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully updated.'
|
39
|
+
else
|
40
|
+
render :edit
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
# DELETE Script Version
|
45
|
+
def destroy
|
46
|
+
@scriptcdn_scriptversion.destroy
|
47
|
+
redirect_to scriptcdn_scriptversions_path, notice: 'Script version was successfully destroyed.'
|
48
|
+
end
|
49
|
+
|
50
|
+
private
|
51
|
+
|
52
|
+
# Callbacks
|
53
|
+
def set_scriptcdn_scriptversion
|
54
|
+
@scriptcdn_scriptversion = Scriptcdn::Scriptversion.find(params[:id])
|
55
|
+
end
|
56
|
+
|
57
|
+
# Whitelist
|
58
|
+
def scriptcdn_scriptversion_params
|
59
|
+
params.require(:scriptcdn_scriptversion).permit(:scrptversion, :scrptversionpakname)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Phcscriptcdnpro
|
2
|
+
class Scriptcdn::Script < ActiveRecord::Base
|
3
|
+
|
4
|
+
# Relationships
|
5
|
+
has_many :scriptversions
|
6
|
+
has_many :scripturls
|
7
|
+
|
8
|
+
# Validation for Form Fields
|
9
|
+
validates :scrptname,
|
10
|
+
uniqueness: true,
|
11
|
+
presence: true,
|
12
|
+
length: { minimum: 3 }
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Phcscriptcdnpro
|
2
|
+
class Scriptcdn::Scripturl < ActiveRecord::Base
|
3
|
+
|
4
|
+
# Relationships
|
5
|
+
belongs_to :scriptversion
|
6
|
+
|
7
|
+
# Validation for Form Fields
|
8
|
+
validates :scrpturlphc,
|
9
|
+
uniqueness: true,
|
10
|
+
presence: true,
|
11
|
+
length: { minimum: 3 }
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Phcscriptcdnpro
|
2
|
+
class Scriptcdn::Scriptversion < ActiveRecord::Base
|
3
|
+
|
4
|
+
# Relationships
|
5
|
+
belongs_to :script
|
6
|
+
has_many :scripturls
|
7
|
+
|
8
|
+
# Validation for Form Fields
|
9
|
+
validates :scrptversionpakname,
|
10
|
+
uniqueness: true,
|
11
|
+
presence: true,
|
12
|
+
length: { minimum: 3 }
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<title>PHCScriptCDN(Pro) - Script Listing Engine</title>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag "phcscriptcdnpro/application", media: "all" %>
|
8
|
+
<%= javascript_include_tag "phcscriptcdnpro/application" %>
|
9
|
+
<%= csrf_meta_tags %>
|
10
|
+
|
11
|
+
</head>
|
12
|
+
|
13
|
+
<body>
|
14
|
+
<div class="container">
|
15
|
+
<div class="row">
|
16
|
+
<%= yield %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
</body>
|
20
|
+
|
21
|
+
</html>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for(@scriptcdn_script) do |f| %>
|
2
|
+
|
3
|
+
<%= render 'phcnotifi/validations', :object => @scriptcdn_script %>
|
4
|
+
|
5
|
+
<div class="form-group">
|
6
|
+
<%= f.label :scrptname, "Script Name" %>
|
7
|
+
<%= f.text_field :scrptname, class: "form-control" %>
|
8
|
+
</div>
|
9
|
+
<div class="form-group">
|
10
|
+
<%= f.label :scrptdescription, "Script Description" %>
|
11
|
+
<%= f.text_area :scrptdescription, class: "form-control" %>
|
12
|
+
</div>
|
13
|
+
<div class="form-group">
|
14
|
+
<%= f.label :scriptversion_id, "Script Version" %>
|
15
|
+
<%= collection_select(:scriptcdn_script, :scriptversion_id, Phcscriptcdnpro::Scriptcdn::Scriptversion.order('scrptversion'), :id, :scrptversion, {}, {class: "form-control form-control-sm"}) %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit "Submit", class: "btn btn-primary btn-sm" %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<div class="wrapper wrapper-content">
|
4
|
+
<div class="panel panel-default">
|
5
|
+
<div class="panel-heading">
|
6
|
+
<i class="fa fa-code"></i> Edit Script
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
9
|
+
<%= render 'form' %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<!-- Main Content -->
|
4
|
+
<div class="wrapper wrapper-content">
|
5
|
+
<div class="panel panel-default">
|
6
|
+
<div class="panel-heading">
|
7
|
+
<i class="fa fa-code"></i> Script CDN List
|
8
|
+
</div>
|
9
|
+
<div class="panel-body">
|
10
|
+
<table class="table table-bordered table-striped table-hover">
|
11
|
+
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th>Script Name</th>
|
15
|
+
<th></th>
|
16
|
+
</tr>
|
17
|
+
</thead>
|
18
|
+
|
19
|
+
<tbody>
|
20
|
+
<% @scriptcdn_scripts.each do |scriptcdn_script| %>
|
21
|
+
<tr>
|
22
|
+
<td><%= scriptcdn_script.scrptname %></td>
|
23
|
+
<td><div class="btn-group" role="group" aria-label="Script CDN">
|
24
|
+
<%= link_to 'Show', scriptcdn_script, class: "btn btn-w-m btn-primary btn-xs btn-phc-custom" %>
|
25
|
+
<%= link_to 'Edit', edit_scriptcdn_script_path(scriptcdn_script), class: "btn btn-w-m btn-primary btn-xs btn-phc-custom" %>
|
26
|
+
<%= link_to 'Destroy', scriptcdn_script, class: "btn btn-w-m btn-danger btn-xs btn-phc-custom", method: :delete, data: { confirm: 'Are you sure?' } %>
|
27
|
+
</div></td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
|
32
|
+
</table>
|
33
|
+
<%= link_to 'New Script', new_scriptcdn_script_path, class: "btn btn-w-m btn-primary btn-phc-custom" %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
<div class="wrapper wrapper-content">
|
3
|
+
<div class="panel panel-default">
|
4
|
+
<div class="panel-heading">
|
5
|
+
<i class="fa fa-code"></i> Add a New Script
|
6
|
+
</div>
|
7
|
+
<div class="panel-body">
|
8
|
+
<%= render 'form' %>
|
9
|
+
</div>
|
10
|
+
</div>
|
11
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Script Name:</strong>
|
5
|
+
<%= @scriptcdn_script.scrptname %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Script Description:</strong>
|
10
|
+
<%= @scriptcdn_script.scrptdescription %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Script Version:</strong>
|
15
|
+
<%= @scriptcdn_script.scriptversion_id %>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
<%= link_to 'Edit', edit_scriptcdn_script_path(@scriptcdn_script) %> |
|
19
|
+
<%= link_to 'Back', scriptcdn_scripts_path %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<p>
|
4
|
+
<strong>Script Name:</strong>
|
5
|
+
<%= @scriptcdn_script.scrptname %>
|
6
|
+
</p>
|
7
|
+
|
8
|
+
<p>
|
9
|
+
<strong>Script Description:</strong>
|
10
|
+
<%= @scriptcdn_script.scrptdescription %>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
<strong>Script Version:</strong>
|
15
|
+
<%= @scriptcdn_script.scriptversion_id %>
|
16
|
+
</p>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for([@scriptcdn_scripturl.scriptversion, @scriptcdn_scripturl], url: scriptcdn_scriptversion_scripturls_path) do |f| %>
|
2
|
+
|
3
|
+
<%= render 'phcnotifi/validations', :object => @scriptcdn_scripturl %>
|
4
|
+
|
5
|
+
<div class="field">
|
6
|
+
<label><%= f.label :scrpturlphc, "Script URL (AWS)" %></label>
|
7
|
+
<%= f.text_field :scrpturlphc, class: "form-control" %>
|
8
|
+
</div>
|
9
|
+
<div class="field">
|
10
|
+
<label><%= f.label :scrpturltype, "Script Type" %></label>
|
11
|
+
<%= f.select :scrpturltype, [['CSS','css'],['JS','js'],['font','Font']], class: "form-control" %>
|
12
|
+
</div>
|
13
|
+
<div class="form-group">
|
14
|
+
<label><%= f.label :scriptversion_id, "Script Version" %></label>
|
15
|
+
<%= collection_select(:scriptcdn_scripturl, :scriptversion_id, Phcscriptcdnpro::Scriptcdn::Scriptversion.order('scrptversion'), :id, :scrptversion, {}, {class: "form-control"}) %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit "Submit", class: "btn btn-primary btn-sm"%>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= form_for([@scriptcdn_scripturl.scriptversion, @scriptcdn_scripturl], url: scriptcdn_scriptversion_scripturl_path, method: :patch) do |f| %>
|
2
|
+
|
3
|
+
<%= render 'phcnotifi/validations', :object => @scriptcdn_scripturl %>
|
4
|
+
|
5
|
+
<div class="field">
|
6
|
+
<label><%= f.label :scrpturlphc, "Script URL (AWS)" %></label>
|
7
|
+
<%= f.text_field :scrpturlphc, class: "form-control" %>
|
8
|
+
</div>
|
9
|
+
<div class="field">
|
10
|
+
<label><%= f.label :scrpturltype, "Script Type" %></label>
|
11
|
+
<%= f.select :scrpturltype, [['CSS','css'],['JS','js'],['font','Font']], class: "form-control" %>
|
12
|
+
</div>
|
13
|
+
<div class="form-group">
|
14
|
+
<label><%= f.label :scriptversion_id, "Script Version" %></label>
|
15
|
+
<%= collection_select(:scriptcdn_scripturl, :scriptversion_id, Phcscriptcdnpro::Scriptcdn::Scriptversion.order('scrptversion'), :id, :scrptversion, {}, {class: "form-control"}) %>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div class="actions">
|
19
|
+
<%= f.submit "Submit", class: "btn btn-primary btn-sm"%>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<div class="wrapper wrapper-content">
|
4
|
+
<div class="panel panel-default">
|
5
|
+
<div class="panel-heading">
|
6
|
+
<i class="fa fa-code"></i> Edit Script URL
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
9
|
+
<%= render 'formpatch' %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<!-- Main Content -->
|
4
|
+
<div class="wrapper wrapper-content">
|
5
|
+
<div class="panel panel-default">
|
6
|
+
<div class="panel-heading">
|
7
|
+
<h4><i class="fa fa-code"></i> Script URL List</h4> <p></p>
|
8
|
+
</div>
|
9
|
+
<div class="panel-body">
|
10
|
+
<table class="table table-bordered table-striped table-hover">
|
11
|
+
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th>Script URL</th>
|
15
|
+
<th>Script Type</th>
|
16
|
+
<th></th>
|
17
|
+
</tr>
|
18
|
+
</thead>
|
19
|
+
|
20
|
+
<tbody>
|
21
|
+
<% @scriptcdn_scripturls.each do |scriptcdn_scripturl| %>
|
22
|
+
<tr>
|
23
|
+
<td><%= scriptcdn_scripturl.scrpturlphc %></td>
|
24
|
+
<td><%= scriptcdn_scripturl.scrpturltype %></td>
|
25
|
+
<td><div class="btn-group" role="group" aria-label="Script CDN">
|
26
|
+
<%= link_to 'Edit', edit_scriptcdn_scriptversion_scripturl_path(scriptcdn_scripturl.scriptversion, scriptcdn_scripturl), class: "btn btn-w-m btn-primary btn-xs btn-phc-custom" %>
|
27
|
+
<%= link_to 'Destroy', scriptcdn_scriptversion_scripturl_path(scriptcdn_scripturl.scriptversion, scriptcdn_scripturl), class: "btn btn-w-m btn-danger btn-xs btn-phc-custom", method: :delete, data: { confirm: 'Are you sure?' } %>
|
28
|
+
</div></td>
|
29
|
+
</tr>
|
30
|
+
<% end %>
|
31
|
+
</tbody>
|
32
|
+
|
33
|
+
</table>
|
34
|
+
<%= link_to 'New Script URL', new_scriptcdn_scriptversion_scripturl_path, class: "btn btn-w-m btn-primary btn-phc-custom" %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<%= render 'phcnotifi/notifications' %>
|
2
|
+
|
3
|
+
<div class="wrapper wrapper-content">
|
4
|
+
<div class="panel panel-default">
|
5
|
+
<div class="panel-heading">
|
6
|
+
<i class="fa fa-code"></i> Add a New Script URL
|
7
|
+
</div>
|
8
|
+
<div class="panel-body">
|
9
|
+
<%= render 'form' %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= form_for(@scriptcdn_scriptversion) do |f| %>
|
2
|
+
|
3
|
+
<%= render 'phcnotifi/validations', :object => @scriptcdn_scriptversion %>
|
4
|
+
|
5
|
+
<div class="form-group">
|
6
|
+
<label><%= f.label :scrptversionpakname, "Version Pak Name" %></label>
|
7
|
+
<%= f.text_field :scrptversionpakname %>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="form-group">
|
11
|
+
<label><%= f.label :scrptversion, "Script Versions" %></label>
|
12
|
+
<%= f.text_field :scrptversion %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="actions">
|
16
|
+
<%= f.submit "Submit", class: "btn btn-primary btn-sm" %>
|
17
|
+
</div>
|
18
|
+
|
19
|
+
<% end %>
|