mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
temp changes
This commit is contained in:
parent
89e14e8a22
commit
2f3059abee
3 changed files with 72 additions and 4 deletions
|
@ -1,12 +1,27 @@
|
||||||
|
<?php js_start() ?>
|
||||||
|
lbry.emailSettingsForm( '<?php echo json_encode($status) ?>');
|
||||||
|
<?php js_end() ?>
|
||||||
<?php $error = $error ?? null ?>
|
<?php $error = $error ?? null ?>
|
||||||
<?php $tag = $tag ?? null ?>
|
<?php $tag = $tag ?? null ?>
|
||||||
<?php $largeInput = $largeInput ?? false ?>
|
<?php $largeInput = $largeInput ?? false ?>
|
||||||
<form id="settings_form" action="/list/subscribe" method="POST" novalidate>
|
<form id="email_form" onsubmit="lbry.applyEmailEdit()" novalidate>
|
||||||
<?php if ($error): ?>
|
<?php if ($error): ?>
|
||||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<div class="mail-submit" >
|
<div class="mail-submit" >
|
||||||
<input name="receive" type="radio" value="true" checked><label>Receive Email</label><br>
|
|
||||||
<input name="receive" type="radio" value="false"><label>Receive No Email</label>
|
|
||||||
</div>
|
</div>
|
||||||
|
<h2>Emails</h2>
|
||||||
|
<h4>Choose which emails you want to receive LBRY news</h4>
|
||||||
|
<div>
|
||||||
|
<table id="email_table"></table>
|
||||||
|
<div><button>Apply</button></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<form id="tag_form" onsubmit=="lbry.applyTagEdit()" novalidate>
|
||||||
|
<h2>Tags</h2>
|
||||||
|
<h4>Any particular interests?</h4>
|
||||||
|
<div>
|
||||||
|
<table id="tag_table"></table>
|
||||||
|
<div><button>Apply</button></div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -1,6 +1,7 @@
|
||||||
<?php Response::setMetaTitle(__('title.join')) ?>
|
<?php Response::setMetaTitle(__('title.join')) ?>
|
||||||
<?php Response::setMetaDescription(__('description.join')) ?>
|
<?php Response::setMetaDescription(__('description.join')) ?>
|
||||||
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
<?php echo View::render('nav/_header', ['isDark' => false]) ?>
|
||||||
|
<?php Response::addJsAsset('/js/emailSettings.js') ?>
|
||||||
<main>
|
<main>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
|
@ -9,7 +10,7 @@
|
||||||
<?php if ($error ?? false): ?>
|
<?php if ($error ?? false): ?>
|
||||||
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
<div class="notice notice-error spacer1"><?php echo $error ?></div>
|
||||||
<?php endif ?>
|
<?php endif ?>
|
||||||
<?php echo View::render('mail/_settingsForm',['returnUrl' => $nextUrl ?? '/']) ?>
|
<?php echo View::render('mail/_settingsForm',['status' => $data ?? '/']) ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="span3">
|
<div class="span3">
|
||||||
<h3>{{social.also}}</h3>
|
<h3>{{social.also}}</h3>
|
||||||
|
|
52
web/js/emailSettings.js
Normal file
52
web/js/emailSettings.js
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
lbry.emailSettingsForm = function (emailState) {
|
||||||
|
var
|
||||||
|
state = JSON.parse(emailState),
|
||||||
|
emails = state.emails,
|
||||||
|
tags = state.tags,
|
||||||
|
emailTable = $('#email_table'),
|
||||||
|
tagTable = $('#tag_table');
|
||||||
|
|
||||||
|
$.each(emails, function(email, enabled = false){
|
||||||
|
console.log('email: ',email, ' enabled: ',enabled)
|
||||||
|
$labelCell = $('<td><label>'+email+'</label></td>');
|
||||||
|
$checkbox = $('<input id="'+email+'" type="checkbox">').prop('checked',enabled ? true : false);
|
||||||
|
$checkBoxCell = $('<td></td>').append($checkbox);
|
||||||
|
$rowEmail = $('<tr></tr><br>').append($labelCell).append($checkBoxCell);
|
||||||
|
emailTable.append($rowEmail)
|
||||||
|
});
|
||||||
|
$.each(tags, function(tag, enabled){
|
||||||
|
console.log('tagName: ',tag,' enabled: ',enabled)
|
||||||
|
$labelCell = $('<td><label>'+tag+'</label></td>')
|
||||||
|
$checkbox = $('<input id="'+tag+'" type="checkbox">').prop('checked',enabled ? true : false);
|
||||||
|
$checkBoxCell = $('<td></td>').append($checkbox);
|
||||||
|
$rowTag = $('<tr></tr><br>')
|
||||||
|
tagTable.append($rowTag).append($labelCell).append($checkBoxCell);
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#email_form').submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
$('#tag_form').submit(function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
lbry.applyEmailEdit = function () {
|
||||||
|
console.log("applied email settings")
|
||||||
|
|
||||||
|
//How do I call PHP api with the proper arguments from here?
|
||||||
|
//Then how do I go to the page again triggering a refresh or show an error?
|
||||||
|
//Need to get the token here as well to call the API
|
||||||
|
|
||||||
|
/*let url = 'http://localhost:8080/user/email/edit?auth_token='+token+'&'
|
||||||
|
fetch('http://localhost:8080/user/email/edit?').then(value => {
|
||||||
|
console.log(value.json())
|
||||||
|
|
||||||
|
});*/
|
||||||
|
}
|
||||||
|
|
||||||
|
lbry.applyTagEdit = function () {
|
||||||
|
console.log("applied tag settings")
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue