Skip to content

Commit

Permalink
basic sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
madfriend committed Jul 16, 2015
1 parent 3b70961 commit fb60e12
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 1 deletion.
8 changes: 8 additions & 0 deletions assets/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1537,4 +1537,12 @@ tr.valign-top td {

.t-row.t-my-level td {
color: #a19679;
}

.single-achievement-wrap {
text-align: center;
}

.single-achievement-wrap .achievement-wrap {
margin-top: 30px;
}
Binary file added assets/img/badges/share/aist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/badges/share/bobr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/badges/share/chameleon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/badges/share/dog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/badges/share/fish.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/badges/share/wantmore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,24 @@
$smarty->assign('manager', $am);
$smarty->display('achievements/all_achievements.tpl');
break;
case 'achievement':
if (!empty($_GET['uid']) && !empty($_GET['type'])) {
$uid = (int)$_GET['uid'];
$type = $_GET['type'];

$am = new AchievementsManager($uid);
$smarty->assign('user', get_user_info($uid));
$smarty->assign('user_id', $uid);

$all = $am->pull_all();

if (!empty($all[$type]) && $all[$type]->given) {

$smarty->assign('achievement', $all[$type]);
$smarty->display('achievements/one_achievement.tpl');
break;
}
}
default:
header("Location:index.php");
break;
Expand Down
14 changes: 14 additions & 0 deletions templates/achievements/one_achievement.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{extends file='common.tpl'}
{block name='content'}
<div class="single-achievement-wrap">
<h2>Бейдж пользователя
<a href="{$web_prefix}/user.php?id={$user_id}">{$user['shown_name']}</a></h2>

{$a = $achievement}
<div class="achievement-wrap achievement-{$a->css_class} achievement-medium">
{if $a->level}
<div class="achievement-{$a->css_class}-level achievement-level"></div>
{/if}
</div>
</div>
{/block}
17 changes: 16 additions & 1 deletion templates/qa/user_splash.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{$titles = $achievements_titles}
{if $achievements_unseen}
<script type="text/javascript" src="//yastatic.net/share/share.js" charset="utf-8"></script>
<link rel="stylesheet" href="/assets/css/animate.min.css">
{assign var="single" value=count($achievements_unseen)==1}
<div class="modal hide fade a-modal {if $single}a-modal-square{/if}">
Expand All @@ -25,6 +26,20 @@
Вы получили <strong>{$a->level}</strong> уровень бейджа <br/>
<strong{$titles[$a->css_class].short_title}»</strong>
{/if}

{$desc = "Я получил(а) бейдж"}
{if $a->level > 1}
{$desc = "`$desc` `$a->level`-го уровня"}
{/if}
{$desc = "`$desc`!"}
<div class="yashare-auto-init"
data-yashareL10n="ru"
data-yashareType="none"
data-yashareQuickServices="vkontakte,facebook,twitter"
data-yashareTitle="{$desc}"
data-yashareDescription="На тебя тоже хватит!"
data-yashareImage="http://opencorpora.org/assets/img/badges/share/{$a->css_class}.png"
data-yashareLink="http://opencorpora.org/page=achievement&uid={$smarty.session.user_id}&type={$a->css_class}"></div>
</div>
</div>
{/foreach}
Expand All @@ -38,7 +53,7 @@

<script>
$('.a-modal').on('shown', function() {
$.post("/ajax/game_mark_shown.php");
// $.post("/ajax/game_mark_shown.php");
$(this).find('.achievement-wrap').addClass("animated bounceIn");
});
Expand Down

0 comments on commit fb60e12

Please sign in to comment.