mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-12 21:30:39 +00:00
[wiki] improved ui & fixed bugs
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
{% block title_panel %}
|
||||
|
||||
|
||||
<div class="tabnav">
|
||||
<div class="grp-profile fright">
|
||||
{% grp_avatar group.props.id 24 %}<span class="name">{{ group.group_name }}</span>
|
||||
@@ -25,36 +24,37 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block main_panel %}
|
||||
<div id="wiki-home" class="">
|
||||
|
||||
{% if not wiki_exists %}
|
||||
<div class="empty-tips">
|
||||
<h2 class="center-contents">{% trans "This group currently has no wiki" %}</h2>
|
||||
<p>Wiki is a normal library with pre-defined file/folder structure. It enables group members to manage project documents or take notes using a simplified markup language called Markdown.<a id="wiki-create" href="#">{% trans "Create Wiki Now." %}</a></p>
|
||||
<p>{% trans "Wiki is a normal library with pre-defined file/folder structure. It enables group members to manage project documents or take notes using a simplified markup language called Markdown." %}</p>
|
||||
<a id="wiki-create" href="#">{% trans "Create Wiki Now" %}</a>
|
||||
</div>
|
||||
<form id="wiki-create-form" action="" method="post" class="hide">
|
||||
<h3>{% trans "Create Wiki"%}</h3>
|
||||
<label>{% trans "Name"%}</label><br/>
|
||||
<input id="repo-name" type="text" name="repo_name" value="" maxlength="{{max_file_name}}"/><br />
|
||||
<label>{% trans "Description"%}</label><br/>
|
||||
<textarea id="repo-desc" name="repo_desc"></textarea>
|
||||
|
||||
<textarea id="repo-desc" name="repo_desc"></textarea><br/>
|
||||
<p class="error hide"></p>
|
||||
<input type="submit" id="wiki-create-submit" value="{% trans "Submit"%}" class="submit" />
|
||||
</form>
|
||||
|
||||
{% else %}
|
||||
<ul class="wiki-nav" id="">
|
||||
<li><a href="{% url 'group_wiki' group.id %}">{% trans "Home" %}</a></li>
|
||||
<li><a href="{% url 'group_wiki_pages' group.id %}">{% trans "Pages" %}</a></li>
|
||||
<div class="wiki-top ovhd">
|
||||
<button id="page-create" class="op-btn">{% trans "New Page" %}</button>
|
||||
<button id="page-delete" class="op-btn" data-url="{% url 'group_wiki_page_delete' group.id page %}">{% trans "Delete Page" %}</button>
|
||||
<button id="page-edit" class="op-btn">{% trans "Edit Page" %}</button>
|
||||
<ul class="wiki-nav fleft">
|
||||
<li class="item">{% trans "Home" %}</li>
|
||||
<li class="item"><a href="{% url 'group_wiki_pages' group.id %}" class="link">{% trans "Pages" %}</a></li>
|
||||
</ul>
|
||||
|
||||
<button id="page-create" class="fright">{% trans "New Page" %}</button>
|
||||
<button id="page-delete" class="fright" data-url="{% url 'group_wiki_page_delete' group.id page %}">{% trans "Delete Page" %}</button>
|
||||
<button id="page-edit" class="fright">{% trans "Edit Page" %}</button>
|
||||
</div>
|
||||
|
||||
<div id="wiki-area" class="article">
|
||||
<h1>{{ page|capfirst }}</h1>
|
||||
<div id="wiki-content"></div>
|
||||
<div id="wiki-content"></div><!--content will be offered by js-->
|
||||
</div>
|
||||
|
||||
<form id="page-create-form" action="{% url 'group_wiki_page_new' group.id %}" method="post" class="hide">
|
||||
@@ -65,25 +65,11 @@
|
||||
<input type="submit" id="page-create-submit" value="{% trans "Submit"%}" class="submit"/>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div> <!--END wiki-home-->
|
||||
|
||||
{% endblock main_panel %}
|
||||
|
||||
{% block left_panel %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block right_panel %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript" src="{{MEDIA_URL}}js/showdown.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
{% if wiki_exists %}
|
||||
var converter = new Showdown.converter();
|
||||
$('#wiki-content').html(converter.makeHtml('{{ content|escapejs }}')).children(':first').css('margin-top', '0');
|
||||
@@ -101,21 +87,20 @@ $('#page-list').click(function () {
|
||||
});
|
||||
|
||||
addConfirmTo($('#page-delete'), {
|
||||
'title': 'Delete page',
|
||||
'title': 'Delete Page',
|
||||
'con': 'Are you sure you want to delete this page?'
|
||||
});
|
||||
|
||||
{% else %}
|
||||
|
||||
$('#wiki-create').click(function() {
|
||||
$('#wiki-create-form').modal({appendTo: '#main', autoResize: true});
|
||||
return false;
|
||||
});
|
||||
$('#wiki-create-submit').click(function () {
|
||||
// if (!$.trim($('#repo-name').val()) || !$.trim($('#repo-desc').val())) {
|
||||
// apply_form_error('wiki-create-form', '{% trans 'Name and description can not be blank.' %}');
|
||||
// return false;
|
||||
// }
|
||||
if (!$.trim($('#repo-name').val()) || !$.trim($('#repo-desc').val())) {
|
||||
apply_form_error('wiki-create-form', '{% trans 'Name and description can not be blank.' %}');
|
||||
return false;
|
||||
}
|
||||
|
||||
var submit_btn = $(this);
|
||||
disable(submit_btn);
|
||||
@@ -123,7 +108,7 @@ $('#wiki-create-submit').click(function () {
|
||||
url: '{% url 'group_wiki_create' group.id %}',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
cache: 'false',
|
||||
cache: false,
|
||||
beforeSend: prepareCSRFToken,
|
||||
data: {
|
||||
'repo_name': $('#repo-name').val(),
|
||||
@@ -144,6 +129,5 @@ $('#wiki-create-submit').click(function () {
|
||||
return false;
|
||||
});
|
||||
{% endif %} // END if wiki_exists
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@@ -5,43 +5,34 @@
|
||||
|
||||
{% block nav_group_class %}class="cur"{% endblock %}
|
||||
|
||||
{% block title_panel %}
|
||||
{% endblock %}
|
||||
|
||||
{% block main_panel %}
|
||||
<div class="tabnav">
|
||||
<div class="grp-profile fright">
|
||||
{% grp_avatar group.props.id 24 %}<span class="name">{{ group.group_name }}</span>
|
||||
</div>
|
||||
<ul class="tabnav-tabs">
|
||||
<li class="tabnav-tab"><a href="{% url 'group_info' group.id %}">{% trans "Libraries" %}</a></li>
|
||||
<li class="tabnav-tab"><a href="{% url 'group_discus' group.id %}">{% trans "Discussions" %}</a></li>
|
||||
<li class="tabnav-tab"><a href="{% url 'group_discuss' group.id %}">{% trans "Discussion" %}</a></li>
|
||||
<li class="tabnav-tab tabnav-tab-cur">{% trans "Wiki" %}</li>
|
||||
{% if is_staff %}
|
||||
<li class="tabnav-tab"><a href="{% url 'group_manage' group.id %}">{% trans "Admin" %}</a></li>
|
||||
{% endif %}
|
||||
|
||||
</ul>
|
||||
<div class="fright">
|
||||
{% grp_avatar group.props.id 24 %} <span style="font-size: 16px; font-weight:bold; margin: 0 6px;">{{ group.group_name }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="">
|
||||
<ul class="wiki-nav" id="">
|
||||
<li><a href="{% url 'group_wiki' group.id %}">{% trans "Home" %}</a></li>
|
||||
<li><a href="{% url 'group_wiki_pages' group.id %}">{% trans "Pages" %}</a></li>
|
||||
<div class="wiki-top ovhd">
|
||||
<button id="page-create" class="op-btn">{% trans "New Page" %}</button>
|
||||
<ul class="wiki-nav fleft">
|
||||
<li class="item"><a href="{% url 'group_wiki' group.id %}" class="link">{% trans "Home" %}</a></li>
|
||||
<li class="item">{% trans "Pages" %}</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<button id="page-create" class="fright">{% trans "New Page" %}</button>
|
||||
|
||||
<div id="wiki-area" class="article">
|
||||
<h1>Pages</h1>
|
||||
<div id="wiki-content">
|
||||
<ul id="wiki-pages">
|
||||
{% for page in pages %}
|
||||
<ul>
|
||||
<li><a href="{% url 'group_wiki' group.id page %}">{{ page }}</a></li>
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
|
||||
<form id="page-create-form" action="{% url 'group_wiki_page_new' group.id %}" method="post" class="hide">
|
||||
<h3>{% trans "New Page"%}</h3>
|
||||
@@ -50,27 +41,13 @@
|
||||
<p class="error hide"></p>
|
||||
<input type="submit" id="page-create-submit" value="{% trans "Submit"%}" class="submit" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% endblock main_panel %}
|
||||
|
||||
|
||||
{% block left_panel %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block right_panel %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript">
|
||||
$('#page-create').click(function() {
|
||||
$('#page-create-form').modal({appendTo: '#main', autoResize: true});
|
||||
})
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
@@ -1138,7 +1138,7 @@ def convert_wiki_link(content, group, repo_id, username):
|
||||
(reverse('group_wiki', args=[group.id, linkname.replace('/', '-')]), linkname)
|
||||
|
||||
token = web_get_access_token(repo_id, obj_id, 'view', username)
|
||||
return '<img src="%s" />' % gen_file_get_url(token, filename)
|
||||
return '<img src="%s" alt="%s" />' % (gen_file_get_url(token, filename), filename)
|
||||
else:
|
||||
from base.templatetags.seahub_tags import file_icon_filter
|
||||
|
||||
@@ -1146,8 +1146,8 @@ def convert_wiki_link(content, group, repo_id, username):
|
||||
path = "/" + linkname
|
||||
icon = file_icon_filter(linkname)
|
||||
s = reverse('repo_view_file', args=[repo_id]) + '?p=' + path
|
||||
a_tag = '''<a href='%s' target='_blank'><img class="wiki-link-icon" src="%simg/file/%s" />%s</a>'''
|
||||
return a_tag % (s, MEDIA_URL, icon, linkname)
|
||||
a_tag = '''<img src="%simg/file/%s" alt="%s" class="vam" /> <a href='%s' target='_blank' class="vam">%s</a>'''
|
||||
return a_tag % (MEDIA_URL, icon, icon, s, linkname)
|
||||
|
||||
return re.sub(r'\[\[(.+)\]\]', repl, content)
|
||||
|
||||
@@ -1211,9 +1211,12 @@ def group_wiki_pages(request, group):
|
||||
if ext == '.md':
|
||||
pages.append(name)
|
||||
|
||||
is_staff = True if check_group_staff(group.id, request.user) else False
|
||||
|
||||
return render_to_response("group/group_wiki_pages.html", {
|
||||
"group": group,
|
||||
"pages": pages,
|
||||
"is_staff": is_staff,
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@login_required
|
||||
|
@@ -1745,7 +1745,8 @@ textarea:-moz-placeholder {/* for FF */
|
||||
#md-view {
|
||||
width:756px;
|
||||
}
|
||||
#md-view h2 {
|
||||
#md-view h2,
|
||||
#wiki-content h2 {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
#svg-view {
|
||||
@@ -2016,31 +2017,35 @@ textarea:-moz-placeholder {/* for FF */
|
||||
}
|
||||
|
||||
/* wiki page */
|
||||
.wiki-nav li{
|
||||
display: inline-block;
|
||||
.wiki-top {
|
||||
text-align:right;
|
||||
padding-bottom:8px;
|
||||
border-bottom:1px solid #eee;
|
||||
}
|
||||
#wiki-area.article {
|
||||
.wiki-top .op-btn {
|
||||
margin-left:3px;
|
||||
}
|
||||
.wiki-nav .item {
|
||||
float:left;
|
||||
font-size:15px;
|
||||
margin:4px 5px 0 10px;
|
||||
}
|
||||
.wiki-nav .link {
|
||||
font-weight:normal;
|
||||
}
|
||||
#wiki-area {
|
||||
padding: 0 0;
|
||||
}
|
||||
#wiki-create-form {
|
||||
width: 262px;
|
||||
}
|
||||
#wiki-create-form input[type="text"]{
|
||||
width: 100%;
|
||||
}
|
||||
#wiki-create-form textarea {
|
||||
width: 100%;
|
||||
}
|
||||
#page-edit {
|
||||
margin-right:6px;
|
||||
#wiki-pages {
|
||||
list-style-type:disc;
|
||||
padding-left:2em;
|
||||
margin-top:1.6em;
|
||||
}
|
||||
.wiki-page-missing {
|
||||
color:red;
|
||||
}
|
||||
.wiki-link-icon {
|
||||
margin: 0 3px -5px 0;
|
||||
}
|
||||
|
||||
/* search */
|
||||
.search-form {
|
||||
padding-left:5px;
|
||||
height:24px;
|
||||
|
Reference in New Issue
Block a user