1
0
Fork 0

Create admin namespace for data admin

This commit is contained in:
Andrew Tomaka 2015-10-09 08:17:29 -04:00
parent 90ebcdf06b
commit 215c989806
82 changed files with 201 additions and 138 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::Dashboard controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View file

@ -5,3 +5,7 @@
.control-icon { .control-icon {
padding: 0 3px 0 3px; padding: 0 3px 0 3px;
} }
.no-margin {
margin-bottom: 0px !important;
}

View file

@ -1,4 +1,4 @@
class AwakenTypesController < ApplicationController class Admin::AwakenTypesController < Admin::BaseController
before_action :set_awaken_type, only: [:show, :edit, :update, :destroy] before_action :set_awaken_type, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class AwakenTypesController < ApplicationController
authorize @awaken_type authorize @awaken_type
if @awaken_type.save 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 else
render :new render :new
end end
@ -38,7 +38,7 @@ class AwakenTypesController < ApplicationController
authorize @awaken_type authorize @awaken_type
if @awaken_type.update(awaken_type_params) 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 else
render :edit render :edit
end end
@ -47,7 +47,7 @@ class AwakenTypesController < ApplicationController
def destroy def destroy
@awaken_type.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 end
private private

View file

@ -0,0 +1,3 @@
class Admin::BaseController < ApplicationController
layout 'admin'
end

View file

@ -1,4 +1,4 @@
class CardsController < ApplicationController class Admin::CardsController < Admin::BaseController
before_action :set_card, only: [:show, :edit, :update, :destroy] before_action :set_card, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class CardsController < ApplicationController
authorize @card authorize @card
if @card.save if @card.save
redirect_to cards_path, notice: 'Card was created' redirect_to admin_cards_path, notice: 'Card was created'
else else
render :new render :new
end end
@ -38,7 +38,7 @@ class CardsController < ApplicationController
authorize @card authorize @card
if @card.update(card_params) if @card.update(card_params)
redirect_to cards_path, notice: 'Card was updated' redirect_to admin_cards_path, notice: 'Card was updated'
else else
render :edit render :edit
end end
@ -49,7 +49,7 @@ class CardsController < ApplicationController
@card.destroy @card.destroy
redirect_to cards_path, notice: 'Card was deleted' redirect_to admin_cards_path, notice: 'Card was deleted'
end end
private private

View file

@ -1,4 +1,4 @@
class CharactersController < ApplicationController class Admin::CharactersController < Admin::BaseController
before_action :set_character, only: [:show, :edit, :update, :destroy] before_action :set_character, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class CharactersController < ApplicationController
authorize @character authorize @character
if @character.save if @character.save
redirect_to characters_path, notice: 'Character was created' redirect_to admin_characters_path, notice: 'Character was created'
else else
render :new render :new
end end
@ -38,7 +38,7 @@ class CharactersController < ApplicationController
authorize @character authorize @character
if @character.update(character_params) if @character.update(character_params)
redirect_to characters_path, notice: 'Character was updated' redirect_to admin_characters_path, notice: 'Character was updated'
else else
render :edit render :edit
end end
@ -49,7 +49,7 @@ class CharactersController < ApplicationController
@character.destroy @character.destroy
redirect_to characters_path, notice: 'Character was deleted' redirect_to admin_characters_path, notice: 'Character was deleted'
end end
private private

View file

@ -0,0 +1,4 @@
class Admin::DashboardController < Admin::BaseController
def index
end
end

View file

@ -1,4 +1,4 @@
class LeaderSkillsController < ApplicationController class Admin::LeaderSkillsController < Admin::BaseController
before_action :set_leader_skill, only: [:show, :edit, :update, :destroy] before_action :set_leader_skill, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class LeaderSkillsController < ApplicationController
authorize @leader_skill authorize @leader_skill
if @leader_skill.save 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 else
render :new render :new
end end
@ -38,7 +38,7 @@ class LeaderSkillsController < ApplicationController
authorize @leader_skill authorize @leader_skill
if @leader_skill.update(leader_skill_params) 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 else
render :edit render :edit
end end
@ -49,7 +49,7 @@ class LeaderSkillsController < ApplicationController
@leader_skill.destroy @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 end
private private

View file

@ -1,4 +1,4 @@
class LinksController < ApplicationController class Admin::LinksController < Admin::BaseController
before_action :set_link, only: [:show, :edit, :update, :destroy] before_action :set_link, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class LinksController < ApplicationController
authorize @link authorize @link
if @link.save if @link.save
redirect_to links_path, notice: 'Link was created' redirect_to admin_links_path, notice: 'Link was created'
else else
render :new render :new
end end
@ -38,7 +38,7 @@ class LinksController < ApplicationController
authorize @link authorize @link
if @link.update(link_params) if @link.update(link_params)
redirect_to links_path, notice: 'Link was updated' redirect_to admin_links_path, notice: 'Link was updated'
else else
render :edit render :edit
end end
@ -49,7 +49,7 @@ class LinksController < ApplicationController
@link.destroy @link.destroy
redirect_to links_path, notice: 'Link was deleted' redirect_to admin_links_path, notice: 'Link was deleted'
end end
private private

View file

@ -1,4 +1,4 @@
class PassiveSkillsController < ApplicationController class Admin::PassiveSkillsController < Admin::BaseController
before_action :set_passive_skill, only: [:show, :edit, :update, :destroy] before_action :set_passive_skill, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class PassiveSkillsController < ApplicationController
authorize @passive_skill authorize @passive_skill
if @passive_skill.save 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 else
render :new render :new
end end
@ -38,7 +38,7 @@ class PassiveSkillsController < ApplicationController
authorize @passive_skill authorize @passive_skill
if @passive_skill.update(passive_skill_params) 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 else
render :edit render :edit
end end
@ -49,7 +49,7 @@ class PassiveSkillsController < ApplicationController
@passive_skill.destroy @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 end
private private

View file

@ -1,4 +1,4 @@
class RaritiesController < ApplicationController class Admin::RaritiesController < Admin::BaseController
before_action :set_rarity, only: [:show, :edit, :update, :destroy] before_action :set_rarity, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized

View file

@ -1,4 +1,4 @@
class SuperAttacksController < ApplicationController class Admin::SuperAttacksController < Admin::BaseController
before_action :set_super_attack, only: [:show, :edit, :update, :destroy] before_action :set_super_attack, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -24,7 +24,7 @@ class SuperAttacksController < ApplicationController
authorize @super_attack authorize @super_attack
if @super_attack.save 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 else
render :new render :new
end end
@ -38,7 +38,7 @@ class SuperAttacksController < ApplicationController
authorize @super_attack authorize @super_attack
if @super_attack.update(super_attack_params) 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 else
render :edit render :edit
end end
@ -49,7 +49,7 @@ class SuperAttacksController < ApplicationController
@super_attack.destroy @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 end
private private

View file

@ -1,4 +1,4 @@
class TypesController < ApplicationController class Admin::TypesController < Admin::BaseController
before_action :set_type, only: [:show, :edit, :update, :destroy] before_action :set_type, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -23,7 +23,7 @@ class TypesController < ApplicationController
authorize @type authorize @type
if @type.save if @type.save
redirect_to types_path, notice: 'Type was created' redirect_to admin_types_path, notice: 'Type was created'
else else
render :new render :new
end end
@ -37,7 +37,7 @@ class TypesController < ApplicationController
authorize @type authorize @type
if @type.update(type_params) if @type.update(type_params)
redirect_to types_path, notice: 'Type was updated' redirect_to admin_types_path, notice: 'Type was updated'
else else
render :edit render :edit
end end
@ -48,7 +48,7 @@ class TypesController < ApplicationController
@type.destroy @type.destroy
redirect_to types_path, notice: 'Type was deleted' redirect_to admin_types_path, notice: 'Type was deleted'
end end
private private

View file

@ -1,4 +1,4 @@
class UsersController < ApplicationController class Admin::UsersController < Admin::BaseController
before_action :set_user, only: [:show, :edit, :update, :destroy] before_action :set_user, only: [:show, :edit, :update, :destroy]
after_action :verify_authorized after_action :verify_authorized
@ -20,7 +20,7 @@ class UsersController < ApplicationController
authorize @user authorize @user
if @user.update(user_params) if @user.update(user_params)
redirect_to users_path, notice: 'User was updated' redirect_to admin_users_path, notice: 'User was updated'
else else
render :edit render :edit
end end
@ -31,7 +31,7 @@ class UsersController < ApplicationController
@user.destroy @user.destroy
redirect_to users_path, notice: 'User was deleted' redirect_to admin_users_path, notice: 'User was deleted'
end end
private private

View file

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

View file

@ -0,0 +1,5 @@
class AdminDashboardPolicy < Struct.new(:user, :admin_dashbard)
def index?
user.admin? || user.moderator?
end
end

View 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)

View file

@ -1,4 +1,4 @@
= simple_form_for @character do |f| = simple_form_for [:admin, @awaken_type] do |f|
.form-inputs .form-inputs
= f.input :name = f.input :name
.form-actions .form-actions

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -17,11 +17,11 @@
td= awaken_type.name td= awaken_type.name
td td
- if policy(:awaken_type).edit? - 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? - 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? - if policy(:awaken_type).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @card do |f| = simple_form_for [:admin, @card] do |f|
.form-inputs .form-inputs
.row .row
.col-md-4 .col-md-4

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -19,11 +19,11 @@
td= card.title td= card.title
td td
- if policy(:card).edit? - 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? - 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? - if policy(:card).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @awaken_type do |f| = simple_form_for [:admin, @character] do |f|
.form-inputs .form-inputs
= f.input :name = f.input :name
.form-actions .form-actions

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -17,11 +17,11 @@
td= character.name td= character.name
td td
- if policy(:character).edit? - 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? - 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? - if policy(:character).new?
.row .row
.col-md-12 .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'

View file

@ -0,0 +1 @@
Admin dashboard

View file

@ -1,4 +1,4 @@
= simple_form_for @leader_skill do |f| = simple_form_for [:admin, @leader_skill] do |f|
.form-inputs .form-inputs
= f.input :description = f.input :description
.form-actions .form-actions

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -17,11 +17,11 @@
td= leader_skill.description td= leader_skill.description
td td
- if policy(:leader_skill).edit? - 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? - 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? - if policy(:leader_skill).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @passive_skill do |f| = simple_form_for [:admin, @link] do |f|
.form-inputs .form-inputs
= f.input :name = f.input :name
= f.input :description = f.input :description

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -19,11 +19,11 @@
td= link.description td= link.description
td td
- if policy(:link).edit? - 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? - 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? - if policy(:link).new?
.row .row
.col-md-12 .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'

View 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

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -19,11 +19,11 @@
td= passive_skill.description td= passive_skill.description
td td
- if policy(:passive_skill).edit? - 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? - 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? - if policy(:passive_skill).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @link do |f| = simple_form_for [:admin, @rarity] do |f|
.form-inputs .form-inputs
= f.input :name = f.input :name
= f.input :description = f.input :description

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -19,11 +19,11 @@
td= rarity.description td= rarity.description
td td
- if policy(:rarity).edit? - 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? - 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? - if policy(:rarity).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @super_attack do |f| = simple_form_for [:admin, @super_attack] do |f|
.form-inputs .form-inputs
= f.input :name = f.input :name
= f.input :description = f.input :description

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -19,11 +19,11 @@
td= super_attack.description td= super_attack.description
td td
- if policy(:super_attack).edit? - 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? - 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? - if policy(:super_attack).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @rarity do |f| = simple_form_for [:admin, @type] do |f|
.form-inputs .form-inputs
= f.input :name = f.input :name
= f.input :description = f.input :description

View file

@ -2,7 +2,7 @@
.row .row
.col-md-12 .col-md-12
.pull-right .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 .row
.col-md-12 .col-md-12
@ -19,11 +19,11 @@
td= type.description td= type.description
td td
- if policy(:type).edit? - 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? - 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? - if policy(:type).new?
.row .row
.col-md-12 .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'

View file

@ -1,4 +1,4 @@
= simple_form_for @user do |f| = simple_form_for [:admin, @user] do |f|
.form-inputs .form-inputs
= f.association :roles, as: :check_boxes = f.association :roles, as: :check_boxes
.form-actions .form-actions

View file

@ -11,6 +11,6 @@
td= user.nickname td= user.nickname
td td
- if policy(:user).edit? - 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? - 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

View file

@ -9,44 +9,8 @@
= link_to 'DBZDokkan', root_path, class: 'navbar-brand' = link_to 'DBZDokkan', root_path, class: 'navbar-brand'
.collapse.navbar-collapse .collapse.navbar-collapse
ul.nav.navbar-nav.navbar-right ul.nav.navbar-nav.navbar-right
- if policy(:user).index? - if policy(:admin_dashboard).index?
li.dropdown li= nav_link_to 'Administration', admin_root_path
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 logged_in? - if logged_in?
li= link_to 'Log Out', logout_path, method: :delete li= link_to 'Log Out', logout_path, method: :delete
- else - else

View 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

View file

@ -1,6 +0,0 @@
= simple_form_for @type do |f|
.form-inputs
= f.input :name
= f.input :description
.form-actions
= f.button :button

View file

@ -3,6 +3,15 @@ Rails.application.routes.draw do
get 'auth/failure', to: 'sessions#failure' get 'auth/failure', to: 'sessions#failure'
delete 'logout', to: 'sessions#destroy', as: 'logout' delete 'logout', to: 'sessions#destroy', as: 'logout'
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 :awaken_types
resources :cards resources :cards
resources :characters resources :characters
@ -13,9 +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 :welcome, only: [:index] end
root to: 'welcome#index'
namespace :api do namespace :api do
namespace :v1 do namespace :v1 do