Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

#9 Add confirmation when closing a group #34

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Jakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ task("cleanup", () => {

desc("runs wslint on the built source");
task("lint", ["build"], {async: true}, () => {
jake.exec([`cd ${DIST_DIR}; eslint .`], {
jake.exec([`cd ${DIST_DIR} & eslint .`], {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry? This runs cd in the background while running eslint in another directory. What were your intentions here?

interactive: true
}, complete);
});

desc("Builds the source and starts a test installation. You can specify jpm parameters with 'JPM_PARAMS=\"...\" jake run'");
task("run", ["build"], {async: true}, () => {
jake.exec([`cd ${DIST_DIR}; jpm run ${process.env.JPM_PARAMS}`], {
jake.exec([`cd ${DIST_DIR} & jpm run ${process.env.JPM_PARAMS}`], {
interactive: true
}, complete);
});
Expand Down
1 change: 1 addition & 0 deletions src/data/action_creators.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const ActionCreators = {
tabgroups: tabgroups
};
},

setGroupCloseTimeout: function(timeout) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little newline here would be nice. :)

return {
type: "GROUP_CLOSE_TIMEOUT_RECIEVE",
Expand Down
2 changes: 1 addition & 1 deletion src/data/assets/css/groupspanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ ul, li {
}

.group.closing .group-title {
color: #CCC;
color: #ccc;
text-decoration: line-through;
}

Expand Down
14 changes: 3 additions & 11 deletions src/data/components/group.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const Group = React.createClass({

getInitialState: function() {
return {
closeTimer: this.props.closeTimeout,
closing: false,
editing: false,
expanded: false,
Expand Down Expand Up @@ -82,7 +81,6 @@ const Group = React.createClass({
React.createElement(
GroupControls,
{
closeTimer: this.state.closeTimer,
closing: this.state.closing,
editing: this.state.editing,
expanded: this.state.expanded,
Expand Down Expand Up @@ -113,7 +111,6 @@ const Group = React.createClass({
event.stopPropagation();
this.setState({editing: false});
this.setState({closing: true});
this.setState({closeTimer: this.props.closeTimeout});

let group = this;

Expand All @@ -122,13 +119,9 @@ const Group = React.createClass({
return;
}

let timer = setInterval(function() {
group.setState({closeTimer: --group.state.closeTimer});
if (group.state.closeTimer <= 0) {
group.props.onGroupCloseClick(group.props.group.id);
clearInterval(timer);
}
}, 1000);
setTimeout(function() {
group.props.onGroupCloseClick(group.props.group.id);
}, this.props.closeTimeout * 1000);
},

handleGroupClick: function(event) {
Expand Down Expand Up @@ -214,6 +207,5 @@ const Group = React.createClass({
event.stopPropagation();

this.setState({closing: false});
this.setState({closeTimer: this.props.closeTimeout});
}
});
5 changes: 0 additions & 5 deletions src/data/components/groupcontrols.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const GroupControls = React.createClass({
propTypes: {
closeTimer: React.PropTypes.number,
expanded: React.PropTypes.bool.isRequired,
onClose: React.PropTypes.func,
onEdit: React.PropTypes.func,
Expand Down Expand Up @@ -35,10 +34,6 @@ const GroupControls = React.createClass({

getClosingControls: function() {
return [
React.DOM.span(
{className: "group-close-undo-timer"},
this.props.closeTimer
),
React.DOM.i({
className: "group-close-undo fa fa-fw fa-undo",
onClick: this.props.onUndoCloseClick
Expand Down
22 changes: 0 additions & 22 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,21 +241,6 @@ TabGroups.prototype = {
},

onGroupClose: function(event) {
let groupTabCount = this._tabs.getGroupTabCount(
this._getTabBrowser(),
event.groupID
);

if (groupTabCount > 0) {
let closeGroupConfirmed = this._closeGroupConfirmation();

this._groupsPanel.show({position: this._panelButton});

if (!closeGroupConfirmed) {
return;
}
}

this._tabs.closeGroup(
this._getWindow(),
this._getTabBrowser(),
Expand Down Expand Up @@ -308,13 +293,6 @@ TabGroups.prototype = {

_getTabBrowser: function() {
return TabsUtils.getTabBrowser(this._getWindow());
},

_closeGroupConfirmation: function() {
let promptTitle = _("close_group_prompt_title");
let promptMessage = _("close_group_prompt_message");

return Utils.confirm(promptTitle, promptMessage);
}
};

Expand Down
6 changes: 2 additions & 4 deletions src/locale/en-US.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
bindPanoramaShortcut_title = Listen to Ctrl/Cmd-Shift-E
enableAlphabeticSort_title = Enable alphabetic sorting
groupUndoCloseTimeout_title = Closing group timeout
groupUndoCloseTimeout_description = Delay before close group in seconds
groupUndoCloseTimeout_title = Closing group delay
groupUndoCloseTimeout_description = Delay in seconds to wait before the group gets actually closed.

add_group = Create new group
close_group_prompt_title = Close group
close_group_prompt_message = Do you want to close this group?
panelButton_label = Group Tabs
unnamed_group = Unnamed Group
close_group_prompt_title = Close group
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the sake of easier translation, I try to keep the lower block of this file ordered alphabetically. Could you move your two strings below add_group?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicated!

Expand Down
5 changes: 3 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
},
{
"name": "groupCloseTimeout",
"title": "Closing group timeout",
"title": "Closing group delay",
"description": "Delay in seconds to wait before the group gets actually closed.",
"type": "integer",
"value": 0
"value": 3
}
]
}