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