Add listing and showing of old versions
This commit is contained in:
parent
f7adce658e
commit
73d5f36357
10 changed files with 87 additions and 0 deletions
3
app/assets/javascripts/admin/versions.coffee
Normal file
3
app/assets/javascripts/admin/versions.coffee
Normal 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/
|
3
app/assets/stylesheets/admin/versions.scss
Normal file
3
app/assets/stylesheets/admin/versions.scss
Normal 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/
|
|
@ -32,6 +32,8 @@ class Admin::CardsController < Admin::BaseController
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
authorize @card
|
authorize @card
|
||||||
|
|
||||||
|
@versions = @card.versions
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|
16
app/controllers/admin/versions_controller.rb
Normal file
16
app/controllers/admin/versions_controller.rb
Normal 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
|
2
app/helpers/admin/versions_helper.rb
Normal file
2
app/helpers/admin/versions_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module Admin::VersionsHelper
|
||||||
|
end
|
|
@ -1 +1,3 @@
|
||||||
== render 'form'
|
== render 'form'
|
||||||
|
|
||||||
|
== render 'admin/versions/list', versions: @versions
|
||||||
|
|
42
app/views/admin/cards/show.html.slim
Normal file
42
app/views/admin/cards/show.html.slim
Normal 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
|
16
app/views/admin/versions/_list.html.slim
Normal file
16
app/views/admin/versions/_list.html.slim
Normal 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
|
0
app/views/admin/versions/show.html.slim
Normal file
0
app/views/admin/versions/show.html.slim
Normal file
|
@ -22,6 +22,7 @@ Rails.application.routes.draw do
|
||||||
resources :super_attacks
|
resources :super_attacks
|
||||||
resources :types
|
resources :types
|
||||||
resources :users, except: [:new, :create]
|
resources :users, except: [:new, :create]
|
||||||
|
resources :versions, only: [:show]
|
||||||
end
|
end
|
||||||
|
|
||||||
namespace :api do
|
namespace :api do
|
||||||
|
|
Loading…
Reference in a new issue