Create admin namespace for data admin
This commit is contained in:
parent
90ebcdf06b
commit
215c989806
82 changed files with 201 additions and 138 deletions
3
app/assets/javascripts/admin/users.coffee
Normal file
3
app/assets/javascripts/admin/users.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/dashboard.scss
Normal file
3
app/assets/stylesheets/admin/dashboard.scss
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Place all the styles related to the Admin::Dashboard controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
|
@ -5,3 +5,7 @@
|
|||
.control-icon {
|
||||
padding: 0 3px 0 3px;
|
||||
}
|
||||
|
||||
.no-margin {
|
||||
margin-bottom: 0px !important;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class AwakenTypesController < ApplicationController
|
||||
class Admin::AwakenTypesController < Admin::BaseController
|
||||
before_action :set_awaken_type, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class AwakenTypesController < ApplicationController
|
|||
authorize @awaken_type
|
||||
|
||||
if @awaken_type.save
|
||||
redirect_to awaken_types_path, notice: 'Awaken Type was created'
|
||||
redirect_to admin_awaken_types_path, notice: 'Awaken Type was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class AwakenTypesController < ApplicationController
|
|||
authorize @awaken_type
|
||||
|
||||
if @awaken_type.update(awaken_type_params)
|
||||
redirect_to awaken_types_path, notice: 'Awaken Type was updated'
|
||||
redirect_to admin_awaken_types_path, notice: 'Awaken Type was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -47,7 +47,7 @@ class AwakenTypesController < ApplicationController
|
|||
def destroy
|
||||
@awaken_type.destroy
|
||||
|
||||
redirect_to awaken_types_path, notice: 'Awaken Type was deleted'
|
||||
redirect_to admin_awaken_types_path, notice: 'Awaken Type was deleted'
|
||||
end
|
||||
|
||||
private
|
3
app/controllers/admin/base_controller.rb
Normal file
3
app/controllers/admin/base_controller.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Admin::BaseController < ApplicationController
|
||||
layout 'admin'
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class CardsController < ApplicationController
|
||||
class Admin::CardsController < Admin::BaseController
|
||||
before_action :set_card, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class CardsController < ApplicationController
|
|||
authorize @card
|
||||
|
||||
if @card.save
|
||||
redirect_to cards_path, notice: 'Card was created'
|
||||
redirect_to admin_cards_path, notice: 'Card was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class CardsController < ApplicationController
|
|||
authorize @card
|
||||
|
||||
if @card.update(card_params)
|
||||
redirect_to cards_path, notice: 'Card was updated'
|
||||
redirect_to admin_cards_path, notice: 'Card was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class CardsController < ApplicationController
|
|||
|
||||
@card.destroy
|
||||
|
||||
redirect_to cards_path, notice: 'Card was deleted'
|
||||
redirect_to admin_cards_path, notice: 'Card was deleted'
|
||||
end
|
||||
|
||||
private
|
|
@ -1,4 +1,4 @@
|
|||
class CharactersController < ApplicationController
|
||||
class Admin::CharactersController < Admin::BaseController
|
||||
before_action :set_character, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class CharactersController < ApplicationController
|
|||
authorize @character
|
||||
|
||||
if @character.save
|
||||
redirect_to characters_path, notice: 'Character was created'
|
||||
redirect_to admin_characters_path, notice: 'Character was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class CharactersController < ApplicationController
|
|||
authorize @character
|
||||
|
||||
if @character.update(character_params)
|
||||
redirect_to characters_path, notice: 'Character was updated'
|
||||
redirect_to admin_characters_path, notice: 'Character was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class CharactersController < ApplicationController
|
|||
|
||||
@character.destroy
|
||||
|
||||
redirect_to characters_path, notice: 'Character was deleted'
|
||||
redirect_to admin_characters_path, notice: 'Character was deleted'
|
||||
end
|
||||
|
||||
private
|
4
app/controllers/admin/dashboard_controller.rb
Normal file
4
app/controllers/admin/dashboard_controller.rb
Normal file
|
@ -0,0 +1,4 @@
|
|||
class Admin::DashboardController < Admin::BaseController
|
||||
def index
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class LeaderSkillsController < ApplicationController
|
||||
class Admin::LeaderSkillsController < Admin::BaseController
|
||||
before_action :set_leader_skill, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class LeaderSkillsController < ApplicationController
|
|||
authorize @leader_skill
|
||||
|
||||
if @leader_skill.save
|
||||
redirect_to leader_skills_path, notice: 'Leader Skill was created'
|
||||
redirect_to admin_leader_skills_path, notice: 'Leader Skill was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class LeaderSkillsController < ApplicationController
|
|||
authorize @leader_skill
|
||||
|
||||
if @leader_skill.update(leader_skill_params)
|
||||
redirect_to leader_skills_path, notice: 'Leader Skill was updated'
|
||||
redirect_to admin_leader_skills_path, notice: 'Leader Skill was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class LeaderSkillsController < ApplicationController
|
|||
|
||||
@leader_skill.destroy
|
||||
|
||||
redirect_to leader_skills_path, notice: 'Leader Skills was deleted'
|
||||
redirect_to admin_leader_skills_path, notice: 'Leader Skills was deleted'
|
||||
end
|
||||
|
||||
private
|
|
@ -1,4 +1,4 @@
|
|||
class LinksController < ApplicationController
|
||||
class Admin::LinksController < Admin::BaseController
|
||||
before_action :set_link, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class LinksController < ApplicationController
|
|||
authorize @link
|
||||
|
||||
if @link.save
|
||||
redirect_to links_path, notice: 'Link was created'
|
||||
redirect_to admin_links_path, notice: 'Link was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class LinksController < ApplicationController
|
|||
authorize @link
|
||||
|
||||
if @link.update(link_params)
|
||||
redirect_to links_path, notice: 'Link was updated'
|
||||
redirect_to admin_links_path, notice: 'Link was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class LinksController < ApplicationController
|
|||
|
||||
@link.destroy
|
||||
|
||||
redirect_to links_path, notice: 'Link was deleted'
|
||||
redirect_to admin_links_path, notice: 'Link was deleted'
|
||||
end
|
||||
|
||||
private
|
|
@ -1,4 +1,4 @@
|
|||
class PassiveSkillsController < ApplicationController
|
||||
class Admin::PassiveSkillsController < Admin::BaseController
|
||||
before_action :set_passive_skill, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class PassiveSkillsController < ApplicationController
|
|||
authorize @passive_skill
|
||||
|
||||
if @passive_skill.save
|
||||
redirect_to passive_skills_path, notice: 'Passive Skill was created'
|
||||
redirect_to admin_passive_skills_path, notice: 'Passive Skill was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class PassiveSkillsController < ApplicationController
|
|||
authorize @passive_skill
|
||||
|
||||
if @passive_skill.update(passive_skill_params)
|
||||
redirect_to passive_skills_path, notice: 'Passive Skill was updated'
|
||||
redirect_to admin_passive_skills_path, notice: 'Passive Skill was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class PassiveSkillsController < ApplicationController
|
|||
|
||||
@passive_skill.destroy
|
||||
|
||||
redirect_to passive_skills_path, notice: 'Passive Skill was deleted'
|
||||
redirect_to admin_passive_skills_path, notice: 'Passive Skill was deleted'
|
||||
end
|
||||
|
||||
private
|
|
@ -1,4 +1,4 @@
|
|||
class RaritiesController < ApplicationController
|
||||
class Admin::RaritiesController < Admin::BaseController
|
||||
before_action :set_rarity, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
class SuperAttacksController < ApplicationController
|
||||
class Admin::SuperAttacksController < Admin::BaseController
|
||||
before_action :set_super_attack, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -24,7 +24,7 @@ class SuperAttacksController < ApplicationController
|
|||
authorize @super_attack
|
||||
|
||||
if @super_attack.save
|
||||
redirect_to super_attacks_path, notice: 'Super Attack was created'
|
||||
redirect_to admin_super_attacks_path, notice: 'Super Attack was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -38,7 +38,7 @@ class SuperAttacksController < ApplicationController
|
|||
authorize @super_attack
|
||||
|
||||
if @super_attack.update(super_attack_params)
|
||||
redirect_to super_attacks_path, notice: 'Super Attack was updated'
|
||||
redirect_to admin_super_attacks_path, notice: 'Super Attack was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -49,7 +49,7 @@ class SuperAttacksController < ApplicationController
|
|||
|
||||
@super_attack.destroy
|
||||
|
||||
redirect_to super_attacks_path, notice: 'Super Attack was deleted'
|
||||
redirect_to admin_super_attacks_path, notice: 'Super Attack was deleted'
|
||||
end
|
||||
|
||||
private
|
|
@ -1,4 +1,4 @@
|
|||
class TypesController < ApplicationController
|
||||
class Admin::TypesController < Admin::BaseController
|
||||
before_action :set_type, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -23,7 +23,7 @@ class TypesController < ApplicationController
|
|||
authorize @type
|
||||
|
||||
if @type.save
|
||||
redirect_to types_path, notice: 'Type was created'
|
||||
redirect_to admin_types_path, notice: 'Type was created'
|
||||
else
|
||||
render :new
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ class TypesController < ApplicationController
|
|||
authorize @type
|
||||
|
||||
if @type.update(type_params)
|
||||
redirect_to types_path, notice: 'Type was updated'
|
||||
redirect_to admin_types_path, notice: 'Type was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -48,7 +48,7 @@ class TypesController < ApplicationController
|
|||
|
||||
@type.destroy
|
||||
|
||||
redirect_to types_path, notice: 'Type was deleted'
|
||||
redirect_to admin_types_path, notice: 'Type was deleted'
|
||||
end
|
||||
|
||||
private
|
|
@ -1,4 +1,4 @@
|
|||
class UsersController < ApplicationController
|
||||
class Admin::UsersController < Admin::BaseController
|
||||
before_action :set_user, only: [:show, :edit, :update, :destroy]
|
||||
after_action :verify_authorized
|
||||
|
||||
|
@ -20,7 +20,7 @@ class UsersController < ApplicationController
|
|||
authorize @user
|
||||
|
||||
if @user.update(user_params)
|
||||
redirect_to users_path, notice: 'User was updated'
|
||||
redirect_to admin_users_path, notice: 'User was updated'
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ class UsersController < ApplicationController
|
|||
|
||||
@user.destroy
|
||||
|
||||
redirect_to users_path, notice: 'User was deleted'
|
||||
redirect_to admin_users_path, notice: 'User was deleted'
|
||||
end
|
||||
|
||||
private
|
2
app/helpers/admin/dashboard_helper.rb
Normal file
2
app/helpers/admin/dashboard_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
|||
module Admin::DashboardHelper
|
||||
end
|
5
app/policies/admin_dashboard_policy.rb
Normal file
5
app/policies/admin_dashboard_policy.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
class AdminDashboardPolicy < Struct.new(:user, :admin_dashbard)
|
||||
def index?
|
||||
user.admin? || user.moderator?
|
||||
end
|
||||
end
|
49
app/views/admin/_navbar.html.slim
Normal file
49
app/views/admin/_navbar.html.slim
Normal file
|
@ -0,0 +1,49 @@
|
|||
.navbar.navbar-default.navbar-static-top.navbar-custom
|
||||
.container
|
||||
.navbar-header
|
||||
button.navbar-toggle.collapsed type='button' data-toggle='collapse' data-target='.navbar-collapse'
|
||||
span.sr-only Toggle navigation
|
||||
span.icon-bar
|
||||
span.icon-bar
|
||||
span.icon-bar
|
||||
= link_to 'DBZDokkan', root_path, class: 'navbar-brand'
|
||||
.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav
|
||||
li= link_to 'Administration', admin_root_path
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
- if policy(:link).index? || policy(:leader_skill).index? || policy(:passive_skill).index? || policy(:super_attack).index?
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Abilities '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
- if policy(:link).index?
|
||||
li= link_to 'Links', admin_links_path
|
||||
- if policy(:leader_skill).index?
|
||||
li= link_to 'Leader Skills', admin_leader_skills_path
|
||||
- if policy(:passive_skill).index?
|
||||
li= link_to 'Passive Skills', admin_passive_skills_path
|
||||
- if policy(:super_attack).index?
|
||||
li= link_to 'Super Attacks', admin_super_attacks_path
|
||||
- if policy(:card).index?
|
||||
li= nav_link_to 'Cards', admin_cards_path
|
||||
- if policy(:character).index?
|
||||
li= nav_link_to 'Characters', admin_characters_path
|
||||
- if policy(:awaken_type).index? || policy(:rarity).index? || policy(:type).index?
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Others '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
- if policy(:awaken_type).index?
|
||||
li= link_to 'Awaken Types', admin_awaken_types_path
|
||||
- if policy(:rarity).index?
|
||||
li= link_to 'Rarities', admin_rarities_path
|
||||
- if policy(:type).index?
|
||||
li= link_to 'Types', admin_types_path
|
||||
- if policy(:user).index?
|
||||
li= nav_link_to 'Users', admin_users_path
|
||||
- if logged_in?
|
||||
li= link_to 'Log Out', logout_path, method: :delete
|
||||
- else
|
||||
li= link_to 'Log In', login_path(:reddit)
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @character do |f|
|
||||
= simple_form_for [:admin, @awaken_type] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
.form-actions
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Awaken Type', new_awaken_type_path, class: 'btn btn-primary'
|
||||
= link_to 'New Awaken Type', new_admin_awaken_type_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -17,11 +17,11 @@
|
|||
td= awaken_type.name
|
||||
td
|
||||
- if policy(:awaken_type).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_awaken_type_path(awaken_type)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_awaken_type_path(awaken_type)
|
||||
- if policy(:awaken_type).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), awaken_type_path(awaken_type), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_awaken_type_path(awaken_type), method: :delete
|
||||
|
||||
- if policy(:awaken_type).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Awaken Type', new_awaken_type_path, class: 'btn btn-primary'
|
||||
= link_to 'New Awaken Type', new_admin_awaken_type_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @card do |f|
|
||||
= simple_form_for [:admin, @card] do |f|
|
||||
.form-inputs
|
||||
.row
|
||||
.col-md-4
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Card', new_card_path, class: 'btn btn-primary'
|
||||
= link_to 'New Card', new_admin_card_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -19,11 +19,11 @@
|
|||
td= card.title
|
||||
td
|
||||
- if policy(:card).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_card_path(card)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_card_path(card)
|
||||
- if policy(:card).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), card_path(card), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_card_path(card), method: :delete
|
||||
|
||||
- if policy(:card).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Card', new_card_path, class: 'btn btn-primary'
|
||||
= link_to 'New Card', new_admin_card_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @awaken_type do |f|
|
||||
= simple_form_for [:admin, @character] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
.form-actions
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Character', new_character_path, class: 'btn btn-primary'
|
||||
= link_to 'New Character', new_admin_character_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -17,11 +17,11 @@
|
|||
td= character.name
|
||||
td
|
||||
- if policy(:character).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_character_path(character)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_character_path(character)
|
||||
- if policy(:character).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), character_path(character), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_character_path(character), method: :delete
|
||||
|
||||
- if policy(:character).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Character', new_character_path, class: 'btn btn-primary'
|
||||
= link_to 'New Character', new_admin_character_path, class: 'btn btn-primary'
|
1
app/views/admin/dashboard/index.html.slim
Normal file
1
app/views/admin/dashboard/index.html.slim
Normal file
|
@ -0,0 +1 @@
|
|||
Admin dashboard
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @leader_skill do |f|
|
||||
= simple_form_for [:admin, @leader_skill] do |f|
|
||||
.form-inputs
|
||||
= f.input :description
|
||||
.form-actions
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Leader Skill', new_leader_skill_path, class: 'btn btn-primary'
|
||||
= link_to 'New Leader Skill', new_admin_leader_skill_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -17,11 +17,11 @@
|
|||
td= leader_skill.description
|
||||
td
|
||||
- if policy(:leader_skill).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_leader_skill_path(leader_skill)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_leader_skill_path(leader_skill)
|
||||
- if policy(:leader_skill).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), leader_skill_path(leader_skill), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_leader_skill_path(leader_skill), method: :delete
|
||||
|
||||
- if policy(:leader_skill).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Leader Skill', new_leader_skill_path, class: 'btn btn-primary'
|
||||
= link_to 'New Leader Skill', new_admin_leader_skill_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @passive_skill do |f|
|
||||
= simple_form_for [:admin, @link] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Link', new_link_path, class: 'btn btn-primary'
|
||||
= link_to 'New Link', new_admin_link_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -19,11 +19,11 @@
|
|||
td= link.description
|
||||
td
|
||||
- if policy(:link).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_link_path(link)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_link_path(link)
|
||||
- if policy(:link).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), link_path(link), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_link_path(link), method: :delete
|
||||
|
||||
- if policy(:link).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Link', new_link_path, class: 'btn btn-primary'
|
||||
= link_to 'New Link', new_admin_link_path, class: 'btn btn-primary'
|
6
app/views/admin/passive_skills/_form.html.slim
Normal file
6
app/views/admin/passive_skills/_form.html.slim
Normal file
|
@ -0,0 +1,6 @@
|
|||
= simple_form_for [:admin, @passive_skill] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Passive Skill', new_passive_skill_path, class: 'btn btn-primary'
|
||||
= link_to 'New Passive Skill', new_admin_passive_skill_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -19,11 +19,11 @@
|
|||
td= passive_skill.description
|
||||
td
|
||||
- if policy(:passive_skill).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_passive_skill_path(passive_skill)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_passive_skill_path(passive_skill)
|
||||
- if policy(:passive_skill).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), passive_skill_path(passive_skill), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_passive_skill_path(passive_skill), method: :delete
|
||||
|
||||
- if policy(:passive_skill).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Passive Skill', new_passive_skill_path, class: 'btn btn-primary'
|
||||
= link_to 'New Passive Skill', new_admin_passive_skill_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @link do |f|
|
||||
= simple_form_for [:admin, @rarity] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Rarity', new_rarity_path, class: 'btn btn-primary'
|
||||
= link_to 'New Rarity', new_admin_rarity_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -19,11 +19,11 @@
|
|||
td= rarity.description
|
||||
td
|
||||
- if policy(:rarity).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_rarity_path(rarity)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_rarity_path(rarity)
|
||||
- if policy(:rarity).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), rarity_path(rarity), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_rarity_path(rarity), method: :delete
|
||||
|
||||
- if policy(:rarity).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Rarity', new_rarity_path, class: 'btn btn-primary'
|
||||
= link_to 'New Rarity', new_admin_rarity_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @super_attack do |f|
|
||||
= simple_form_for [:admin, @super_attack] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Super Attack', new_super_attack_path, class: 'btn btn-primary'
|
||||
= link_to 'New Super Attack', new_admin_super_attack_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -19,11 +19,11 @@
|
|||
td= super_attack.description
|
||||
td
|
||||
- if policy(:super_attack).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_super_attack_path(super_attack)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_super_attack_path(super_attack)
|
||||
- if policy(:super_attack).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), super_attack_path(super_attack), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_super_attack_path(super_attack), method: :delete
|
||||
|
||||
- if policy(:super_attack).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Super Attack', new_super_attack_path, class: 'btn btn-primary'
|
||||
= link_to 'New Super Attack', new_admin_super_attack_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @rarity do |f|
|
||||
= simple_form_for [:admin, @type] do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
|
@ -2,7 +2,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.pull-right
|
||||
= link_to 'New Type', new_type_path, class: 'btn btn-primary'
|
||||
= link_to 'New Type', new_admin_type_path, class: 'btn btn-primary'
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
@ -19,11 +19,11 @@
|
|||
td= type.description
|
||||
td
|
||||
- if policy(:type).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_type_path(type)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_type_path(type)
|
||||
- if policy(:type).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), type_path(type), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_type_path(type), method: :delete
|
||||
|
||||
- if policy(:type).new?
|
||||
.row
|
||||
.col-md-12
|
||||
= link_to 'New Type', new_type_path, class: 'btn btn-primary'
|
||||
= link_to 'New Type', new_admin_type_path, class: 'btn btn-primary'
|
|
@ -1,4 +1,4 @@
|
|||
= simple_form_for @user do |f|
|
||||
= simple_form_for [:admin, @user] do |f|
|
||||
.form-inputs
|
||||
= f.association :roles, as: :check_boxes
|
||||
.form-actions
|
|
@ -11,6 +11,6 @@
|
|||
td= user.nickname
|
||||
td
|
||||
- if policy(:user).edit?
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_user_path(user)
|
||||
= link_to glyph('edit', classes: 'control-icon'), edit_admin_user_path(user)
|
||||
- if policy(:user).destroy?
|
||||
= link_to glyph('trash', classes: 'control-icon'), user_path(user), method: :delete
|
||||
= link_to glyph('trash', classes: 'control-icon'), admin_user_path(user), method: :delete
|
|
@ -9,44 +9,8 @@
|
|||
= link_to 'DBZDokkan', root_path, class: 'navbar-brand'
|
||||
.collapse.navbar-collapse
|
||||
ul.nav.navbar-nav.navbar-right
|
||||
- if policy(:user).index?
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Admin '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
- if policy(:user).index?
|
||||
li= link_to 'Users', users_path
|
||||
- if policy(:link).index? || policy(:leader_skill).index? || policy(:passive_skill).index? || policy(:super_attack).index?
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Abilities '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
- if policy(:link).index?
|
||||
li= link_to 'Links', links_path
|
||||
- if policy(:leader_skill).index?
|
||||
li= link_to 'Leader Skills', leader_skills_path
|
||||
- if policy(:passive_skill).index?
|
||||
li= link_to 'Passive Skills', passive_skills_path
|
||||
- if policy(:super_attack).index?
|
||||
li= link_to 'Super Attacks', super_attacks_path
|
||||
- if policy(:card).index?
|
||||
li= nav_link_to 'Cards', cards_path
|
||||
- if policy(:character).index?
|
||||
li= nav_link_to 'Characters', characters_path
|
||||
- if policy(:awaken_type).index? || policy(:rarity).index? || policy(:type).index?
|
||||
li.dropdown
|
||||
a href='#' class='dropdown-toggle' data-toggle='dropdown'
|
||||
= 'Others '
|
||||
span class='caret'
|
||||
ul.dropdown-menu
|
||||
- if policy(:awaken_type).index?
|
||||
li= link_to 'Awaken Types', awaken_types_path
|
||||
- if policy(:rarity).index?
|
||||
li= link_to 'Rarities', rarities_path
|
||||
- if policy(:type).index?
|
||||
li= link_to 'Types', types_path
|
||||
- if policy(:admin_dashboard).index?
|
||||
li= nav_link_to 'Administration', admin_root_path
|
||||
- if logged_in?
|
||||
li= link_to 'Log Out', logout_path, method: :delete
|
||||
- else
|
||||
|
|
18
app/views/layouts/admin.html.slim
Normal file
18
app/views/layouts/admin.html.slim
Normal file
|
@ -0,0 +1,18 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
meta charset="utf-8"
|
||||
meta http-equiv="X-UA-Compatible" content="IE=edge"
|
||||
meta name="viewport" content="width=device-width, initial-scale=1"
|
||||
title= "DBZDokkan - #{page_title}"
|
||||
= stylesheet_link_tag 'application', media: 'all'
|
||||
= javascript_include_tag 'application'
|
||||
= csrf_meta_tags
|
||||
|
||||
body
|
||||
== render 'admin/navbar'
|
||||
.container
|
||||
== render 'flash_messages', flash: flash
|
||||
.container
|
||||
h1= page_title
|
||||
= yield
|
|
@ -1,6 +0,0 @@
|
|||
= simple_form_for @type do |f|
|
||||
.form-inputs
|
||||
= f.input :name
|
||||
= f.input :description
|
||||
.form-actions
|
||||
= f.button :button
|
|
@ -3,20 +3,27 @@ Rails.application.routes.draw do
|
|||
get 'auth/failure', to: 'sessions#failure'
|
||||
delete 'logout', to: 'sessions#destroy', as: 'logout'
|
||||
|
||||
resources :awaken_types
|
||||
resources :cards
|
||||
resources :characters
|
||||
resources :leader_skills
|
||||
resources :links
|
||||
resources :passive_skills
|
||||
resources :rarities
|
||||
resources :super_attacks
|
||||
resources :types
|
||||
resources :users, except: [:new, :create]
|
||||
resources :welcome, only: [:index]
|
||||
get '/welcome', to: 'welcome#index'
|
||||
|
||||
root to: 'welcome#index'
|
||||
|
||||
namespace :admin do
|
||||
root to: 'dashboard#index'
|
||||
|
||||
get '/dashboard', to: 'dashboard#index'
|
||||
|
||||
resources :awaken_types
|
||||
resources :cards
|
||||
resources :characters
|
||||
resources :leader_skills
|
||||
resources :links
|
||||
resources :passive_skills
|
||||
resources :rarities
|
||||
resources :super_attacks
|
||||
resources :types
|
||||
resources :users, except: [:new, :create]
|
||||
end
|
||||
|
||||
namespace :api do
|
||||
namespace :v1 do
|
||||
resources :cards, only: [:index, :show]
|
||||
|
|
Loading…
Reference in a new issue