fixes #2073
This commit is contained in:
parent
78ce868878
commit
e20c83647f
@ -1160,6 +1160,23 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange {
|
||||
foreach ( $ignore as $property => $val ) {
|
||||
unset( $out[ $property ] );
|
||||
}
|
||||
|
||||
$comment = $this->comment();
|
||||
|
||||
if ($comment->id_restaurant_comment) {
|
||||
$auths = $comment->user()->auths();
|
||||
foreach ($auths as $auth) {
|
||||
if ($auth->type == 'facebook') {
|
||||
$id = $auth->auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$out['comment'] = [
|
||||
'content' => $comment->content,
|
||||
'user' => $comment->user()->get(0)->name(),
|
||||
'fb' => $id
|
||||
];
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
@ -1493,6 +1510,13 @@ class Crunchbutton_Restaurant extends Cana_Table_Trackchange {
|
||||
WHERE txt IS NOT NULL";
|
||||
return Admin::q( $query );
|
||||
}
|
||||
|
||||
public function comment() {
|
||||
if (!isset($this->_comment)) {
|
||||
$this->_comment = Restaurant_Comment::q('select * from restaurant_comment where top=1 && id_restaurant='.$this->id_restaurant.'');
|
||||
}
|
||||
return $this->_comment;
|
||||
}
|
||||
|
||||
public function save() {
|
||||
if (!$this->timezone) {
|
||||
|
||||
25
include/library/Crunchbutton/Restaurant/Comment.php
Normal file
25
include/library/Crunchbutton/Restaurant/Comment.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class Crunchbutton_Restaurant_Comment extends Cana_Table {
|
||||
public function __construct($id = null) {
|
||||
parent::__construct();
|
||||
$this
|
||||
->table('restaurant_comment')
|
||||
->idVar('id_restaurant_comment')
|
||||
->load($id);
|
||||
}
|
||||
|
||||
public function user() {
|
||||
if (!isset($this->_user)) {
|
||||
$this->_user = User::o($this->id_user);
|
||||
}
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
public function restaurant() {
|
||||
if (!isset($this->_restaurant)) {
|
||||
$this->_restaurant = Restaurant::o($this->id_restaurant);
|
||||
}
|
||||
return $this->_restaurant;
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,14 @@
|
||||
|
||||
class Crunchbutton_User extends Cana_Table {
|
||||
|
||||
public function name() {
|
||||
if (!isset($this->_name)) {
|
||||
$name = explode(' ',$this->name);
|
||||
$this->_name = $name[0];
|
||||
}
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function byPhone($phone) {
|
||||
$phone = preg_replace('/[^0-9]/i','',$phone);
|
||||
return User::q('select * from user where phone="'.$phone.'" order by id_user desc limit 1');
|
||||
|
||||
@ -17,11 +17,21 @@
|
||||
<h1>{{restaurant.name}}</h1>
|
||||
<h2>{{restaurant.message || restaurant.short_description}}</h2>
|
||||
</div>
|
||||
<div class="restaurant-comment" ng-show="restaurant.comment">
|
||||
<div class="restaurant-comment-wrap">
|
||||
<div class="restaurant-comment-image">
|
||||
<div class="restaurant-comment-image-img" style="background: url(http://graph.facebook.com/{{restaurant.comment.fb}}/picture?type=normal)"></div>
|
||||
</div>
|
||||
<div class="restaurant-comment-content">
|
||||
<h4>{{restaurant.comment.user}} says</h4>
|
||||
<p>{{restaurant.comment.content}}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="giftcard-badge" ng-show="credit.hasValue">
|
||||
<i class="fa fa-certificate"></i>
|
||||
<div class="giftcard-badge-value"><sup>$</sup>{{Math.round(credit.value)}}</div>
|
||||
<div class="giftcard-badge-text">gift card</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
@ -1336,6 +1336,48 @@ p {
|
||||
|
||||
-webkit-transform: translateZ(0);
|
||||
}
|
||||
.restaurant-comment {
|
||||
margin-top: -11em;
|
||||
position: absolute;
|
||||
background: rgba(0,0,0,.5);
|
||||
border-radius: 4px;
|
||||
padding: .5em .6em .5em .6em;
|
||||
margin-left: .8em;
|
||||
margin-right: .8em;
|
||||
}
|
||||
.restaurant-comment-wrap {
|
||||
display: table-row;
|
||||
}
|
||||
|
||||
.restaurant-comment-image {
|
||||
display: table-cell;
|
||||
vertical-align: top;
|
||||
}
|
||||
.restaurant-comment-image-img {
|
||||
background-size: 100% !important;
|
||||
height: 3.6em;
|
||||
width: 3.6em;
|
||||
}
|
||||
.restaurant-comment-content {
|
||||
font-size: .8em;
|
||||
display: table-cell;
|
||||
color: #fff;
|
||||
padding-left: 1em;
|
||||
vertical-align: top;
|
||||
}
|
||||
.restaurant-comment-content h4 {
|
||||
margin-top: -.3em;
|
||||
text-transform: uppercase;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
.restaurant-comment-content p {
|
||||
line-height: 1.3em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.restaurant-name {
|
||||
color: #fff;
|
||||
text-shadow: 1px 1px 0 rgba(0,0,0,.6);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user