aboutsummaryrefslogtreecommitdiffstats
path: root/public/js
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-12-05 01:09:14 -0500
committerUnknwon <u@gogs.io>2015-12-05 01:09:14 -0500
commitf41360d864bfa3fb850d669a0a8321820fc550de (patch)
tree5450285739bd0be98258474f45d62991dd1429ee /public/js
parente82ee40e9e667797099edc05ec1b774f65310464 (diff)
downloadgitea-f41360d864bfa3fb850d669a0a8321820fc550de.tar.gz
gitea-f41360d864bfa3fb850d669a0a8321820fc550de.zip
#2052 advanced select ops for system notices
Diffstat (limited to 'public/js')
-rw-r--r--public/js/gogs.js85
1 files changed, 66 insertions, 19 deletions
diff --git a/public/js/gogs.js b/public/js/gogs.js
index 489b6996d6..a045f56069 100644
--- a/public/js/gogs.js
+++ b/public/js/gogs.js
@@ -319,23 +319,23 @@ function initRepository() {
$('#edit-title').click(editTitleToggle);
$('#cancel-edit-title').click(editTitleToggle);
$('#save-edit-title').click(editTitleToggle).
- click(function () {
- if ($edit_input.val().length == 0 ||
- $edit_input.val() == $issue_title.text()) {
- $edit_input.val($issue_title.text());
- return false;
- }
-
- $.post($(this).data('update-url'), {
- "_csrf": csrf,
- "title": $edit_input.val()
- },
- function (data) {
- $edit_input.val(data.title);
- $issue_title.text(data.title);
- });
+ click(function () {
+ if ($edit_input.val().length == 0 ||
+ $edit_input.val() == $issue_title.text()) {
+ $edit_input.val($issue_title.text());
return false;
- });
+ }
+
+ $.post($(this).data('update-url'), {
+ "_csrf": csrf,
+ "title": $edit_input.val()
+ },
+ function (data) {
+ $edit_input.val(data.title);
+ $issue_title.text(data.title);
+ });
+ return false;
+ });
// Edit issue or comment content
$('.edit-content').click(function () {
@@ -607,6 +607,50 @@ function initAdmin() {
}
});
}
+
+ // Notice
+ if ($('.admin.notice')) {
+ var $detail_modal = $('#detail-modal');
+
+ // Attach view detail modals
+ $('.view-detail').click(function () {
+ $detail_modal.find('.content p').text($(this).data('content'));
+ $detail_modal.modal('show');
+ return false;
+ });
+
+ // Select actions
+ var $checkboxes = $('.select.table .ui.checkbox');
+ $('.select.action').click(function () {
+ switch ($(this).data('action')) {
+ case 'select-all':
+ $checkboxes.checkbox('check');
+ break;
+ case 'deselect-all':
+ $checkboxes.checkbox('uncheck');
+ break;
+ case 'inverse':
+ $checkboxes.checkbox('toggle');
+ break;
+ }
+ });
+ $('#delete-selection').click(function () {
+ var $this = $(this);
+ $this.addClass("loading disabled");
+ var ids = [];
+ $checkboxes.each(function () {
+ if ($(this).checkbox('is checked')) {
+ ids.push($(this).data('id'));
+ }
+ });
+ $.post($this.data('link'), {
+ "_csrf": csrf,
+ "ids": ids
+ }).done(function () {
+ window.location.href = $this.data('redirect');
+ });
+ });
+ }
}
function buttonsClickOnEnter() {
@@ -734,9 +778,9 @@ $(document).ready(function () {
// Show exact time
$('.time-since').each(function () {
$(this).addClass('poping up').
- attr('data-content', $(this).attr('title')).
- attr('data-variation', 'inverted tiny').
- attr('title', '');
+ attr('data-content', $(this).attr('title')).
+ attr('data-variation', 'inverted tiny').
+ attr('title', '');
});
// Semantic UI modules.
@@ -750,6 +794,9 @@ $(document).ready(function () {
$('.slide.up.dropdown').dropdown({
transition: 'slide up'
});
+ $('.upward.dropdown').dropdown({
+ direction: 'upward'
+ });
$('.ui.accordion').accordion();
$('.ui.checkbox').checkbox();
$('.ui.progress').progress({