Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bootstrap label alert #1682

Closed
wants to merge 2 commits into from
Closed

Conversation

liuzhenrain
Copy link

@liuzhenrain liuzhenrain commented May 25, 2017

Label style

usage: {% label class %} content {% endlabel %}

class :

default, primary, success, info, warning, danger

files:

next\source\css_common\components\tags\tags.styl
next\scripts\tags\label.js

站点配置主要在 {% label primary %} 博客根目录 {% endlabel %}的`_config.yml`文件中配置

Result:
image

Alert

usage: {% alert [tips] [class] %} content {% endalert %}
if tips is null then will replace with default string. e.g. Warning Message (class = warning)
content can use Markdow syntax but except (``` message ```)

class :

success, info, warning, danger
class default is success

files:

next\source\css_common\components\tags\alert.styl
next\scripts\tags\alert.js

{% alert "警告提示" warning %}
`这是一个警告提示`
# Hello Bootstarp
{% endalert %}

Result:
image

@ivan-nginx
Copy link
Collaborator

@liuzhenrain alert is duplicate of note tag?

style = 'default';
}
return '&nbsp;<span class="label label-' + style + '">' + content + '</span>&nbsp;';
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon.

var text = '<div class="alert alert-' + style + '"><i class="fa ' + icon + ' fa-lg">&nbsp;&nbsp;<strong>' + tip + '</strong></i> ' + content + '</div>';

return text;
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon.

}

content = hexo.render.renderSync({ text: content, engine: 'markdown' });
var text = '<div class="alert alert-' + style + '"><i class="fa ' + icon + ' fa-lg">&nbsp;&nbsp;<strong>' + tip + '</strong></i> ' + content + '</div>';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.

icon = 'fa-bug';
break;
default:
tip = tip.length == 0 ? "Success Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

icon = 'fa-bell';
break;
case 'danger':
tip = tip.length == 0 ? "Danger Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

icon = 'fa-info';
break;
case 'warning':
tip = tip.length == 0 ? "Warning Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

icon = 'fa-lightbulb-o';
break;
case 'info':
tip = tip.length == 0 ? "Info Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.


switch (style) {
case 'success':
tip = tip.length == 0 ? "Success Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

style = 'default';
}
return '&nbsp;<span class="label label-' + style + '">' + content + '</span>&nbsp;';
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon.

var text = '<div class="alert alert-' + style + '"><i class="fa ' + icon + ' fa-lg">&nbsp;&nbsp;<strong>' + tip + '</strong></i> ' + content + '</div>';

return text;
};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary semicolon.

}

content = hexo.render.renderSync({ text: content, engine: 'markdown' });
var text = '<div class="alert alert-' + style + '"><i class="fa ' + icon + ' fa-lg">&nbsp;&nbsp;<strong>' + tip + '</strong></i> ' + content + '</div>';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.

icon = 'fa-bug';
break;
default:
tip = tip.length == 0 ? "Success Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

icon = 'fa-bell';
break;
case 'danger':
tip = tip.length == 0 ? "Danger Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

icon = 'fa-info';
break;
case 'warning':
tip = tip.length == 0 ? "Warning Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

icon = 'fa-lightbulb-o';
break;
case 'info':
tip = tip.length == 0 ? "Info Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.


switch (style) {
case 'success':
tip = tip.length == 0 ? "Success Message" : tip;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use '===' to compare with '0'.
Mixed double and single quotes.

@liuzhenrain
Copy link
Author

@ivan-nginx maybe is true with duplicate note tag ,but is note same display,and note tag has some error.so I add the alert tag.
Alert like this:
2017-06-01 11 16 41

Note like this:
2017-06-01 11 17 13

@ivan-nginx
Copy link
Collaborator

and note tag has some error

Errors like what?

I know how looks note tag, i made it. For example, at this link u can see same note tag, but with modify css.

And, yes, i see how look your note (alert) tag, but this is css style only. Any other functionality is on same level, instead of original note.js have 11 strings of code and your alert.js have 45 strings of code.

@liuzhenrain
Copy link
Author

@ivan-nginx
Error like this:
2017-06-02 1 28 13

If i delete the second note tag ,it will be right to generate.
Like this:
image

@ivan-nginx
Copy link
Collaborator

@liuzhenrain may i see source code with this error? Mb u not right use this tag.

@liuzhenrain
Copy link
Author

@ivan-nginx
Copy link
Collaborator

ivan-nginx commented Jun 1, 2017

@liuzhenrain ok, i see what u use {% note warning %}string{% endnote %}, right?
Can u please use note tag with instructions? #1674


No need to write this in 1 line, like that:

{% note danger %}note danger, note danger, note danger{% endnote %}

or like that:

{% note danger %}note danger
note danger
note danger{% endnote %}

Need to write it like u may see in note documentation link (#1160), like this:

{% note danger %}
note danger, note danger, note danger
note danger, note danger, note danger
note danger, note danger, note danger
{% endnote %}

@ivan-nginx
Copy link
Collaborator

@liuzhenrain let's do it again and catch this error: need clean source code in English language, without any other addition styles/letters/etc.
If error will, i'll try to fix it and/or think about alert tag.
If error not will, need just to add css style to present note tag.
For now i don't see any errors with note tag.

@liuzhenrain
Copy link
Author

liuzhenrain commented Jun 1, 2017

I Changed two tag like :

{% note danger %}
note danger, note danger, note danger
note danger, note danger, note danger
note danger, note danger, note danger
{% endnote %}

IS OK
and can be only use like that... if you have more than one note tag..
Thank you..

@ivan-nginx
Copy link
Collaborator

@liuzhenrain you are welcome. Need to use by instructions all tags and/or modules if want no errors.
But i will make css style on note tag and label tag style too. Thank's for pull, it's real help me.

@liuzhenrain
Copy link
Author

@ivan-nginx if you can modify the Chinese doc with Bootstrap Callout.
Please modify it..

@ivan-nginx
Copy link
Collaborator

@liuzhenrain this can modify @iissnan and i don't know Chinese. And now i see what docs is not right.

P.S. Close #1674 if solved.

@liuzhenrain
Copy link
Author

@ivan-nginx Need me to close this PR?

@ivan-nginx
Copy link
Collaborator

@liuzhenrain no no, this PR no need to close for now. I will close it when i finish with this tags and styles. Thx.

@liuzhenrain
Copy link
Author

@ivan-nginx
OK
It's time to sleep
....bye....

@ivan-nginx
Copy link
Collaborator

@liuzhenrain add modern note style in #1697. Some later i'll add label style too.

@ivan-nginx
Copy link
Collaborator

Label tag was added in #1697 PART 8.

@liuzhenrain thank's for pull, it really help for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants