Skip to content
Snippets Groups Projects
Commit 5ad48933 authored by Arnaud Levy's avatar Arnaud Levy
Browse files

style

parent a1e100ed
No related branches found
No related tags found
No related merge requests found
Showing with 59 additions and 9 deletions
......@@ -73,11 +73,13 @@ class Admin::Communication::ExtranetsController < Admin::Communication::Applicat
:feature_posts,
:has_sso,
:host,
:home_sentence,
:logo,
:logo_delete,
:name,
:privacy_policy,
:registration_contact,
:registration_contact,
:sass,
:sso_target_url,
:sso_cert,
:sso_name_identifier_format,
......
class Extranet::StyleController < Extranet::ApplicationController
def index
render body: current_extranet.css, content_type: 'text/css'
end
end
\ No newline at end of file
......@@ -6,16 +6,19 @@
# about_type :string indexed => [about_id]
# color :string
# cookies_policy :text
# css :text
# feature_alumni :boolean default(FALSE)
# feature_assets :boolean default(FALSE)
# feature_contacts :boolean default(FALSE)
# feature_jobs :boolean default(FALSE)
# feature_posts :boolean default(FALSE)
# has_sso :boolean default(FALSE)
# home_sentence :text
# host :string
# name :string
# privacy_policy :text
# registration_contact :string
# sass :text
# sso_button_label :string
# sso_cert :text
# sso_mapping :jsonb
......@@ -44,6 +47,7 @@ class Communication::Extranet < ApplicationRecord
include WithAbouts
include WithFeatures
include WithLegal
include WithStyle
include WithSso
include WithUniversity
......
module Communication::Extranet::WithStyle
extend ActiveSupport::Concern
included do
before_validation :generate_css
end
protected
def generate_css
self.css = SassC::Sass2Scss.convert sass
end
end
\ No newline at end of file
......@@ -22,6 +22,8 @@
preview: 100,
direct_upload: true %>
<%= f.input :color, as: :color %>
<%= f.input :home_sentence %>
<%= f.input :sass %>
<% end %>
</div>
<div class="col-xl-6">
......
......@@ -4,6 +4,7 @@
<%= csrf_meta_tags %>
<%= csp_meta_tag %>
<%= stylesheet_link_tag 'extranet', media: 'all' %>
<link rel="stylesheet" href="<%= extranet_style_path(format: :css) %>" media="all">
<%= javascript_include_tag 'extranet' %>
<% if current_extranet.favicon.attached? %>
<%= favicon_link_tag url_for(current_extranet.favicon.variant(:thumb)) %>
......
<% content_for :title, current_context %>
<% content_for :header do %>
<h1><%# TODO i18n %>
Bienvenue sur l’extranet <%= current_context %>.
Retrouvez les <%= link_to University::Person::Alumnus.model_name.human(count: 2).downcase, university_persons_path %>,
<% if current_extranet.should_show_years? %>
recherchez par <%= link_to Education::AcademicYear.model_name.human(count: 2).downcase, education_academic_years_path %>,
<h1>
<% if current_extranet.home_sentence.present? %>
<%= current_extranet.home_sentence.html_safe %>
<% else %>
<%# TODO i18n %>
Bienvenue sur l’extranet <%= current_context %>.
Retrouvez les <%= link_to University::Person::Alumnus.model_name.human(count: 2).downcase, university_persons_path %>,
<% if current_extranet.should_show_years? %>
recherchez par <%= link_to Education::AcademicYear.model_name.human(count: 2).downcase, education_academic_years_path %>,
<% end %>
explorez les <%= link_to Education::Cohort.model_name.human(count: 2).downcase, education_cohorts_path %>,
découvrez les <%= link_to University::Organization.model_name.human(count: 2).downcase, university_organizations_path %>.
<% end %>
explorez les <%= link_to Education::Cohort.model_name.human(count: 2).downcase, education_cohorts_path %>,
découvrez les <%= link_to University::Organization.model_name.human(count: 2).downcase, university_organizations_path %>.
</h1>
<% end %>
......
......@@ -2,4 +2,5 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register "text/css", :css
Mime::Type.register "application/xml", :xml, %w( text/xml application/x-xml )
......@@ -19,4 +19,5 @@ get 'terms' => 'extranet/pages#terms', as: :terms
get 'privacy-policy' => 'extranet/pages#privacy_policy', as: :privacy_policy
get 'cookies-policy' => 'extranet/pages#cookies_policy', as: :cookies_policy
get 'data' => 'extranet/pages#data', as: :data
get 'extranet' => 'extranet/style#index', as: :extranet_style, constraints: { format: 'css' }
root to: 'extranet/home#index'
class AddLookToExtranets < ActiveRecord::Migration[7.0]
def change
add_column :communication_extranets, :home_sentence, :text
add_column :communication_extranets, :sass, :text
add_column :communication_extranets, :css, :text
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.0].define(version: 2023_02_27_045821) do
ActiveRecord::Schema[7.0].define(version: 2023_02_27_052540) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
......@@ -118,6 +118,9 @@ ActiveRecord::Schema[7.0].define(version: 2023_02_27_045821) do
t.boolean "feature_assets", default: false
t.boolean "feature_posts", default: false
t.boolean "feature_jobs", default: false
t.text "home_sentence"
t.text "sass"
t.text "css"
t.index ["about_type", "about_id"], name: "index_communication_extranets_on_about"
t.index ["university_id"], name: "index_communication_extranets_on_university_id"
end
......
......@@ -6,16 +6,19 @@
# about_type :string indexed => [about_id]
# color :string
# cookies_policy :text
# css :text
# feature_alumni :boolean default(FALSE)
# feature_assets :boolean default(FALSE)
# feature_contacts :boolean default(FALSE)
# feature_jobs :boolean default(FALSE)
# feature_posts :boolean default(FALSE)
# has_sso :boolean default(FALSE)
# home_sentence :text
# host :string
# name :string
# privacy_policy :text
# registration_contact :string
# sass :text
# sso_button_label :string
# sso_cert :text
# sso_mapping :jsonb
......
......@@ -6,16 +6,19 @@
# about_type :string indexed => [about_id]
# color :string
# cookies_policy :text
# css :text
# feature_alumni :boolean default(FALSE)
# feature_assets :boolean default(FALSE)
# feature_contacts :boolean default(FALSE)
# feature_jobs :boolean default(FALSE)
# feature_posts :boolean default(FALSE)
# has_sso :boolean default(FALSE)
# home_sentence :text
# host :string
# name :string
# privacy_policy :text
# registration_contact :string
# sass :text
# sso_button_label :string
# sso_cert :text
# sso_mapping :jsonb
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment