Changed Enum::toString() calls
Fixed chrome ghost margin
This commit is contained in:
Marcin Kurczewski 2013-10-16 08:33:45 +02:00
parent 75e68aea5a
commit 28c1ce68b4
7 changed files with 36 additions and 9 deletions

View file

@ -96,8 +96,11 @@ body {
margin-right: -1px; margin-right: -1px;
box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
} }
#top-nav li.safety a:after {
content: ' ';
}
#top-nav li.safety span { #top-nav li.safety span {
visibility: hidden; display: none;
} }
#top-nav li.safety a:hover { opacity: .7; } #top-nav li.safety a:hover { opacity: .7; }
#top-nav li.safety a.inactive { opacity: 1; } #top-nav li.safety a.inactive { opacity: 1; }

View file

@ -6,3 +6,15 @@
width: 140px; width: 140px;
height: 140px; height: 140px;
} }
.posts .post-type-flash img {
border-color: #dd5;
box-shadow: 0.25em 0.25em #eeb, 0.1em 0.1em 0.5em 0.1em rgba(238,238,187,0.5);
}
.posts a:focus img,
.posts a:hover img {
border: 1px solid firebrick;
box-shadow: 0.25em 0.25em pink;
opacity: .9;
}

View file

@ -36,6 +36,18 @@ class TextHelper
return $string; return $string;
} }
public static function camelCaseToHumanCase($string, $ucfirst = false)
{
$string = preg_replace_callback('/[A-Z]/', function($x)
{
return ' ' . strtolower($x[0]);
}, $string);
$string = trim($string);
if ($ucfirst)
$string = ucfirst($string);
return $string;
}
public static function resolveConstant($constantName, $className = null) public static function resolveConstant($constantName, $className = null)
{ {
$constantName = self::kebabCaseToCamelCase($constantName); $constantName = self::kebabCaseToCamelCase($constantName);

View file

@ -68,9 +68,9 @@
<ul> <ul>
<?php foreach (PostSafety::getAll() as $safety): ?> <?php foreach (PostSafety::getAll() as $safety): ?>
<?php if (PrivilegesHelper::confirm($this->context->user, Privilege::ListPosts, PostSafety::toString($safety))): ?> <?php if (PrivilegesHelper::confirm($this->context->user, Privilege::ListPosts, PostSafety::toString($safety))): ?>
<li class="safety-<?php echo strtolower(PostSafety::toString($safety)) ?>"> <li class="safety-<?php echo TextHelper::camelCaseToHumanCase(PostSafety::toString($safety)) ?>">
<a href="<?php echo \Chibi\UrlHelper::route('user', 'toggle-safety', ['safety' => $safety]) ?>" class="<?php echo $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>" title="Searching <?php echo strtolower(PostSafety::ToString($safety)) ?> posts: <?php echo $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>"> <a href="<?php echo \Chibi\UrlHelper::route('user', 'toggle-safety', ['safety' => $safety]) ?>" class="<?php echo $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>" title="Searching <?php echo TextHelper::camelCaseToHumanCase(PostSafety::ToString($safety)) ?> posts: <?php echo $this->context->user->hasEnabledSafety($safety) ? 'enabled' : 'disabled' ?>">
<span><?php echo PostSafety::toString($safety) ?></span> <span><?php echo TextHelper::camelCaseToHumanCase(PostSafety::toString($safety), true) ?></span>
</a> </a>
</li> </li>
<?php endif ?> <?php endif ?>

View file

@ -3,7 +3,7 @@
<?php else: ?> <?php else: ?>
<div class="posts paginator-content"> <div class="posts paginator-content">
<?php foreach ($this->context->transport->posts as $post): ?> <?php foreach ($this->context->transport->posts as $post): ?>
<a href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $post['id']]) ?>"> <a class="post post-type-<?php echo TextHelper::camelCaseToHumanCase(PostType::toString($post['type'])) ?>" href="<?php echo \Chibi\UrlHelper::route('post', 'view', ['id' => $post['id']]) ?>">
<img src="<?php echo \Chibi\UrlHelper::route('post', 'thumb', ['id' => $post['id']]) ?>" alt="@<?php echo $post['id'] ?>"/> <img src="<?php echo \Chibi\UrlHelper::route('post', 'thumb', ['id' => $post['id']]) ?>" alt="@<?php echo $post['id'] ?>"/>
</a> </a>
<?php endforeach ?> <?php endforeach ?>

View file

@ -46,7 +46,7 @@
<div class="key-value safety"> <div class="key-value safety">
<span class="key">Safety:</span> <span class="key">Safety:</span>
<span class="value" title="<?php echo $val = PostSafety::toString($this->context->transport->post->safety) ?>"> <span class="value" title="<?php echo $val = TextHelper::camelCaseToHumanCase(PostSafety::toString($this->context->transport->post->safety)) ?>">
<?php echo $val ?> <?php echo $val ?>
</span> </span>
</div> </div>
@ -209,7 +209,7 @@
<?php foreach (PostSafety::getAll() as $safety): ?> <?php foreach (PostSafety::getAll() as $safety): ?>
<label> <label>
<input type="radio" name="safety" value="<?php echo $safety ?>" <?php if ($this->context->transport->post->safety == $safety) echo 'checked="checked"' ?>/> <input type="radio" name="safety" value="<?php echo $safety ?>" <?php if ($this->context->transport->post->safety == $safety) echo 'checked="checked"' ?>/>
&nbsp;<?php echo PostSafety::toString($safety) ?> &nbsp;<?php echo TextHelper::camelCaseToHumanCase(PostSafety::toString($safety), true) ?>
</label> </label>
<?php endforeach ?> <?php endforeach ?>
</div> </div>

View file

@ -16,7 +16,7 @@
<div class="key-value access-rank"> <div class="key-value access-rank">
<span class="key">Access rank:</span> <span class="key">Access rank:</span>
<span class="value" title="<?php echo $val = strtolower(AccessRank::toString($this->context->transport->user->access_rank)) ?>"><?php echo $val ?></span> <span class="value" title="<?php echo $val = TextHelper::camelCaseToHumanCase(AccessRank::toString($this->context->transport->user->access_rank)) ?>"><?php echo $val ?></span>
</div> </div>
<?php if ($this->context->user->id == $this->context->transport->user->id): ?> <?php if ($this->context->user->id == $this->context->transport->user->id): ?>
@ -206,7 +206,7 @@
<?php else: ?> <?php else: ?>
<option value="<?php echo $rank ?>"> <option value="<?php echo $rank ?>">
<?php endif ?> <?php endif ?>
<?php echo AccessRank::toString($rank) ?> <?php echo TextHelper::camelCaseToHumanCase(AccessRank::toString($rank)) ?>
</option> </option>
<?php endforeach ?> <?php endforeach ?>
</select> </select>