sd
This commit is contained in:
@@ -148,8 +148,8 @@ class SiteAdmin(AccountAdminMixin, admin.ModelAdmin):
|
|||||||
|
|
||||||
def get_api_key_status(self, obj):
|
def get_api_key_status(self, obj):
|
||||||
"""Show API key status in list view"""
|
"""Show API key status in list view"""
|
||||||
|
from django.utils.html import format_html
|
||||||
if obj.wp_api_key:
|
if obj.wp_api_key:
|
||||||
from django.utils.html import format_html
|
|
||||||
return format_html('<span style="color:green;">●</span> Active')
|
return format_html('<span style="color:green;">●</span> Active')
|
||||||
return format_html('<span style="color:gray;">○</span> None')
|
return format_html('<span style="color:gray;">○</span> None')
|
||||||
get_api_key_status.short_description = 'API Key'
|
get_api_key_status.short_description = 'API Key'
|
||||||
|
|||||||
@@ -202,19 +202,9 @@ export default function SiteSettings() {
|
|||||||
const response = await fetchIndustries();
|
const response = await fetchIndustries();
|
||||||
let allIndustries = response.industries || [];
|
let allIndustries = response.industries || [];
|
||||||
|
|
||||||
// Filter to show only user's pre-selected industries/sectors from account preferences
|
// Note: For existing sites with industries already configured,
|
||||||
try {
|
// we show ALL industries so users can change their selection.
|
||||||
const { fetchAccountSetting } = await import('../../services/api');
|
// The filtering by user preferences only applies during initial site creation.
|
||||||
const setting = await fetchAccountSetting('user_preferences');
|
|
||||||
const preferences = setting.config as { selectedIndustry?: string; selectedSectors?: string[] } | undefined;
|
|
||||||
|
|
||||||
if (preferences?.selectedIndustry) {
|
|
||||||
// Filter industries to only show the user's pre-selected industry
|
|
||||||
allIndustries = allIndustries.filter(i => i.slug === preferences.selectedIndustry);
|
|
||||||
}
|
|
||||||
} catch (error: any) {
|
|
||||||
// Silently handle errors - show all industries
|
|
||||||
}
|
|
||||||
|
|
||||||
setIndustries(allIndustries);
|
setIndustries(allIndustries);
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
@@ -262,14 +252,11 @@ export default function SiteSettings() {
|
|||||||
const getIndustrySectors = () => {
|
const getIndustrySectors = () => {
|
||||||
if (!selectedIndustry) return [];
|
if (!selectedIndustry) return [];
|
||||||
const industry = industries.find(i => i.slug === selectedIndustry);
|
const industry = industries.find(i => i.slug === selectedIndustry);
|
||||||
let sectors = industry?.sectors || [];
|
|
||||||
|
|
||||||
// Filter to show only user's pre-selected sectors from account preferences
|
// Note: For existing sites in Settings page, show ALL sectors from the selected industry
|
||||||
if (userPreferences?.selectedSectors && userPreferences.selectedSectors.length > 0) {
|
// so users can change their sector selection. The filtering by user preferences
|
||||||
sectors = sectors.filter(s => userPreferences.selectedSectors!.includes(s.slug));
|
// only applies during initial site creation (in the Sites wizard).
|
||||||
}
|
return industry?.sectors || [];
|
||||||
|
|
||||||
return sectors;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSelectSectors = async () => {
|
const handleSelectSectors = async () => {
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ class Igny8RestAPI {
|
|||||||
));
|
));
|
||||||
|
|
||||||
// Manual publish endpoint - for triggering WordPress publish from IGNY8
|
// Manual publish endpoint - for triggering WordPress publish from IGNY8
|
||||||
register_rest_route('igny8/v1', '/publish-content/', array(
|
// Route: /wp-json/igny8/v1/publish
|
||||||
|
register_rest_route('igny8/v1', '/publish', array(
|
||||||
'methods' => 'POST',
|
'methods' => 'POST',
|
||||||
'callback' => array($this, 'publish_content_to_wordpress'),
|
'callback' => array($this, 'publish_content_to_wordpress'),
|
||||||
'permission_callback' => array($this, 'check_permission'),
|
'permission_callback' => array($this, 'check_permission'),
|
||||||
|
|||||||
Reference in New Issue
Block a user