ui and js update

This commit is contained in:
FuXiaoHei 2014-03-17 15:17:44 +08:00
parent 3a2eee0827
commit 24d91ecda8
13 changed files with 47 additions and 41 deletions

View File

@ -51,7 +51,6 @@ html, body {
.gogs-masthead { .gogs-masthead {
background-color: #428bca; background-color: #428bca;
box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .1); box-shadow: inset 0 -2px 5px rgba(0, 0, 0, .1);
padding: 0 16px;
margin: 0; margin: 0;
} }
@ -133,6 +132,11 @@ html, body {
padding: 5px 0; padding: 5px 0;
margin-left: 10px; margin-left: 10px;
height: 28px; height: 28px;
float: right;
}
#gogs-nav-signin{
float: right;
} }
#gogs-nav-out .fa { #gogs-nav-out .fa {
@ -349,10 +353,6 @@ html, body {
/* #gogs-feed */ /* #gogs-feed */
#gogs-feed-left {
padding-left: 0;
}
#gogs-feed-right .repo-panel .panel-heading .btn { #gogs-feed-right .repo-panel .panel-heading .btn {
margin-top: -4px; margin-top: -4px;
} }
@ -635,7 +635,7 @@ html, body {
} }
#footer .footer-wrap { #footer .footer-wrap {
padding: 20px 0; padding: 20px 15px;
} }
#footer a { #footer a {

View File

@ -43,7 +43,15 @@ var Gogits = {
Gogits.initTabs = function () { Gogits.initTabs = function () {
var $tabs = $('[data-init=tabs]'); var $tabs = $('[data-init=tabs]');
$tabs.find("li:eq(0) a").tab("show"); $tabs.find("li:eq(0) a").tab("show");
};
// render markdown
Gogits.renderMarkdown = function () {
var $pre = $('.markdown').find('pre > code').parent();
$pre.addClass("prettyprint");
prettyPrint();
} }
})(jQuery); })(jQuery);
// ajax utils // ajax utils
@ -70,6 +78,7 @@ function initCore() {
Gogits.initTooltips(); Gogits.initTooltips();
Gogits.initTabs(); Gogits.initTabs();
Gogits.initModals(); Gogits.initModals();
Gogits.renderMarkdown();
} }
function initRegister() { function initRegister() {
@ -98,14 +107,14 @@ function initRegister() {
}); });
} }
function initUserSetting(){ function initUserSetting() {
$('#gogs-ssh-keys .delete').confirmation({ $('#gogs-ssh-keys .delete').confirmation({
singleton: true, singleton: true,
onConfirm: function(e, $this){ onConfirm: function (e, $this) {
Gogits.ajaxDelete("",{"id":$this.data("del")},function(json){ Gogits.ajaxDelete("", {"id": $this.data("del")}, function (json) {
if(json.ok){ if (json.ok) {
window.location.reload(); window.location.reload();
}else{ } else {
alert(json.err); alert(json.err);
} }
}); });
@ -113,11 +122,15 @@ function initUserSetting(){
}); });
} }
;(function($){ (function ($) {
// on Dom Ready $(function () {
$(function(){ initCore();
var $pre = $('.markdown').find('pre > code').parent(); var body = $("#gogs-body");
$pre.addClass("prettyprint"); if (body.data("page") == "user-signup") {
prettyPrint(); initRegister();
}
if (body.data("page") == "user") {
initUserSetting();
}
}); });
})(jQuery); })(jQuery);

View File

@ -1,19 +1,12 @@
<script> <div class="wrapper-push"></div>
$(function(){
initCore();{{if .PageIsSignUp}}
initRegister();{{end}}{{if .PageIsUserSetting}}
initUserSetting();{{end}}
});
</script>
<div class="wrapper-push"></div>
</div> </div>
<footer id="footer"> <footer id="footer">
<div class="container footer-wrap"> <div class="container footer-wrap">
<p> <p>© 2014 Gogs · ver {{AppVer}} ·
© 2014 Gogs · ver {{AppVer}} · <i class="fa fa-github"></i><a target="_blank" href="https://github.com/gogits/gogs">GitHub</a> <i class="fa fa-github"></i><a target="_blank" href="https://github.com/gogits/gogs">GitHub</a>
</p> </p>
<p class="desc"></p> <p class="desc"></p>
</div> </div>
</footer> </footer>
</body> </body>
</html> </html>

View File

@ -11,7 +11,7 @@
<h3>News Feed</h3> <h3>News Feed</h3>
</div> </div>
</div> </div>
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
{{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}} {{if .HasInfo}}<div class="alert alert-info">{{.InfoMsg}}</div>{{end}}
<div id="gogs-feed-left" class="col-md-8"> <div id="gogs-feed-left" class="col-md-8">
<ul class="list-unstyled activity-list"> <ul class="list-unstyled activity-list">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-setting-nav" class="col-md-3"> <div id="gogs-user-setting-nav" class="col-md-3">
<h4>Account Setting</h4> <h4>Account Setting</h4>
<ul class="list-group"> <ul class="list-group">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-setting-nav" class="col-md-3"> <div id="gogs-user-setting-nav" class="col-md-3">
<h4>Account Setting</h4> <h4>Account Setting</h4>
<ul class="list-group"> <ul class="list-group">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-setting-nav" class="col-md-3"> <div id="gogs-user-setting-nav" class="col-md-3">
<h4>Account Setting</h4> <h4>Account Setting</h4>
<ul class="list-group"> <ul class="list-group">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-profile" class="col-md-3"> <div id="gogs-user-profile" class="col-md-3">
<div class="profile-avatar text-center"> <div class="profile-avatar text-center">
<a href="{{.Owner.HomeLink}}" class="center-block" data-toggle="tooltip" data-placement="bottom" title="Change Avatar"> <a href="{{.Owner.HomeLink}}" class="center-block" data-toggle="tooltip" data-placement="bottom" title="Change Avatar">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-setting-nav" class="col-md-3"> <div id="gogs-user-setting-nav" class="col-md-3">
<h4>Account Setting</h4> <h4>Account Setting</h4>
<ul class="list-group"> <ul class="list-group">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-setting-nav" class="col-md-3"> <div id="gogs-user-setting-nav" class="col-md-3">
<h4>Account Setting</h4> <h4>Account Setting</h4>
<ul class="list-group"> <ul class="list-group">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div id="gogs-body" class="container"> <div id="gogs-body" class="container" data-page="user">
<div id="gogs-user-setting-nav" class="col-md-3"> <div id="gogs-user-setting-nav" class="col-md-3">
<h4>Account Setting</h4> <h4>Account Setting</h4>
<ul class="list-group"> <ul class="list-group">

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div class="container" id="gogs-body"> <div class="container" id="gogs-body" data-page="user-signin">
<form action="/user/login" method="post" class="form-horizontal gogs-card" id="gogs-login-card"> <form action="/user/login" method="post" class="form-horizontal gogs-card" id="gogs-login-card">
<h3>Log in</h3> <h3>Log in</h3>
<div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div> <div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div>

View File

@ -1,6 +1,6 @@
{{template "base/head" .}} {{template "base/head" .}}
{{template "base/navbar" .}} {{template "base/navbar" .}}
<div class="container" id="gogs-body"> <div class="container" id="gogs-body" data-page="user-signup">
<form action="/user/sign_up" method="post" class="form-horizontal gogs-card" id="gogs-login-card"> <form action="/user/sign_up" method="post" class="form-horizontal gogs-card" id="gogs-login-card">
<h3>Sign Up</h3> <h3>Sign Up</h3>
<div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div> <div class="alert alert-danger form-error{{if .HasError}}{{else}} hidden{{end}}">{{.ErrorMsg}}</div>