-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
2,529 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
'use strict'; | ||
import Base from './base.js'; | ||
|
||
export default class extends Base { | ||
/** | ||
* index action | ||
* @return {Promise} [] | ||
*/ | ||
indexAction(){ | ||
return this.display(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
import Base from './base.js'; | ||
|
||
export default class extends Base { | ||
/** | ||
* index action | ||
* @return {Promise} [] | ||
*/ | ||
async indexAction(){ | ||
let data = await this.model('article').order('id DESC').limit(5).select(); | ||
this.assign('articleList', data); | ||
this.type('application/javascript'); | ||
return this.display(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
/** | ||
* logic | ||
* @param {} [] | ||
* @return {} [] | ||
*/ | ||
export default class extends think.logic.base { | ||
/** | ||
* index action logic | ||
*/ | ||
indexAction() { | ||
if( this.cookie('token') !== this.config('token') ) { | ||
return this.redirect('/'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{% extends './inc/base.html' %} | ||
|
||
{% block head %} | ||
<script src="/static/module/jquery/jquery-2.1.4.js"></script> | ||
<script src="/static/module/bootstrap/js/bootstrap.min.js"></script> | ||
{% endblock %} | ||
|
||
{% block body %} | ||
<ul class="nav nav-tabs" role="tablist"> | ||
<li role="presentation" class="active"><a href="#widget" aria-controls="widget" data-toggle="tab">挂件</a></li> | ||
</ul> | ||
<div class="tab-content"> | ||
<div role="tabpanel" id="widget" class="tab-pane active"> | ||
<div class="row" style="margin-top: 20px;"> | ||
<div class="col-md-6"> | ||
<p>复制以下代码到你的网站中:</p> | ||
<textarea style="width:100%;height:200px;resize:none;"><div id="cicada-widget"></div><script src="{{config.protocol}}://{{http.host}}/widget"></script></textarea> | ||
</div> | ||
<div class="col-md-6"> | ||
<div id="cicada-widget"></div> | ||
<script src="{{config.protocol}}://{{http.host}}/widget"></script> | ||
</div> | ||
</div> | ||
</div> | ||
<div role="tabpanel" id="password" class="tab-pane"> | ||
test | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{%- set classname = 'cicada-widget-'+config.port -%} | ||
{%- set url = config.protocol + '://' + http.host -%} | ||
(function() { | ||
var d = document, s = d.createElement('style'); | ||
var i = '<div class="{{classname}}"><div class="title">{{config.website_title | escape}}</div><ul> | ||
{%- for article in articleList -%} | ||
<li><a href="{{article.url}}" target="cicada">{{article.title | escape}}</a><datetime>{{article.create_time}}</datetime></li> | ||
{%- endfor -%} | ||
</ul><div class="footer"> <a href="{{url}}" target="_blank">{{_('widget-more')}}</a> <span>power by <a href="https://github.com/thinkjs-team/cicada">cicada</a></div></div>'; | ||
s.innerHTML = '.{{classname}} {\ | ||
background: #A4D4E8;\ | ||
padding: 5px 10px;\ | ||
width: 100%;\ | ||
}\ | ||
.{{classname}} .title {\ | ||
font-size: 18px;\ | ||
font-weight: bold;\ | ||
margin-bottom: 5px;\ | ||
color: #265778;\ | ||
}\ | ||
.{{classname}} ul {\ | ||
list-style: none;\ | ||
margin: 0;\ | ||
padding: 0;\ | ||
}\ | ||
.{{classname}} ul li {\ | ||
padding: 5px 10px;\ | ||
background: #E1F2FA;\ | ||
border-radius: 2px;\ | ||
}\ | ||
.{{classname}} ul li + li {\ | ||
margin-top: 5px;\ | ||
}\ | ||
.{{classname}} ul li > a,\ | ||
.{{classname}} ul li > a:hover,\ | ||
.{{classname}} ul li > a:visited,\ | ||
.{{classname}} ul li:focus {\ | ||
color: #4c4c4c;\ | ||
}\ | ||
.{{classname}} ul li > a:before {\ | ||
content: \'\';\ | ||
width: 5px;\ | ||
height: 5px;\ | ||
border-radius: 5px;\ | ||
display: inline-block;\ | ||
background: #A4D4E8;\ | ||
border: 1px solid #4c4c4c;\ | ||
margin-right: 5px;\ | ||
}\ | ||
.{{classname}} ul li > datetime {\ | ||
display: block;\ | ||
font-size: 12px;\ | ||
color: #ccc;\ | ||
font-family: Georgia, serif;\ | ||
}\ | ||
.{{classname}} .footer {\ | ||
color: #265778;\ | ||
font-size: 12px;\ | ||
padding: 10px 0 5px\ | ||
}\ | ||
.{{classname}} .footer span {\ | ||
font-style: italic;\ | ||
float: right;\ | ||
}'; | ||
d.head.appendChild(s); | ||
d.getElementById('cicada-widget').innerHTML = i; | ||
})(); |
Oops, something went wrong.