Skip to content

Commit

Permalink
Лайк и комментарий от незаригистрированного пользователя
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Korchagin committed Jun 1, 2013
1 parent 117235e commit b6ba328
Show file tree
Hide file tree
Showing 4 changed files with 355 additions and 384 deletions.
43 changes: 16 additions & 27 deletions template/pages/day.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,13 @@ $this->day->is_gathering_enabled = false;
{{/into}}
{{into slot="js_include"}}
<script src="/app/day.js"></script>
<? if($this->toolkit->getUser()) { ?>
<script src="/app/day.user.js"></script>
<? if($this->is_owner) { ?>
<script src="/lib/vendor/jquery.ajax-progress.js"></script>
<script src="/lib/vendor/jquery.jcrop.js"></script>
<script src="/lib/vendor/jquery.exif.js"></script>
<script src="/lib/Importer.js"></script>
<script src="/app/day.scroller.js"></script>
<script src="/app/day.owner.js"></script>
<? } ?>
<? if($this->toolkit->getUser() && $this->is_owner) { ?>
<script src="/lib/vendor/jquery.ajax-progress.js"></script>
<script src="/lib/vendor/jquery.jcrop.js"></script>
<script src="/lib/vendor/jquery.exif.js"></script>
<script src="/lib/Importer.js"></script>
<script src="/app/day.scroller.js"></script>
<script src="/app/day.owner.js"></script>
<? } ?>
<? if($this->is_import_preview) { ?>
<script src="/app/day.import.js"></script>
Expand Down Expand Up @@ -604,7 +601,6 @@ $this->day->is_gathering_enabled = false;

<? if(!$this->is_import_preview) { ?>
<hr />

<section class="comments">
<a name="comments"></a>
<? if($this->day->comments && $this->day->comments_count > 0) { ?>
Expand All @@ -613,7 +609,7 @@ $this->day->is_gathering_enabled = false;
<span class="counter">{$this->day->comments_count}</span>
</span>
<? } ?>
<h2>Comments:</h2>
<h2 class="muted">Comments:</h2>

<div class="articles">
<? if(property_exists($this->day, 'comments')) { ?>
Expand Down Expand Up @@ -643,7 +639,6 @@ $this->day->is_gathering_enabled = false;
</article>
{{/list:item}}
{{list:default}}
<? if($this->toolkit->getUser()){ ?>
<article class="template">
<img src="/users/default_image_72.png" width="72" class="pull-left img-rounded" />
<div class="bubble left">
Expand All @@ -653,7 +648,6 @@ $this->day->is_gathering_enabled = false;
</p>
</div>
</article>
<? } ?>
{{/list:default}}
{{/list}}
<? } ?>
Expand All @@ -666,19 +660,14 @@ $this->day->is_gathering_enabled = false;
</button>
</div>

<? if($this->toolkit->getUser()) { ?>
<form name="add_comment_form">
<textarea rows="3" class="input-block-level text"></textarea>
<button type="submit" class="btn btn-block has-spinner disabled">
<span class="spinner icon-spin icon-refresh"></span>
Send comment
</button>
</form>
<? } else { ?>
<div class="alert alert-block">
<a href="#" class="trigger_login">Sign up</a> to write comment
</div>
<? } ?>
<form name="add_comment_form">
<textarea rows="3" class="input-block-level text"></textarea>
<button type="submit" class="btn btn-block has-spinner disabled">
<span class="spinner icon-spin icon-refresh"></span>
Send comment
</button>
</form>

</section>
<? } ?>

Expand Down
39 changes: 21 additions & 18 deletions template/pages/shared/templates.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -285,25 +285,28 @@
</script>

{{template name='day_like_button'}}
<? if($this->toolkit->getUser()) { ?>
<div class="input-prepend small like<?= property_exists($day, 'is_liked') ? ($day->is_liked ? ' liked' : '') : ' disabled' ?>">
<span class="add-on">
<span class="heart toggle">
<span class="state"><i class="icon icon-heart-empty"></i></span>
<span class="state"><i class="icon icon-heart"></i></span>
</span>
<span class="counter toggle">
<span class="state">{$day->likes_count}</span>
</span>
<?
$can_like = !property_exists($day, 'is_liked') || !$day->is_liked;
$button_class = $can_like ? '' : 'disabled';
?>

<div class="input-prepend small like" {$button_class}>
<span class="add-on">
<span class="heart toggle">
<span class="state"><i class="icon icon-heart-empty"></i></span>
<span class="state"><i class="icon icon-heart"></i></span>
</span>
<span class="counter toggle">
<span class="state">{$day->likes_count}</span>
</span>
<button class="btn btn-small action-like" type="button"<?= !property_exists($day, 'is_liked') ? ' disabled' : '' ?>>
<span class="text toggle">
<span class="state">Like</span>
<span class="state">Unlike</span>
</span>
</button>
</div>
<? } ?>
</span>
<button class="btn btn-small action-like" type="button" {$button_class}>
<span class="text toggle">
<span class="state">Like</span>
<span class="state">Unlike</span>
</span>
</button>
</div>
{{/template}}

{{template name='day_share_button'}}
Expand Down
Loading

0 comments on commit b6ba328

Please sign in to comment.