Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #217 from cursedcoder/feature/Tooltipes

Added tooltips for bundle states
  • Loading branch information...
commit 397b2daf9545e28835bc1fc3ca4c1ead821fc6a6 2 parents abd0dc6 + d1d92b6
@stloyd stloyd authored
View
2  CHANGELOG.markdown
@@ -0,0 +1,2 @@
+* 2012-08-15
+ * BundleActivityTwigExtension renamed to BundleUtilsExtension
View
4 src/Knp/Bundle/KnpBundlesBundle/Resources/config/twig.yml
@@ -4,7 +4,7 @@ services:
tags:
- { name: twig.extension }
- twig.extension.knp.bundle_activity:
- class: Knp\Bundle\KnpBundlesBundle\Twig\Extension\BundleActivityTwigExtension
+ twig.extension.knp.bundle_utils:
+ class: Knp\Bundle\KnpBundlesBundle\Twig\Extension\BundleUtilsExtension
tags:
- { name: twig.extension }
View
6 src/Knp/Bundle/KnpBundlesBundle/Resources/public/css/style.css
@@ -318,4 +318,8 @@ pre.code {
.canonical-configuration-class {
display: none;
-}
+}
+
+span.state {
+ border-bottom: 1px dotted #aaa;
+}
View
3  src/Knp/Bundle/KnpBundlesBundle/Resources/public/js/main.js
@@ -69,8 +69,9 @@
return false;
});
});
-
+
$('img[class=tooltip]').tipsy({gravity: 'sw'});
+ $('span.state').tipsy({gravity: 's', title: 'data-state-title'});
function moveElement(className ,direction)
{
View
3  src/Knp/Bundle/KnpBundlesBundle/Resources/views/Bundle/bigList.html.twig
@@ -6,7 +6,8 @@
</div>
<div class="generals">
<div class="bundle-title">
- <a href="{{ path('bundle_show', {'username': bundle.username, 'name': bundle.name}) }}" class="name">{{ bundle.name }}</a>{% if bundle.state != 'unknown' %} <span class="state">({{ bundle.state }})</span>{% endif %}
+ <a href="{{ path('bundle_show', {'username': bundle.username, 'name': bundle.name}) }}" class="name">{{ bundle.name }}</a>
+ {% if bundle.state != 'unknown' %}<span class="state" data-state-title="{{ bundle.state|bundle_state_tooltip }}">({{ bundle.state }})</span>{% endif %}
</div>
<p class="description">{{ bundle.description|default('') }}</p>
View
7 src/Knp/Bundle/KnpBundlesBundle/Resources/views/Bundle/show.html.twig
@@ -14,7 +14,12 @@
<h3>{% trans %}bundles.show.infos.title{% endtrans %}</h3>
<ul>
{%- if bundle.state != 'unknown' -%}
- <li>{% trans %}bundles.show.infos.state{% endtrans %} <span class="state {{ bundle.state|replace({' ': '-'}) }}">{{ bundle.state }}</span></li>
+ <li>
+ {% trans %}bundles.show.infos.state{% endtrans %}
+ <span class="state {{ bundle.state|replace({' ': '-'}) }}" data-state-title="{{ bundle.state|bundle_state_tooltip }}">
+ {{ bundle.state }}
+ </span>
+ </li>
{%- endif -%}
<li>{% trans %}bundles.show.infos.score{% endtrans %} <span><a href="#bundle-score-details">{{ bundle.score }}</a></span></li>
<li>{% trans %}bundles.show.infos.symfonyVersion{% endtrans %} {{ bundle.symfonyVersion ? bundle.symfonyVersion : "bundles.show.infos.unknown" | trans }}</li>
View
41 src/Knp/Bundle/KnpBundlesBundle/Twig/Extension/BundleActivityTwigExtension.php
@@ -1,41 +0,0 @@
-<?php
-
-namespace Knp\Bundle\KnpBundlesBundle\Twig\Extension;
-
-use Knp\Bundle\KnpBundlesBundle\Activity\BundleActivity;
-
-class BundleActivityTwigExtension extends \Twig_Extension
-{
- /**
- * @return array
- */
- public function getFilters()
- {
- return array(
- 'bundle_activity' => new \Twig_Filter_Method($this, 'bundleActivity'),
- );
- }
-
- /**
- * Display bundle activity
- *
- * @param DateTime $lastCommitAt
- * @return string
- */
- public function bundleActivity(\DateTime $lastCommitAt)
- {
- return BundleActivity::getActivityByDays(
- $lastCommitAt->diff(new \DateTime('now'))->format('%a')
- );
- }
-
- /**
- * Returns the name of the extension.
- *
- * @return string The extension name
- */
- public function getName()
- {
- return 'bundle_activity';
- }
-}
View
69 src/Knp/Bundle/KnpBundlesBundle/Twig/Extension/BundleUtilsExtension.php
@@ -0,0 +1,69 @@
+<?php
+
+namespace Knp\Bundle\KnpBundlesBundle\Twig\Extension;
+
+use Knp\Bundle\KnpBundlesBundle\Activity\BundleActivity;
+use Knp\Bundle\KnpBundlesBundle\Entity\Bundle;
+
+class BundleUtilsExtension extends \Twig_Extension
+{
+ /**
+ * @return array
+ */
+ public function getFilters()
+ {
+ return array(
+ 'bundle_activity' => new \Twig_Filter_Method($this, 'bundleActivity'),
+ 'bundle_state_tooltip' => new \Twig_Filter_Method($this, 'bundleStateTooltip')
+ );
+ }
+
+ /**
+ * Display help message about bundle state
+ *
+ * @return string
+ */
+ public function bundleStateTooltip($state)
+ {
+ switch ($state) {
+ default:
+ return 'status of this bundle is not yet confirmed';
+ break;
+
+ case Bundle::STATE_READY:
+ return 'this bundle is ready for production usage';
+ break;
+
+ case Bundle::STATE_NOT_YET_READY:
+ return 'this bundle is currently in development stage, you can use it on your own risk';
+ break;
+
+ case Bundle::STATE_DEPRECATED:
+ return 'this bundle is not maintained anymore, you can use it on your own risk';
+ break;
+ }
+ }
+
+ /**
+ * Display bundle activity
+ *
+ * @param DateTime $lastCommitAt
+ * @return string
+ */
+ public function bundleActivity(\DateTime $lastCommitAt)
+ {
+ return BundleActivity::getActivityByDays(
+ $lastCommitAt->diff(new \DateTime('now'))->format('%a')
+ );
+ }
+
+ /**
+ * Returns the name of the extension.
+ *
+ * @return string The extension name
+ */
+ public function getName()
+ {
+ return 'bundle_utils';
+ }
+}

0 comments on commit 397b2da

Please sign in to comment.
Something went wrong with that request. Please try again.