Got logs working for users and bikes

Not my best work, but it works, need to add transactions, need to add edit/show actions
This commit is contained in:
Jason Denney
2012-12-14 00:03:11 -05:00
parent b2eefd8163
commit c98c53de76
16 changed files with 378 additions and 54 deletions
@@ -0,0 +1,47 @@
= form_for @log, :html => { :class => 'form-horizontal' }, :url => @loggable_path do |f|
- if @log.loggable_type or @log.loggable_id
= f.hidden_field :loggable_id, :class => 'number_field'
= f.hidden_field :loggable_type, :class => 'text_field'
= f.hidden_field :logger_id, :class => 'number_field'
= f.hidden_field :logger_type, :class => 'text_field'
= f.hidden_field :context, :class => 'text_field'
- else
.control-group
= f.label :loggable_id, :class => 'control-label'
.controls
= f.number_field :loggable_id, :class => 'number_field'
.control-group
= f.label :loggable_type, :class => 'control-label'
.controls
= f.text_field :loggable_type, :class => 'text_field'
.control-group
= f.label :logger_id, :class => 'control-label'
.controls
= f.number_field :logger_id, :class => 'number_field'
.control-group
= f.label :logger_type, :class => 'control-label'
.controls
= f.text_field :logger_type, :class => 'text_field'
.control-group
= f.label :context, :class => 'control-label'
.controls
= f.text_field :context, :class => 'text_field'
.control-group
= f.label :start_date, :class => 'control-label'
.controls
= f.datetime_select :start_date, :class => 'datetime_select'
.control-group
= f.label :end_date, :class => 'control-label'
.controls
= f.datetime_select :end_date, :class => 'datetime_select'
.control-group
= f.label :description, :class => 'control-label'
.controls
= f.text_area :description, :class => 'text_area'
.control-group
= f.label :action_id, :class => 'control-label'
.controls
= f.number_field :action_id, :class => 'number_field'
.form-actions
= f.submit nil, :class => 'btn btn-primary'
= link_to t('.cancel', :default => t("helpers.links.cancel")), @loggable_path, :class => 'btn'
@@ -0,0 +1,36 @@
- model_class = ActsAsLoggable::Log.new.class
.page-header
%h1=t '.title', :default => model_class.model_name.human.pluralize
%table.table.table-striped
%thead
%tr
%th= model_class.human_attribute_name(:id)
%th= model_class.human_attribute_name(:loggable_id)
%th= model_class.human_attribute_name(:loggable_type)
%th= model_class.human_attribute_name(:logger_id)
%th= model_class.human_attribute_name(:logger_type)
%th= model_class.human_attribute_name(:context)
%th= model_class.human_attribute_name(:start_date)
%th= model_class.human_attribute_name(:end_date)
%th= model_class.human_attribute_name(:description)
%th= model_class.human_attribute_name(:action_id)
%th= model_class.human_attribute_name(:created_at)
%th=t '.actions', :default => t("helpers.actions")
%tbody
- @logs.each do |log|
%tr
%td= link_to log.id, acts_as_loggable_log_path(log)
%td= log.loggable_id
%td= log.loggable_type
%td= log.logger_id
%td= log.logger_type
%td= log.context
%td= log.start_date
%td= log.end_date
%td= log.description
%td= log.action
%td=l log.created_at
%td
= link_to t('.edit', :default => t("helpers.links.edit")), edit_acts_as_loggable_log_path(log), :class => 'btn btn-mini'
= link_to t('.destroy', :default => t("helpers.links.destroy")), acts_as_loggable_log_path(log), :method => :delete, :confirm => t('.confirm', :default => t("helpers.links.confirm", :default => 'Are you sure?')), :class => 'btn btn-mini btn-danger'
= link_to t('.new', :default => t("helpers.links.new")), "#{@loggable_path}/new", :class => 'btn btn-primary'
@@ -0,0 +1,4 @@
- model_class = @log.class
.page-header
%h1=t '.title', :default => t('helpers.titles.new', :model => model_class.model_name.human, :default => "New #{model_class.model_name.human}")
= render :partial => "form"