Permalink
Browse files

refactored bricks page in user reserved area

  • Loading branch information...
inmarelibero committed Nov 28, 2012
1 parent 1dbc558 commit d5c0862abfe6a99f63bece6e7928d3c54c9a8473
View
@@ -33,6 +33,7 @@ assetic:
- %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-tab.js
- %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-alert.js
- %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-modal.js
+ - %kernel.root_dir%/../web/assets/bootstrap/js/bootstrap-tooltip.js
- bundles/fosjsrouting/js/router.js
- @BricksSiteBundle/Resources/js/*.js
- @BricksSiteBundle/Resources/js/*/*.js
@@ -17,9 +17,12 @@
{# canonical url #}
<link rel="canonical" href="{% spaceless %}{% block canonical_url %}{{ app.request.uri }}{% endblock canonical_url %}{% endspaceless %}"/>
- {% stylesheets '@stylesheets' %}
- <link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
- {% endstylesheets %}
+ {% javascripts '@javascripts' %}
+ <script type="text/javascript" src="{{ asset_url }}"></script>
+ {% endjavascripts %}
+
+ {# FOSJsRoutingBundle generated routes by controller #}
+ <script type="text/javascript" src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
{% block javascripts_header %}
{# twitter #}
@@ -41,6 +44,10 @@
})();
</script>
+
+ {% stylesheets '@stylesheets' %}
+ <link rel="stylesheet" type="text/css" href="{{ asset_url }}" />
+ {% endstylesheets %}
</head>
<body lang="{{app.request.locale}}" class="route-{{ app.request.get('_route') }} {% block body_class '' %}">
@@ -217,14 +224,6 @@
{% render 'BricksUserBundle:Security:_modalLogin' %}
- {% javascripts '@javascripts' %}
- <script type="text/javascript" src="{{ asset_url }}"></script>
- {% endjavascripts %}
-
- {# FOSJsRoutingBundle generated routes by controller #}
- <script type="text/javascript" src="{{ path('fos_js_routing_js', {"callback": "fos.Router.setData"}) }}"></script>
-
-
{% block javascripts_footer '' %}
</body>
@@ -32,7 +32,7 @@ public function indexAction()
$entities = $em->getRepository('BricksSiteBundle:Brick')->findBy(
array('user' => $user->getId()),
- array('updated_at' => 'DESC')
+ array('title' => 'ASC')
);
return array(
@@ -7,6 +7,42 @@ rules for all the templates loaded through Bricks\UserBundle\BrickController
/* import bootstrap mixins */
@import "../../../../../web/assets/bootstrap/less/mixins.less";
+/**
+ bricks index (user reserved area)
+
+ route: user_brick
+*/
+body.route-user_brick {
+ table#bricks-table {
+ border: 1px solid #CCC;
+
+ thead {
+ #gradient .vertical(#F8F8F8, #DEDEDE);
+ font-weight: bold;
+ }
+ tbody {
+ td#last_update {
+ font-size: 12px;
+ }
+ td#published { text-align: center;
+ a {
+ i.icon-published { color: #51A351; }
+ i.icon-not-published {
+ color: #CCC;
+ &:hover { color: #E94132; }
+ }
+ }
+ }
+ td#actions { text-align: center;
+ a {
+ color: #333;
+ margin-right: 4px;
+ }
+ }
+ }
+ }
+}
+
/**
create and edit a brick
@@ -26,6 +26,7 @@ brick:
content: content
preview: preview
confirm_deletion: "This operation cannot be undone. Confirm the deletion?"
+ actions: actions
help:
title:
@@ -25,6 +25,7 @@ brick:
content: contenido
preview: previsualización
confirm_deletion: "Esta operación no puede ser anulada. ¿Seguir?"
+ actions: acciones
help:
title:
@@ -25,6 +25,7 @@ brick:
content: contenuto
preview: anteprima
confirm_deletion: "Questa operazione non può essere annullata. Continuare?"
+ actions: azioni
help:
title:
@@ -1,4 +1,9 @@
-<form action="{{ path('user_brick_delete', {'id': id}) }}" method="post" {{ form_enctype(form) }} onSubmit="return confirm('{{ 'brick.confirm_deletion'|trans({}, 'UserBundle') }}');">
+{% set formId = 'form_user_brick_delete_'~id %}
+
+{# delete form #}
+<form id="{{ formId }}" style="display: none;" action="{{ path('user_brick_delete', {'id': id}) }}" method="post" {{ form_enctype(form) }} onSubmit="return confirm('{{ 'brick.confirm_deletion'|trans({}, 'UserBundle') }}');">
{{ form_widget(form) }}
- <button type="submit" class="btn btn-mini"><i class="icon-trash"></i> {{ 'delete'|trans }}</button>
-</form>
+</form>
+
+{# <a> tag with javascript submit() function #}
+<a href="javascript:void(0);" onClick="$('#{{ formId }}').submit();"><i class="icon-trash"></i></a>
@@ -5,37 +5,57 @@
<div class="row">
<div class="span12">
+ <a href="{{ path('user_brick_new') }}" class="btn btn-primary pull-right">
+ <i class="icon-check"></i> {{ 'brick.create_new_brick'|trans({}, 'UserBundle') }}
+ </a>
+
<h1>Bricks</h1>
- <table class="records_list table table-striped">
- <tbody>
- {% for entity in entities %}
+ <table id="bricks-table" class="records_list table table-striped">
+ <thead>
<tr>
<td>
- <a href="{{ path('user_brick_edit', { 'id': entity.id }) }}">{{ entity.title }}</a>
- <br>
- <i class="icon-calendar"></i> {{ 'brick.last_update'|trans }}: {{ entity.updatedat|date('Y-m-d H:i:s') }}
+ <i class="icon-book"></i> {{ 'brick.title'|trans|capitalize }}
</td>
<td>
- {% if (entity.published) %}
- <a href="{{ path('user_brick_toggle_published', { 'id': entity.id }) }}" class="btn btn-success"><i class="icon-ok-sign"></i> {{ 'brick.published'|trans|capitalize }}</a>
- {% else %}
- <a href="{{ path('user_brick_toggle_published', { 'id': entity.id }) }}" class="btn"><i class="icon-remove-sign"></i> {{ 'brick.not_published'|trans|capitalize }}</a>
- {% endif %}
+ <i class="icon-calendar"></i> {{ 'brick.last_update'|trans|capitalize }}
</td>
<td>
- <a href="{{ path('user_brick_edit', { 'id': entity.id }) }}" class="btn btn-mini"><i class="icon-edit"></i> {{ 'edit'|trans }}</a>
- {% render 'BricksUserBundle:Brick:_deleteForm' with {'id': entity.id} %}
+ <i class="icon-bullhorn"></i> {{ 'brick.published'|trans|capitalize }}
+ </td>
+ <td>
+ <i class="icon-reorder"></i> {{ 'brick.actions'|trans({}, 'UserBundle')|capitalize }}
</td>
</tr>
- {% endfor %}
+ </thead>
+ <tbody>
+ {% for entity in entities %}
+ <tr>
+ <td>
+ <a href="{{ path('user_brick_edit', { 'id': entity.id }) }}">{{ entity.title }}</a>
+ </td>
+ <td id="last_update">
+ {{ entity.updatedat|date('H:i:s | d M Y') }}
+ </td>
+ <td id="published">
+ <a href="{{ path('user_brick_toggle_published', { 'id': entity.id }) }}">
+ {% if (entity.published) %}
+ <i class="icon-published icon-ok"></i>
+ {% else %}
+ <i class="icon-not-published icon-remove"></i>
+ {% endif %}
+ </a>
+ </td>
+ <td id="actions">
+ <a href="{{ path('user_brick_edit', { 'id': entity.id }) }}" ><i class="icon-edit"></i></a>
+ {% render 'BricksUserBundle:Brick:_deleteForm' with {'id': entity.id} %}
+ </td>
+ </tr>
+ {% endfor %}
</tbody>
</table>
- <a href="{{ path('user_brick_new') }}" class="btn btn-primary">
- <i class="icon-check"></i> {{ 'brick.create_new_brick'|trans({}, 'UserBundle') }}
- </a>
</div>
</div>
-{% endblock %}
+{% endblock %}

0 comments on commit d5c0862

Please sign in to comment.