Skip to content

Commit

Permalink
Merge pull request #88 from pierredup/navigation
Browse files Browse the repository at this point in the history
Improve Navigation
  • Loading branch information
pierredup committed Dec 21, 2015
2 parents 3df02e8 + b53861e commit 6e03ec0
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 57 deletions.
4 changes: 3 additions & 1 deletion src/CSBill/ClientBundle/Menu/ClientMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
namespace CSBill\ClientBundle\Menu;

use CSBill\CoreBundle\Menu\Core\AuthenticatedMenu;
use Knp\Menu\ItemInterface;
use CSBill\CoreBundle\Menu\ItemInterface;

class ClientMenu extends AuthenticatedMenu
{
Expand Down Expand Up @@ -73,6 +73,8 @@ public function clientViewMenu(ItemInterface $menu)

$this->clientsMenu($menu);

$menu->addDivider();

$menu->addChild(
$translator->trans('view_client'),
array(
Expand Down
11 changes: 11 additions & 0 deletions src/CSBill/CoreBundle/Menu/ItemInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,15 @@

interface ItemInterface extends BaseInterface
{
/**
* @param string $type
*
* @return $this
*/
public function addDivider($type = '');

/**
* @return bool
*/
public function isDivider();
}
12 changes: 8 additions & 4 deletions src/CSBill/CoreBundle/Menu/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@

use Knp\Menu\MenuItem as BaseItem;

class MenuItem extends BaseItem
class MenuItem extends BaseItem implements ItemInterface
{
/**
* {@inheritdoc}
*/
public function addDivider($type = '')
{
$name = uniqid();
Expand All @@ -23,11 +26,12 @@ public function addDivider($type = '')
$type = '-'.$type;
}

$child = $this->addChild($name, array('extras' => array('divider' => $type)));

return $child;
return $this->addChild($name, array('extras' => array('divider' => $type)));
}

/**
* {@inheritdoc}
*/
public function isDivider()
{
return $this->getExtra('divider') !== null;
Expand Down
48 changes: 0 additions & 48 deletions src/CSBill/CoreBundle/Resources/public/less/core.less

This file was deleted.

7 changes: 7 additions & 0 deletions src/CSBill/CoreBundle/Resources/public/less/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,19 @@ ul.unstyled {
}
}

/* NAV
********/

.right-nav {
.action-button {
width: 100%;
}
}

#top-menu-create-button {
margin: 15px 0 0 15px;
}

.modal .loading-mask {
z-index: 10;
}
Expand Down
7 changes: 6 additions & 1 deletion src/CSBill/CoreBundle/Resources/public/less/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ body {

.nav {
li {
border: none;
border: none;

> a {
border-radius: 0;
Expand All @@ -302,6 +302,11 @@ body {
}
}
}

.divider {
background-color: @grey-200;
height: 1px;
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/CSBill/CoreBundle/Resources/translations/messages.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ exception:
not_found:
text: Sorry, but the page you were trying to view does not exist.

menu:
button:
create: Create

powered_by: Powered By
invalid_file: Invalid File
upload_error: There was an error uploading the file
Expand Down
23 changes: 23 additions & 0 deletions src/CSBill/CoreBundle/Resources/views/Menu/top.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,29 @@
{{ menu('top', {'attr' : {'class' : 'nav navbar-nav'}}) }}

{{ menu('top_right', {'attr' : {'class' : 'nav navbar-nav navbar-right'}}) }}

<div class="btn-group hidden-xs" id="top-menu-create-button">
<button class="btn btn-primary btn-sm dropdown-toggle" type="button" data-toggle="dropdown">
{{ 'menu.button.create'|trans }}
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="{{ path('_clients_add') }}">
{{ icon('user') }} {{ 'dashboard.create.client'|trans }}
</a>
</li>
<li>
<a href="{{ path('_quotes_create') }}">
{{ icon('file-text-o') }} {{ 'dashboard.create.quote'|trans }}
</a>
</li>
<li>
<a href="{{ path('_invoices_create') }}">
{{ icon('file-text-o') }} {{ 'dashboard.create.invoice'|trans }}
</a>
</li>
</ul>
</div>
</div>
</div>
</nav>
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<br class="clear"/>
<br class="clear"/>

{% embed "CSBillInvoiceBundle::invoice_template.html.twig" %}
{% embed "CSBillInvoiceBundle::invoice_template.html.twig" with {'link_client' : true} %}
{% block contentBody %}
{{ parent() }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@
<div class="row">
<div class="col-xs-7">
<h4>
{{ invoice.client }}
{% if link_client is defined and link_client == true %}
<a href="{{ path('_clients_view', {'id' : invoice.client.id}) }}">
{{ invoice.client }}
</a>
{% else %}
{{ invoice.client }}
{% endif %}
</h4>
{% if invoice.client.website is not empty %}
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
payment:
create:
cancel: Cancel
force: Force payment status (Optional)
discount: Discount
base_total: Base Total
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@
{{ form_widget(form) }}

<button type="submit" class="btn btn-info">{{ icon('credit-card') }} {{ 'payment.action.pay'|trans }}</button>
<a href="javascript:history.go(-1)" class="btn btn-warning">
{{ icon('reply') }} {{ 'payment.create.cancel'|trans }}
</a>
{{ form_end(form) }}

</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@
<div class="row">
<div class="col-xs-7">
<h4>
{{ quote.client }}
{% if link_client is defined and link_client == true %}
<a href="{{ path('_clients_view', {'id' : quote.client.id}) }}">
{{ quote.client }}
</a>
{% else %}
{{ quote.client }}
{% endif %}
</h4>
{% if quote.client.website is not empty %}
<p>
Expand Down

0 comments on commit 6e03ec0

Please sign in to comment.