Merge pull request #129 from simple-login/intro-shown-once
Intro shown once
This commit is contained in:
commit
82c2c669c2
|
@ -346,15 +346,12 @@
|
|||
<script>
|
||||
var clipboard = new ClipboardJS('.clipboard');
|
||||
|
||||
var introShown = store.get("introShown");
|
||||
if ("yes" !== introShown) {
|
||||
{% if show_intro %}
|
||||
// only show intro when screen is big enough to show "developer" tab
|
||||
if (window.innerWidth >= 1024) {
|
||||
introJs().start();
|
||||
store.set("introShown", "yes")
|
||||
}
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
|
||||
$(".delete-email").on("click", function (e) {
|
||||
let alias = $(this).parent().find(".alias").val();
|
||||
|
|
|
@ -175,6 +175,15 @@ def index():
|
|||
|
||||
mailboxes = current_user.mailboxes()
|
||||
|
||||
show_intro = False
|
||||
if not current_user.intro_shown:
|
||||
LOG.d("Show intro to %s", current_user)
|
||||
show_intro = True
|
||||
|
||||
# to make sure not showing intro to user again
|
||||
current_user.intro_shown = True
|
||||
db.session.commit()
|
||||
|
||||
return render_template(
|
||||
"dashboard/index.html",
|
||||
client_users=client_users,
|
||||
|
@ -183,6 +192,7 @@ def index():
|
|||
query=query,
|
||||
AliasGeneratorEnum=AliasGeneratorEnum,
|
||||
mailboxes=mailboxes,
|
||||
show_intro=show_intro,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -160,6 +160,11 @@ class User(db.Model, ModelMixin, UserMixin):
|
|||
|
||||
referral = db.relationship("Referral", foreign_keys=[referral_id])
|
||||
|
||||
# whether intro has been shown to user
|
||||
intro_shown = db.Column(
|
||||
db.Boolean, default=False, nullable=False, server_default="0"
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def create(cls, email, name, password=None, **kwargs):
|
||||
user: User = super(User, cls).create(email=email, name=name, **kwargs)
|
||||
|
|
29
migrations/versions/2020_041313_bfd7b2302903_.py
Normal file
29
migrations/versions/2020_041313_bfd7b2302903_.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: bfd7b2302903
|
||||
Revises: ea30c0b5b2e3
|
||||
Create Date: 2020-04-13 13:21:14.857574
|
||||
|
||||
"""
|
||||
import sqlalchemy_utils
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'bfd7b2302903'
|
||||
down_revision = 'ea30c0b5b2e3'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('users', sa.Column('intro_shown', sa.Boolean(), server_default='0', nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('users', 'intro_shown')
|
||||
# ### end Alembic commands ###
|
Loading…
Reference in a new issue