1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-15 21:53:37 +00:00

[wiki] modification

This commit is contained in:
llj 2016-07-19 15:52:16 +08:00
parent c40b67b297
commit 7184b6502f
5 changed files with 69 additions and 62 deletions

View File

@ -1614,8 +1614,7 @@ button.sf-dropdown-toggle:focus {
} }
.btn-white, .btn-white,
.tabnav button, .tabnav button,
.repo-file-list-topbar .op-btn, .repo-file-list-topbar .op-btn {
.wiki-top .op-btn {
height:29px; height:29px;
background:#fff; background:#fff;
line-height:17px; line-height:17px;
@ -2719,7 +2718,7 @@ button.sf-dropdown-toggle:focus {
text-align:right; text-align:right;
height:auto; height:auto;
} }
.wiki-top .op-btn { .wiki-top .btn-white {
margin-left:3px; margin-left:3px;
} }
.wiki-nav .item { .wiki-nav .item {
@ -2730,7 +2729,7 @@ button.sf-dropdown-toggle:focus {
font-weight:normal; font-weight:normal;
} }
#wiki-area { #wiki-area {
padding: 0 0; padding: 30px 0 0;
} }
#wiki-last-modified { #wiki-last-modified {
margin-top: 10px; margin-top: 10px;

View File

@ -73,15 +73,15 @@
</ul> </ul>
{% if repo_perm == 'rw' %} {% if repo_perm == 'rw' %}
<button id="page-create" class="op-btn">{% trans "New Page" %}</button> <button id="page-create" class="btn-white">{% 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-delete" class="btn-white" 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> <a class="sf-btn-link btn-white" href="{% url 'group_wiki_page_edit' group.id page %}">{% trans "Edit Page" %}</a>
<button id="page-history" class="op-btn">{% trans "Page History" %}</button> <a class="sf-btn-link btn-white" href="{% url 'file_revisions' repo_id %}?p={{path|urlencode}}" target="_blank">{% trans "Page History" %}</a>
{% endif %} {% endif %}
</div> </div>
<div id="wiki-area" class="article"> <div id="wiki-area" class="article">
<h1>{{ page|capfirst }}</h1> <h1 class="bold">{{ page|capfirst }}</h1>
<div id="wiki-content"></div><!--content will be offered by js--> <div id="wiki-content"></div><!--content will be offered by js-->
<p id="wiki-last-modified">{% blocktrans with modifier=latest_contributor|email2nickname modify_time=last_modified|translate_seahub_time %}Last modified by {{modifier}}, {{modify_time}}{% endblocktrans %}</p> <p id="wiki-last-modified">{% blocktrans with modifier=latest_contributor|email2nickname modify_time=last_modified|translate_seahub_time %}Last modified by {{modifier}}, {{modify_time}}{% endblocktrans %}</p>
</div> </div>
@ -91,7 +91,7 @@
<label for="page-name">{% trans "Name"%}</label><br/> <label for="page-name">{% trans "Name"%}</label><br/>
<input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><br /> <input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><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" value="{% trans "Submit"%}" class="submit" />
</form> </form>
{% endif %} {% endif %}
@ -124,36 +124,31 @@ $('#wiki-content')
); );
$('#page-create').click(function() { $('#page-create').click(function() {
$('#page-create-form').modal({appendTo: '#main', autoResize: true}); $('#page-create-form').modal({appendTo: '#main'});
}) $('#simplemodal-container').css({'height':'auto'});
$('#page-edit').click(function() {
location.href = "{% url 'group_wiki_page_edit' group.id page %}";
})
$('#page-list').click(function () {
location.href = "{% url 'group_wiki_pages' group.id %}";
}); });
$('#page-create-form').submit(function() {
$('#page-history').click(function () { var page_name = $.trim($('[name="page_name"]', $(this)).val());
window.open("{% url 'file_revisions' repo_id %}" + "?p=" + "{{path|urlencode}}"); if (!page_name) {
return false;
}
}); });
addConfirmTo($('#page-delete'), { addConfirmTo($('#page-delete'), {
'title': "{% trans "Delete Page" %}", 'title': "{% trans "Delete Page" %}",
'con': "{% trans "Are you sure you want to delete this page?" %}" 'con': "{% trans "Are you sure you want to delete this page?" %}"
}); });
$('a.wiki-page-missing').each(function(){ $('a.wiki-page-missing').click(function() {
$(this).click(function() { $('#page-create-form').modal({appendTo: '#main'});
$('#page-name').val($(this).text()); $('#simplemodal-container').css({'height':'auto'});
$('#page-create-form').modal({appendTo: '#main', autoResize: true}); $('#page-name').val($(this).text());
return false; return false;
});
}); });
{% else %} {% else %}
$('#wiki-create').click(function() { $('#wiki-create').click(function() {
$('#wiki-create-form').modal({appendTo: '#main', autoResize: true}); $('#wiki-create-form').modal({appendTo: '#main'});
$('#simplemodal-container').css({'height':'auto'});
return false; return false;
}); });
$('#wiki-create-form').submit(function () { $('#wiki-create-form').submit(function () {

View File

@ -15,7 +15,7 @@
{% endif %} {% endif %}
</ul> </ul>
{% if repo_perm == 'rw' %} {% if repo_perm == 'rw' %}
<button id="page-create" class="op-btn">{% trans "New Page" %}</button> <button id="page-create" class="btn-white">{% trans "New Page" %}</button>
{% endif %} {% endif %}
</div> </div>
@ -30,14 +30,21 @@
<label for="page-name">{% trans "Name"%}</label><br/> <label for="page-name">{% trans "Name"%}</label><br/>
<input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><br /> <input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><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" value="{% trans "Submit"%}" class="submit" />
</form> </form>
{% endblock %} {% endblock %}
{% block extra_script %}{{block.super}} {% block extra_script %}{{block.super}}
<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'});
}) $('#simplemodal-container').css({'height':'auto'});
});
$('#page-create-form').submit(function() {
var page_name = $.trim($('[name="page_name"]', $(this)).val());
if (!page_name) {
return false;
}
});
</script> </script>
{% endblock %} {% endblock %}

View File

@ -7,6 +7,7 @@
{% block cur_personal_wiki %}tab-cur{% endblock %} {% block cur_personal_wiki %}tab-cur{% endblock %}
{% comment %}
{% block left_panel %} {% block left_panel %}
{{ block.super }} {{ block.super }}
{% if wiki_exists %} {% if wiki_exists %}
@ -25,6 +26,7 @@
</div> </div>
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% endcomment %}
{% block right_panel %} {% block right_panel %}
{% if not wiki_exists %} {% if not wiki_exists %}
@ -49,7 +51,7 @@
<form id="wiki-use-lib-form" action="{% url 'personal_wiki_use_lib' %}" method="post" class="file-choose-form hide">{% csrf_token %} <form id="wiki-use-lib-form" action="{% url 'personal_wiki_use_lib' %}" method="post" class="file-choose-form hide">{% csrf_token %}
<h3 id="dialogTitle">{% trans "Choose a library as wiki:" %}</h3> <h3 id="dialogTitle">{% trans "Choose a library as wiki:" %}</h3>
<div class="dir-tree-cont"> <div class="dir-tree-cont">
<div id="repos-dirs"></div> <div id="repos-dirs"></div>
</div> </div>
<input type="hidden" name="dst_repo" value="" /> <input type="hidden" name="dst_repo" value="" />
<p class="error hide">{% trans "Please click and choose a library."%}</p> <p class="error hide">{% trans "Please click and choose a library."%}</p>
@ -65,14 +67,14 @@
<li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li> <li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li>
</ul> </ul>
<button id="page-create" class="op-btn">{% trans "New Page" %}</button> <button id="page-create" class="btn-white">{% trans "New Page" %}</button>
<button id="page-delete" class="op-btn" data-url="{% url 'personal_wiki_page_delete' page %}">{% trans "Delete Page" %}</button> <button id="page-delete" class="btn-white" data-url="{% url 'personal_wiki_page_delete' page %}">{% trans "Delete Page" %}</button>
<button id="page-edit" class="op-btn">{% trans "Edit Page" %}</button> <a class="sf-btn-link btn-white" href="{% url 'personal_wiki_page_edit' page %}">{% trans "Edit Page" %}</a>
<button id="page-history" class="op-btn">{% trans "Page History" %}</button> <a class="sf-btn-link btn-white" href="{% url 'file_revisions' repo_id %}?p={{path|urlencode}}" target="_blank">{% trans "Page History" %}</a>
</div> </div>
<div id="wiki-area" class="article"> <div id="wiki-area" class="article">
<h1>{{ page|capfirst }}</h1> <h1 class="bold">{{ page|capfirst }}</h1>
<div id="wiki-content"></div><!--content will be offered by js--> <div id="wiki-content"></div><!--content will be offered by js-->
<p id="wiki-last-modified">{% blocktrans with modifier=latest_contributor|email2nickname modify_time=last_modified|translate_seahub_time %}Last modified by {{modifier}}, {{modify_time}}{% endblocktrans %} <p id="wiki-last-modified">{% blocktrans with modifier=latest_contributor|email2nickname modify_time=last_modified|translate_seahub_time %}Last modified by {{modifier}}, {{modify_time}}{% endblocktrans %}
</p> </p>
@ -83,7 +85,7 @@
<label for="page-name">{% trans "Name"%}</label><br/> <label for="page-name">{% trans "Name"%}</label><br/>
<input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><br /> <input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><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" value="{% trans "Submit"%}" class="submit" />
</form> </form>
{% endif %} {% endif %}
@ -116,36 +118,31 @@ $('#wiki-content')
); );
$('#page-create').click(function() { $('#page-create').click(function() {
$('#page-create-form').modal({appendTo: '#main', autoResize: true}); $('#page-create-form').modal({appendTo: '#main'});
}) $('#simplemodal-container').css({'height':'auto'});
$('#page-edit').click(function() {
location.href = "{% url 'personal_wiki_page_edit' page %}";
})
$('#page-list').click(function () {
location.href = "{% url 'personal_wiki_pages' %}";
}); });
$('#page-create-form').submit(function() {
$('#page-history').click(function () { var page_name = $.trim($('[name="page_name"]', $(this)).val());
window.open("{% url 'file_revisions' repo_id %}" + "?p=" + "{{path|urlencode}}"); if (!page_name) {
return false;
}
}); });
addConfirmTo($('#page-delete'), { addConfirmTo($('#page-delete'), {
'title': "{% trans "Delete Page" %}", 'title': "{% trans "Delete Page" %}",
'con': "{% trans "Are you sure you want to delete this page?" %}" 'con': "{% trans "Are you sure you want to delete this page?" %}"
}); });
$('a.wiki-page-missing').each(function(){ $('a.wiki-page-missing').click(function() {
$(this).click(function() { $('#page-create-form').modal({appendTo: '#main'});
$('#page-name').val($(this).text()); $('#simplemodal-container').css({'height':'auto'});
$('#page-create-form').modal({appendTo: '#main', autoResize: true}); $('#page-name').val($(this).text());
return false; return false;
});
}); });
{% else %} {% else %}
$('#wiki-create').click(function() { $('#wiki-create').click(function() {
$('#wiki-create-form').modal({appendTo: '#main', autoResize: true}); $('#wiki-create-form').modal({appendTo: '#main'});
$('#simplemodal-container').css({'height':'auto'});
return false; return false;
}); });
$('#wiki-create-form').submit(function () { $('#wiki-create-form').submit(function () {
@ -216,6 +213,7 @@ $('#wiki-use-lib-form').submit(function() {
{% endif %} // END wiki_exists {% endif %} // END wiki_exists
{% comment %}
{% if wiki_exists %} {% if wiki_exists %}
{% if wiki_index_exists %} {% if wiki_index_exists %}
$('#wiki-index-con').html(marked('{{ index_content|escapejs }}')); $('#wiki-index-con').html(marked('{{ index_content|escapejs }}'));
@ -230,5 +228,6 @@ $('#create-index').click(function() {
}); });
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endcomment %}
</script> </script>
{% endblock %} {% endblock %}

View File

@ -14,7 +14,7 @@
<li class="item cur-item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li> <li class="item cur-item"><a href="{% url 'personal_wiki_pages' %}" class="link">{% trans "Pages" %}</a></li>
<li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li> <li class="item"><a href="{% url 'repo_history' repo_id %}" target="_blank" class="link">{% trans "Wiki History" %}</a></li>
</ul> </ul>
<button id="page-create" class="op-btn">{% trans "New Page" %}</button> <button id="page-create" class="btn-white">{% trans "New Page" %}</button>
</div> </div>
<ul id="wiki-pages"> <ul id="wiki-pages">
@ -28,14 +28,21 @@
<label for="page-name">{% trans "Name"%}</label><br/> <label for="page-name">{% trans "Name"%}</label><br/>
<input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><br /> <input id="page-name" type="text" name="page_name" value="" maxlength="{{max_file_name}}" class="input" /><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" value="{% trans "Submit" %}" class="submit" />
</form> </form>
{% endblock %} {% endblock %}
{% block extra_script %}{{block.super}} {% block extra_script %}{{block.super}}
<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'});
$('#simplemodal-container').css({'height':'auto'});
}) })
$('#page-create-form').submit(function() {
var page_name = $.trim($('[name="page_name"]', $(this)).val());
if (!page_name) {
return false;
}
});
</script> </script>
{% endblock %} {% endblock %}