Skip to content

Commit

Permalink
Use new Ruby hash syntax in templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef Stribny committed Oct 4, 2015
1 parent ac08c77 commit 032068e
Show file tree
Hide file tree
Showing 18 changed files with 35 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ Rake::TestTask.new(:test) do |t|
end


task :default => :test
task default: :test
6 changes: 3 additions & 3 deletions app/views/invoice_bar/accounts/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= form_for(@account) do |f| %>
<%= render 'invoice_bar/forms/errors', :model => @account %>
<%= render 'invoice_bar/forms/errors', model: @account %>
<div class="control-group">
<%= f.label :name, t('attributes.account.name') %>
<%= f.text_field :name, placeholder: t('attributes.account.name'), class: 'suggested' %>
Expand All @@ -15,7 +15,7 @@
<div class="control-group">
<%= f.label :swift, t('attributes.account.swift') %>
<%= f.text_field :swift, placeholder: t('attributes.account.swift') %>
</div>
</div>
<div class="control-group">
<%= f.label :currency_id, t('attributes.account.currency_id') %>
<%= f.collection_select :currency_id, @currencies, :id, :name %>
Expand All @@ -26,4 +26,4 @@
</div>
<%= f.hidden_field :user_id %>
<%= f.submit t('buttons.save'), class: 'btn btn-primary' %>
<% end %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/invoice_bar/contacts/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= form_for @contact do |f| %>
<%= render 'invoice_bar/forms/errors', :model => @contact %>
<%= render 'invoice_bar/forms/errors', model: @contact %>
<div class="row">
<div class="span4 fixmax4">
<div class="control-group">
Expand All @@ -16,7 +16,7 @@
</div>
</div>
<div class="span4 fixmax4">
<div class="control-group">
<div class="control-group">
<%= f.label :email, t('attributes.contact.email') %>
<%= f.text_field :email, placeholder: t('attributes.contact.email') %>
</div>
Expand All @@ -41,4 +41,4 @@
</div>
<%= f.hidden_field :user_id %>
<%= f.submit t('buttons.save'), class: 'btn btn-primary' %>
<% end %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/invoice_bar/currencies/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<%= form_for(@currency) do |f| %>
<%= render 'invoice_bar/forms/errors', :model => @currency %>
<%= render 'invoice_bar/forms/errors', model: @currency %>
<div class="control-group">
<%= f.label :name, t('attributes.currency.name') %>
<%= f.text_field :name, class: 'suggested', placeholder: t('attributes.currency.name') %>
Expand All @@ -13,4 +13,4 @@
<%= f.text_field :priority, placeholder: t('attributes.currency.priority') %>
</div>
<%= f.submit t('buttons.save'), class: 'btn btn-primary' %>
<% end %>
<% end %>
4 changes: 2 additions & 2 deletions app/views/invoice_bar/documents/_show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@
<br>
<span>Forma uhrady:</span> <% if document.account_bank_account_number.blank? %>Hotově<% else %>převodem na účet<% end %>
<br>
<span><%= t('attributes.invoice.issue_date') %>:</span> <%= l(document.issue_date, :format => :invoice) unless document.issue_date.blank? %><br>
<span><%= t('attributes.invoice.issue_date') %>:</span> <%= l(document.issue_date, format: :invoice) unless document.issue_date.blank? %><br>
<% if document.instance_of? InvoiceBar::Invoice or document.instance_of? InvoiceBar::InvoiceTemplate %>
<span><%= t('attributes.invoice.due_date') %>:</span> <strong><%= l(document.due_date, :format => :invoice) unless document.due_date.blank? %></strong>
<span><%= t('attributes.invoice.due_date') %>:</span> <strong><%= l(document.due_date, format: :invoice) unless document.due_date.blank? %></strong>
<% end %>
</fieldset>
</div>
Expand Down
13 changes: 5 additions & 8 deletions app/views/invoice_bar/forms/_document.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<%# Form for invoices, bills and receipts %>
<%= nested_form_for(document) do |f| %>
<%= render 'invoice_bar/forms/errors', :model => document %>
<%= render 'invoice_bar/forms/errors', model: document %>
<% if document.instance_of? InvoiceBar::Invoice or document.instance_of? InvoiceBar::Receipt %>
<div id="prefill-form" class="row" style="display:none">
<div class="span4 fixmax4">
<div class="control-group">
<div class="control-group">
<%= label_tag :template_ids, I18n.t('attributes.invoice_template.name')%>
<% if document.instance_of? InvoiceBar::Invoice %>
<%= select_tag :template_ids, options_from_collection_for_select(@invoice_templates, :id, :name), multiple: true %>
Expand Down Expand Up @@ -44,7 +42,6 @@
</div>
<% end %>
<% if document.instance_of? InvoiceBar::Invoice or document.instance_of? InvoiceBar::Receipt %>
<% if (@invoice_templates && @invoice_templates.size != 0) || (@receipt_templates && @receipt_templates.size != 0) %>
<div class="span4 fixmax4">
<div class="btn-group">
Expand Down Expand Up @@ -91,7 +88,7 @@
Výdaj
</label>
</div>
</div>
</div>
<% end %>
</div>

Expand Down Expand Up @@ -124,8 +121,8 @@
</div>

<%# Links and buttons %>
<div style="row">
<div style="row">
<%= f.link_to_add I18n.t('links.new_item'), :items %>
<%= f.submit I18n.t('buttons.save'), class: 'btn btn-primary' %>
</div>
<% end %>
<% end %>
3 changes: 1 addition & 2 deletions app/views/invoice_bar/invoice_templates/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<%= render partial: 'invoice_bar/forms/document', locals: { :document => @invoice_template } %>

<%= render partial: 'invoice_bar/forms/document', locals: { document: @invoice_template } %>
2 changes: 1 addition & 1 deletion app/views/invoice_bar/invoice_templates/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h1><%= t('links.new_invoice_template') %></h1>

<%= render partial: 'invoice_bar/forms/document', locals: { :document => @invoice_template } %>
<%= render partial: 'invoice_bar/forms/document', locals: { document: @invoice_template } %>
2 changes: 1 addition & 1 deletion app/views/invoice_bar/invoices/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: 'invoice_bar/forms/document', locals: { :document => @invoice } %>
<%= render partial: 'invoice_bar/forms/document', locals: { document: @invoice } %>
3 changes: 1 addition & 2 deletions app/views/invoice_bar/invoices/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<h1><%= t('links.new_invoice') %></h1>

<%= render 'invoice_bar/forms/document', :document => @invoice %>

<%= render 'invoice_bar/forms/document', document: @invoice %>
4 changes: 2 additions & 2 deletions app/views/invoice_bar/layouts/_messages.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% if msg.is_a?(String) %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<a class="close" data-dismiss="alert">&#215;</a>
<%= content_tag :div, msg, :id => "flash_#{name}" %>
<%= content_tag :div, msg, id: "flash_#{name}" %>
</div>
<% end %>
<% end %>
<% end %>
2 changes: 1 addition & 1 deletion app/views/invoice_bar/receipt_templates/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: 'invoice_bar/forms/document', locals: { :document => @receipt_template } %>
<%= render partial: 'invoice_bar/forms/document', locals: { document: @receipt_template } %>
2 changes: 1 addition & 1 deletion app/views/invoice_bar/receipt_templates/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h1><%= t('links.new_receipt_template') %></h1>

<%= render partial: 'invoice_bar/forms/document', locals: { :document => @receipt_template } %>
<%= render partial: 'invoice_bar/forms/document', locals: { document: @receipt_template } %>
2 changes: 1 addition & 1 deletion app/views/invoice_bar/receipts/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%= render partial: 'invoice_bar/forms/document', locals: { :document => @receipt } %>
<%= render partial: 'invoice_bar/forms/document', locals: { document: @receipt } %>
3 changes: 1 addition & 2 deletions app/views/invoice_bar/receipts/new.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<h1><%= t('links.new_receipt') %></h1>

<%= render 'invoice_bar/forms/document', :document => @receipt %>

<%= render 'invoice_bar/forms/document', document: @receipt %>
4 changes: 2 additions & 2 deletions app/views/invoice_bar/settings/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<h1>Nastavení</h1>
<div class="row">
<%= form_for @user do |f| %>
<%= render 'invoice_bar/forms/errors', :model => @user %>
<%= render 'invoice_bar/forms/errors', model: @user %>

<div class="span3">
<h4>Konto</h4>
Expand Down Expand Up @@ -34,4 +34,4 @@
</div>
<% end %>
</div>
</div>
</div>
9 changes: 4 additions & 5 deletions app/views/invoice_bar/users/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<%= form_for @user, :class => 'form-horizontal' do |f| %>
<%= render 'invoice_bar/forms/errors', :model => @user %>

<%= form_for @user, class: 'form-horizontal' do |f| %>
<%= render 'invoice_bar/forms/errors', model: @user %>
<div class="span3">
<h4>Konto</h4>
<div class="control-group">
Expand All @@ -27,6 +26,6 @@
end -%>
</div>
<div class="span10">
<%= f.submit I18n.t('buttons.signup'), :class => 'btn' %>
<%= f.submit I18n.t('buttons.signup'), class: 'btn' %>
</div>
<% end %>
<% end %>
6 changes: 3 additions & 3 deletions app/views/invoice_bar/users/signup.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ul>
</div>
<% end %>

<div class="field">
<%= f.label :email, I18n.t('attributes.user.email') %>
<%= f.text_field :email %>
Expand All @@ -20,6 +20,6 @@
<%= f.label :password, I18n.t('attributes.user.password') %>
<%= f.text_field :password %>
</div>
<%= f.submit I18n.t('buttons.signup'), :class => 'main' %>
<%= f.submit I18n.t('buttons.signup'), class: 'main' %>
<% end %>
</div>
</div>

0 comments on commit 032068e

Please sign in to comment.