Mailinglist Archive: yast-devel (126 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] <web-client> master : Better indentation
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Tue, 24 Nov 2009 12:39:24 +0100
  • Message-id: <200911241239.24438.jreidinger@xxxxxxx>
Klaus KXXmpf write:
ref: refs/heads/master
commit d1e9f121df16fe85120b62f0d961c276e5013234
Author: Klaus Kأ¤mpf <kkaempf@xxxxxxx>
Date: Tue Nov 24 11:16:12 2009 +0100

Better indentation
---
webclient/app/views/layouts/main.rhtml | 64
++++++++++++++++--------------- 1 files changed, 33 insertions(+), 31
deletions(-)

diff --git a/webclient/app/views/layouts/main.rhtml
b/webclient/app/views/layouts/main.rhtml index 6e5f44f..cd161be 100644
--- a/webclient/app/views/layouts/main.rhtml
+++ b/webclient/app/views/layouts/main.rhtml
@@ -48,19 +48,19 @@
<h1><%= _("My Appliance") %></h1>

<div id="login-wrapper">
- <% host = Host.find(session[:host]) rescue nil
- user = session[:user]
- if host.blank? || user.blank? -%>
- <% else -%>
- <ul>
- <li><%=_("Connected host:")%> <strong><%= host.name
-%></strong></li> - <li><%=_("User:")%> <strong><%= user
-%></strong></li>
- </ul>
- <ul class='header-links'>
- <li><em><%= link_to _("Control panel"),
'/controlpanel'%></em></li> - <li><em><%= link_to _("Logout"),
'/logout' %></em></li> - </ul>
- <% end -%>
+ <% host = Host.find(session[:host]) rescue nil
+ user = session[:user]
+ if host.blank? || user.blank? -%>
+ <% else -%>

Ugh, WTF (I know that klaus doesn't write that code)? use unless and then see
if ... which do nothing and immediately else if really not good practice.


+ <ul>
+ <li><%=_("Connected host:")%> <strong><%= host.name
-%></strong></li> + <li><%=_("User:")%> <strong><%= user
-%></strong></li> + </ul>
+ <ul class='header-links'>
+ <li><em><%= link_to _("Control panel"),
'/controlpanel'%></em></li> + <li><em><%= link_to _("Logout"),
'/logout' %></em></li> + </ul>
+ <% end -%>
</div>
</div>

@@ -68,33 +68,35 @@

<!-- here both flash and dynamic notifications should be added -->
<div id="flash-messages" class="grid_12 alpha">
- <div id="language_selection"></div>
- <!-- show the flash messages -->
+ <div id="language_selection"></div>
+ <!-- show the flash messages -->

- <% flash.each do |flash_type, message| %>
- <%
- flash_icon = case flash_type
- when :error then "ui-icon-alert"
- else "ui-icon-info"
- end
- flash_style = case flash_type
- when :error then "ui-state-error"
- else "ui-state-highlight"
- end
- %>
+ <% flash.each do |flash_type, message| %>
+ <%
+ flash_icon = case flash_type
+ when :error then "ui-icon-alert"
+ else "ui-icon-info"
+ end
+ flash_style = case flash_type
+ when :error then "ui-state-error"
+ else "ui-state-highlight"
+ end
+ %>

- <div class="flash-message <%= flash_style %> ui-corner-all
grid_12"> - <p><span class="ui-icon <%= flash_icon
%>"></span><strong><%= message %></strong></p> - </div>
- <% flash.delete flash_type -%>
- <% end %>
+ <div class="flash-message <%= flash_style %> ui-corner-all
grid_12"> + <p><span class="ui-icon <%= flash_icon
%>"></span><strong><%= message %></strong></p> + </div>
+ <% flash.delete flash_type -%>
+ <% end %>
</div> <!-- flash messages -->
+
<div id="progress" style="display: none;">
<%= image_tag("/images/working.gif") %><%=_("...Wait...")%>
</div>

<%= yield %>
</div>
+
<div id="footer" class="container_12">
<div class="copy">&copy; 2009 Novell, Inc.</div>
</div>


--
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast
(language,time,basesystem,ntp)
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages