Compare commits

..

3 Commits

Author SHA1 Message Date
Bilal
0bda6c3480 rebase 2020-09-01 23:07:50 +03:00
Bilal
98afad4174 remove 2020-09-01 23:07:50 +03:00
Bilal
3471e21429 improve download releases button 2020-09-01 23:07:50 +03:00
29 changed files with 51 additions and 407 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,4 +1,8 @@
$(document).on("click", "[data-behavior=play_recording]", function() { $(document).on("click", "[data-behavior=play_recording]", function() {
if ($(this).hasClass('active')){
return false;
}
$("#broadcast_video").data('videoType', 'recording'); $("#broadcast_video").data('videoType', 'recording');
var playback_url = $(this).attr("data-playback-url") var playback_url = $(this).attr("data-playback-url")
@@ -12,6 +16,13 @@ $(document).on("click", "[data-behavior=play_recording]", function() {
height: '100%', height: '100%',
autoPlay: true autoPlay: true
}); });
$(".dropdown-menu").children().removeClass('active');
$(".dropdown-menu").children().children('i').remove();
$(this).siblings().removeClass('active');
$(this).siblings().children("i").remove();
$(this).addClass('active');
$(this).prepend('<i class="fa fa-check">&nbsp;</i>');
}); });
$(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").data('videoType', 'stream'); }); $(document).on("click", "[data-behavior=play_stream]", function() { $("#broadcast_video").data('videoType', 'stream'); });

View File

@@ -1,30 +1,4 @@
// Do not allow file attachments in rich text content // Do not allow file attachments in rich text content
addEventListener("trix-file-accept", function(event) { addEventListener("trix-file-accept", function(event) {
event.preventDefault(); event.preventDefault();
}); })
Trix.config.textAttributes.underline = {
style: { "textDecoration": "underline" },
inheritable: true,
parser: function (element) {
var style = window.getComputedStyle(element);
return style.textDecoration === "underline";
}
}
document.addEventListener('trix-initialize', function (e) {
const trix = e.target;
const toolBar = trix.toolbarElement;
// // Creation of the button
const button = document.createElement("button");
button.setAttribute("type", "button");
button.setAttribute("class", "trix-button trix-button--icon trix-button--icon-underline");
button.setAttribute("data-trix-attribute", "underline");
button.setAttribute("title", "underline");
button.setAttribute("tabindex", "-1");
button.innerText = "U";
// Attachment of the button to the toolBar
toolBar.querySelector('.trix-button-group--text-tools').appendChild(button);
});

View File

@@ -461,10 +461,3 @@ a[data-behavior=seekable-timecode] {
border-color: transparent; border-color: transparent;
border-bottom: 3px solid #ff0000; border-bottom: 3px solid #ff0000;
} }
//Trix underline style
trix-toolbar {
.trix-button--icon-underline::before {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3Cpath d='M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z'/%3E%3C/svg%3E");
}
}

View File

@@ -48,10 +48,6 @@ u {
margin-right: -30px; margin-right: -30px;
} }
.embed-person-photo {
text-align: right;
}
.do-not-copy-warning { .do-not-copy-warning {
padding-right: 15px; padding-right: 15px;
} }

View File

@@ -45,14 +45,13 @@ class Api::ReleasesController < Api::ApiController
if model_name == "acquired_media_release" if model_name == "acquired_media_release"
mapping = { mapping = {
"#{model_name.camelize}": SerializableAcquiredMediaRelease, "#{model_name.camelize}": SerializableAcquiredMediaRelease,
FileInfo: SerializableFileInfo, FileInfo: SerializableFileInfo
"ActiveStorage::Attachment".to_sym => ActiveStorage::SerializableAttachment,
} }
render jsonapi: release, render jsonapi: release,
status: status, status: status,
class: mapping, class: mapping,
include: [:files, :file_infos] include: [:file_infos]
else else
mapping = { mapping = {
"#{model_name.camelize}": show_serializable, "#{model_name.camelize}": show_serializable,

View File

@@ -3,7 +3,7 @@ class ContractsController < ApplicationController
respond_to do |format| respond_to do |format|
format.pdf { send_contract_pdf } format.pdf { send_contract_pdf }
if Rails.env.development? || Rails.env.test? if Rails.env.development?
format.html { render_sample_html } format.html { render_sample_html }
end end
end end

View File

@@ -4,16 +4,4 @@ class PagesController < ApplicationController
skip_after_action :verify_authorized skip_after_action :verify_authorized
skip_after_action :verify_policy_scoped skip_after_action :verify_policy_scoped
skip_before_action :require_login skip_before_action :require_login
layout :layout_for_page
private
def layout_for_page
case params[:id]
when 'nanocosmos_player'
false
else
end
end
end end

View File

@@ -12,10 +12,10 @@ class BroadcastRecordingPolicy < ApplicationPolicy
end end
def edit? def edit?
true destroy?
end end
def update? def update?
true edit?
end end
end end

View File

@@ -7,7 +7,7 @@ class SerializableAcquiredMediaRelease < JSONAPI::Serializable::Resource
:person_title, :person_company, :created_at, :updated_at, :collection_uid, :territory_old, :term_old, :person_title, :person_company, :created_at, :updated_at, :collection_uid, :territory_old, :term_old,
:applicable_medium_id, :applicable_medium_text, :territory_id, :territory_text, :term_id, :term_text, :applicable_medium_id, :applicable_medium_text, :territory_id, :territory_text, :term_id, :term_text,
:restriction_id, :restriction_text, :categories, :description, :tag_list :restriction_id, :restriction_text, :categories, :description, :tag_list
has_many :file_infos do has_many :file_infos do
data do data do
@object.file_infos @object.file_infos
@@ -17,14 +17,4 @@ class SerializableAcquiredMediaRelease < JSONAPI::Serializable::Resource
{ count: @object.file_infos.size } { count: @object.file_infos.size }
end end
end end
has_many :files do
data do
@object.files
end
meta do
{ count: @object.files.size }
end
end
end end

View File

@@ -1,9 +1,5 @@
class SerializableUser < JSONAPI::Serializable::Resource class SerializableUser < JSONAPI::Serializable::Resource
type "user" type "user"
attributes :email, :full_name attributes :email
attribute :company_name do
@object.primary_account.name
end
end end

View File

@@ -6,7 +6,7 @@
<%= form.email_field :email, class: "form-group" %> <%= form.email_field :email, class: "form-group" %>
<%= form.password_field :password %> <%= form.password_field :password %>
<%= form.text_field :account_name, label: 'Account Name' %> <%= form.text_field :account_name, label: 'Account Name' %>
<%= form.select :interested_product_name, options_for_select(["I'm interested in all products", "ME Suite PRO", "DirectME", "ReleaseME", "CastME", "EditME", "DeliverME", "ExpenseME"]), { label: "What product are you most interested in?" }, { class: "form-control custom-select" } %> <%= form.select :interested_product_name, options_for_select(["I'm interested in all products", "DirectME", "ReleaseME", "CastME", "EditME", "DeliverME", "ExpenseME"]), { label: "What product are you most interested in?" }, { class: "form-control custom-select" } %>
<div class="pt-3"> <div class="pt-3">
<%= form.submit "Start Free Trial", class: "btn btn-block btn-danger font-weight-bold" %> <%= form.submit "Start Free Trial", class: "btn btn-block btn-danger font-weight-bold" %>
</div> </div>

View File

@@ -4,9 +4,6 @@
<h3>Welcome To <%= suite_wordmark("d-inline-block") %></h3> <h3>Welcome To <%= suite_wordmark("d-inline-block") %></h3>
<div class="mt-4"> <div class="mt-4">
<p>Sign up for a <strong>14 Day Free Trial</strong> which includes full access to the following products. No credit card required!</p> <p>Sign up for a <strong>14 Day Free Trial</strong> which includes full access to the following products. No credit card required!</p>
<div class="d-flex justify-content-between pb-2">
<div><%= image_tag "ME_PRO_black.png", width: "96.66%" %></div>
</div>
<div class="d-flex justify-content-between pb-2"> <div class="d-flex justify-content-between pb-2">
<div><%= image_tag "logo_directme.png", width: "90%" %></div> <div><%= image_tag "logo_directme.png", width: "90%" %></div>
<div><%= image_tag "logo_releaseme.png", width: "90%" %></div> <div><%= image_tag "logo_releaseme.png", width: "90%" %></div>

View File

@@ -3,12 +3,12 @@
<% recordings.each do |recording| %> <% recordings.each do |recording| %>
<div class="list-group-item list-group-item-action"> <div class="list-group-item list-group-item-action">
<div class="d-flex align-items-start"> <div class="d-flex align-items-start">
<% if policy(BroadcastRecording).update? %> <% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).update?) %>
<%= link_to fa_icon("#{recording.starred ? 'star' : 'star-o'} fw"), [broadcast.project, broadcast, recording, :broadcast_recording_starrings], method: :post, class: "text-warning mr-3", remote: true %> <%= link_to fa_icon("#{recording.starred ? 'star' : 'star-o'} fw"), [broadcast.project, broadcast, recording, :broadcast_recording_starrings], method: :post, class: "text-warning mr-3", remote: true %>
<% end %> <% end %>
<%= image_tag(recording.thumbnail_url, class: 'img-thumbnail img-fluid max-w-75', data: { behavior: "play_recording", playback_url: recording.playback_url, id: dom_id(recording) }) %> <%= image_tag(recording.thumbnail_url, class: 'img-thumbnail img-fluid max-w-75') %>
<div class="ml-auto"> <div class="ml-auto">
<% if policy(BroadcastRecording).edit? %> <% if (controller.class.module_parent.to_s != "Public" && policy(BroadcastRecording).edit?) %>
<%= link_to fa_icon('edit'), [:edit, broadcast.project, broadcast, recording], remote: true %> <%= link_to fa_icon('edit'), [:edit, broadcast.project, broadcast, recording], remote: true %>
<% end %> <% end %>
<%= link_to(fa_icon('download'), recording.download_url, target: "_blank") %> <%= link_to(fa_icon('download'), recording.download_url, target: "_blank") %>

View File

@@ -9,4 +9,4 @@
</div> </div>
</div> </div>
</div> </div>
<hr/>

View File

@@ -22,16 +22,11 @@
<div class="d-flex justify-content-start align-items-center flex-row p-3 mb-5 bg-dark"> <div class="d-flex justify-content-start align-items-center flex-row p-3 mb-5 bg-dark">
<%= product_wordmark(:direct_me, class: 'navbar-brand text-white') %> <%= product_wordmark(:direct_me, class: 'navbar-brand text-white') %>
<div class="ml-4 dropdown"> <div class="ml-4 dropdown">
<% if @multi_view_broadcasts.present? %> <%= link_to "#", class: "btn btn-light dropdown-toggle text-white bg-black border-0 override-dropdown-show-state", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } do %>
<%= link_to "#", class: "btn btn-light dropdown-toggle text-white bg-black border-0 override-dropdown-show-state", role: "button", id: "dropdownMenuLink", data: { toggle: "dropdown" }, aria: { haspopup: "true", expanded: "false" } do %> <i class="fa fa-video-camera text-primary" aria-hidden="true"></i><span class="ml-2" id="selected_stream"><%= @broadcast.name %></span>
<i class="fa fa-video-camera text-primary" aria-hidden="true"></i><span class="ml-2" id="selected_stream"><%= @broadcast.name %></span>
<% end %>
<% else %>
<%= link_to "javascript:void(0);", class: "btn btn-light text-white bg-black border-0 override-dropdown-show-state", role: "button", id: "dropdownMenuLink", aria: { haspopup: "true", expanded: "false" } do %>
<i class="fa fa-video-camera text-primary" aria-hidden="true"></i><span class="ml-2" id="selected_stream"><%= @broadcast.name %></span>
<% end %>
<% end %> <% end %>
<div class="dropdown-menu bg-black" aria-labelledby="dropdownMenuLink"> <div class="dropdown-menu bg-black" aria-labelledby="dropdownMenuLink">
<h5 class="dropdown-header">Live Streams</h5>
<%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", data: { behavior: "play_stream"}, class: "dropdown-item active" %> <%= link_to fa_icon("check", text: @broadcast.name.titleize), "#", data: { behavior: "play_stream"}, class: "dropdown-item active" %>
<% @multi_view_broadcasts.each do |broadcast| %> <% @multi_view_broadcasts.each do |broadcast| %>
<% if broadcast.id != @broadcast.id %> <% if broadcast.id != @broadcast.id %>
@@ -125,21 +120,6 @@
<div id="live_take"> <div id="live_take">
<%= render partial: 'broadcasts/live_take', locals: { broadcast: @broadcast } %> <%= render partial: 'broadcasts/live_take', locals: { broadcast: @broadcast } %>
</div> </div>
<% if params[:director_mode] %>
<% if controller.class.module_parent.to_s == "Public" %>
<%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(director_mode: true, token: @broadcast.token)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
<% else %>
<%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(director_mode: true, id: @broadcast.id)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
<% end %>
<hr/>
<% else %>
<% if controller.class.module_parent.to_s == "Public" %>
<%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(token: @broadcast.token).except(:director_mode)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
<% else %>
<%= link_to "Play #{@broadcast.name.titleize}", url_for(params.permit!.merge(id: @broadcast.id).except(:director_mode)), data: { behavior: "play_stream"}, class: "mt-2 btn btn-primary" %>
<% end %>
<hr/>
<% end %>
<div id="broadcast_recordings"> <div id="broadcast_recordings">
<%= render partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast } %> <%= render partial: 'broadcasts/broadcast_recordings', locals: { recordings: @recordings, broadcast: @broadcast } %>
</div> </div>

View File

@@ -4,31 +4,19 @@
</div> </div>
<hr> <hr>
<% end %> <% end %>
<% if preview %>
<h1>PREVIEW ONLY</h1>
<% end %>
<% if contract_template.body.present? %>
<%= contract_template.body %>
<br/>
<% end %>
<% if releasable.minor? && contract_template.guardian_clause.present? %>
<p class="text-left"><strong>Guardian Clause</strong></p>
<%= contract_template.guardian_clause %>
<% end %>
<div class="page"> <% if releasable.respond_to?(:question_1_answer) %>
<% if preview %>
<h1>PREVIEW ONLY</h1>
<% end %>
<% if releasable.model_name == "AppearanceRelease" && releasable.person_photo.attached? %>
<div class="embed-person-photo">
<%= image_tag releasable.photos.first.variant(auto_orient: true, resize: "200x200"), id: "top-person-photo" %>
</div>
<hr>
<% end %>
<% if contract_template.body.present? %>
<%= contract_template.body %>
<br/>
<% end %>
<% if releasable.minor? && contract_template.guardian_clause.present? %>
<p class="text-left"><strong>Guardian Clause</strong></p>
<%= contract_template.guardian_clause %>
<% end %>
</div>
<% if contract_template.present? && contract_template.has_questionnaire? %>
<div class="page"> <div class="page">
<%= render "contracts/questionnaire", releasable: releasable, contract_template: contract_template, preview: preview %> <%= render "contracts/questionnaire", releasable: releasable, contract_template: contract_template, preview: preview %>
</div> </div>

View File

@@ -1,45 +0,0 @@
<div>
<div id="playerDiv"></div>
<script type="text/javascript" src="https://demo.nanocosmos.de/nanoplayer/api/release/nanoplayer.4.min.js"></script>
<%= javascript_tag nonce: true do %>
var urlParams = new URLSearchParams(window.location.search);
var streamName = urlParams.get('stream_name');
console.log("streamName", streamName);
var player;
var config = {
"source": {
"entries": [
{
"h5live": {
// your rtmp stream
"rtmp": {
"url": "rtmp://bintu-play.nanocosmos.de/play",
"streamname": streamName,
},
"server": {
"websocket": "wss://bintu-h5live.nanocosmos.de:443/h5live/stream.mp4",
"hls": "https://bintu-h5live.nanocosmos.de:443/h5live/http/playlist.m3u8",
"progressive": "https://bintu-h5live.nanocosmos.de:443/h5live/http/stream.mp4"
}
}
}
]
},
"style": {
"width": "auto",
}
};
function initPlayer() {
player = new NanoPlayer('playerDiv');
player.setup(config).then(function (config) {
console.log('setup ok with config: ' + JSON.stringify(config));
}, function (error) {
console.log(error);
});
}
// load player from playerDiv
document.addEventListener('DOMContentLoaded', function () {
initPlayer();
});
<% end %>
</div>

View File

@@ -9,12 +9,12 @@ Rails.application.config.content_security_policy do |policy|
policy.font_src :self, :https, :data policy.font_src :self, :https, :data
policy.img_src :self, :https, :data policy.img_src :self, :https, :data
policy.object_src :self policy.object_src :self
policy.script_src :self, :https, AppHost.new.domain_with_port, "https://stream.mux.com", "https://demo.nanocosmos.de", :blob, :unsafe_eval policy.script_src :self, :https, AppHost.new.domain_with_port, "https://stream.mux.com", :blob, :unsafe_eval
policy.media_src :self, :https, AppHost.new.domain_with_port, "https://stream.mux.com", :data, :blob policy.media_src :self, :https, AppHost.new.domain_with_port, "https://stream.mux.com", :data, :blob
# policy.style_src :self, :https, :unsafe_inline # policy.style_src :self, :https, :unsafe_inline
# If you are using webpack-dev-server then specify webpack-dev-server host # If you are using webpack-dev-server then specify webpack-dev-server host
# policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? # policy.connect_src :self, :https, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development?
policy.connect_src :self, :https, "ws://#{AppHost.new.domain_with_port}", "wss://#{AppHost.new.domain_with_port}", "wss://bintu-h5live.nanocosmos.de" policy.connect_src :self, :https, "ws://#{AppHost.new.domain_with_port}", "wss://#{AppHost.new.domain_with_port}"
# Specify URI for violation reports # Specify URI for violation reports
# policy.report_uri "/csp-violation-report-endpoint" # policy.report_uri "/csp-violation-report-endpoint"

View File

@@ -200,7 +200,6 @@ Rails.application.routes.draw do
get "cookies_disabled" => 'pages#show', id: "cookies_disabled", as: :cookies_disabled get "cookies_disabled" => 'pages#show', id: "cookies_disabled", as: :cookies_disabled
get "accountless_user" => 'pages#show', id: "accountless_user", as: :accountless_user get "accountless_user" => 'pages#show', id: "accountless_user", as: :accountless_user
get "nanocosmos_player" => 'pages#show', id: "nanocosmos_player", as: :nanocosmos_player
resource :session, only: [:new, :create] resource :session, only: [:new, :create]
resources :password_resets, only: [:new, :create, :edit, :update] resources :password_resets, only: [:new, :create, :edit, :update]

View File

@@ -542,9 +542,9 @@ CREATE TABLE public.broadcast_recordings (
updated_at timestamp(6) without time zone NOT NULL, updated_at timestamp(6) without time zone NOT NULL,
duration double precision, duration double precision,
hidden boolean DEFAULT false, hidden boolean DEFAULT false,
starred boolean DEFAULT false,
name character varying, name character varying,
description text description text,
starred boolean DEFAULT false
); );
@@ -1492,6 +1492,7 @@ CREATE TABLE public.settings (
-- --
CREATE SEQUENCE public.settings_id_seq CREATE SEQUENCE public.settings_id_seq
AS integer
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
@@ -1527,6 +1528,7 @@ CREATE TABLE public.taggings (
-- --
CREATE SEQUENCE public.taggings_id_seq CREATE SEQUENCE public.taggings_id_seq
AS integer
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE
@@ -1557,6 +1559,7 @@ CREATE TABLE public.tags (
-- --
CREATE SEQUENCE public.tags_id_seq CREATE SEQUENCE public.tags_id_seq
AS integer
START WITH 1 START WITH 1
INCREMENT BY 1 INCREMENT BY 1
NO MINVALUE NO MINVALUE

View File

@@ -30,16 +30,6 @@ RSpec.describe Api::AcquiredMediaReleasesController, type: :controller do
expect(response).to be_successful expect(response).to be_successful
end end
it 'contains files attachment data' do
tested_release = create(:acquired_media_release, name: 'ct1', project_id: project.id)
sign_in_to_api(current_user)
get :show, params: { id: tested_release.id }
expect(response.body).to match /file_infos/
expect(response.body).to match /files/
end
end end
describe '#create' do describe '#create' do

View File

@@ -14,8 +14,6 @@ RSpec.describe Api::ProfilesController, type: :controller do
expect(response).to be_successful expect(response).to be_successful
expect(response_body_data).to include('id' => current_user.to_param, 'type' => 'user') expect(response_body_data).to include('id' => current_user.to_param, 'type' => 'user')
expect(response_body_data_attributes).to include('email' => current_user.email) expect(response_body_data_attributes).to include('email' => current_user.email)
expect(response_body_data_attributes).to include('full_name' => current_user.full_name)
expect(response_body_data_attributes).to include('company_name' => current_user.primary_account.name)
end end
end end

View File

@@ -19,22 +19,6 @@ FactoryBot.define do
amendment_clause "Amendment Legal Language" amendment_clause "Amendment Legal Language"
end end
trait :with_questionnaire_legal_text do
questionnaire_legal_text "Questionnaire Legal Text"
end
trait :with_one_question do
question_1_text "Is this a question?"
end
trait :with_exhibits do
exhibit_a_legal_text "Exhibit A legal text"
exhibit_b_legal_text "Exhibit B legal text"
exhibit_a_question_text "Exhibit A question text"
exhibit_b_question_text "Exhibit B question text"
end
factory :appearance_release_contract_template do factory :appearance_release_contract_template do
release_type "appearance" release_type "appearance"
end end

View File

@@ -1,13 +1,6 @@
require "rails_helper" require "rails_helper"
feature "Guest account sign up" do feature "Guest account sign up" do
scenario "guest can select ME Suite PRO in 'interested in' dropdown" do
visit new_account_path
expect(page).to have_selector("img[src*='ME_PRO_black']")
select "ME Suite PRO", from: interested_in_product_dropdown
end
scenario "creates a new account and signs in successfully" do scenario "creates a new account and signs in successfully" do
visit new_account_path visit new_account_path
@@ -45,10 +38,4 @@ feature "Guest account sign up" do
expect(page).to have_content "Sign Up" expect(page).to have_content "Sign Up"
end end
private
def interested_in_product_dropdown
"user[interested_product_name]"
end
end end

View File

@@ -386,13 +386,6 @@ RSpec.feature 'User manages contract templates', type: :feature do
expect(ct.signature_legal_text.id).not_to eq ContractTemplate.last.signature_legal_text.id expect(ct.signature_legal_text.id).not_to eq ContractTemplate.last.signature_legal_text.id
end end
scenario 'trix editor has underline button', js: true do
visit new_project_contract_template_path(project)
select 'Appearance Release', from: 'Release type'
expect(page).to have_selector("button[data-trix-attribute='underline']")
end
context 'When the user is associate' do context 'When the user is associate' do
let(:current_user) { create(:user, :associate) } let(:current_user) { create(:user, :associate) }

View File

@@ -544,7 +544,7 @@ feature 'User managing appearance releases' do
expect(pdf_body).to have_content('Guardian Email') expect(pdf_body).to have_content('Guardian Email')
end end
scenario "viewing the contract PDF when exhibit A is signed and without questionnaire" do scenario "viewing the contract PDF when exhibit A is signed" do
contract_template = create(:appearance_release_contract_template, project: project, exhibit_a_legal_text: "Exhibit A legal text", exhibit_a_question_text: "Exhibit A question text") contract_template = create(:appearance_release_contract_template, project: project, exhibit_a_legal_text: "Exhibit A legal text", exhibit_a_question_text: "Exhibit A question text")
appearance_release = create(:appearance_release, appearance_release = create(:appearance_release,
:amendment_signed, :amendment_signed,
@@ -566,122 +566,10 @@ feature 'User managing appearance releases' do
expect(pdf_body).to have_content("John Doe") expect(pdf_body).to have_content("John Doe")
expect(pdf_body).to have_content exhibit_a_heading expect(pdf_body).to have_content "Exhibit A"
expect(pdf_body).to have_content "Exhibit A legal text" expect(pdf_body).to have_content "Exhibit A legal text"
expect(pdf_body).to have_content "Exhibit A question text" expect(pdf_body).to have_content "Exhibit A question text"
expect(pdf_body).to have_content "Answer to exhibit A question" expect(pdf_body).to have_content "Answer to exhibit A question"
expect(pdf_body).not_to have_content questionnaire_heading
expect(pdf_body).not_to have_content exhibit_b_heading
end
scenario "viewing the contract PDF when exhibit B is signed and without questionnaire" do
contract_template = create(:appearance_release_contract_template, project: project, exhibit_b_legal_text: "Exhibit B legal text", exhibit_b_question_text: "Exhibit B question text")
appearance_release = create(:appearance_release,
:amendment_signed,
:native,
contract_template: contract_template,
project: project,
person_first_name: "John",
person_last_name: "Doe",
exhibit_b_answer: "Answer to exhibit B question"
)
sign_in(current_user)
visit project_appearance_releases_path(project)
click_link *view_release_pdf_link_for(appearance_release)
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("doe-john")
expect(pdf_body).to have_content("John Doe")
expect(pdf_body).to have_content exhibit_b_heading
expect(pdf_body).to have_content "Exhibit B legal text"
expect(pdf_body).to have_content "Exhibit B question text"
expect(pdf_body).to have_content "Answer to exhibit B question"
expect(pdf_body).not_to have_content questionnaire_heading
expect(pdf_body).not_to have_content exhibit_a_heading
end
scenario "viewing the contract PDF with questionnaire and without exhibits" do
contract_template = create(:appearance_release_contract_template, :with_questionnaire_legal_text, :with_one_question, project: project)
appearance_release = create(:appearance_release,
:amendment_signed,
:native,
contract_template: contract_template,
project: project,
person_first_name: "John",
person_last_name: "Doe",
question_1_answer: "Yes"
)
sign_in(current_user)
visit project_appearance_releases_path(project)
click_link *view_release_pdf_link_for(appearance_release)
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("doe-john")
expect(pdf_body).to have_content questionnaire_heading
expect(pdf_body).to have_content contract_template.question_1_text
expect(pdf_body).to have_content appearance_release.question_1_answer
expect(pdf_body).not_to have_content exhibit_a_heading
expect(pdf_body).not_to have_content exhibit_b_heading
end
scenario "viewing the contract PDF with questionnaire and with exhibits" do
contract_template = create(:appearance_release_contract_template,
:with_questionnaire_legal_text,
:with_one_question,
:with_exhibits,
project: project)
appearance_release = create(:appearance_release,
:amendment_signed,
:native,
contract_template: contract_template,
project: project,
person_first_name: "John",
person_last_name: "Doe",
question_1_answer: "Yes",
exhibit_a_answer: "Exhibit A answer",
exhibit_b_answer: "Exhibit B answer"
)
sign_in(current_user)
visit project_appearance_releases_path(project)
click_link *view_release_pdf_link_for(appearance_release)
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("doe-john")
expect(pdf_body).to have_content questionnaire_heading
expect(pdf_body).to have_content contract_template.question_1_text
expect(pdf_body).to have_content appearance_release.question_1_answer
expect(pdf_body).to have_content exhibit_a_heading
expect(pdf_body).to have_content contract_template.exhibit_a_legal_text.to_plain_text
expect(pdf_body).to have_content contract_template.exhibit_a_question_text
expect(pdf_body).to have_content appearance_release.exhibit_a_answer
expect(pdf_body).to have_content exhibit_b_heading
expect(pdf_body).to have_content contract_template.exhibit_b_legal_text.to_plain_text
expect(pdf_body).to have_content contract_template.exhibit_b_question_text
expect(pdf_body).to have_content appearance_release.exhibit_b_answer
end
scenario "viewing the contract PDF - it shows person photo on first page if person photo is attached" do
appearance_release = create(:appearance_release_with_contract_template, :native, :minor_with_guardian_photo, project: project)
visit view_release_pdf_html_preview_link_for(appearance_release)
person_photo_url = url_for(appearance_release.person_photo.variant(auto_orient: true, resize: "200x200")).to_s
expect(page).to have_selector("#top-person-photo[src^='#{person_photo_url}']")
end end
scenario 'deleting a release', js: true do scenario 'deleting a release', js: true do
@@ -1020,10 +908,6 @@ feature 'User managing appearance releases' do
['Download', href: appearance_release_contracts_path(appearance_release, format: 'pdf')] ['Download', href: appearance_release_contracts_path(appearance_release, format: 'pdf')]
end end
def view_release_pdf_html_preview_link_for(appearance_release)
appearance_release_contracts_path(appearance_release)
end
def successful_submission_message def successful_submission_message
'Your release was successfully submitted. Thank you.' 'Your release was successfully submitted. Thank you.'
end end
@@ -1103,16 +987,4 @@ feature 'User managing appearance releases' do
def amendment_signature_label def amendment_signature_label
t 'contracts.amendment_page.description_labels.amendment_signature' t 'contracts.amendment_page.description_labels.amendment_signature'
end end
def questionnaire_heading
t 'contracts.questionnaire.heading.appearance_release'
end
def exhibit_a_heading
t 'contracts.exhibit_a_page.heading.appearance_release'
end
def exhibit_b_heading
t 'contracts.exhibit_b_page.heading.appearance_release'
end
end end

View File

@@ -244,32 +244,11 @@ feature "User managing medical releases" do
expect(pdf_filename).to include("doe-john") expect(pdf_filename).to include("doe-john")
expect(pdf_body).to have_content("John Doe") expect(pdf_body).to have_content("John Doe")
expect(pdf_body).to have_content questionnaire_heading.upcase expect(pdf_body).to have_content "MEDICAL QUESTIONNAIRE"
expect(pdf_body).to have_content "Question 1 text" expect(pdf_body).to have_content "Question 1 text"
expect(pdf_body).to have_content "Question 1 answer" expect(pdf_body).to have_content "Question 1 answer"
expect(pdf_body).to have_content "Questionnaire legal text" expect(pdf_body).to have_content "Questionnaire legal text"
end end
scenario 'viewing contract PDF without medical questionnaire' do
contract_template = create(:medical_release_contract_template, project: project)
medical_release = create(:medical_release,
:native,
contract_template: contract_template,
project: project,
person_first_name: "John",
person_last_name: "Doe",
)
sign_in(current_user)
visit project_medical_releases_path(project)
click_link *view_release_pdf_link_for(medical_release)
expect(content_type).to eq("application/pdf")
expect(content_disposition).to include("inline")
expect(pdf_filename).to include("doe-john")
expect(pdf_body).not_to have_content questionnaire_heading.upcase
end
end end
context "when the user is manager(project manager)" do context "when the user is manager(project manager)" do
@@ -520,8 +499,4 @@ feature "User managing medical releases" do
def dummy_signature_legal_text def dummy_signature_legal_text
'Some signature legal language' 'Some signature legal language'
end end
def questionnaire_heading
t 'contracts.questionnaire.heading.medical_release'
end
end end

View File

@@ -80,7 +80,7 @@ feature "User managing misc releases" do
end end
scenario 'viewing the contract PDF with questionnaire' do scenario 'viewing the contract PDF' do
misc_release = create(:misc_release, misc_release = create(:misc_release,
:native, :native,
contract_template: build(:misc_release_contract_template, question_1_text: 'Q1'), contract_template: build(:misc_release_contract_template, question_1_text: 'Q1'),
@@ -121,30 +121,10 @@ feature "User managing misc releases" do
expect(pdf_body).to have_content('Woman') expect(pdf_body).to have_content('Woman')
expect(pdf_body).to have_content('Brunette') expect(pdf_body).to have_content('Brunette')
expect(pdf_body).not_to have_content('Guardian Email') expect(pdf_body).not_to have_content('Guardian Email')
expect(pdf_body).to have_content questionnaire_heading.upcase expect(pdf_body).to have_content('QUESTIONNAIRE')
expect(pdf_body).to have_content('Q1') expect(pdf_body).to have_content('Q1')
expect(pdf_body).to have_content('A1') expect(pdf_body).to have_content('A1')
end end
scenario 'viewing the contract PDF without questionnaire' do
misc_release = create(:misc_release,
:native,
contract_template: build(:misc_release_contract_template),
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe'
)
sign_in(current_user)
visit project_misc_releases_path(project)
click_link *view_release_pdf_link_for(misc_release)
expect(content_type).to eq('application/pdf')
expect(content_disposition).to include('inline')
expect(pdf_filename).to include('doe-jane')
expect(pdf_body).not_to have_content questionnaire_heading.upcase
end
end end
context "when the user is manager(project manager)" do context "when the user is manager(project manager)" do
@@ -235,8 +215,4 @@ feature "User managing misc releases" do
def view_release_pdf_link_for(release) def view_release_pdf_link_for(release)
['Download', href: misc_release_contracts_path(release, format: 'pdf')] ['Download', href: misc_release_contracts_path(release, format: 'pdf')]
end end
def questionnaire_heading
t 'contracts.questionnaire.heading.misc_release'
end
end end