File: //usr/local/CyberCP/websiteFunctions/templates/websiteFunctions/WPAddNewPlugin.html
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% load static %}
{% block title %}{% trans "Add Plugin Bucket - CyberPanel" %}{% endblock %}
{% block header_scripts %}
<style>
/* Add New Plugin Page Specific Styles */
.plugin-wrapper {
background: transparent;
padding: 20px;
}
.plugin-container {
max-width: 800px;
margin: 0 auto;
}
.plugin-section {
background: var(--bg-secondary, white);
border-radius: 12px;
padding: 25px;
margin-bottom: 25px;
box-shadow: 0 2px 8px var(--shadow-color, rgba(0,0,0,0.08));
border: 1px solid var(--border-color, #e8e9ff);
}
.section-title {
font-size: 16px;
font-weight: 700;
color: var(--text-heading, #2f3640);
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.section-title::before {
content: '';
width: 4px;
height: 24px;
background: var(--accent-color, #5b5fcf);
border-radius: 2px;
}
.plugin-description {
color: var(--text-secondary, #8893a7);
font-size: 14px;
margin-bottom: 25px;
line-height: 1.5;
}
/* Form Styles */
.form-group {
margin-bottom: 25px;
}
.form-label {
font-size: 13px;
font-weight: 600;
color: var(--text-primary, #2f3640);
margin-bottom: 8px;
text-transform: uppercase;
letter-spacing: 0.5px;
display: block;
}
.form-control {
width: 100%;
padding: 12px 16px;
border: 1px solid var(--border-color, #e8e9ff);
border-radius: 8px;
font-size: 14px;
color: var(--text-primary, #2f3640);
background: var(--bg-secondary, white);
transition: all 0.2s ease;
}
.form-control:focus {
outline: none;
border-color: var(--accent-color, #5b5fcf);
box-shadow: 0 0 0 3px rgba(91,95,207,0.1);
}
.form-control::placeholder {
color: var(--text-secondary, #94a3b8);
font-size: 13px;
}
/* Search Results Dropdown */
#mysearch {
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
max-height: 300px;
overflow-y: auto;
margin-top: 5px;
}
.search-result-item {
padding: 12px 16px;
border-bottom: 1px solid #f1f3f5;
cursor: pointer;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 12px;
}
.search-result-item:hover {
background: var(--bg-hover, #f8f9ff);
color: var(--accent-color, #5b5fcf);
}
.search-result-item:last-child {
border-bottom: none;
}
.plugin-icon {
width: 40px;
height: 40px;
background: var(--border-color, #e8e9ff);
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
}
.plugin-info {
flex: 1;
}
.plugin-name {
font-weight: 600;
font-size: 14px;
margin-bottom: 2px;
}
.plugin-desc {
font-size: 12px;
color: var(--text-secondary, #8893a7);
}
/* Selected Plugins Section */
.selected-plugins-section {
background: var(--bg-hover, #fafbff);
border: 1px solid var(--border-color, #e8e9ff);
border-radius: 8px;
padding: 20px;
margin-bottom: 25px;
}
.selected-header {
font-size: 14px;
font-weight: 700;
color: var(--text-heading, #2f3640);
margin-bottom: 15px;
text-transform: uppercase;
letter-spacing: 0.5px;
}
#selJS {
display: flex;
flex-wrap: wrap;
gap: 10px;
}
.selected-plugin {
background: var(--bg-secondary, white);
border: 1px solid var(--border-color, #e8e9ff);
border-radius: 8px;
padding: 10px 16px;
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
color: var(--text-primary, #2f3640);
transition: all 0.2s ease;
}
.selected-plugin:hover {
border-color: var(--accent-color, #5b5fcf);
box-shadow: 0 2px 8px rgba(91,95,207,0.15);
}
.remove-plugin {
background: none;
border: none;
color: #ef4444;
cursor: pointer;
padding: 2px;
margin-left: 8px;
transition: all 0.2s ease;
}
.remove-plugin:hover {
color: #dc2626;
transform: scale(1.1);
}
/* Button Styles */
.btn-primary {
background: var(--accent-color, #5b5fcf);
border: 1px solid var(--accent-color, #5b5fcf);
color: white;
padding: 12px 32px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 8px;
text-decoration: none;
}
.btn-primary:hover {
background: var(--accent-hover, #4b4fbf);
border-color: var(--accent-hover, #4b4fbf);
box-shadow: 0 3px 8px rgba(91,95,207,0.3);
transform: translateY(-1px);
}
.btn-primary:disabled {
background: #94a3b8;
border-color: #94a3b8;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
.btn-secondary {
background: var(--bg-secondary, white);
border: 1px solid var(--border-color, #e8e9ff);
color: var(--text-primary, #2f3640);
padding: 12px 32px;
border-radius: 8px;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
display: inline-flex;
align-items: center;
gap: 8px;
text-decoration: none;
}
.btn-secondary:hover {
background: var(--bg-hover, #f8f9ff);
border-color: var(--accent-color, #5b5fcf);
color: var(--accent-color, #5b5fcf);
text-decoration: none;
}
.btn-group {
display: flex;
gap: 15px;
margin-top: 30px;
}
.loading-spinner {
width: 16px;
height: 16px;
margin-left: 8px;
}
/* Empty State */
.empty-selected {
text-align: center;
padding: 40px;
color: var(--text-secondary, #8893a7);
font-size: 14px;
}
.empty-selected i {
font-size: 48px;
opacity: 0.3;
margin-bottom: 10px;
}
/* Info Alert */
.info-alert {
background: var(--info-bg, #f0f9ff);
border: 1px solid var(--info-border, #bae6fd);
border-radius: 8px;
padding: 15px;
margin-bottom: 20px;
color: var(--info-text, #0c4a6e);
font-size: 14px;
display: flex;
align-items: center;
gap: 10px;
}
.info-alert i {
color: var(--info-accent, #0284c7);
}
/* Responsive */
@media (max-width: 768px) {
.plugin-wrapper {
padding: 15px;
}
.plugin-section {
padding: 20px;
}
.btn-group {
flex-direction: column;
}
.btn-group > * {
width: 100%;
}
}
</style>
{% endblock %}
{% block content %}
<div class="plugin-wrapper" ng-controller="WPAddNewPlugin">
<div class="plugin-container">
<!-- Header Section -->
<div class="plugin-section">
<h2 class="section-title">
ADD NEW PLUGIN BUCKET
<img ng-hide="webSiteCreationLoading" src="{% static 'images/loading.gif' %}" class="loading-spinner">
</h2>
<p class="plugin-description">{% trans "Create a plugin bucket to automatically install selected plugins when deploying new WordPress sites." %}</p>
</div>
<!-- Form Section -->
<div class="plugin-section">
<form name="websiteCreationForm">
<!-- Bucket Name -->
<div class="form-group">
<label class="form-label">{% trans "Plugin Bucket Name" %}</label>
<input name="PluginbucketName" type="text" class="form-control" ng-model="PluginbucketName"
placeholder="e.g., Essential Plugins, Security Bundle, etc." required>
</div>
<!-- Plugin Search -->
<div class="form-group">
<label class="form-label">{% trans "Search and Add Plugins" %}</label>
<input name="searchcontent" type="text" class="form-control" ng-model="searchcontent"
ng-keyup="$event.keyCode == 13 ? SearchPluginName('add') : null"
placeholder="{% trans "Type to search for plugins..." %}" required>
<!-- Search Results Dropdown -->
<div id="mysearch" style="display: none; border-top: none!important;
border: 1px solid #e8e9ff;
position: absolute; z-index: 1000;
background-color: #FFFFFF;
width: calc(100% - 50px);
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
max-height: 300px;
overflow-y: auto;
margin-top: 5px;">
</div>
</div>
<!-- Selected Plugins -->
<div class="selected-plugins-section">
<h3 class="selected-header">Selected Plugins</h3>
<div id="selJS" style="display: none;">
<!-- Selected plugins will be displayed here -->
</div>
<div class="empty-selected" id="emptySelected">
<i class="fas fa-plug"></i>
<p>No plugins selected yet. Search for plugins above to add them to this bucket.</p>
</div>
</div>
<!-- Action Buttons -->
<div class="btn-group">
<button ng-disabled="websiteCreationForm.PluginbucketName.$error.required"
type="button" ng-click="AddNewplugin()"
class="btn-primary">
<i class="fas fa-save"></i>
{% trans "Create Plugin Bucket" %}
</button>
<a href="{% url 'ConfigurePlugins' %}" class="btn-secondary">
<i class="fas fa-arrow-left"></i>
{% trans "Back to Plugin Buckets" %}
</a>
</div>
</form>
</div>
<!-- Info Section -->
<div class="plugin-section">
<div class="info-alert">
<i class="fas fa-info-circle"></i>
<div>
<strong>How it works:</strong> When you create a new WordPress site and select this plugin bucket, all the plugins in this bucket will be automatically installed and activated.
</div>
</div>
</div>
</div>
</div>
<script>
// Hide empty state when plugins are selected
$(document).on('DOMSubtreeModified', '#selJS', function() {
if ($('#selJS').children().length > 0) {
$('#emptySelected').hide();
} else {
$('#emptySelected').show();
}
});
</script>
{% endblock %}