Skip to content

Commit

Permalink
merge develop into this branch
Browse files Browse the repository at this point in the history
  • Loading branch information
amtuannguyen committed Jul 22, 2024
2 parents 53c636c + 62a4a8b commit 8db6955
Show file tree
Hide file tree
Showing 31 changed files with 816 additions and 135 deletions.
160 changes: 153 additions & 7 deletions app/assets/stylesheets/bootstrap_and_overrides.css.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,157 @@
/************************/
/*** YORKU CSS START ***/
/************************/
// Import Bootstrap's default functions first
// then add your custom variables
// then import variables, mixins
// then import bootstrap
// then add your custom css

@import "bootstrap/functions";

//YorkU Colors
/* 2021 YorkU colours */
/* http://toolbox.info.yorku.ca/visual-identity/colours/ */
$york-grey-dark: #686260;
$york-grey-medium: #B7AEA9;
$york-grey-pewter: #D6CFCA;
$york-grey-light: #E8E4DF;
$york-grey-lighter: #FAFAFA;
$york-red-pms-186: #E31837;
$york-red-medium: #B82025;
$york-red-dark: #8C0000;
$york-light-blue: #ACE6F8;
$york-bright-blue: #3AC2EF;

// Custom theme colors
$primary: $york-red-pms-186;
$secondary: $york-grey-dark;
$success: #2e8540 !default; //#35B01C !default; //$green !default; $success: #3AC2EF;
$info: darken($york-light-blue, 50%);
$warning: #ffc107;
$danger: $york-red-medium;
$light: $york-grey-lighter;
$dark: $york-grey-dark;

// Additional custom styles
$border-radius: .25rem;
$btn-border-radius: .25rem;
$btn-padding-y: .5rem;
$btn-padding-x: 1rem;
$btn-font-weight: 400;

$theme-colors: (
'primary': $primary,
'secondary': $secondary,
'success': $success,
'info': $info,
'warning': $warning,
'danger': $danger,
'light': $light,
'dark': $dark,
);

$yorku-colors: (
'york-grey-dark': $york-grey-dark,
'york-grey-medium': $york-grey-medium,
'york-grey-pewter': $york-grey-pewter,
'york-grey-light': $york-grey-light,
'york-grey-lighter': $york-grey-lighter,
'york-red-pms-186': $york-red-pms-186,
'york-red-medium': $york-red-medium,
'york-red-dark': $york-red-dark,
'york-light-blue': $york-light-blue,
'york-bright-blue': $york-bright-blue
);

// Merge the maps
$theme-colors: map-merge($theme-colors, $yorku-colors);
$theme-colors-rgb: map-loop($theme-colors, to-rgb, "$value");


@import "bootstrap/variables";
@import "bootstrap/mixins";
@import "bootstrap";
$color_h6: #d2452a;
$color_h6_green: #009900;
h6 {
color: $color_h6;

// Headings customization
.container {

h1, .h1 {
color: $black;
font-weight: 700;
}

h2, .h2 {
color: $primary;
font-weight: 600;
}

h3, .h3 {
color: darken($info, 30%);
font-weight: 500;
}

h4, .h4, h5, .h5, h6, .h6 {
color: $secondary;
font-weight: 400;
}

// Subheadings customization
.subheading {
color: $secondary;
font-weight: 300;
font-size: 1.25rem; // Adjust as needed
}
}
// Key-Value pairs in forms
.dl-horizontal dt {
font-weight: 500;
color: $primary;
}

h6.green{
color: $color_h6_green;
border-bottom: 1px solid rgb(228, 228, 228);
.dl-horizontal dd {
color: $secondary;
}

.page-header {
margin-bottom: 10px;
}
.student-view {
margin-top: 10px;
}

// Custom styles can go here, if needed
.record-data {
margin-top: 10px;
margin-bottom: 10px;
tr {
td:nth-child(1) {
@extend .lead;
// font-size: $small-font-size;
font-size: 1rem;
color: $secondary;
}
td:nth-child(2) {
// color: $secondary;
font-weight: 600;
}
}
}

.simple_form {
// background-color: lighten($york-grey-pewter, 8%);
// background-color: $york-grey-pewter;
background-color: $light;
padding: 0.875rem;
}
.simple_form .form-control {
font-size: 1.1rem;
margin-bottom: 10px;
}
.simple_form .form-text {
margin-bottom: 0.25rem;
}
.container section {
padding-top: 15px;
padding-bottom: 15px;
}
2 changes: 1 addition & 1 deletion app/controllers/committee_members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ def destroy
private

def committee_member_params
params.require(:committee_member).permit(:first_name, :last_name, :role, :thesis_id)
params.require(:committee_member).permit(:first_name, :last_name, :role, :thesis_id, :gem_record_id)
end
end
3 changes: 3 additions & 0 deletions app/controllers/student_view_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ def thesis_process_router
when Thesis::PROCESS_REVIEW
@primary_documents = @thesis.documents.not_deleted.primary
@supplemental_documents = @thesis.documents.not_deleted.supplemental
@supplemental_licence_documents = @thesis.documents.not_deleted.supplemental.licence_type
render_according_to_validation('student_view/process/review')
when Thesis::PROCESS_SUBMIT
@primary_documents = @thesis.documents.not_deleted.primary
@supplemental_documents = @thesis.documents.not_deleted.supplemental
@supplemental_licence_documents = @thesis.documents.not_deleted.supplemental.licence_type
@supplemental_embargo_documents = @thesis.documents.not_deleted.supplemental.embargo_type
render_according_to_validation('student_view/process/submit')
when Thesis::PROCESS_STATUS
render_according_to_validation('student_view/process/status')
Expand Down
12 changes: 12 additions & 0 deletions app/controllers/theses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ def new
@thesis.exam_date = record.examdate
@thesis.program = record.program
@thesis.assign_degree_name_and_level
@thesis.committee_members = record.committee_members

end

def create
Expand All @@ -53,8 +55,18 @@ def create
@thesis.student = @student
@thesis.audit_comment = 'Starting a new thesis. Status: OPEN.'

@thesis.audit_comment = 'Starting a new thesis. Status: OPEN.'

@thesis.status = Thesis::OPEN
if @thesis.save
if params[:committee_member_ids].present?
params[:committee_member_ids].each do |committee_member_id|
if committee_member_id.present?
committee_member = CommitteeMember.find(committee_member_id)
committee_member.update(thesis: @thesis)
end
end
end
redirect_to [@student, @thesis], notice: 'ETD record successfully created.'
else
render action: 'new'
Expand Down
6 changes: 6 additions & 0 deletions app/models/app_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class AppSettings < RailsSettings::Base
<li><strong>Video:</strong> 8-10 bit uncompressed AVI (.avi)</li>
<li><strong>Audio:</strong> Free Lossless Audio Codec or WAVE (.flac or .wav)</li>
</ul>'
field :student_supplementary_embargo_upload_files, default: '<p> Please Upload the following documents:</p>
<ul>
<li><strong>Supervisor Letter</strong></li>
<li><strong>Other Embargo Supporting Documents</strong></li>
<li><strong>Portable Document Format:</strong> (.pdf), Text (.txt), Hypertext Markup Language (.html, .htm), Open Document Format (.odt, .odp, .ods).</li>
</ul>'
field :student_review_license_info, default: 'Please review the licences below, you must agree to all to proceed.'
field :student_review_license_lac, default: 'LAC Licence is required. Please download the form (<a href="~//lib/assets/lac-non-exclusive-licence-en.pdf">lac-non-exclusive-licence-en.pdf</a>), sign it and upload it.'
field :student_review_lac_licence_instructions, default: '<p class="fw-bold">Please download, sign and upload the LAC Licence file. You must upload the licence to proceed to next step</p>
Expand Down
1 change: 1 addition & 0 deletions app/models/committee_member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class CommitteeMember < ApplicationRecord

## RELATIONS ##
belongs_to :thesis
belongs_to :gem_record

## VALIDATIONS ##
validates_presence_of :first_name, message: 'Please choose a name.'
Expand Down
2 changes: 2 additions & 0 deletions app/models/document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class Document < ApplicationRecord
scope :supplemental, -> { where('supplemental = ? ', true) }
scope :deleted, -> { where('deleted = ?', true) }
scope :not_deleted, -> { where('deleted = ?', false) }
scope :licence_type, -> { where(usage: :licence) }
scope :embargo_type, -> { where(usage: [:embargo, :embargo_letter])}

enum usage: %i[thesis embargo embargo_letter licence]

Expand Down
2 changes: 2 additions & 0 deletions app/models/gem_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class GemRecord < ApplicationRecord
MASTERS_EXAM = "Master's Thesis Exam"
ACCEPTED = 'Accepted'

has_many :committee_members

scope :completed, lambda {
where('eventtype = ? OR eventtype = ?', GemRecord::PHD_COMPLETED, GemRecord::MASTERS_COMPLETED)
}
Expand Down
13 changes: 10 additions & 3 deletions app/views/committee_members/_committee_member.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@
<div class="col"><span class="fw-bold"><%= committee_member.name %></span></div>
<div class="col"><%= committee_member.role %></div>
<div class="col-1">
<% if can?(:destroy, committee_member) && @thesis.status != Thesis::PUBLISHED %>
<%= link_to student_thesis_committee_member_path(@student, @thesis, committee_member),
method: :delete, class: "btn btn-close pull-right", remote: true, data: { confirm: "Are you sure?" } do %>&nbsp;<% end %>
<% if @thesis.id && %>
<% if can?(:destroy, committee_member) && @thesis.status != Thesis::PUBLISHED %>
<%= link_to student_thesis_committee_member_path(@student, @thesis, committee_member),
method: :delete, class: "btn btn-close pull-right", remote: true, data: { confirm: "Are you sure?" } do %>&nbsp;<% end %>
<% end %>
<% else %>
<%= hidden_field_tag "committee_member_ids[]", committee_member.id %>
<a href="#" class="btn btn-close pull-right" onclick="this.closest('.row').remove(); return false;" data-confirm="Are you sure?" rel="nofollow" data-remote="true">
&nbsp;
</a>
<% end %>
</div>
</div>
52 changes: 52 additions & 0 deletions app/views/documents/_new_embargo_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<% primary = false if local_assigns[:primary].nil? %>
<div class="modal fade" id="<%= primary ? 'primary-file' : 'supplemental-embargo-files' %>" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<% if primary %>
<h1 class="modal-title fs-5" id="primary-file">Upload Primary File</h1>
<% else %>
<h1 class="modal-title fs-5" id="supplemental-files">Upload Supplementary File</h1>
<% end %>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<%= simple_form_for [@student, @thesis, Document.new], html: { class: "document", multipart: true, id: "new_document_#{primary}" }, authenticity_token: true, remote: true do |f| %>
<div class="modal-body">
<div class="alert alert-secondary" role="alert">
<% if primary %>
<p>Your primary file should be in <strong>PDF format.</strong></p>
<% else %>
<% if "#{AppSettings.student_supplementary_embargo_upload_files}" != '' %>
<%= raw(AppSettings.student_supplementary_embargo_upload_files) %>
<% else %>
<p>File size must be limited to acceptable formats include:</p>
<ul>
<li><strong>Documents:</strong> Portable Document Format (.pdf), Text (.txt), Hypertext Markup Language (.html, .htm), Open Document Format (.odt, .odp, .ods).</li>
<li><strong>Images:</strong> Portable Network Graphics format (.png), Tagged Image File format (.tif), JPEG (.jpg)</li>
<li><strong>Data:</strong> Comma-separated values (.csv) or other delimited text, Extensible Markup Language (.xml)</li>
<li><strong>Video:</strong> 8-10 bit uncompressed AVI (.avi)</li>
<li><strong>Audio:</strong> Free Lossless Audio Codec or WAVE (.flac or .wav)</li>
</ul>
<% end %>
<% end %>
</div>
<% f.input :name, required: false, input_html: { class: "span4", autocomplete: "off"} %>
<%= f.input :file, required: true, as: :file %>
<% if primary %>
<%= f.hidden_field :usage, value: :thesis %>
<%= f.hidden_field :supplemental, value: false %>
<% else %>
<%= f.input :usage, label: "Document type", collection: Document.usages.keys.map(&:to_sym).reject { |usage| usage == :licence or usage == :thesis }, required: true, label_html: { class: 'pt-2' } %>
<%= f.hidden_field :supplemental, value: true %>
<% end %>

</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<%= f.button :submit, "Upload", class: "btn btn-primary" %>
</div>
<% end %>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion app/views/documents/_new_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<%= f.hidden_field :usage, value: :thesis %>
<%= f.hidden_field :supplemental, value: false %>
<% else %>
<%= f.input :usage, label: "Document type", collection: Document.usages.keys.map(&:to_sym).reject { |usage| usage == :licence }, required: true, label_html: { class: 'pt-2' } %>
<%= f.input :usage, label: "Document type", collection: Document.usages.keys.map(&:to_sym).reject { |usage| usage != :thesis }, required: true, label_html: { class: 'pt-2' } %>
<%= f.hidden_field :supplemental, value: true %>
<% end %>

Expand Down
6 changes: 6 additions & 0 deletions app/views/gem_records/_gem_record.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
<p><%= gem_record.eventtype%></p>
<h6>Program</h6>
<p><%= gem_record.program %></p>
<h6>Committee Members</h6>
<% gem_record.committee_members.each do |committee_member| %>
<div class="row" id="committee_member_<%= committee_member.id %>">
<div class="col"><%= committee_member.name %> - <%= committee_member.role %></div>
</div>
<% end %>
</div>
<div class="col-4">
<h6>Event date</h6>
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<% end %>
<div class="container my-3">
<div class="row align-items-center shadow-lg rounded-3 border">
<div class="row align-items-center shadow-lg rounded-3 border p-3">
<div class="container">
<div class="york_header">
<%= image_tag("yorklogo.gif", alt: "York University - Graduate Studies" )%>
Expand Down
1 change: 1 addition & 0 deletions app/views/settings/_student_submission.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<div class="tab-pane fade" id="nav-upload" role="tabpanel" aria-labelledby="nav-upload-tab" tabindex="0">
<%= f.input :student_upload_files, as: :rich_text_area, label: "Upload files message", input_html: { rows: 20 } %>
<%= f.input :student_supplementary_upload_files, as: :rich_text_area, label: "Supplementary Upload files message", input_html: { rows: 30 } %>
<%= f.input :student_supplementary_embargo_upload_files, as: :rich_text_area, label: "Supplementary Embargo Upload files message", input_html: { rows: 30 } %>
</div>
<div class="tab-pane fade" id="nav-review" role="tabpanel" aria-labelledby="nav-review-tab" tabindex="0">
<%= f.input :student_review_license_info, as: :rich_text_area, label: "Information", input_html: { rows: 20, class: "mb-4" } %>
Expand Down
8 changes: 3 additions & 5 deletions app/views/student_view/process/review.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,14 @@
</li>
<li class="list-group-item">
<p>
<% if @supplemental_documents.count == 0 %>
<% if @supplemental_licence_documents.count == 0 %>
<p>There are no <strong>supplementary</strong> license files or documents attached to this thesis/dissertation.</p>
<% end %>
<% if AppSettings.student_review_lac_licence_instructions.present? %>
<p><%= raw(AppSettings.student_review_lac_licence_instructions) %></p>
<% end %>
<% @supplemental_documents.each do | document | %>
<% if document.usage == "licence" %>
<%= render partial: document %>
<% end %>
<% @supplemental_licence_documents.each do | document | %>
<%= render partial: document %>
<% end %>
<br/>
<% unless block_thesis_changes?(@thesis) %>
Expand Down
Loading

0 comments on commit 8db6955

Please sign in to comment.