Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
a0accaf7
Commit
a0accaf7
authored
Nov 15, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix label subscription menu on small screens resolution
parent
1af4d29b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
16 deletions
+42
-16
app/assets/javascripts/group_label_subscription.js.es6
app/assets/javascripts/group_label_subscription.js.es6
+15
-10
app/assets/javascripts/label_subscription.js.es6
app/assets/javascripts/label_subscription.js.es6
+15
-4
app/views/shared/_label.html.haml
app/views/shared/_label.html.haml
+12
-2
No files found.
app/assets/javascripts/group_label_subscription.js.es6
View file @
a0accaf7
...
...
@@ -4,24 +4,24 @@
constructor(container) {
const $container = $(container);
this.$dropdown = $container.find('.dropdown');
this.$unsubscribeBtn = $container.find('.js-unsubscribe-button');
this.$subscribeButtons = $container.find('.js-subscribe-button');
this.$unsubscribeButtons = $container.find('.js-unsubscribe-button');
$container.on('click', '.js-subscribe-button
', this.subscribe.bind(this));
$container.on('click', '.js-unsubscribe-button
', this.unsubscribe.bind(this));
this.$subscribeButtons.on('click
', this.subscribe.bind(this));
this.$unsubscribeButtons.on('click
', this.unsubscribe.bind(this));
}
unsubscribe(event) {
event.preventDefault();
const url = this.$unsubscribeB
tn
.attr('data-url');
const url = this.$unsubscribeB
uttons
.attr('data-url');
$.ajax({
type: 'POST',
url: url
}).done(() => {
this.$dropdown.toggleClass('hidden');
this.$unsubscribeBtn.toggleClass('hidden');
this.$unsubscribeBtn.removeAttr('data-url');
this.toggleSubscriptionButtons();
this.$unsubscribeButtons.removeAttr('data-url');
});
}
...
...
@@ -31,16 +31,21 @@
const $btn = $(event.currentTarget);
const url = $btn.attr('data-url');
this.$unsubscribeB
tn
.attr('data-url', url);
this.$unsubscribeB
uttons
.attr('data-url', url);
$.ajax({
type: 'POST',
url: url
}).done(() => {
this.$dropdown.toggleClass('hidden');
this.$unsubscribeBtn.toggleClass('hidden');
this.toggleSubscriptionButtons();
});
}
toggleSubscriptionButtons() {
this.$dropdown.toggleClass('hidden');
this.$subscribeButtons.toggleClass('hidden');
this.$unsubscribeButtons.toggleClass('hidden');
}
}
global.GroupLabelSubscription = GroupLabelSubscription;
...
...
app/assets/javascripts/label_subscription.js.es6
View file @
a0accaf7
...
...
@@ -2,7 +2,10 @@
(function(global) {
class LabelSubscription {
constructor(container) {
$(container).on('click', '.js-subscribe-button', this.toggleSubscription);
this.$container = $(container);
this.$buttons = this.$container.find('.js-subscribe-button');
this.$buttons.on('click', this.toggleSubscription.bind(this));
}
toggleSubscription(event) {
...
...
@@ -28,11 +31,19 @@
[newStatus, newAction] = ['subscribed', 'Unsubscribe'];
}
$span.text(newAction);
$span.toggleClass('hidden');
$btn.removeClass('disabled');
$btn.tooltip('hide').attr('data-original-title', newAction).tooltip('fixTitle');
$btn.attr('data-status', newStatus);
this.$buttons.attr('data-status', newStatus);
this.$buttons.find('> span').text(newAction);
for (let button of this.$buttons) {
let $button = $(button);
if ($button.attr('data-original-title')) {
$button.tooltip('hide').attr('data-original-title', newAction).tooltip('fixTitle');
}
}
});
}
}
...
...
app/views/shared/_label.html.haml
View file @
a0accaf7
...
...
@@ -20,8 +20,18 @@
=
pluralize
open_issues_count
,
'open issue'
-
if
current_user
&&
defined?
(
@project
)
%li
.label-subscription
%a
.js-subscribe-button.label-subscribe-button
{
role:
'button'
,
href:
'#'
,
data:
{
toggle:
'tooltip'
,
status:
label_subscription_status
(
label
,
@project
),
url:
toggle_subscription_namespace_project_label_path
(
@project
.
namespace
,
@project
,
label
)
}
}
-
if
label
.
is_a?
(
ProjectLabel
)
%a
.js-subscribe-button.label-subscribe-button
{
role:
'button'
,
href:
'#'
,
data:
{
status:
label_subscription_status
(
label
,
@project
),
url:
toggle_subscription_namespace_project_label_path
(
@project
.
namespace
,
@project
,
label
)
}
}
%span
=
label_subscription_toggle_button_text
(
label
,
@project
)
-
else
-
status
=
group_label_subscription_status
(
label
,
@project
).
inquiry
%a
.js-unsubscribe-button.label-subscribe-button
{
role:
'button'
,
href:
'#'
,
class:
(
'hidden'
if
status
.
unsubscribed?
),
data:
{
url:
group_label_unsubscribe_path
(
label
,
@project
)
}
}
%span
Unsubscribe
%a
.js-subscribe-button.label-subscribe-button
{
role:
'button'
,
href:
'#'
,
class:
(
'hidden'
unless
status
.
unsubscribed?
),
data:
{
url:
toggle_subscription_namespace_project_label_path
(
@project
.
namespace
,
@project
,
label
)
}
}
%span
Subscribe at project level
%a
.js-subscribe-button.label-subscribe-button
{
role:
'button'
,
href:
'#'
,
class:
(
'hidden'
unless
status
.
unsubscribed?
),
data:
{
url:
toggle_subscription_group_label_path
(
label
.
group
,
label
)
}
}
%span
Subscribe at group level
-
if
can?
(
current_user
,
:admin_label
,
label
)
%li
=
link_to
'Edit'
,
edit_label_path
(
label
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment