-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #889 from openeyes/release/v1.18.1
Release/v1.18.1
- Loading branch information
Showing
163 changed files
with
4,379 additions
and
657 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* OpenEyes | ||
* | ||
* (C) OpenEyes Foundation, 2017 | ||
* This file is part of OpenEyes. | ||
* OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @package OpenEyes | ||
* @link http://www.openeyes.org.uk | ||
* @author OpenEyes <[email protected]> | ||
* @copyright Copyright (c) 2017, OpenEyes Foundation | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 | ||
*/ | ||
|
||
// Tags container | ||
|
||
.oe-tagsinput-wrapper .tagsinput{ | ||
@extend textarea | ||
} | ||
|
||
// Tag element | ||
|
||
.oe-tagsinput-wrapper .tagsinput .tag{ | ||
@extend .pill; | ||
border-radius: $oe-box-border-radius; | ||
border-color: $primary-color; | ||
background-color: lighten($primary-color, 50%); | ||
} | ||
|
||
// Tag text | ||
|
||
.oe-tagsinput-wrapper .tagsinput .tag span{ | ||
color: $primary-color; | ||
} | ||
|
||
// Remove link | ||
|
||
.oe-tagsinput-wrapper .tagsinput .tag a{ | ||
background: image-url("_elements/icons/event-optional/element-remove.png") no-repeat -10px -2px; | ||
color: transparent; | ||
display: inline-block; | ||
height: 15px; | ||
margin-left: 2px; | ||
margin-top: 1px; | ||
vertical-align: top; | ||
width: 14px; | ||
&:hover { | ||
@include opacity(1); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<?php | ||
|
||
/** | ||
* OpenEyes | ||
* | ||
* (C) OpenEyes Foundation, 2017 | ||
* This file is part of OpenEyes. | ||
* OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. | ||
* OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
* @package OpenEyes | ||
* @link http://www.openeyes.org.uk | ||
* @author OpenEyes <[email protected]> | ||
* @copyright Copyright (c) 2017, OpenEyes Foundation | ||
* @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 | ||
*/ | ||
/** | ||
* Class TaggedActiveRecordBehavior | ||
* | ||
* Attach this behaviour to all Active Records that have | ||
* MANY_MANY relation to Tags | ||
*/ | ||
|
||
class TaggedActiveRecordBehavior extends CActiveRecordBehavior | ||
{ | ||
/** | ||
* Translates tag names from user input | ||
* into an array of tag ids. If tag name | ||
* cant be found, creates one. | ||
* | ||
* @return bool | ||
*/ | ||
|
||
public function beforeSave($event) | ||
{ | ||
if(is_array($this->owner->tags)) | ||
{ | ||
return parent::beforeSave($event); | ||
} | ||
|
||
if($this->owner->tags !== '') | ||
{ | ||
$tags = explode(",", $this->owner->tags); | ||
$tag_ids=array(); | ||
foreach($tags as $tag) | ||
{ | ||
// Get tag id... | ||
if($t = Tag::model()->findByAttributes(['name'=>$tag])) | ||
{ | ||
$tag_ids[] = $t->id; | ||
} | ||
// ...or create new tag | ||
else | ||
{ | ||
$t = new Tag(); | ||
$t->name = $tag; | ||
$t->save(); | ||
$tag_ids[] = $t->id; | ||
} | ||
} | ||
|
||
$this->owner->tags = $tag_ids; | ||
} | ||
else | ||
{ | ||
$this->owner->tags = array(); | ||
} | ||
|
||
return parent::beforeSave($event); | ||
} | ||
|
||
/** | ||
* @return string | ||
* | ||
* Returns the list of tag names, | ||
* separated by comma+space (', ') | ||
*/ | ||
|
||
public function getTagNames() | ||
{ | ||
return implode(', ', array_map(function($e){ return $e->name; }, $this->owner->tags)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.