Commit inicial - WordPress Análisis de Precios Unitarios

- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2025-11-03 21:04:30 -06:00
commit a22573bf0b
24068 changed files with 4993111 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
var base_view = require( './../views/base' );
module.exports = base_view.extend( {
className: 'tvd-input-field',
template: TVE_Dash.tpl( 'util/edit-title' ),
events: {
'keyup input': 'keyup',
'change input': function () {
var trim_value = this.input.val().trim();
if ( ! trim_value ) {
this.input.addClass( 'tvd-invalid' );
return false;
}
this.model.set( 'post_title', trim_value );
return false;
},
'blur input': function () {
this.model.trigger( 'thrive-ab-title-no-change' );
}
},
initialize: function ( args ) {
var is_valid_args = true;
if ( ! args ) {
is_valid_args = false;
}
if ( typeof args !== 'object' ) {
is_valid_args = false;
}
if ( typeof args === 'object' && typeof args.el === 'undefined' ) {
is_valid_args = false;
}
if ( ! is_valid_args ) {
console.log( 'Error: invalid arguments for edit title control' );
return;
}
this.render();
},
keyup: function ( event ) {
if ( event.which === 27 ) {
this.model.trigger( 'thrive-ab-title-no-change' );
}
},
render: function () {
this.$el.html( this.template( {item: this.model} ) );
this.input = this.$( 'input' );
return this;
},
focus: function () {
this.input.focus().select();
}
} );

View File

@@ -0,0 +1,172 @@
/**
* Autocomplete input
*/
var base_view = Backbone.View,
base_model = require( './../models/base' );
var page_model = base_model.extend( {
defaults: function () {
return {
post_id: '',
post_title: ''
};
},
validate: function ( attrs ) {
var _errors = [];
if ( ! attrs.post_title || ! attrs.post_id ) {
_errors.push( this.validation_error( 'post_title', 'Page not selected' ) );
}
return _errors.length ? _errors : undefined;
}
} );
var view = base_view.extend( {
className: 'tvd-input-field thrive-ab-page-search',
template: TVE_Dash.tpl( 'util/page-search' ),
initialize: function ( attrs ) {
if ( ! attrs || ! attrs.model ) {
this.model = new page_model();
}
this.goal_pages = attrs.goal_pages;
this.on( 'select', this.select );
this.on( 'save-page', this.save_page );
},
render: function () {
this.$el.html( this.template( {item: this.model} ) );
TVE_Dash.data_binder( this );
this.$autocomplete = this.$( '.page-search' );
this.$autocomplete.on( 'input', _.bind( function () {
this.model.set( {
post_id: null
} );
this.$( '.thrive-ab-edit-page' ).attr( 'href', 'javascript:void(0)' ).addClass( 'tvd-btn-flat-secondary' );
this.$( '.thrive-ab-preview-page' ).attr( 'href', 'javascript:void(0)' ).addClass( 'tvd-btn-flat-secondary' );
}, this ) );
this.bind();
return this;
},
select: function ( item ) {
this.$( '.thrive-ab-edit-page' ).attr( 'href', item.edit_url ).removeClass( 'tvd-btn-flat-secondary' ).show();
this.$( '.thrive-ab-preview-page' ).attr( 'href', item.url ).removeClass( 'tvd-btn-flat-secondary' ).show();
},
save_page: function ( item ) {
var self = this,
_options = {
title: item.title
};
TVE_Dash.showLoader();
ThriveAB.ajax.do( 'add_new_page', 'post', _options ).done( function ( response ) {
self.model.set( {
post_id: response.post.ID,
post_title: response.post.post_title
} );
self.select( {
edit_url: response.post.edit_url,
url: response.post.guid
} );
TVE_Dash.hideLoader();
} );
},
bind: function () {
var self = this,
last,
cache;
this.$autocomplete.autocomplete( {
appendTo: this.$el,
minLength: 2,
delay: 300,
source: function ( request, response ) {
var exclude_ids;
if ( self.goal_pages ) {
exclude_ids = Object.keys( self.goal_pages );
exclude_ids.push( ThriveAB.page.ID );
} else {
exclude_ids = [ThriveAB.page.ID];
}
var _options = {
q: request.term,
exclude_id: exclude_ids
};
ThriveAB.ajax.do( 'post_search', 'post', _options )
.done( function ( data ) {
if ( true || data.length === 0 ) {
data.push( {
title: request.term,
label: request.term,
type: 'Create New Page',
value: request.term
} );
}
cache = data;
response( data );
} );
last = request.term;
},
select: function ( event, ui ) {
self.$autocomplete.val( ui.item.title );
self.model.set( {
post_id: ui.item.id,
post_title: ui.item.title
} );
if ( ui.item.id ) {
self.trigger( 'select', ui.item );
}
return false;
}
} );
this.$autocomplete.data( 'ui-autocomplete' )._renderItem = function ( ul, item ) {
var $li = jQuery( '<li/>' );
if ( typeof item.id === 'undefined' ) {
$li.addClass( 'ui-not-found' );
$li.click( function () {
self.trigger( 'save-page', item );
} );
}
var _html;
if ( item.type === 'Create New Page' ) {
_html = '<span class="post-name" style="width: 60%">' + item.label + '</span><span class="post-type" style="width: 40%">' + item.type + '</span>';
} else {
_html = '<span class="post-name">' + item.label + '</span><span class="post-type">' + item.type + '</span>';
}
$li.append( _html ).appendTo( ul );
return $li;
};
}
} );
module.exports = {
model: page_model,
view: view
};

View File

@@ -0,0 +1,82 @@
var base = require( '../views/base' );
module.exports = base.extend( {
initialize: function () {
base.prototype.initialize.apply( this, arguments );
this.$( 'input' ).attr( 'data-value', this.model.get( 'traffic' ) );
this.listenTo( this.model, 'change:traffic', function ( model, _value ) {
this.$( 'input' ).val( _value );
this.$( 'input' ).attr( 'data-value', _value );
} );
if ( this.model.collection.length === 1 ) {
this.disable();
}
},
on_change: function ( event ) {
this.model.collection.save_distributed_traffic();
return false;
},
on_input: function ( event ) {
var _value = event.target.value;
if ( _value.length <= 0 ) {
event.target.value = 0;
}
if ( isNaN( parseInt( _value ) ) || parseInt( _value ) > 100 ) {
_value = _value.substring( 0, _value.length - 1 );
}
if ( isNaN( parseInt( _value ) ) ) {
_value = 0;
}
event.target.value = parseInt( _value );
var _diff = parseInt( event.target.dataset.value ) - _value;
_diff = parseInt(_diff);
this.set_traffic( parseInt( event.target.value ), _diff );
return false;
},
set_traffic: function ( value, diff ) {
var _value = parseInt( value );
if ( isNaN( _value ) ) {
_value = 0;
}
if ( _value < 0 ) {
_value = 0;
}
if ( _value > 100 ) {
_value = 100;
}
this.model.set( 'traffic', _value );
//this.model.collection.distribute_traffic( this.model );
var traffic_alocated = this.model.collection.allocate_traffic( this.model, diff );
},
enable: function () {
this.$( 'input' ).removeAttr( 'disabled' );
},
disable: function () {
this.$( 'input' ).attr( 'disabled', 'disabled' );
}
} );