Permalink
Browse files

Colored buttons

  • Loading branch information...
1 parent f7aae25 commit e0bae28fba1465db1e2718796809153474e8422f Dmitry Demeshchuk committed Jan 31, 2014
Showing with 51 additions and 31 deletions.
  1. +3 −1 wrike.com/approve.coffee
  2. +18 −0 wrike.com/approve.css
  3. +30 −30 wrike.com/approve.js
View
4 wrike.com/approve.coffee
@@ -49,7 +49,7 @@
toolbarSelector: '.wspace-task-settings-bar'
taistToolbarId: 'wrike-taist-toolbar'
buttonTemplate: '<a class="wspace-task-settings-button"></a>'
- buttonHighlightClass: 'x-btn-over'
+ buttonHighlightClass: 'taist-wrike-x-btn-over'
}
}
@@ -136,9 +136,11 @@
for buttonTitle, nextState of states[@state].triggers
do(buttonTitle, nextState) =>
+ idSuffix = buttonTitle.toLowerCase().replace(/\s/g, '-')
button = $(cfg.buttonTemplate)
button.text buttonTitle
button.hover mOver, mOut
+ button.attr 'id', 'taist-wrike-approval-' + idSuffix
button.on 'click', =>
@toolbar.empty()
@applyState nextState
View
18 wrike.com/approve.css
@@ -0,0 +1,18 @@
+#taist-wrike-approval-send-for-approval {
+ background-color: #8686E8;
+ text-shadow: none;
+}
+
+#taist-wrike-approval-approve {
+ background-color: #86E886;
+ text-shadow: none;
+}
+
+#taist-wrike-approval-decline {
+ background-color: #E88686;
+ text-shadow: none;
+}
+
+.taist-wrike-x-btn-over {
+ opacity: 0.5
+}
View
60 wrike.com/approve.js
@@ -49,7 +49,7 @@
toolbarSelector: '.wspace-task-settings-bar',
taistToolbarId: 'wrike-taist-toolbar',
buttonTemplate: '<a class="wspace-task-settings-button"></a>',
- buttonHighlightClass: 'x-btn-over'
+ buttonHighlightClass: 'taist-wrike-x-btn-over'
}
};
WrikeTaskFilters = (function() {
@@ -157,36 +157,36 @@
_this = this;
this.toolbar.empty();
roles = taistWrike.myTaskRoles(this.task);
- if (!(roles.owner && states[this.state].owner || roles.author && states[this.state].author)) {
- return;
- }
- console.log(this.task.data['responsibleList']);
- cfg = this.cfg;
- mOver = function() {
- return $(this).addClass(cfg.buttonHighlightClass);
- };
- mOut = function() {
- return $(this).removeClass(cfg.buttonHighlightClass);
- };
- _ref = states[this.state].triggers;
- _results = [];
- for (buttonTitle in _ref) {
- nextState = _ref[buttonTitle];
- _results.push((function(buttonTitle, nextState) {
- var button;
- button = $(cfg.buttonTemplate);
- button.text(buttonTitle);
- button.hover(mOver, mOut);
- button.on('click', function() {
- _this.toolbar.empty();
- _this.applyState(nextState);
- _this.renderControls();
- return false;
- });
- return _this.toolbar.append(button);
- })(buttonTitle, nextState));
+ if (roles.owner && states[this.state].owner || roles.author && states[this.state].author) {
+ cfg = this.cfg;
+ mOver = function() {
+ return $(this).addClass(cfg.buttonHighlightClass);
+ };
+ mOut = function() {
+ return $(this).removeClass(cfg.buttonHighlightClass);
+ };
+ _ref = states[this.state].triggers;
+ _results = [];
+ for (buttonTitle in _ref) {
+ nextState = _ref[buttonTitle];
+ _results.push((function(buttonTitle, nextState) {
+ var button, idSuffix;
+ idSuffix = buttonTitle.toLowerCase().replace(/\s/g, '-');
+ button = $(cfg.buttonTemplate);
+ button.text(buttonTitle);
+ button.hover(mOver, mOut);
+ button.attr('id', 'taist-wrike-approval-' + idSuffix);
+ button.on('click', function() {
+ _this.toolbar.empty();
+ _this.applyState(nextState);
+ _this.renderControls();
+ return false;
+ });
+ return _this.toolbar.append(button);
+ })(buttonTitle, nextState));
+ }
+ return _results;
}
- return _results;
};
WrikeTaskApprover.prototype.applyState = function(newState) {

0 comments on commit e0bae28

Please sign in to comment.