Skip to content

Commit

Permalink
add delete accounts to user profile
Browse files Browse the repository at this point in the history
  • Loading branch information
ishmael committed Dec 1, 2010
1 parent 8203bca commit 49dac2e
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/controllers/bankaccounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ def destroy

respond_to do |format|
flash[:notice] = I18n.t('layout.bankaccounts.delete_message') % [@bankaccount.name,@bankaccount.number,@bankaccount.bank]
format.html { redirect_to(bankaccounts_url) }
format.iphone { redirect_to(bankaccounts_url) }
format.html { redirect_to(dashboard_url) }
format.iphone { redirect_to(dashboard_url) }
end
else
redirect_to(dashboard_url)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/creditcardaccounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def destroy

respond_to do |format|
flash[:notice] = I18n.t('layout.creditcardaccounts.delete_message') % [@creditcardaccount.name,@creditcardaccount.number,@creditcardaccount.bank]
format.html { redirect_to(creditcardaccounts_url) }
format.html { redirect_to(dashboard_url) }
end
else
redirect_to(dashboard_url)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/loanaccounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def destroy

respond_to do |format|
flash[:notice] = I18n.t('layout.loanaccounts.delete_message') % [@loanaccount.name,@loanaccount.number,@loanaccount.bank]
format.html { redirect_to(bankaccounts_url) }
format.html { redirect_to(dashboard_url) }
end
end

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def create

def show
@user = @current_user
add_breadcrumb I18n.t('layout.application.settings'), account_path
@user_accounts = @current_user.accounts.find(:all)
add_breadcrumb I18n.t('layout.application.settings'), account_path
respond_to do |format|
format.html # show.html.erb
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/charts/_balance_by_year.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ categories = Array.new

@year_data = Movement.data_by_year(:all, :conditions => ["accounts_users.user_id= :id and movements.movdate BETWEEN :from AND :to and accounts.currency = :currency",{:id => @current_user.id, :from => Time.now.beginning_of_year, :to => Time.now.end_of_year,:currency =>currency}] )
accounts_info = Account.find_by_sql(["select accounts.id ,accounts.name,accounts.color,accounts.currency,accounts.balance_in_cents,(select sum(movements.amount_in_cents* movements.mov_type) from movements
where movements.account_id= accounts.id and movements.movdate < ?) starting_balance
where movements.account_id= accounts.id and movements.movdate < ?) as starting_balance
from accounts,
accounts_users
where accounts_users.account_id = accounts.id
Expand Down
2 changes: 1 addition & 1 deletion app/views/dashboard/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
</tr><% end %>
</tbody>
</table>
</div>
</div>
</div>
<div id="movements_content" class="box box-100 cr-all">
<div id="charts_movements" class="yui-navset ">
Expand Down
43 changes: 42 additions & 1 deletion app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="box box-50 cr-all">
<div class="box box-first box-50 cr-all">
<div class="header cr-top">
<h3><%= I18n.t('layout.users.title') %></h3>
<%= link_to I18n.t('layout.application.edit'), edit_account_path ,:class => 'phosney-button phosney-header-button' %>
Expand All @@ -11,4 +11,45 @@
<dd><%=h @user.email%></dd>
</dl>
</div>
</div>
<div class="box box-last box-50 cr-all" style="vertical-align:top;">
<div class="header cr-top">
<h3>
<%= I18n.t('layout.bankaccounts.tagline') %>
</h3>
</div>
<div class="content cr-bottom">
<table cellspacing="0">
<thead>
<tr>
<th class="first">
<%= I18n.t('layout.bankaccounts.name') %>
</th>
<td class="last">
<%= I18n.t('layout.bankaccounts.accountbank') %>
</td>
<td class="tc last actions"><%= I18n.t('layout.application.actions') %></td>
</tr>
</thead>
<tbody>
<% @user_accounts.each_with_index do |account,i| %>
<tr class="<% if i == 0 %>first<% else %><%= cycle('even', 'odd',:name=> "accounts") %><% end%>">
<th class="first">
<%=h account.name %>
</th>
<td class="tr">
<%= account.bank %>
</td>
<td class="tc last">
<ul class="actions">
<li>
<%= link_to image_tag("/images/led-ico/delete.png",:alt =>I18n.t('layout.application.delete')), polymorphic_path(account) , {:confirm => I18n.t('layout.application.deletemessage'), :method => :delete ,:class => 'ico' , :title => I18n.t('layout.application.delete')} %>
</li>

</ul>
</td>
</tr>
<% end %>
</table>
</div>
</div>
2 changes: 1 addition & 1 deletion public/stylesheets/main-min.css

Large diffs are not rendered by default.

0 comments on commit 49dac2e

Please sign in to comment.