Namespace CSS and remove uneccessary site attributes
Dieser Commit ist enthalten in:
Ursprung
60823cd87a
Commit
150afb29e0
22 geänderte Dateien mit 1335 neuen und 1504 gelöschten Zeilen
|
@ -3,7 +3,7 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
before_action :ensure_plugin_enabled
|
before_action :ensure_plugin_enabled
|
||||||
before_action :ensure_logged_in, only: [:skip]
|
before_action :ensure_logged_in, only: [:skip]
|
||||||
|
|
||||||
def index
|
def show
|
||||||
if wizard.present?
|
if wizard.present?
|
||||||
render json: CustomWizard::WizardSerializer.new(wizard, scope: guardian, root: false).as_json, status: 200
|
render json: CustomWizard::WizardSerializer.new(wizard, scope: guardian, root: false).as_json, status: 200
|
||||||
else
|
else
|
||||||
|
@ -31,26 +31,8 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
render json: result
|
render json: result
|
||||||
end
|
end
|
||||||
|
|
||||||
def qunit
|
|
||||||
raise Discourse::InvalidAccess.new if Rails.env.production?
|
|
||||||
|
|
||||||
respond_to do |format|
|
|
||||||
format.html do
|
|
||||||
render "default/empty"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def ensure_logged_in
|
|
||||||
raise Discourse::NotLoggedIn.new unless current_user.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
def guardian
|
|
||||||
@guardian ||= Guardian.new(current_user, request)
|
|
||||||
end
|
|
||||||
|
|
||||||
def wizard
|
def wizard
|
||||||
@wizard ||= begin
|
@wizard ||= begin
|
||||||
builder = CustomWizard::Builder.new(params[:wizard_id].underscore, current_user)
|
builder = CustomWizard::Builder.new(params[:wizard_id].underscore, current_user)
|
||||||
|
@ -61,41 +43,6 @@ class CustomWizard::WizardController < ::ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def wizard_page_title
|
|
||||||
wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title')
|
|
||||||
end
|
|
||||||
|
|
||||||
def wizard_theme_id
|
|
||||||
wizard ? wizard.theme_id : nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def wizard_theme_lookup(name)
|
|
||||||
Theme.lookup_field(wizard_theme_id, view_context.mobile_view? ? :mobile : :desktop, name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def wizard_theme_translations_lookup
|
|
||||||
Theme.lookup_field(wizard_theme_id, :translations, I18n.locale)
|
|
||||||
end
|
|
||||||
|
|
||||||
def preload_wizard_json
|
|
||||||
return if request.xhr? || request.format.json?
|
|
||||||
return if request.method != "GET"
|
|
||||||
|
|
||||||
store_preloaded("siteSettings", SiteSetting.client_settings_json)
|
|
||||||
end
|
|
||||||
|
|
||||||
def store_preloaded(key, json)
|
|
||||||
@preloaded ||= {}
|
|
||||||
@preloaded[key] = json.gsub("</", "<\\/")
|
|
||||||
end
|
|
||||||
|
|
||||||
## Simplified version of with_resolved_locale in ApplicationController
|
|
||||||
def with_resolved_locale
|
|
||||||
locale = current_user ? current_user.effective_locale : SiteSetting.default_locale
|
|
||||||
I18n.ensure_all_loaded!
|
|
||||||
I18n.with_locale(locale) { yield }
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def ensure_plugin_enabled
|
def ensure_plugin_enabled
|
||||||
|
|
|
@ -9,13 +9,10 @@ class CustomWizard::WizardSerializer < CustomWizard::BasicWizardSerializer
|
||||||
:completed,
|
:completed,
|
||||||
:required,
|
:required,
|
||||||
:permitted,
|
:permitted,
|
||||||
:uncategorized_category_id,
|
|
||||||
:categories,
|
|
||||||
:resume_on_revisit
|
:resume_on_revisit
|
||||||
|
|
||||||
has_many :steps, serializer: ::CustomWizard::StepSerializer, embed: :objects
|
has_many :steps, serializer: ::CustomWizard::StepSerializer, embed: :objects
|
||||||
has_one :user, serializer: ::BasicUserSerializer, embed: :objects
|
has_one :user, serializer: ::BasicUserSerializer, embed: :objects
|
||||||
has_many :groups, serializer: ::BasicGroupSerializer, embed: :objects
|
|
||||||
|
|
||||||
def completed
|
def completed
|
||||||
object.completed?
|
object.completed?
|
||||||
|
@ -46,24 +43,4 @@ class CustomWizard::WizardSerializer < CustomWizard::BasicWizardSerializer
|
||||||
def include_steps?
|
def include_steps?
|
||||||
!include_completed?
|
!include_completed?
|
||||||
end
|
end
|
||||||
|
|
||||||
def include_categories?
|
|
||||||
object.needs_categories
|
|
||||||
end
|
|
||||||
|
|
||||||
def include_groups?
|
|
||||||
object.needs_groups
|
|
||||||
end
|
|
||||||
|
|
||||||
def uncategorized_category_id
|
|
||||||
SiteSetting.uncategorized_category_id
|
|
||||||
end
|
|
||||||
|
|
||||||
def include_uncategorized_category_id?
|
|
||||||
object.needs_categories
|
|
||||||
end
|
|
||||||
|
|
||||||
def categories
|
|
||||||
object.categories.map { |c| c.to_h }
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<%= discourse_color_scheme_stylesheets %>
|
|
||||||
|
|
||||||
<%= discourse_stylesheet_link_tag :wizard, theme_id: nil %>
|
|
||||||
<%= discourse_stylesheet_link_tag :wizard_custom %>
|
|
||||||
<%- if wizard_theme_id.present? %>
|
|
||||||
<%= discourse_stylesheet_link_tag (mobile_view? ? :mobile_theme : :desktop_theme), theme_id: wizard_theme_id %>
|
|
||||||
<%- end %>
|
|
||||||
|
|
||||||
<%= preload_script "locales/#{I18n.locale}" %>
|
|
||||||
<%= preload_script "ember_jquery" %>
|
|
||||||
<%= preload_script "wizard-vendor" %>
|
|
||||||
<%= preload_script "wizard-custom" %>
|
|
||||||
<%= preload_script "wizard-raw-templates" %>
|
|
||||||
<%= preload_script "wizard-plugin" %>
|
|
||||||
<%= preload_script "pretty-text-bundle" %>
|
|
||||||
<%= preload_script_url ExtraLocalesController.url("wizard") %>
|
|
||||||
<%= csrf_meta_tags %>
|
|
||||||
|
|
||||||
<%- unless customization_disabled? %>
|
|
||||||
<%= wizard_theme_translations_lookup %>
|
|
||||||
<%= raw wizard_theme_lookup("head_tag") %>
|
|
||||||
<%- end %>
|
|
||||||
|
|
||||||
<%= server_plugin_outlet "custom_wizard" %>
|
|
||||||
|
|
||||||
<%= tag.meta id: 'data-discourse-setup', data: client_side_setup_data %>
|
|
||||||
|
|
||||||
<meta name="discourse_theme_id" content="<%= wizard_theme_id %>">
|
|
||||||
<meta name="discourse-base-uri" content="<%= Discourse.base_path %>">
|
|
||||||
|
|
||||||
<%= render partial: "layouts/head" %>
|
|
||||||
<title><%= wizard_page_title %></title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body class='custom-wizard wizard'>
|
|
||||||
<%- unless customization_disabled? %>
|
|
||||||
<%= raw wizard_theme_lookup("header") %>
|
|
||||||
<%- end %>
|
|
||||||
|
|
||||||
<div id='custom-wizard-main'></div>
|
|
||||||
|
|
||||||
<%- unless customization_disabled? %>
|
|
||||||
<%= raw wizard_theme_lookup("body_tag") %>
|
|
||||||
<%- end %>
|
|
||||||
|
|
||||||
<%- if current_user %>
|
|
||||||
<%= preload_script 'wizard-custom-start' %>
|
|
||||||
<%- else %>
|
|
||||||
<%= preload_script 'wizard-custom-guest' %>
|
|
||||||
<%- end %>
|
|
||||||
|
|
||||||
<div id="svg-sprites" style="display:none;">
|
|
||||||
<div class="fontawesome">
|
|
||||||
<%= raw SvgSprite.bundle %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="hidden" id="data-preloaded-wizard" data-preloaded-wizard="<%= preloaded_json %>"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -34,7 +34,7 @@ export default ComposerEditor.extend({
|
||||||
if (this.siteSettings.enable_mentions) {
|
if (this.siteSettings.enable_mentions) {
|
||||||
$input.autocomplete({
|
$input.autocomplete({
|
||||||
template: findRawTemplate("user-selector-autocomplete"),
|
template: findRawTemplate("user-selector-autocomplete"),
|
||||||
dataSource: (term) => this.userSearchTerm.call(this, term),
|
dataSource: (term) => this._userSearchTerm.call(this, term),
|
||||||
key: "@",
|
key: "@",
|
||||||
transformComplete: (v) => v.username || v.name,
|
transformComplete: (v) => v.username || v.name,
|
||||||
afterComplete: (value) => {
|
afterComplete: (value) => {
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
import { findCustomWizard, updateCachedWizard } from "../models/custom-wizard";
|
import { findCustomWizard, updateCachedWizard } from "../models/custom-wizard";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Route from "@ember/routing/route";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
|
|
||||||
|
export default DiscourseRoute.extend({
|
||||||
|
titleToken() {
|
||||||
|
const wizard = this.modelFor('custom-wizard');
|
||||||
|
return wizard ? (wizard.name || wizard.id) : I18n.t('wizard.custom_title');
|
||||||
|
},
|
||||||
|
|
||||||
export default Route.extend({
|
|
||||||
beforeModel(transition) {
|
beforeModel(transition) {
|
||||||
if (transition.intent.queryParams) {
|
if (transition.intent.queryParams) {
|
||||||
this.set("queryParams", transition.intent.queryParams);
|
this.set("queryParams", transition.intent.queryParams);
|
||||||
|
|
|
@ -4,4 +4,3 @@
|
||||||
maximum=field.limit
|
maximum=field.limit
|
||||||
onChange=(action (mut categories))
|
onChange=(action (mut categories))
|
||||||
tabindex=field.tabindex}}
|
tabindex=field.tabindex}}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{{custom-wizard-group-selector
|
{{custom-wizard-group-selector
|
||||||
groups=wizard.groups
|
groups=site.groups
|
||||||
field=field
|
field=field
|
||||||
whitelist=field.content
|
whitelist=field.content
|
||||||
value=field.value
|
value=field.value
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
img.avatar {
|
body.custom-wizard {
|
||||||
border-radius: 50%;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
div.ac-wrap {
|
div.ac-wrap {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -173,3 +169,4 @@ div.ac-wrap {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
.badge-wrapper {
|
.badge-wrapper {
|
||||||
font-size: $font-down-1;
|
font-size: $font-down-1;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -128,3 +129,4 @@
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
input {
|
input {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
padding: 4px 10px;
|
padding: 4px 10px;
|
||||||
|
@ -28,6 +29,7 @@ select,
|
||||||
textarea {
|
textarea {
|
||||||
color: var(--primary);
|
color: var(--primary);
|
||||||
caret-color: currentColor;
|
caret-color: currentColor;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
&[class*="span"] {
|
&[class*="span"] {
|
||||||
float: none;
|
float: none;
|
||||||
|
@ -57,34 +59,7 @@ textarea {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.spinner {
|
|
||||||
margin: 20px auto 20px auto;
|
|
||||||
position: relative;
|
|
||||||
-webkit-animation: rotate-forever 1s infinite linear;
|
|
||||||
animation: rotate-forever 1s infinite linear;
|
|
||||||
height: 30px;
|
|
||||||
width: 30px;
|
|
||||||
border: 4px solid var(--primary-low-mid);
|
|
||||||
border-right-color: transparent;
|
|
||||||
border-radius: 50%;
|
|
||||||
|
|
||||||
&.small {
|
|
||||||
width: 10px;
|
|
||||||
height: 10px;
|
|
||||||
margin: 0;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes rotate-forever {
|
|
||||||
0% {
|
|
||||||
transform: rotate(0deg);
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
transform: rotate(360deg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.body-length {
|
.body-length {
|
||||||
text-align: right;
|
text-align: right;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
.wizard-btn {
|
.wizard-btn {
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
font-size: var(--font-0);
|
font-size: var(--font-0);
|
||||||
|
@ -86,3 +87,4 @@
|
||||||
color: var(--tertiary-hover);
|
color: var(--tertiary-hover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
.d-editor-container {
|
.d-editor-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
@ -278,3 +279,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
// event form
|
body.custom-wizard {
|
||||||
|
|
||||||
.event-form {
|
.event-form {
|
||||||
width: 585px;
|
width: 585px;
|
||||||
max-width: 80vw;
|
max-width: 80vw;
|
||||||
|
@ -512,3 +511,4 @@ li.ui-timepicker-selected .ui-timepicker-duration,
|
||||||
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
|
.ui-timepicker-list li.ui-timepicker-selected.ui-timepicker-disabled {
|
||||||
background: #f2f2f2;
|
background: #f2f2f2;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
5
assets/stylesheets/common/custom/header.scss
Normale Datei
5
assets/stylesheets/common/custom/header.scss
Normale Datei
|
@ -0,0 +1,5 @@
|
||||||
|
body.custom-wizard {
|
||||||
|
.d-header .panel {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
.location-form-instructions {
|
.location-form-instructions {
|
||||||
color: #919191;
|
color: #919191;
|
||||||
margin: 5px 0;
|
margin: 5px 0;
|
||||||
|
@ -189,3 +190,4 @@ div.input-location {
|
||||||
color: #919191;
|
color: #919191;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
span.mentionable-item {
|
span.mentionable-item {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
@ -30,3 +31,4 @@ a.mentionable-item span {
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
body.custom-wizard {
|
||||||
.similar-topics-validator {
|
.similar-topics-validator {
|
||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -38,3 +39,4 @@
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ body.custom-wizard {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 1px solid var(--primary-low-mid);
|
border: 1px solid var(--primary-low-mid);
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
margin: 0 auto;
|
margin: 0 auto 2.5em auto;
|
||||||
|
|
||||||
.wizard-field .input-area {
|
.wizard-field .input-area {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
|
@ -144,13 +144,13 @@ body.custom-wizard {
|
||||||
.wizard-column .action-link {
|
.wizard-column .action-link {
|
||||||
color: var(--tertiary);
|
color: var(--tertiary);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.no-access-gutter {
|
.no-access-gutter {
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* IE11 hacks */
|
/* IE11 hacks */
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
@import "custom/base";
|
@import "custom/base";
|
||||||
@import "custom/wizard";
|
@import "custom/wizard";
|
||||||
|
@import "custom/header";
|
||||||
@import "custom/step";
|
@import "custom/step";
|
||||||
@import "custom/badges";
|
@import "custom/badges";
|
||||||
@import "custom/buttons";
|
@import "custom/buttons";
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
CustomWizard::Engine.routes.draw do
|
CustomWizard::Engine.routes.draw do
|
||||||
get 'qunit' => 'wizard#qunit'
|
get ':wizard_id' => 'wizard#show'
|
||||||
get ':wizard_id' => 'wizard#index'
|
|
||||||
put ':wizard_id/skip' => 'wizard#skip'
|
put ':wizard_id/skip' => 'wizard#skip'
|
||||||
get ':wizard_id/steps' => 'wizard#index'
|
get ':wizard_id/steps' => 'wizard#show'
|
||||||
get ':wizard_id/steps/:step_id' => 'wizard#index'
|
get ':wizard_id/steps/:step_id' => 'wizard#show'
|
||||||
put ':wizard_id/steps/:step_id' => 'steps#update'
|
put ':wizard_id/steps/:step_id' => 'steps#update'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -120,18 +120,6 @@ class CustomWizard::Builder
|
||||||
params[:property] = field_template['property']
|
params[:property] = field_template['property']
|
||||||
end
|
end
|
||||||
|
|
||||||
if field_template['type'] === 'category' || (
|
|
||||||
field_template['validations'] &&
|
|
||||||
field_template['validations']['similar_topics'] &&
|
|
||||||
field_template['validations']['similar_topics']['categories'].present?
|
|
||||||
)
|
|
||||||
@wizard.needs_categories = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if field_template['type'] === 'group'
|
|
||||||
@wizard.needs_groups = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if (content_inputs = field_template['content']).present?
|
if (content_inputs = field_template['content']).present?
|
||||||
content = CustomWizard::Mapper.new(
|
content = CustomWizard::Mapper.new(
|
||||||
inputs: content_inputs,
|
inputs: content_inputs,
|
||||||
|
|
|
@ -23,8 +23,6 @@ class CustomWizard::Wizard
|
||||||
:restart_on_revisit,
|
:restart_on_revisit,
|
||||||
:resume_on_revisit,
|
:resume_on_revisit,
|
||||||
:permitted,
|
:permitted,
|
||||||
:needs_categories,
|
|
||||||
:needs_groups,
|
|
||||||
:steps,
|
:steps,
|
||||||
:step_ids,
|
:step_ids,
|
||||||
:field_ids,
|
:field_ids,
|
||||||
|
@ -54,8 +52,6 @@ class CustomWizard::Wizard
|
||||||
@after_time_scheduled = attrs['after_time_scheduled']
|
@after_time_scheduled = attrs['after_time_scheduled']
|
||||||
@required = cast_bool(attrs['required'])
|
@required = cast_bool(attrs['required'])
|
||||||
@permitted = attrs['permitted'] || nil
|
@permitted = attrs['permitted'] || nil
|
||||||
@needs_categories = false
|
|
||||||
@needs_groups = false
|
|
||||||
@theme_id = attrs['theme_id']
|
@theme_id = attrs['theme_id']
|
||||||
|
|
||||||
if attrs['theme'].present?
|
if attrs['theme'].present?
|
||||||
|
@ -243,14 +239,6 @@ class CustomWizard::Wizard
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def categories
|
|
||||||
@categories ||= ::Site.new(Guardian.new(user)).categories
|
|
||||||
end
|
|
||||||
|
|
||||||
def groups
|
|
||||||
@groups ||= ::Site.new(Guardian.new(user)).groups
|
|
||||||
end
|
|
||||||
|
|
||||||
def update_step_ids
|
def update_step_ids
|
||||||
@step_ids = steps.map(&:id)
|
@step_ids = steps.map(&:id)
|
||||||
end
|
end
|
||||||
|
|
Laden …
In neuem Issue referenzieren