summaryrefslogtreecommitdiffstats
path: root/public/js/gogs.js
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-05 15:24:26 +0800
committerUnknwon <u@gogs.io>2015-08-05 15:24:26 +0800
commit3e4cdccf6bfe1904c97204b65c3143414a3c725d (patch)
tree72df1740ed28e2fbd01557fa14665842fab6423d /public/js/gogs.js
parentce4dcf1e83d19ac0eb54ff059a52fca7c94308f8 (diff)
downloadgitea-3e4cdccf6bfe1904c97204b65c3143414a3c725d.tar.gz
gitea-3e4cdccf6bfe1904c97204b65c3143414a3c725d.zip
milestone: create page
Diffstat (limited to 'public/js/gogs.js')
-rw-r--r--public/js/gogs.js92
1 files changed, 56 insertions, 36 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js
index 200db3e314..dc9537bc1a 100644
--- a/public/js/gogs.js
+++ b/public/js/gogs.js
@@ -1,3 +1,5 @@
+'use strict';
+
var csrf;
function initInstall() {
@@ -40,44 +42,62 @@ function initRepository() {
}
// Labels
- if ($('.repository.labels').length == 0) {
- return;
+ if ($('.repository.labels').length > 0) {
+ $('.color-picker').each(function () {
+ $(this).minicolors();
+ });
+ $('.precolors .color').click(function () {
+ var color_hex = $(this).data('color-hex')
+ $('.color-picker').val(color_hex);
+ $('.minicolors-swatch-color').css("background-color", color_hex);
+ });
+ $('.delete-label-button').click(function () {
+ var $this = $(this);
+ $('.delete-label.modal').modal({
+ closable: false,
+ onApprove: function () {
+ $.post($this.data('url'), {
+ "_csrf": csrf,
+ "id": $this.data("id")
+ }).done(function (data) {
+ window.location.href = data.redirect;
+ });
+ }
+ }).modal('show');
+ return false;
+ });
+ $('.edit-label-button').click(function () {
+ $('#label-modal-id').val($(this).data('id'));
+ $('#label-modal-title').val($(this).data('title'));
+ $('#label-modal-color').val($(this).data('color'))
+ $('.minicolors-swatch-color').css("background-color", $(this).data('color'));
+ $('.edit-label.modal').modal({
+ onApprove: function () {
+ $('.edit-label.form').submit();
+ }
+ }).modal('show');
+ return false;
+ });
}
- $('.color-picker').each(function () {
- $(this).minicolors();
- });
- $('.precolors .color').click(function () {
- var color_hex = $(this).data('color-hex')
- $('.color-picker').val(color_hex);
- $('.minicolors-swatch-color').css("background-color", color_hex);
- });
- $('.delete-label-button').click(function () {
- var $this = $(this);
- $('.delete-label.modal').modal({
- closable: false,
- onApprove: function () {
- $.post($this.data('url'), {
- "_csrf": csrf,
- "id": $this.data("id")
- }).done(function (data) {
- window.location.href = data.redirect;
- });
- }
- }).modal('show');
- return false;
- });
- $('.edit-label-button').click(function () {
- $('#label-modal-id').val($(this).data('id'));
- $('#label-modal-title').val($(this).data('title'));
- $('#label-modal-color').val($(this).data('color'))
- $('.minicolors-swatch-color').css("background-color", $(this).data('color'));
- $('.edit-label.modal').modal({
- onApprove: function () {
- $('.edit-label.form').submit();
+
+ // Milestones
+ if ($('.repository.new.milestone').length > 0) {
+ var $datepicker = $('.milestone.datepicker')
+ $datepicker.datetimepicker({
+ lang: $datepicker.data('lang'),
+ inline: true,
+ timepicker: false,
+ startDate: $datepicker.data('start-date'),
+ formatDate: 'm/d/Y',
+ onSelectDate: function (ct) {
+ $('#deadline').val(ct.dateFormat('m/d/Y'));
}
- }).modal('show');
- return false;
- });
+ });
+ $('#clear-date').click(function () {
+ $('#deadline').val('');
+ return false;
+ });
+ }
};
$(document).ready(function () {