1
0
Fork 0

Add listing and showing of old versions

This commit is contained in:
Andrew Tomaka 2015-10-13 16:38:33 -04:00
parent f7adce658e
commit 73d5f36357
10 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View file

@ -0,0 +1,3 @@
// Place all the styles related to the Admin::Versions controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -32,6 +32,8 @@ class Admin::CardsController < Admin::BaseController
def edit
authorize @card
@versions = @card.versions
end
def update

View file

@ -0,0 +1,16 @@
class Admin::VersionsController < Admin::BaseController
before_action :set_version, only: [:show]
def show
type = @version.class.to_s.underscore
instance_variable_set('@' + type, @version)
render "admin/#{type.pluralize}/show"
end
private
def set_version
@version = PaperTrail::Version.find(params[:id]).reify
end
end

View file

@ -0,0 +1,2 @@
module Admin::VersionsHelper
end

View file

@ -1 +1,3 @@
== render 'form'
== render 'admin/versions/list', versions: @versions

View file

@ -0,0 +1,42 @@
.row
.col-md-4
strong Game ID Number:
= @card.gameid
.col-md-4
strong Title:
= @card.title
.col-md-4
strong Character:
= @card.character.name
.row
.col-md-4
strong Rarity:
= @card.rarity.name
.col-md-4
strong Type:
= @card.type.name
.col-md-4
strong Awaken Type:
= @card.awaken_type.name
.row
.col-md-6
strong Leader Skill:
= @card.leader_skill.description
.col-md-6
strong Passive Skill:
= @card.passive_skill.name
.row
.col-md-12
strong Super Attack:
= "#{@card.super_attack.name} - #{@card.super_attack.description}"
.row
.col-md-6
strong Dokkan Card:
- if @card.dokkan_card
= @card.dokkan_card.full_name
.row
.col-md-12
strong Links:
ul
- @card.links.each do |link|
li= link.name

View file

@ -0,0 +1,16 @@
.row
.col-md-12
table.table.table-striped.table-hover
thead
tr
th ID
th Event
th Date
th Modified By
tbody
- versions.each do |version|
tr
td= link_to version.id, admin_version_path(version)
td= version.event
td= version.created_at
td= User.find(version.version_author).nickname

View file

View file

@ -22,6 +22,7 @@ Rails.application.routes.draw do
resources :super_attacks
resources :types
resources :users, except: [:new, :create]
resources :versions, only: [:show]
end
namespace :api do