-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/uwblueprint/sdc-api
- Loading branch information
Showing
27 changed files
with
770 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register AdminUser do | ||
permit_params :email, :password, :password_confirmation | ||
|
||
index do | ||
selectable_column | ||
id_column | ||
column :email | ||
column :current_sign_in_at | ||
column :sign_in_count | ||
column :created_at | ||
actions | ||
end | ||
|
||
filter :email | ||
filter :current_sign_in_at | ||
filter :sign_in_count | ||
filter :created_at | ||
|
||
form do |f| | ||
f.inputs do | ||
f.input :email | ||
f.input :password | ||
f.input :password_confirmation | ||
end | ||
f.actions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register_page 'Dashboard' do | ||
menu priority: 1, label: proc { I18n.t('active_admin.dashboard') } | ||
|
||
content title: proc { I18n.t('active_admin.dashboard') } do | ||
columns do | ||
column do | ||
panel 'Recent Flowcharts' do | ||
table_for Flowchart.order('id').limit(10) do | ||
column('Title', &:title) | ||
column('Description', &:description) | ||
end | ||
end | ||
end | ||
column do | ||
panel 'Recent Icons' do | ||
table_for FlowchartIcon.order('id').limit(10) do | ||
column('ID', &:id) | ||
column('URL', &:url) | ||
end | ||
end | ||
end | ||
end | ||
columns do | ||
column do | ||
panel 'Info' do | ||
para 'Welcome to the admin dashboard for SDC flowcharts!' | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register FlowchartIconHelper, as: 'Icon Connectors' do | ||
# See permitted parameters documentation: | ||
# https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters | ||
# | ||
# Uncomment all parameters which should be permitted for assignment | ||
# | ||
permit_params :flowchart_node_id, :flowchart_icon_id | ||
# | ||
# or | ||
# | ||
# permit_params do | ||
# permitted = [:flowchart_node_id, :flowchart_icon_id] | ||
# permitted << :other if params[:action] == 'create' && current_user.admin? | ||
# permitted | ||
# end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register FlowchartIcon, as: 'Icon' do | ||
permit_params :url | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register FlowchartNode do | ||
sidebar 'Flowchart Details', only: %i[show edit] do | ||
ul do | ||
li link_to 'Node Icons', admin_icon_connectors_path('q[flowchart_node_id_eq]' => flowchart_node.id) | ||
end | ||
end | ||
|
||
belongs_to :flowchart | ||
permit_params :id, :text, :header, :next_question, :is_root, :flowchart_id, :deleted, :flowchart_node_id, :flowchart_id, :is_leaf, :breadcrumb_title, | ||
flowchart_icon_helpers_attributes: %i[id flowchart_icon_id flowchart_node_id _destroy] | ||
|
||
controller do | ||
def permitted_params | ||
params.permit :authenticity_token, :commit, :_method, :flowchart_id, :id, flowchart_node: [:id, :text, :header, :breadcrumb_title, :next_question, :is_root, :flowchart_id, :flowchart_node_id, :is_leaf, :deleted, :flowchart_id, | ||
flowchart_icon_helpers_attributes: %i[id flowchart_icon_id flowchart_node_id _destroy]] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
ActiveAdmin.register Flowchart do | ||
sidebar 'Flowchart Details', only: %i[show edit] do | ||
ul do | ||
li link_to 'Flowchart Nodes', admin_flowchart_flowchart_nodes_path(resource) | ||
end | ||
end | ||
|
||
permit_params :id, :title, :description, :root_id, :created_at, :updated_at, :deleted, :height, | ||
flowchart_node_attributes: [:id, :text, :header, :button_text, :next_question, :child_id, :sibling_id, :is_root, :flowchart_id, :flowchart_node_id, :deleted, :_destroy, | ||
flowchart_icon_helpers_attributes: %i[id flowchart_icon_id flowchart_node_id _destroy]] | ||
|
||
controller do | ||
def permitted_params | ||
params.permit :authenticity_token, :commit, flowchart: [:id, :title, :description, :root_id, :created_at, :updated_at, :deleted, :height, | ||
flowchart_nodes_attributes: [:id, :text, :header, :button_text, :next_question, :is_root, :flowchart_id, :flowchart_node_id, :deleted, :_destroy, | ||
flowchart_icon_helpers_attributes: %i[id flowchart_icon_id flowchart_node_id _destroy]]] | ||
end | ||
end | ||
|
||
form do |f| | ||
f.inputs 'Details' do | ||
f.input :title, label: 'Flowchart title' | ||
f.input :description, label: 'Description' | ||
f.hidden_field :height, value: 1 | ||
unless f.object.new_record? | ||
f.input :root_id, label: 'Root Node ID' | ||
end | ||
end | ||
unless f.object.new_record? | ||
f.inputs 'Flowchart Nodes' do | ||
f.has_many :flowchart_nodes, new_record: true, allow_destroy: true, heading: false do |n| | ||
n.input :id, label: 'Node ID', input_html: { disabled: true } | ||
n.input :header, label: 'Node Title' | ||
n.input :text, label: 'Node Text' | ||
n.input :next_question, label: 'Node Question' | ||
n.input :breadcrumb_title, label: 'Breadcrumb Title' | ||
n.input :parent, label: 'Parent Node', as: :select, collection: FlowchartNode.select(:header).where(flowchart_id: f.object.id) | ||
n.input :is_root, label: 'Root Node?' | ||
n.input :is_leaf, label: 'Leaf Node?' | ||
n.has_many :flowchart_icon_helpers, new_record: 'Add Icon', allow_destroy: true, heading: 'Node Icons' do |i| | ||
i.input :flowchart_icon, label: 'Icon ID' | ||
end | ||
end | ||
end | ||
end | ||
f.actions | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
//= require active_admin/base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// SASS variable overrides must be declared before loading up Active Admin's styles. | ||
// | ||
// To view the variables that Active Admin provides, take a look at | ||
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the | ||
// Active Admin source. | ||
// | ||
// For example, to change the sidebar width: | ||
// $sidebar-width: 242px; | ||
|
||
// Active Admin's got SASS! | ||
@import "active_admin/mixins"; | ||
@import "active_admin/base"; | ||
|
||
// Overriding any non-variable SASS must be done after the fact. | ||
// For example, to change the default status-tag color: | ||
// | ||
// .status_tag { background: #6090DB; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# frozen_string_literal: true | ||
|
||
# == Schema Information | ||
# | ||
# Table name: admin_users | ||
# | ||
# id :bigint not null, primary key | ||
# email :string default(""), not null | ||
# encrypted_password :string default(""), not null | ||
# remember_created_at :datetime | ||
# reset_password_sent_at :datetime | ||
# reset_password_token :string | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
# Indexes | ||
# | ||
# index_admin_users_on_email (email) UNIQUE | ||
# index_admin_users_on_reset_password_token (reset_password_token) UNIQUE | ||
# | ||
|
||
class AdminUser < ApplicationRecord | ||
# Include default devise modules. Others available are: | ||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable | ||
devise :database_authenticatable, | ||
:recoverable, :rememberable, :validatable | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.