-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to mount dashboard in production
- Loading branch information
Showing
21 changed files
with
133 additions
and
46 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
15 changes: 15 additions & 0 deletions
15
app/controllers/passkit/dashboard/application_controller.rb
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,15 @@ | ||
module Passkit | ||
module Dashboard | ||
class ApplicationController < ActionController::Base | ||
layout "passkit/application" | ||
|
||
before_action :_authenticate_dashboard! | ||
|
||
private | ||
|
||
def _authenticate_dashboard! | ||
instance_eval(&Passkit.configuration.authenticate_dashboard_with) | ||
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,9 @@ | ||
module Passkit | ||
module Dashboard | ||
class LogsController < ApplicationController | ||
def index | ||
@logs = Passkit::Log.order(created_at: :desc).first(100) | ||
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,9 @@ | ||
module Passkit | ||
module Dashboard | ||
class PassesController < ApplicationController | ||
def index | ||
@passes = Passkit::Pass.order(created_at: :desc).includes(:devices).first(100) | ||
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,13 @@ | ||
module Passkit | ||
module Dashboard | ||
class PreviewsController < ApplicationController | ||
def index | ||
end | ||
|
||
def show | ||
builder = Passkit.configuration.available_passes[params[:class_name]] | ||
send_file Factory.create_pass(params[:class_name].constantize, builder.call) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<nav> | ||
<%=link_to 'Logs', logs_path %> | ||
<%=link_to 'Passes', passes_path %> | ||
<%=link_to 'Passes Previews', previews_path %> | ||
<%=link_to 'Logs', dashboard_logs_path %> | ||
<%=link_to 'Passes', dashboard_passes_path %> | ||
<%=link_to 'Passes Previews', dashboard_previews_path %> | ||
</nav> |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Passkit | ||
VERSION = "0.3.3" | ||
VERSION = "0.4.0" | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Passkit.configure do |_config| | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require "rails_helper" | ||
|
||
class LogsDashboardTest < ActionDispatch::SystemTestCase | ||
include Passkit::Engine.routes.url_helpers | ||
|
||
setup do | ||
@routes = Passkit::Engine.routes | ||
end | ||
|
||
def authorize | ||
visit "http://#{ENV["PASSKIT_DASHBOARD_USERNAME"]}:#{ENV["PASSKIT_DASHBOARD_PASSWORD"]}@#{Capybara.current_session.server.host}:#{Capybara.current_session.server.port}/passkit/dashboard/logs" | ||
end | ||
|
||
test "visiting the logs dashboard" do | ||
Passkit::Log.create!(content: "[today] shit happened") | ||
Passkit::Log.create!(content: "[tomorrow] shit will happen") | ||
|
||
authorize | ||
|
||
visit dashboard_logs_path | ||
|
||
assert_selector "h1", text: "Passkit Logs" | ||
assert_content "shit happened" | ||
assert_content "shit will happen" | ||
assert_no_content "today" | ||
assert_no_content "tomorrow" | ||
end | ||
end |