diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml new file mode 100644 index 0000000000000000000000000000000000000000..408aae82a148e0a5490ee44f942a567e5ffd924c --- /dev/null +++ b/app/views/layouts/application.rhtml @@ -0,0 +1,24 @@ +<html> +<head> + <title><%= @heading %></title> + <%= stylesheet_link_tag 'scaffold' %> +</head> +<body> + +<p style="color: green"><%= flash[:notice] %></p> + +<h1><%= @heading %></h1> +<%= @content_for_layout %> + +<p/> +<% if not @back.nil? %> + <% if not @back_page.nil? %> + <%= link_to 'Back', :action => @back, :page => @back_page %> + <% else %> + <%= link_to 'Back', :action => @back %> + <% end %> +<% end %> +<br /> + +</body> +</html> diff --git a/app/views/layouts/recurring_items.rhtml b/app/views/layouts/recurring_items.rhtml deleted file mode 100644 index fc6177ba1d3a5a560a71b4c854e7a0528a5574a8..0000000000000000000000000000000000000000 --- a/app/views/layouts/recurring_items.rhtml +++ /dev/null @@ -1,13 +0,0 @@ -<html> -<head> - <title>RecurringItems: <%= controller.action_name %></title> - <%= stylesheet_link_tag 'scaffold' %> -</head> -<body> - -<p style="color: green"><%= flash[:notice] %></p> - -<%= @content_for_layout %> - -</body> -</html> diff --git a/app/views/layouts/schedules.rhtml b/app/views/layouts/schedules.rhtml deleted file mode 100644 index af23b3aecb872fd717f3bbacdfde1c04026ebe91..0000000000000000000000000000000000000000 --- a/app/views/layouts/schedules.rhtml +++ /dev/null @@ -1,13 +0,0 @@ -<html> -<head> - <title>Schedules: <%= controller.action_name %></title> - <%= stylesheet_link_tag 'scaffold' %> -</head> -<body> - -<p style="color: green"><%= flash[:notice] %></p> - -<%= @content_for_layout %> - -</body> -</html> diff --git a/app/views/recurring_items/_list.rhtml b/app/views/recurring_items/_list.rhtml new file mode 100644 index 0000000000000000000000000000000000000000..8c2492e66bf003682a134d8ead6b54104cfe4111 --- /dev/null +++ b/app/views/recurring_items/_list.rhtml @@ -0,0 +1,55 @@ +<% ignored_columns = ["created_on", "updated_on"] %> +<% sorted_columns = ["schedule_id"] %> + +<% for column in RecurringItems.content_columns %> + <% if not (ignored_columns + sorted_columns).include?(column.name) %> + <% sorted_columns << column.name %> + <% end %> +<% end %> + +<table border="1"> + <tr> + <th colspan="2"> </th> + <% for column_name in sorted_columns %> + <th><%= RecurringItems.columns_hash[column_name].human_name %></th> + <%end%> + <th> </th> + </tr> + +<% for recurring_item in @recurring_items %> + <tr class="<%= if recurring_item["amount"] < 0 then "debet" else "credit" end %>"> + <td><%= link_to 'Edit', :action => 'edit', :id => recurring_item %></td> + <td><%= link_to 'Show', :action => 'show', :id => recurring_item %></td> + + <% for column_name in sorted_columns %> + <td class="<%= column_name %>"> + <% case column_name + when "startdate": %> + <%= recurring_item["startdate"].strftime("%Y-%m-%d") %> + <% when "enddate": %> + <% if recurring_item["enddate"].nil? %> + --- + <% else %> + <%= recurring_item["startdate"].strftime("%Y-%m-%d") %> + <% end %> + <% when "schedule_id": %> + <% if recurring_item.schedule.nil? %> + + <% else %> + <%=h recurring_item.schedule.name %> + <% end %> + <% else %> + <% if recurring_item[column_name].to_s != "" %> + <%=h recurring_item.send(column_name) %> + <% else %> + + <% end %> + <% end %> + </td> + <% end %> + + <td><%= link_to 'Destroy', { :action => 'destroy', :id => recurring_item }, :confirm => 'Are you sure?', :post => true %></td> + + </tr> +<% end %> +</table> diff --git a/app/views/recurring_items/edit.rhtml b/app/views/recurring_items/edit.rhtml index 4ec015c6abb48c5f181133cce8b75edd48abc30a..4ee50d0a27aa2971a3e75993ae90347e04fb42a1 100644 --- a/app/views/recurring_items/edit.rhtml +++ b/app/views/recurring_items/edit.rhtml @@ -1,4 +1,4 @@ -<h1>Editing recurring_items</h1> +<% @heading = "Editing recurring_items" %> <%= start_form_tag :action => 'update', :id => @recurring_items %> <%= render :partial => 'form' %> diff --git a/app/views/recurring_items/list.rhtml b/app/views/recurring_items/list.rhtml index e63673dce2330327edc8a3f992d05b84b6f4560a..21096f2e64d94965d190b15fab171d8df0072776 100644 --- a/app/views/recurring_items/list.rhtml +++ b/app/views/recurring_items/list.rhtml @@ -1,27 +1,10 @@ -<h1>Listing recurring_items</h1> +<% @heading = "Listing recurring_items" %> -<table> - <tr> - <% for column in RecurringItems.content_columns %> - <th><%= column.human_name %></th> - <% end %> - </tr> - -<% for recurring_items in @recurring_items %> - <tr> - <% for column in RecurringItems.content_columns %> - <td><%=h recurring_items.send(column.name) %></td> - <% end %> - <td><%= link_to 'Show', :action => 'show', :id => recurring_items %></td> - <td><%= link_to 'Edit', :action => 'edit', :id => recurring_items %></td> - <td><%= link_to 'Destroy', { :action => 'destroy', :id => recurring_items }, :confirm => 'Are you sure?', :post => true %></td> - </tr> -<% end %> -</table> +<%= render :partial => 'list' %> <%= link_to 'Previous page', { :page => @recurring_items_pages.current.previous } if @recurring_items_pages.current.previous %> <%= link_to 'Next page', { :page => @recurring_items_pages.current.next } if @recurring_items_pages.current.next %> <br /> -<%= link_to 'New recurring_items', :action => 'new' %> +<%= link_to 'New recurring_item', :action => 'new' %> diff --git a/app/views/recurring_items/new.rhtml b/app/views/recurring_items/new.rhtml index c6b1bbba6e34fe75d51eee402fd9457084de47e3..daa51ff7ac6bbce4adedd4d8b7d2b7504a1bf201 100644 --- a/app/views/recurring_items/new.rhtml +++ b/app/views/recurring_items/new.rhtml @@ -1,4 +1,4 @@ -<h1>New recurring_items</h1> +<% @heading = "New recurring_item" %> <%= start_form_tag :action => 'create' %> <%= render :partial => 'form' %> diff --git a/app/views/recurring_items/show.rhtml b/app/views/recurring_items/show.rhtml index 8ce83ad2f8a93580da1d26997971ef00d8672658..66030352d4839fbb7a9f095441d4d193b1177e63 100644 --- a/app/views/recurring_items/show.rhtml +++ b/app/views/recurring_items/show.rhtml @@ -1,3 +1,5 @@ +<% @heading = "Showing recurring_item" %> + <% for column in RecurringItems.content_columns %> <p> <b><%= column.human_name %>:</b> <%=h @recurring_items.send(column.name) %> diff --git a/app/views/schedules/edit.rhtml b/app/views/schedules/edit.rhtml index d65c92df718315dc129323e2b506a51f4a601e18..c624eb9edab0046adbb35d90203843ea0c1adbb1 100644 --- a/app/views/schedules/edit.rhtml +++ b/app/views/schedules/edit.rhtml @@ -1,4 +1,4 @@ -<h1>Editing schedules</h1> +<% @heading = "Editing schedule" %> <%= start_form_tag :action => 'update', :id => @schedules %> <%= render :partial => 'form' %> diff --git a/app/views/schedules/list.rhtml b/app/views/schedules/list.rhtml index 546c15da8b0d6059977b4f0c958d0f5fd6ae1f06..2486d890c291fde24a96d00f999a4dc331ce0122 100644 --- a/app/views/schedules/list.rhtml +++ b/app/views/schedules/list.rhtml @@ -1,4 +1,4 @@ -<h1>Listing schedules</h1> +<% @heading = "Listing schedules" %> <table> <tr> diff --git a/app/views/schedules/new.rhtml b/app/views/schedules/new.rhtml index fd1eec83eef7eb1041636746d564ec22dbcecbe5..fedc8a9a313cf5590e6a455c2228264b84bca3d7 100644 --- a/app/views/schedules/new.rhtml +++ b/app/views/schedules/new.rhtml @@ -1,4 +1,4 @@ -<h1>New schedules</h1> +<% @heading = "New schedule" %> <%= start_form_tag :action => 'create' %> <%= render :partial => 'form' %> diff --git a/app/views/schedules/show.rhtml b/app/views/schedules/show.rhtml index f58027f53579c90725e12910ac3ea5a7d8d48e01..2f2bd9c1b486ddd9a1f8555fce8b898b95156c83 100644 --- a/app/views/schedules/show.rhtml +++ b/app/views/schedules/show.rhtml @@ -1,3 +1,5 @@ +<% @heading = "Show schedule" %> + <% for column in Schedules.content_columns %> <p> <b><%= column.human_name %>:</b> <%=h @schedules.send(column.name) %>