Skip to content

Commit

Permalink
Merge branch 'workingconcept-master'
Browse files Browse the repository at this point in the history
Using × for close X
  • Loading branch information
marionnewlevant committed Dec 31, 2016
2 parents 7d77402 + 5bf007e commit f806979
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mnsnitch/MnSnitchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function getReleaseFeedUrl()
*/
public function getVersion()
{
return '1.0.1';
return '1.0.2';
}

/**
Expand Down
9 changes: 7 additions & 2 deletions mnsnitch/resources/css/mnsnitch.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,23 @@ body.rtl .mnsnitch {
}
.mnsnitch>div {
display: block;
padding: 0.25em 0.5em;
font-size: 1.5em;
padding: 0.5em 0.75em 0.65em 0.75em;
font-size: 1em;
line-height: 1em;
background-color: #bf5035;
background-image: linear-gradient(#bf5035, #b34b3b);
color: white;
}

/* the x for closing */
.mnsnitch span {
cursor: pointer;
display: inline-block;
padding: 0 .5em;
font-size: 2em;
}

/* the link for email */
.mnsnitch a {
color: white;
text-decoration: underline;
Expand Down
2 changes: 1 addition & 1 deletion mnsnitch/resources/js/mnsnitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var warn = function(selector, collisions, message) {
// otherwise add to old warnings, value = true
// and add to container
oldWarnings[email] = true;
$(selector).append('<div>'+msg[0]+'<a href="mailto:'+email+'">'+collisions[i].name+'</a>'+msg[1]+' <span>X</span></div>');
$(selector).append('<div>'+msg[0]+'<a href="mailto:'+email+'">'+collisions[i].name+'</a>'+msg[1]+' <span>&times;</span></div>');
}
}
// update current warnings
Expand Down
10 changes: 8 additions & 2 deletions mnsnitch/services/MnSnitchService.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class MnSnitchService extends BaseApplicationComponent
*/
public function registerCollision($elementId, $userId = null, $now = null)
{
$transaction = craft()->db->getCurrentTransaction() === null ? craft()->db->beginTransaction() : null;
$now = $this->_now($now);
$userId = $this->_userId($userId);
// look for existing record to update
Expand All @@ -34,7 +35,12 @@ public function registerCollision($elementId, $userId = null, $now = null)
$record->elementId = $elementId;
}
$record->whenEntered = $now;
$result = $record->save();
$result = $record->save(false);

if ($transaction !== null)
{
$transaction->commit();
}
}

public function getCollisions($elementId, $userId = null, $now = null)
Expand Down Expand Up @@ -64,7 +70,7 @@ public function removeCollision($elementId, $userId = null)
public function expire($now = null)
{
$now = $this->_now($now);
$timeOut = craft()->config->get('serverPollInterval', 'mnnocollide') * 10;
$timeOut = craft()->config->get('serverPollInterval', 'mnsnitch') * 10;
$old = clone $now;
$old->sub(new DateInterval('PT'.$timeOut.'S'));
$oldDateString = DateTimeHelper::formatTimeForDb($old);
Expand Down
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,13 @@
"notes": [
"[Fixed] Only load snitch js and css for control panel"
]
}, {
"version": "1.0.2",
"downloadUrl": "https://github.com/marionnewlevant/craft-snitch/archive/v1.0.2.zip",
"date": "2016-12-31T20:37:12.921Z",
"notes": [
"[Fixed] Use db transactions",
"[Fixed] Expire collisions properly"
]
}
]

0 comments on commit f806979

Please sign in to comment.